aim2dat.plots.spectroscopy
¶
Module to plot spectroscopy data.
Module Contents¶
Classes¶
Plot x-ray absorption spectra. |
Functions¶
|
Depreciated Spectrum class. |
-
class aim2dat.plots.spectroscopy.SpectrumPlot(detect_peaks=
False
, smooth_spectra=False
, plot_original_spectra=False
, plot_unit_x='eV'
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
,aim2dat.plots.base_mixin._VLineMixin
,aim2dat.plots.base_mixin._PeakDetectionMixin
,aim2dat.plots.base_mixin._SmearingMixin
Plot x-ray absorption spectra.
- Variables:¶
- detect_peaks : bool¶
Whether to detect peaks of the spectra.
- smooth_spectra : bool¶
Whether to broaden the spectra.
- plot_original_spectra : bool¶
Whether to plot the original spectra (in addition to the broadened spectra).
- plot_unit_x : str¶
Unit of the x-values. Imported spectra are transformed to the corresponding unit if the unit of the imported data set is given.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
-
-
-
-
-
-
-
-
-
-
-
-
-
Whether to draw a grid in the plot. The default value is
False
.Set unit of x-axis.
Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Spacing between two values. If set to
None
the original function isMethod used to smear out the functions. Supported options are
'gaussian'
andSigma value of the smearing distribution.
Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_vline
(x, y_min, y_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_spectrum
(data_label, x_values, y_values, unit_x)Import spectrum.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Remove all added plot elements.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property peak_color¶
- property peak_distance¶
- property peak_height¶
- property peak_line_style¶
- property peak_max_factor¶
- property peak_plateau_size¶
- property peak_prominence¶
- property peak_rel_height¶
- property peak_threshold¶
- property peak_width¶
- property peak_wlen¶
- property peak_y_min¶
- property peaks¶
- property plot_unit_x¶
Set unit of x-axis.
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
- property smearing_delta¶
Spacing between two values. If set to
None
the original function is used.- Type:¶
float or None
- property smearing_method¶
Method used to smear out the functions. Supported options are
'gaussian'
and'lorentzian'
.- Type:¶
str
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_vline(x, y_min, y_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
x (float) – x-position of the line.
y_min (float) – Bottom y-position of the line.
y_max (float) – Top y-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
- import_spectrum(data_label, x_values, y_values, unit_x)[source]¶
Import spectrum.
- Parameters:¶
data_label (str) – Internal label of the data set.
x_values (list) – x-values of the spectrum.
y_values (list) – y-values of the spectrum.
unit_x (str) – Unit of the x-values.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- remove_additional_plot_elements()¶
Remove all added plot elements.
- reset_gridspec()¶
Reset gridspec settings.