plot
Apply settings to matplotlib
FASTRUN = False
module-attribute
Can be used to check whether to take smaller data sets to test code faster
FIGURE_COLOR = 'tab:blue'
module-attribute
Default color
FIGURE_DIR = path.join(FIGURE_DIR_SUBDIR, f'{FIGURE_DIR_TIME.strftime('%Y-%m-%dT%H-%M-%S')}')
module-attribute
Directory to save figures used by figure_save()
FIGURE_DIR_SUBDIR = 'fig'
module-attribute
Subdirectory of working directory to save figures in + timestamp (if not overwritten)
FIGURE_DIR_TIME = datetime.now()
module-attribute
Defaults to datetime.now()
FIGURE_SAVE = True
module-attribute
Whether figure_save()
saves the figures
MPL_COLORS_TAB = ['tab:blue', 'tab:green', 'tab:orange', 'tab:red', 'tab:purple', 'tab:pink', 'tab:olive', 'tab:cyan', 'tab:gray', 'tab:brown']
module-attribute
Set of MPL 'tab:' colors
PLOTTING = True
module-attribute
Enabe or disable plotting. to be used like if PLOTTING: ...
save_figure = figure_save
module-attribute
aliase for figure_save()
. legacy support, to be removed in a later version
args_err(*, ls='', marker='.', mec='k', ms=7, ecolor='k', elinewidth=2, capsize=5, capthick=2, **kwargs)
Provides (default) parameters for plt.errorbar
. Can be used like
None
is given, no value is set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ls |
str
|
line style |
''
|
marker |
str
|
marker style |
'.'
|
mec |
str
|
marker edge color |
'k'
|
ms |
int
|
marker size |
7
|
ecolor |
str
|
error bar color |
'k'
|
elinewidth |
int
|
error bar line width |
2
|
capsize |
int
|
error bar cap size |
5
|
capthick |
int
|
error bar cap thickness |
2
|
**kwargs |
str | int
|
other valid |
{}
|
Returns:
Type | Description |
---|---|
dict[str, str | int]
|
Dictionary with parameters |
Source code in src/labeva/plot.py
figure_save(figure_name, fileformat, **kwargs)
saves the current matplotlib figure to a file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
figure_name |
str
|
File name |
required |
**kwargs |
Additional keyword arguments passed to |
{}
|
Source code in src/labeva/plot.py
plt_setup(plotting=None, size=None, dpi=None, save=None, dirname=None, dir_subdir=None, dir_time=None, fastrun=None)
Sets up default matplotlib settings and changes by the module provided constants
Parameters:
Name | Type | Description | Default |
---|---|---|---|
plotting |
bool
|
whether to compute plots |
None
|
size |
(int, int)
|
Size of mpl figures |
None
|
dpi |
int
|
DPI of mpl figures |
None
|
save |
bool
|
whether to save mpl figures (effects |
None
|
dirname |
str
|
Directory to save image files to |
None
|
dir_subdir |
str
|
Compute directory to save image files to with subdirectory name and timestamp (no effect if |
None
|
dir_time |
str
|
|
None
|
fastrun |
bool
|
|
None
|