Module plottools.params
Functions setting default rcParams settings for all modules.
You actually do not need to import this module. Rather use one of its functions as a template. Copy it to your own module and adapt it to your needs.
Default plot styles and rc parameters
screen_style()
: layout and plot styles optimized for display on a screen.paper_style()
: layout and plot styles optimized for inclusion into a paper.sketch_style()
: layout and plot styles with xkcd style activated.
Functions
def screen_style(namespace=None)
-
Layout and plot styles optimized for display on a screen.
You might want to copy this function and adjust it according to your needs.
Call this function before you create any matplotlib figure to have the following features in effect:
- modified rc settings.
- figure sizes are to be specified in centimeter.
- detailed control over spine appearance.
- xlabel and ylabel with separately specified unit,
e.g.
set_xlabel('Time', 'ms')
. - automatic alignment of x- and ylabels.
lsSpine
,lsGrid
,lsMarker
line styles defined innamespace
.- a range of line, point, linepoint and fill styles defined in
namespace
, called A1-A3, B1-B4, C1-C4, Male, Female, that can be used as follows:
ax.plot(x, y, **lsA1) # major line only ax.plot(x, y, **lsB2m) # minor line only ax.plot(x, y, **psA2) # markers (points) only ax.plot(x, y, **lpsC3) # markers (points) with connecting lines ax.fill_between(x, y0, y1, **fsA3a) # transparent fill
Parameters
namespace
:class
orNone
- Namespace to which the generated line, point, linepoint and fill styles are added. If None add styles to the global namespace of the main module.
def paper_style(namespace=None)
-
Layout and plot styles optimized for inclusion into a paper.
You might want to copy this function and adjust it according to your needs.
Call this function before you create any matplotlib figure to have the following features in effect:
- modified rc settings.
- figure sizes are to be specified in centimeter.
- detailed control over spine appearance.
- xlabel and ylabel with separately specified unit,
e.g.
set_xlabel('Time', 'ms')
. - automatic alignment of x- and ylabels.
lsSpine
,lsGrid
,lsMarker
line styles defined innamespace
.- a range of line, point, linepoint and fill styles defined in
namespace
, called A1-A3, B1-B4, C1-C4, Male, Female, that can be used as follows:
ax.plot(x, y, **lsA1) # major line only ax.plot(x, y, **lsB2m) # minor line only ax.plot(x, y, **psA2) # markers (points) only ax.plot(x, y, **lpsC3) # markers (points) with connecting lines ax.fill_between(x, y0, y1, **fsA3a) # transparent fill
Parameters
namespace
:clas
orNone
- Namespace to which the generated line, point, linepoint and fill styles are added. If None add styles to the global namespace of the main module.
def sketch_style(namespace=None)
-
Layout and plot styles with xkcd style activated.
You might want to copy this function and adjust it according to your needs.
Call this function before you create any matplotlib figure to have the following features in effect:
- modified rc settings.
- figure sizes are to be specified in centimeter.
- detailed control over spine appearance.
- xlabel and ylabel with separately specified unit,
e.g.
set_xlabel('Time', 'ms')
. - automatic alignment of x- and ylabels.
lsSpine
,lsGrid
,lsMarker
line styles defined innamespace
.- a range of line, point, linepoint and fill styles defined in
namespace
, called A1-A3, B1-B4, C1-C4, Male, Female, that can be used as follows:
ax.plot(x, y, **lsA1) # major line only ax.plot(x, y, **lsB2m) # minor line only ax.plot(x, y, **psA2) # markers (points) only ax.plot(x, y, **lpsC3) # markers (points) with connecting lines ax.fill_between(x, y0, y1, **fsA3a) # transparent fill
Parameters
namespace
:class
orNone
- Namespace to which the generated line, point, linepoint and fill styles are added. If None add styles to the global namespace of the main module.
def demo(style='screen')
-
Run a demonstration of the params module.
Parameters
style
:string
- 'screen', 'print', or 'sketch': style to use.