- class plot_class(path)[source]
Bases:
object
Defines parameters and methods for the plotting of data produced by functions belonging to the bm3_thermal_2 module
- multi(x, y, sl, lgl, title='', xlab='default', ylab='default', fsize=0, tsize=0, save=False, dpi=0, name='default', ext='default', tex='default')[source]
Plot multiple curves.
- Parameters:
x – array of independent variable arrays
y – array of dependent variable arrays
sl – array of styles (one for each curve)
lgl – array of curve labels (for the legend)
Note
See the documentation for the ‘simple’ method for information about the other keyword arguments.
Example
>>> x=np.linspace(-2, 2, 24) >>> y1=x**2 >>> y2=x**3 >>> x=[x,x] >>> y=[y1,y2] >>> style=['k-', 'r+'] >>> label=[r'Y=X$^2$', r'Y=X$^3$'] >>> plot.multi(x,y, style, label, tex=True)
- set_param(dpi=0, fsize=0, tsize=0, style='', name='', ext='', tex='')[source]
Sets parameters relevant to the production of plots.
- Parameters:
dpi – resolution of the saved picture (default 80)
fsize – fontsize of labels and title (default 10)
tsize – fontsize of ticks (default 10)
style – style of the plot (line or point types and color; default ‘k-‘)
name – name of the saved file (default ‘myplot’)
ext – extension (and format) of the saved file (default jpg)
tex – if True, LaTeX fonts and format is used (default False)
Note
Some of these parameters affect the output from the methods ‘simple’ and ‘multi’ of the class, as a function of the argument ‘save’ passed to the methods themselves.
- simple(x, y, title='', style='default', xlab='default', ylab='default', fsize=0, tsize=0, save=False, dpi=0, name='default', ext='default', tex='default')[source]
Plots a single (x, y) curve.
- Parameters:
x – independent variable (array of data)
y – dependent variable (array of data)
title – plot title (default no title ‘’)
style – style of the plot (default self.style)
xlab – X axis label (default self.xlab)
ylab – Y axis label (default self.ylab)
fsize – label and title size (default self.fsize)
tsize – tick size (default self.tsize)
save – if True, the plot will be saved on a file (default False)
dpi – resolution of the saved file (default self.dpi)
name – name of the saved file (default self.name)
ext – extension (and format) of the saved file (default self.ext)
tex – if True, tex fonts and format are used
Note
The arguments dpi, name and ext are relevant only if save is True
Examples
>>> plot.simple(x,y, style='r-', xlab='T (K)', ylab='Alpha (K^-1)', fsize=12)
>>> plot.set_param(fsize=12, style='r-') >>> plot.simple(x,y, xlab='T (K)', ylab='alpha (K^-1)')