Class Chart
source code
object --+
|
Chart
Simple and clean facade to Matplotlib's plotting API.
A chart instance abstracts a plotting device, on which one or multiple
related plots can be drawn. Charts can be exported as images, or
visualized interactively. Each chart instance will always open in its own
GUI window, and this window will never block the execution of the rest of
the program, or interfere with other Charts. The GUI can
be safely opened in the background and closed infinite number of times,
as long as the client program is still running.
By default, a chart contains a single plot:
>>> chart.plot
matplotlib.axes.AxesSubplot
>>> chart.plot.hist(...)
If rows
and columns
are defined, the chart
will contain rows
x columns
number of plots
(equivalent to MPL's sub-plots). Each plot can be assessed by its
index:
>>> chart.plots[0]
first plot
or by its position in the grid:
>>> chart.plots[0, 1]
plot at row=0, column=1
Note:
additional arguments are passed directly to Matplotlib's Figure
constructor.
|
|
|
|
|
|
|
__init__(self,
number=None,
title='
' ,
rows=1,
columns=1,
backend=<class 'csb.io.plots.WxBackendImpl'>,
*fa,
**fk)
x.__init__(...) initializes x; see help(type(x)) for signature |
source code
|
|
|
|
|
hide(self)
Hide (but do not dispose) the GUI window. |
source code
|
|
|
save(self,
file,
format=' png ' ,
crop=False,
dpi=None,
*a,
**k)
Save all plots to an image. |
source code
|
|
|
show(self)
Show the GUI window (non-blocking). |
source code
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
|
AUTONUMBER = None
hash(x)
|
int
|
columns
Number of columns in this chart
|
int
|
dpi
Chart's DPI
|
csb.core.enum
|
formats
Supported output file formats
|
int
|
height
Chart's height in inches
|
int
|
number
Chart number
|
matplotlib.AxesSubplot
|
plot
First plot
|
PlotsCollection
|
plots
Index-based access to the plots in this chart
|
int
|
rows
Number of rows in this chart
|
str
|
title
Chart title
|
int
|
width
Chart's width in inches
|
Inherited from object :
__class__
|
__init__(self,
number=None,
title='
' ,
rows=1,
columns=1,
backend=<class 'csb.io.plots.WxBackendImpl'>,
*fa,
**fk)
(Constructor)
| source code
|
x.__init__(...) initializes x; see help(type(x)) for signature
- Parameters:
number (int or None) - chart number; by default this a Chart.AUTONUMBER
title (str) - chart master title
rows (int) - number of rows in the chart window
columns (int) - number of columns in the chart window
- Overrides:
object.__init__
- (inherited documentation)
|
Dispose the GUI interface. Must be called at the end if any
chart.show() calls have been made. Automatically called if using the
chart in context manager ("with" statement).
Note:
Failing to call this method if show() has been called at least once
may cause backend-related errors.
|
save(self,
file,
format=' png ' ,
crop=False,
dpi=None,
*a,
**k)
| source code
|
Save all plots to an image.
- Parameters:
file (str) - destination file name
format (str or csb.core.EnumItem) - output image format; see chart.formats for
enumeration
crop (bool) - if True, crop the image (equivalent to MPL's bbox=tight)
Note:
additional arguments are passed directly to MPL's savefig method
|
columns
Number of columns in this chart
- Get Method:
- unreachable.columns(self)
- Number of columns in this chart
- Type:
- int
|
dpi
Chart's DPI
- Get Method:
- unreachable.dpi(self)
- Chart's DPI
- Set Method:
- unreachable.dpi(self,
dpi)
- Type:
- int
|
formats
Supported output file formats
- Get Method:
- unreachable.formats(self)
- Supported output file formats
- Type:
- csb.core.enum
|
height
Chart's height in inches
- Get Method:
- unreachable.height(self)
- Chart's height in inches
- Set Method:
- unreachable.height(self,
inches)
- Type:
- int
|
number
Chart number
- Get Method:
- unreachable.number(self)
- Chart number
- Type:
- int
|
plot
First plot
- Get Method:
- unreachable.plot(self)
- First plot
- Type:
- matplotlib.AxesSubplot
|
plots
Index-based access to the plots in this chart
- Get Method:
- unreachable.plots(self)
- Index-based access to the plots in this chart
- Type:
- PlotsCollection
|
rows
Number of rows in this chart
- Get Method:
- unreachable.rows(self)
- Number of rows in this chart
- Type:
- int
|
title
Chart title
- Get Method:
- unreachable.title(self)
- Chart title
- Type:
- str
|
width
Chart's width in inches
- Get Method:
- unreachable.width(self)
- Chart's width in inches
- Set Method:
- unreachable.width(self,
inches)
- Type:
- int
|