sciplot package¶
Subpackages¶
Submodules¶
sciplot.sciplotUI module¶
SciPlot-PyQt: Publication-ready scientific plotting for Python¶
SciPlot-PyQt (aka SciPlot) is a user-interface/matplotlib wrapper built with PyQt5 that allows interactive plotting through an embedded matplotlib canvas. It enables fast and easy publication-ready plots and images:
- Interactive plotting
- Theme and style editing (TODO)
- Figure saving and opening for later editing (TODO)
Supported Plot Types¶
Line plots : plot
Bar plots : bar, hist
Polycollections : fill_between
Images : imshow
Notes¶
SciPlot has a lot of advances/improvements to make. Feel free to contact me– help is always welcome!
Usage¶
import sciplot sp = sciplot.SciPlotUI() sp.show()
Example¶
sp.plot((0,1),(2,3),label=’Line’, x_label=’X’, y_label=’Y’, ls=’–’) sp.fill_between((0,1),(1,2),(3,4),label=’Fill Between’, color=’r’, alpha=0.25)
Authors¶
- Charles H. Camp Jr. <charles.camp@nist.gov>
-
class
sciplot.sciplotUI.
SciPlotUI
(limit_to=None, parent=None, show=True)[source]¶ Bases:
PyQt5.QtWidgets.QMainWindow
Scientific plotting user-interface for creating publication-quality plots and images
Parameters: limit_to : list, optional (default = None)
Limit the application to implement only certain functionality. Default is all elements turned ON. See Notes for options.
show : bool, optional (default = True)
Whether to show the UI upon instantiation
Notes
- limit_to options: ‘lines’, ‘fill betweens’, ‘bars’, images’
Methods
plot (MPL-like plotting functionality) imshow (MPL-like imshow) bar (MPL-like bar plot EXCEPT centered (rather than left-edge defined)) hist (MPL-like histogram) fill_between (MPL-like fill_between) -
_SciPlotUI__bar
(x, y, bottom=0, width_factor=1.0, use_real_width=False, label=None, meta={}, x_label=None, y_label=None, **kwargs)¶ MPL-like plotting functionality
Parameters: x : ndarray (1D)
X-axis data (center of bars)
y : ndarray (1D, for now)
Y-axis data (height)
bottom : float (for now)
Baseline of bars
width_factor: float
If legnth of y>1, fraction of space between bars taken up by bar (e.g. 1.0 leads to bars that tough). If y is a single-value OR use_real_width is True), is the width of the bar.
use_real_width : bool, optional (default=False):
If True, width_factor is the real width (in x-units)
label : str
Label of plot
x_label : str
X-axis label (units)
y_label : str
Y-axis label (units)
kwargs : dict
Other parameters sent directly to mpl-plot
-
_SciPlotUI__fill_between
(x, y_low, y_high, label=None, meta={}, x_label=None, y_label=None, **kwargs)¶ MPL-like fill_between plotting functionality
Parameters: x : ndarray (1D)
X-axis data
y_low : ndarray (1D, for now)
Low Y-axis data
y_high : ndarray (1D, for now)
High Y-axis data
label : str
Label of plot
x_label : str
X-axis label (units)
y_label : str
Y-axis label (units)
kwargs : dict
Other parameters sent directly to mpl-fill_between
-
_SciPlotUI__hist
(data, bins=10, label=None, meta={}, x_label=None, y_label='Counts', **kwargs)¶ MPL-like histogram plotting
Parameters: data : ndarray (1D, for now)
Data (center of bars)
bins : int
Number of histogram bins
label : str
Label of plot
x_label : str
X-axis label (units)
y_label : str
Y-axis label (units)
kwargs : dict
Other parameters sent directly to mpl-plot
-
_SciPlotUI__imshow
(img, x=None, y=None, label=None, meta={}, x_label=None, y_label=None, cbar=False, **kwargs)¶ MPL-like plotting functionality
Parameters: img : ndarray (2D)
Image data
x : ndarray (1D)
X-axis data
y : ndarray (1D, for now)
Y-axis data
label : str
Label of plot
x_label : str
X-axis label (units)
y_label : str
Y-axis label (units)
cbar : bool
Attach a colorbar to the img
kwargs : dict
Other parameters sent directly to mpl-imshow
-
_SciPlotUI__plot
(x, y, label=None, x_label=None, y_label=None, meta={}, **kwargs)¶ MPL-like plotting functionality
Parameters: x : ndarray (1D)
X-axis data
y : ndarray (1D, for now)
Y-axis data
label : str
Label of plot
x_label : str
X-axis label (units)
y_label : str
Y-axis label (units)
kwargs : dict
Other parameters sent directly to mpl-plot
-
_SciPlotUI__updateBarsDataDelete
(row, plt_id)¶ A plot was deleted (likely from within the model); thus, need to remove the corresponding plot data
-
_SciPlotUI__updateBarsDataStyle
()¶ Something style-related changed in the model; thus, need to change these elements in the fill_between data
-
_SciPlotUI__updateFillBetweenDataDelete
(row, plt_id)¶ A plot was deleted (likely from within the model); thus, need to remove the corresponding plot data
-
_SciPlotUI__updateFillBetweenDataStyle
()¶ Something style-related changed in the model; thus, need to change these elements in the fill_between data
-
_SciPlotUI__updateImagesDataDelete
(row, plt_id)¶ A plot was deleted (likely from within the model); thus, need to remove the corresponding plot data
-
_SciPlotUI__updateImagesDataStyle
()¶ Something style-related changed in the model; thus, need to change these elements in the fill_between data
-
_SciPlotUI__updatePlotDataDelete
(row, plt_id)¶ A plot was deleted (likely from within the model); thus, need to remove the corresponding plot data
-
_SciPlotUI__updatePlotDataStyle
()¶ Something style-related changed in the model; thus, need to change these elements in the plot data
-
_tabAvailability
(limit_to=None)[source]¶ If limit_to is provided, limits the tabs (elements) that are available.
May be useful for built-upon applications.
-
all_cleared
¶
-
list_bar_ids
¶
-
list_bar_objs
¶
-
list_fillbetween_ids
¶
-
list_fillbetween_objs
¶
-
list_image_ids
¶
-
list_image_objs
¶
-
list_line_ids
¶
-
list_line_objs
¶
-
n_bars
¶
-
n_fillbetweens
¶
-
n_images
¶
-
n_lines
¶
-
updateAllLabels
(x_label=None, y_label=None, title=None)[source]¶ Update the x- and y-labels and the title in the MPL widget, the lineEdit boxes, and the global data container
-
updateAxisParameters
()[source]¶ Query current state of axis settings and update appropriate lineEdit’s
-
updateDataLabels
(x_label=None, y_label=None, title=None)[source]¶ Within the global data container, update the x- and y-labels and the title
-
updateLabelsFromLineEdit
()[source]¶ From the linEdit widgets, update the x- and y-labels and the title in the MPL widget and the global data container
sciplot.sciplotUI_addon module¶
Demonstration of adding functionality to Sciplot
Created on Mon Jul 11 23:46:01 2016
@author: chc
-
class
sciplot.sciplotUI_addon.
SciPlotAddon
(limit_to=None, parent=None)[source]¶ Bases:
sciplot.sciplotUI.SciPlotUI
Trivial example of using SciPlot with addons (or building another application on top of SciPlot).
Module contents¶
SciPlot-PyQt: Publication-ready scientific plotting for Python¶
SciPlot-PyQt (aka SciPlot) is a user-interface/matplotlib wrapper built with PyQt5 that allows interactive plotting through an embedded matplotlib canvas. It enables fast and easy publication-ready plots and images:
- Interactive plotting
- Theme and style editing (TODO)
- Figure saving and opening for later editing (TODO)
Supported Plot Types¶
Line plots : plot
Bar plots : bar, hist
Polycollections : fill_between
Images : imshow
Notes¶
SciPlot has a lot of advances/improvements to make. Feel free to contact me– help is always welcome!
Usage¶
import sciplot sp = sciplot.SciPlotUI() sp.show()
Example¶
sp.plot((0,1),(2,3),label=’Line’, x_label=’X’, y_label=’Y’, ls=’–’) sp.fill_between((0,1),(1,2),(3,4),label=’Fill Between’, color=’r’, alpha=0.25)
Authors¶
- Charles H. Camp Jr. <charles.camp@nist.gov>