RADICAL-Analytics does not provide plotting primitives. Instead, it offers helper methods that can be used with 3rd party plotting libraries.
RADICAL-Analytics provides a style for Matplotlib. Loading it guarantees an uniform look&feel across plots. The style is located at styles/radical_mpl.txt
.
import matplotlib.pyplot as plt
import radical.analytics as ra
plt.style.use(ra.get_mplstyle("radical_mpl")
- #1a80b2
- #ff801a
- #339933
- #cc3333
- #9966b2
- #804c4c
- #e680cc
- #b2b21a
- #1ab2cc
- #4c4c4c
- #808080
- #99b2b2
- #b2cce6
- #ffb280
- #99e680
- #ff9999
- #ccb2cc
- #cc9999
- #ffb2cc
- #e6e699
- #99e6e6
- #666666
- #998080
- #cccccc
In LaTeX documents, scaling images make the overall look&feel of a plot difficult to predict. Often, fonts are too small or too large, lines, bars, dots and axes too thin or too thick, and so on. Thus, plots should not be scaled in LaTeX---e.g., width=0.49\textwidth
should not be used to scale a figure down of 50%---but, instead, plots should be created with the exact size of a column or a page. Column and page sizes depends on the .sty
used for the LaTeX document and need to be inspected in order to know how to size a plot. Further, plots need to have their own style so that size, color, font face and overall features are consistent, readable and "pleasant" to look at.
The following assume the use of Matplotlib to create a plot that needs to be added to a LaTeX document for publication.
Create a laTeX document using the following template:
\documentclass{<your_style_eg_IEEEtran>} \newcommand{\recordvalue}[1]{% \typeout{% === Value of \detokenize{#1}: \the#1% }% } \begin{document} % gives the width of the current document in pts \recordvalue{\textwidth} \recordvalue{\columnwidth} \end{document}
Compile your LaTeX document---e.g., pdlatex your_document---and note down the size of the text and of the column expressed in points (pts). An example output is shown below (shortened):
$ pdflatex test.tex This is pdfTeX, [...] [...] === Value of \textwidth : 252.0pt === Value of \columnwidth: 516.0pt (./test.aux) ) No pages of output. Transcript written on test.log.
Use
ra.set_size()
to compute the exact size of your plot. For a plot with a single figure that span the width of a IEEtran LaTeX column:fig, ax = plt.subplots(figsize=ra.get_plotsize(252))
for plot with 1 row and 3 subplots that spans the whole width of a IEEtran LaTeX page:
fig, axarr = plt.subplots(1, 3, figsize=(ra.set_size(516)))