Project module of the psyplot Package.

This module contains the Project class that serves as the main part of the psyplot API. One instance of the Project class serves as coordinator of multiple plots and can be distributed into subprojects that keep reference to the main project without holding all array instances

Furthermore this module contains an easy pyplot-like API to the current subproject.

Classes:

DataArrayPlotter(da, *args, **kwargs)

Interface between the xarray.Dataset and the psyplot project

DataArrayPlotterInterface(methodname, ...[, ...])

Interface for the DataArrayPlotter to a plotter

DatasetPlotter(ds, *args, **kwargs)

Interface between the xarray.Dataset and the psyplot project

DatasetPlotterInterface(methodname, module, ...)

Interface for the DatasetPlotter to a plotter

PROJECT_CLS

The project class that is used for creating new projects

PlotterInterface(methodname, module, ...[, ...])

Base class for visualizing a data array from an predefined plotter

Project(*args, **kwargs)

A manager of multiple interactive data projects

ProjectPlotter([project])

Plotting methods of the psyplot.project.Project class

Functions:

close([num, figs, data, ds, remove_only])

Close the project

gcp([main])

Get the current project

get_project_nums()

Returns the project numbers of the open projects

multiple_subplots([rows, cols, maxplots, n, ...])

Function to create subplots.

project([num])

Create a new main project

register_plotter(identifier, module, ...[, ...])

Register a psyplot.plotter.Plotter for the projects

scp(project)

Set the current project

unregister_plotter(identifier[, sorter, ...])

Unregister a psyplot.plotter.Plotter for the projects

Data:

plot

ProjectPlotter of the current project.

class psyplot.project.DataArrayPlotter(da, *args, **kwargs)[source]

Bases: ProjectPlotter

Interface between the xarray.Dataset and the psyplot project

This class can be used to make new plots from a given dataset and add them to the current psyplot.project()

Attributes:

barplot(*args, **kwargs)

Make a bar plot of one-dimensional data

combined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field

density(*args, **kwargs)

Make a density plot of point data

fldmean(*args, **kwargs)

Calculate and plot the mean over x- and y-dimensions

lineplot(*args, **kwargs)

Make a line plot of one-dimensional data

mapcombined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field on a map

mapplot(*args, **kwargs)

Plot a 2D scalar field on a map

mapvector(*args, **kwargs)

Plot a 2D vector field on a map

plot2d(*args, **kwargs)

Make a simple plot of a 2D scalar field

vector(*args, **kwargs)

Make a simple plot of a 2D vector field

violinplot(*args, **kwargs)

Make a violin plot of your data

barplot(*args, **kwargs)

Make a bar plot of one-dimensional data

This plotting method visualizes the data via a psy_simple.plotters.BarPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.barplot()

Possible formatoptions are

alpha

axiscolor

background

categorical

color

coord

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

widths

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.barplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.barplot.summaries('title')

# show the full documentation
>>> da.psy.plot.barplot.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.barplot.plot
combined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field

This plotting method visualizes the data via a psy_simple.plotters.CombinedSimplePlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.combined()

Possible formatoptions are

arrowsize

arrowstyle

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

linewidth

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

vbounds

vcbar

vcbarspacing

vclabel

vclabelprops

vclabelsize

vclabelweight

vcmap

vcticklabels

vctickprops

vcticks

vcticksize

vctickweight

vplot

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.combined.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.combined.summaries('title')

# show the full documentation
>>> da.psy.plot.combined.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.combined.plot
density(*args, **kwargs)

Make a density plot of point data

This plotting method visualizes the data via a psy_simple.plotters.DensityPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.density()

Possible formatoptions are

axiscolor

background

bins

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

coord

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

normed

plot

post

post_timing

precision

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrange

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrange

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.density.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.density.summaries('title')

# show the full documentation
>>> da.psy.plot.density.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.density.plot
fldmean(*args, **kwargs)

Calculate and plot the mean over x- and y-dimensions

This plotting method visualizes the data via a psy_simple.plotters.FldmeanPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.fldmean()

Possible formatoptions are

axiscolor

background

color

coord

err_calc

error

erroralpha

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

linewidth

marker

markersize

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

mean

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.fldmean.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.fldmean.summaries('title')

# show the full documentation
>>> da.psy.plot.fldmean.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.fldmean.plot
lineplot(*args, **kwargs)

Make a line plot of one-dimensional data

This plotting method visualizes the data via a psy_simple.plotters.LinePlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.lineplot()

Possible formatoptions are

axiscolor

background

color

coord

error

erroralpha

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

linewidth

marker

markersize

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.lineplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.lineplot.summaries('title')

# show the full documentation
>>> da.psy.plot.lineplot.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.lineplot.plot
mapcombined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field on a map

This plotting method visualizes the data via a psy_maps.plotters.CombinedPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.mapcombined()

Possible formatoptions are

arrowsize

arrowstyle

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

interp_bounds

levels

linewidth

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

vbounds

vcbar

vcbarspacing

vclabel

vclabelprops

vclabelsize

vclabelweight

vcmap

vcticklabels

vctickprops

vcticks

vcticksize

vctickweight

vplot

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.mapcombined.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.mapcombined.summaries('title')

# show the full documentation
>>> da.psy.plot.mapcombined.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.mapcombined.plot
mapplot(*args, **kwargs)

Plot a 2D scalar field on a map

This plotting method visualizes the data via a psy_maps.plotters.FieldPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.mapplot()

Possible formatoptions are

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

interp_bounds

levels

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.mapplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.mapplot.summaries('title')

# show the full documentation
>>> da.psy.plot.mapplot.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.mapplot.plot
mapvector(*args, **kwargs)

Plot a 2D vector field on a map

This plotting method visualizes the data via a psy_maps.plotters.VectorPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.mapvector()

Possible formatoptions are

arrowsize

arrowstyle

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

linewidth

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.mapvector.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.mapvector.summaries('title')

# show the full documentation
>>> da.psy.plot.mapvector.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.mapvector.plot
plot2d(*args, **kwargs)

Make a simple plot of a 2D scalar field

This plotting method visualizes the data via a psy_simple.plotters.Simple2DPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.plot2d()

Possible formatoptions are

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.plot2d.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.plot2d.summaries('title')

# show the full documentation
>>> da.psy.plot.plot2d.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.plot2d.plot
vector(*args, **kwargs)

Make a simple plot of a 2D vector field

This plotting method visualizes the data via a psy_simple.plotters.SimpleVectorPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.vector()

Possible formatoptions are

arrowsize

arrowstyle

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

linewidth

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.vector.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.vector.summaries('title')

# show the full documentation
>>> da.psy.plot.vector.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.vector.plot
violinplot(*args, **kwargs)

Make a violin plot of your data

This plotting method visualizes the data via a psy_simple.plotters.ViolinPlotter plotters

To plot a variable in this dataset, type:

>>> da.psy.plot.violinplot()

Possible formatoptions are

axiscolor

background

color

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> da.psy.plot.violinplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> da.psy.plot.violinplot.summaries('title')

# show the full documentation
>>> da.psy.plot.violinplot.docs('plot')

# or access the documentation via the attribute
>>> da.psy.plot.violinplot.plot
class psyplot.project.DataArrayPlotterInterface(methodname, module, plotter_name, project_plotter=None)[source]

Bases: PlotterInterface

Interface for the DataArrayPlotter to a plotter

Methods:

check_data(*args, **kwargs)

Check whether the plotter of this plot method can visualize the data

check_data(*args, **kwargs)[source]

Check whether the plotter of this plot method can visualize the data

class psyplot.project.DatasetPlotter(ds, *args, **kwargs)[source]

Bases: ProjectPlotter

Interface between the xarray.Dataset and the psyplot project

This class can be used to make new plots from a given dataset and add them to the current psyplot.project()

Attributes:

barplot(*args, **kwargs)

Make a bar plot of one-dimensional data

combined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field

density(*args, **kwargs)

Make a density plot of point data

fldmean(*args, **kwargs)

Calculate and plot the mean over x- and y-dimensions

lineplot(*args, **kwargs)

Make a line plot of one-dimensional data

mapcombined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field on a map

mapplot(*args, **kwargs)

Plot a 2D scalar field on a map

mapvector(*args, **kwargs)

Plot a 2D vector field on a map

plot2d(*args, **kwargs)

Make a simple plot of a 2D scalar field

vector(*args, **kwargs)

Make a simple plot of a 2D vector field

violinplot(*args, **kwargs)

Make a violin plot of your data

barplot(*args, **kwargs)

Make a bar plot of one-dimensional data

This plotting method adds data arrays and plots them via psy_simple.plotters.BarPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.barplot(name=['my_variable'], ...)

Possible formatoptions are

alpha

axiscolor

background

categorical

color

coord

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

widths

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.barplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.barplot.summaries('title')

# show the full documentation
>>> ds.psy.plot.barplot.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.barplot.plot
combined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field

This plotting method adds data arrays and plots them via psy_simple.plotters.CombinedSimplePlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.combined(name=[['my_variable', ['u_var', 'v_var']]], ...)

Possible formatoptions are

arrowsize

arrowstyle

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

linewidth

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

vbounds

vcbar

vcbarspacing

vclabel

vclabelprops

vclabelsize

vclabelweight

vcmap

vcticklabels

vctickprops

vcticks

vcticksize

vctickweight

vplot

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.combined.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.combined.summaries('title')

# show the full documentation
>>> ds.psy.plot.combined.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.combined.plot
density(*args, **kwargs)

Make a density plot of point data

This plotting method adds data arrays and plots them via psy_simple.plotters.DensityPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.density(name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

bins

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

coord

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

normed

plot

post

post_timing

precision

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrange

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrange

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.density.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.density.summaries('title')

# show the full documentation
>>> ds.psy.plot.density.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.density.plot
fldmean(*args, **kwargs)

Calculate and plot the mean over x- and y-dimensions

This plotting method adds data arrays and plots them via psy_simple.plotters.FldmeanPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.fldmean(name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

color

coord

err_calc

error

erroralpha

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

linewidth

marker

markersize

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

mean

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.fldmean.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.fldmean.summaries('title')

# show the full documentation
>>> ds.psy.plot.fldmean.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.fldmean.plot
lineplot(*args, **kwargs)

Make a line plot of one-dimensional data

This plotting method adds data arrays and plots them via psy_simple.plotters.LinePlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.lineplot(name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

color

coord

error

erroralpha

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

linewidth

marker

markersize

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.lineplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.lineplot.summaries('title')

# show the full documentation
>>> ds.psy.plot.lineplot.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.lineplot.plot
mapcombined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field on a map

This plotting method adds data arrays and plots them via psy_maps.plotters.CombinedPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.mapcombined(name=[['my_variable', ['u_var', 'v_var']]], ...)

Possible formatoptions are

arrowsize

arrowstyle

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

interp_bounds

levels

linewidth

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

vbounds

vcbar

vcbarspacing

vclabel

vclabelprops

vclabelsize

vclabelweight

vcmap

vcticklabels

vctickprops

vcticks

vcticksize

vctickweight

vplot

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.mapcombined.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.mapcombined.summaries('title')

# show the full documentation
>>> ds.psy.plot.mapcombined.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.mapcombined.plot
mapplot(*args, **kwargs)

Plot a 2D scalar field on a map

This plotting method adds data arrays and plots them via psy_maps.plotters.FieldPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.mapplot(name=['my_variable'], ...)

Possible formatoptions are

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

interp_bounds

levels

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.mapplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.mapplot.summaries('title')

# show the full documentation
>>> ds.psy.plot.mapplot.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.mapplot.plot
mapvector(*args, **kwargs)

Plot a 2D vector field on a map

This plotting method adds data arrays and plots them via psy_maps.plotters.VectorPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.mapvector(name=[['u_var', 'v_var']], ...)

Possible formatoptions are

arrowsize

arrowstyle

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

linewidth

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.mapvector.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.mapvector.summaries('title')

# show the full documentation
>>> ds.psy.plot.mapvector.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.mapvector.plot
plot2d(*args, **kwargs)

Make a simple plot of a 2D scalar field

This plotting method adds data arrays and plots them via psy_simple.plotters.Simple2DPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.plot2d(name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.plot2d.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.plot2d.summaries('title')

# show the full documentation
>>> ds.psy.plot.plot2d.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.plot2d.plot
vector(*args, **kwargs)

Make a simple plot of a 2D vector field

This plotting method adds data arrays and plots them via psy_simple.plotters.SimpleVectorPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.vector(name=[['u_var', 'v_var']], ...)

Possible formatoptions are

arrowsize

arrowstyle

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

linewidth

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.vector.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.vector.summaries('title')

# show the full documentation
>>> ds.psy.plot.vector.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.vector.plot
violinplot(*args, **kwargs)

Make a violin plot of your data

This plotting method adds data arrays and plots them via psy_simple.plotters.ViolinPlotter plotters

To plot a variable in this dataset, type:

>>> ds.psy.plot.violinplot(name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

color

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

# show the keys corresponding to a group or multiple
# formatopions
>>> ds.psy.plot.violinplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> ds.psy.plot.violinplot.summaries('title')

# show the full documentation
>>> ds.psy.plot.violinplot.docs('plot')

# or access the documentation via the attribute
>>> ds.psy.plot.violinplot.plot
class psyplot.project.DatasetPlotterInterface(methodname, module, plotter_name, project_plotter=None)[source]

Bases: PlotterInterface

Interface for the DatasetPlotter to a plotter

psyplot.project.PROJECT_CLS

The project class that is used for creating new projects

Methods:

append(*args, **kwargs)

Append a new array to the list

close([figs, data, ds, remove_only])

Close this project instance

disable()

Disables the plotters in this list

docs(*args, **kwargs)

Show the available formatoptions in this project and their full docu

enable()

export(output[, tight, concat, close_pdf, ...])

Exports the figures of the project to one or more image files

extend(*args, **kwargs)

Add further arrays from an iterable to this list

extract_fmts_from_preset(preset, plotmethod)

Extract the formatoptions for a plotmethod from a given preset

format_string(s[, use_time, format_args])

Format a string with the attributes in this project

from_dataset(*args, **kwargs)

Construct an ArrayList instance from an existing base dataset

joined_attrs([delimiter, enhanced, ...])

Join the attributes of the arrays in this project

keys(*args, **kwargs)

Show the available formatoptions in this project

load_preset(preset, **kwargs)

Load a preset from disk and apply it to the open project.

load_project(fname[, auto_update, ...])

Load a project from a file or dict

new([num])

Create a new main project

save_preset([fname, include_defaults, update])

Save the formatoptions of this project as a preset

save_project([fname, pwd, pack])

Save this project to a file

scp(project)

Set the current project

share([base, keys, by])

Share the formatoptions of one plotter with all the others

show()

Shows all open figures

summaries(*args, **kwargs)

Show the available formatoptions and their summaries in this project

unshare(**kwargs)

Unshare the formatoptions of all the plotters in this instance

Attributes:

arr_names

Names of the arrays (!not of the variables!) in this list

axes

A mapping from axes to data objects with the plotter in this axes

barplot

List of data arrays that are plotted by psy_simple.plotters.BarPlotter plotters

block_signals([value])

Wrapper around a boolean defining an __enter__ and __exit__ method

combined

List of data arrays that are plotted by psy_simple.plotters.CombinedSimplePlotter plotters

datasets

A mapping from dataset numbers to datasets in this list

density

List of data arrays that are plotted by psy_simple.plotters.DensityPlotter plotters

dsnames

The set of dataset names in this instance

dsnames_map

A dictionary from the dataset numbers in this list to their filenames

figs

A mapping from figures to data objects with the plotter in this figure

fldmean

List of data arrays that are plotted by psy_simple.plotters.FldmeanPlotter plotters

is_cmp

Boolean that is True if the project is the current main project

is_csp

Boolean that is True if the project is the current subproject

is_main

bool.

lineplot

List of data arrays that are plotted by psy_simple.plotters.LinePlotter plotters

logger

logging.Logger of this instance

main

Project.

mapcombined

List of data arrays that are plotted by psy_maps.plotters.CombinedPlotter plotters

mapplot

List of data arrays that are plotted by psy_maps.plotters.FieldPlotter plotters

maps

List of data arrays that are plotted by psy_maps.plotters.MapPlotter plotters

mapvector

List of data arrays that are plotted by psy_maps.plotters.VectorPlotter plotters

oncpchange

signal to be emiitted when the current main and/or subproject changes

plot

Plotting instance of this Project.

plot2d

List of data arrays that are plotted by psy_simple.plotters.Simple2DPlotter plotters

plotters

A list of all the plotters in this instance

simple

List of data arrays that are plotted by psy_simple.plotters.SimplePlotterBase plotters

vector

List of data arrays that are plotted by psy_simple.plotters.SimpleVectorPlotter plotters

violinplot

List of data arrays that are plotted by psy_simple.plotters.ViolinPlotter plotters

with_plotter

The arrays in this instance that are visualized with a plotter

class psyplot.project.PlotterInterface(methodname, module, plotter_name, project_plotter=None)[source]

Bases: object

Base class for visualizing a data array from an predefined plotter

See the __call__() method for details on plotting.

Methods:

check_data(ds, name, dims[, decoder])

A validation method for the data shape

docs(*args, **kwargs)

Method to print the full documentations of the formatoptions

keys(*args, **kwargs)

Classmethod to return a nice looking table with the given formatoptions

summaries(*args, **kwargs)

Method to print the summaries of the formatoptions

Attributes:

is_imported

True if the module for this plot method has been imported already

plotter_cls

The plotter class

print_func

The function that is used to return a formatoption

check_data(ds, name, dims, decoder=None, *args, **kwargs)[source]

A validation method for the data shape

Parameters:
  • name (list of lists of strings) – The variable names (see the check_data() method of the plotter_cls attribute for details)

  • dims (list of dictionaries) – The dimensions of the arrays. It will be enhanced by the default dimensions of this plot method

  • is_unstructured (bool or list of bool) – True if the corresponding array is unstructured.

  • decoder (psyplot.data.CFDecoder, dict or a list of them) – The decoders to use per array. Dictionaries are parsed as keyword arguments to the psyplot.data.CFDecoder.get_decoder() method

Returns:

  • list of bool or None – True, if everything is okay, False in case of a serious error, None if it is intermediate. Each object in this list corresponds to one in the given name

  • list of str – The message giving more information on the reason. Each object in this list corresponds to one in the given name

docs(*args, **kwargs)[source]

Method to print the full documentations of the formatoptions

Parameters:
  • keys (list of str or None) – If None, the all formatoptions of the given class are used. Group names from the psyplot.plotter.groups mapping are replaced by the formatoptions

  • indent (int) – The indentation of the table

  • grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the Formatoption.groupname attribute

  • func (function or None) – The function the is used for returning (by default it is printed via the print() function or (when using the gui) in the help explorer). The given function must take a string as argument

  • include_links (bool or None, optional) – Default False. If True, links (in restructured formats) are included in the description. If None, the behaviour is determined by the psyplot.plotter.Plotter.include_links attribute.

Returns:

The enhanced list of the formatoptions

Return type:

list of str

See also

keys, docs

property is_imported

True if the module for this plot method has been imported already

keys(*args, **kwargs)[source]

Classmethod to return a nice looking table with the given formatoptions

Parameters:
  • keys (list of str or None) – If None, the all formatoptions of the given class are used. Group names from the psyplot.plotter.groups mapping are replaced by the formatoptions

  • indent (int) – The indentation of the table

  • grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the Formatoption.groupname attribute

  • func (function or None) – The function the is used for returning (by default it is printed via the print() function or (when using the gui) in the help explorer). The given function must take a string as argument

  • include_links (bool or None, optional) – Default False. If True, links (in restructured formats) are included in the description. If None, the behaviour is determined by the psyplot.plotter.Plotter.include_links attribute.

Returns:

The enhanced list of the formatoptions

Return type:

list of str

See also

summaries, docs

property plotter_cls

The plotter class

property print_func

The function that is used to return a formatoption

By default the print() function is used (i.e. it is printed to the terminal)

summaries(*args, **kwargs)[source]

Method to print the summaries of the formatoptions

Parameters:
  • keys (list of str or None) – If None, the all formatoptions of the given class are used. Group names from the psyplot.plotter.groups mapping are replaced by the formatoptions

  • indent (int) – The indentation of the table

  • grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the Formatoption.groupname attribute

  • func (function or None) – The function the is used for returning (by default it is printed via the print() function or (when using the gui) in the help explorer). The given function must take a string as argument

  • include_links (bool or None, optional) – Default False. If True, links (in restructured formats) are included in the description. If None, the behaviour is determined by the psyplot.plotter.Plotter.include_links attribute.

Returns:

The enhanced list of the formatoptions

Return type:

list of str

See also

keys, docs

class psyplot.project.Project(*args, **kwargs)[source]

Bases: ArrayList

A manager of multiple interactive data projects

Parameters:
  • iterable (iterable) – The iterable (e.g. another list) defining this list

  • attrs (dict-like or iterable, optional) – Global attributes of this list

  • auto_update (bool) – Default: None. A boolean indicating whether this list shall automatically update the contained arrays when calling the update() method or not. See also the no_auto_update attribute. If None, the value from the 'lists.auto_update' key in the psyplot.rcParams dictionary is used.

  • new_name (bool or str) – If False, and the arr_name attribute of the new array is already in the list, a ValueError is raised. If True and the arr_name attribute of the new array is not already in the list, the name is not changed. Otherwise, if the array name is already in use, new_name is set to ‘arr{0}’. If not True, this will be used for renaming (if the array name of arr is in use or not). '{0}' is replaced by a counter

  • main (Project) – The main project this subproject belongs to (or None if this project is the main project)

  • num (int) – The number of the project

Methods:

append(*args, **kwargs)

Append a new array to the list

close([figs, data, ds, remove_only])

Close this project instance

disable()

Disables the plotters in this list

docs(*args, **kwargs)

Show the available formatoptions in this project and their full docu

enable()

export(output[, tight, concat, close_pdf, ...])

Exports the figures of the project to one or more image files

extend(*args, **kwargs)

Add further arrays from an iterable to this list

extract_fmts_from_preset(preset, plotmethod)

Extract the formatoptions for a plotmethod from a given preset

format_string(s[, use_time, format_args])

Format a string with the attributes in this project

from_dataset(*args, **kwargs)

Construct an ArrayList instance from an existing base dataset

joined_attrs([delimiter, enhanced, ...])

Join the attributes of the arrays in this project

keys(*args, **kwargs)

Show the available formatoptions in this project

load_preset(preset, **kwargs)

Load a preset from disk and apply it to the open project.

load_project(fname[, auto_update, ...])

Load a project from a file or dict

new([num])

Create a new main project

save_preset([fname, include_defaults, update])

Save the formatoptions of this project as a preset

save_project([fname, pwd, pack])

Save this project to a file

scp(project)

Set the current project

share([base, keys, by])

Share the formatoptions of one plotter with all the others

show()

Shows all open figures

summaries(*args, **kwargs)

Show the available formatoptions and their summaries in this project

unshare(**kwargs)

Unshare the formatoptions of all the plotters in this instance

Attributes:

arr_names

Names of the arrays (!not of the variables!) in this list

axes

A mapping from axes to data objects with the plotter in this axes

barplot

List of data arrays that are plotted by psy_simple.plotters.BarPlotter plotters

block_signals([value])

Wrapper around a boolean defining an __enter__ and __exit__ method

combined

List of data arrays that are plotted by psy_simple.plotters.CombinedSimplePlotter plotters

datasets

A mapping from dataset numbers to datasets in this list

density

List of data arrays that are plotted by psy_simple.plotters.DensityPlotter plotters

dsnames

The set of dataset names in this instance

dsnames_map

A dictionary from the dataset numbers in this list to their filenames

figs

A mapping from figures to data objects with the plotter in this figure

fldmean

List of data arrays that are plotted by psy_simple.plotters.FldmeanPlotter plotters

is_cmp

Boolean that is True if the project is the current main project

is_csp

Boolean that is True if the project is the current subproject

is_main

bool.

lineplot

List of data arrays that are plotted by psy_simple.plotters.LinePlotter plotters

logger

logging.Logger of this instance

main

Project.

mapcombined

List of data arrays that are plotted by psy_maps.plotters.CombinedPlotter plotters

mapplot

List of data arrays that are plotted by psy_maps.plotters.FieldPlotter plotters

maps

List of data arrays that are plotted by psy_maps.plotters.MapPlotter plotters

mapvector

List of data arrays that are plotted by psy_maps.plotters.VectorPlotter plotters

oncpchange

signal to be emiitted when the current main and/or subproject changes

plot

Plotting instance of this Project.

plot2d

List of data arrays that are plotted by psy_simple.plotters.Simple2DPlotter plotters

plotters

A list of all the plotters in this instance

simple

List of data arrays that are plotted by psy_simple.plotters.SimplePlotterBase plotters

vector

List of data arrays that are plotted by psy_simple.plotters.SimpleVectorPlotter plotters

violinplot

List of data arrays that are plotted by psy_simple.plotters.ViolinPlotter plotters

with_plotter

The arrays in this instance that are visualized with a plotter

append(*args, **kwargs)[source]

Append a new array to the list

Parameters:
  • value (InteractiveBase) – The data object to append to this list

  • new_name (bool or str) – If False, and the arr_name attribute of the new array is already in the list, a ValueError is raised. If True and the arr_name attribute of the new array is not already in the list, the name is not changed. Otherwise, if the array name is already in use, new_name is set to ‘arr{0}’. If not True, this will be used for renaming (if the array name of arr is in use or not). '{0}' is replaced by a counter

Raises:
  • ValueError – If it was impossible to find a name that isn’t already in the list

  • ValueError – If new_name is False and the array is already in the list

See also

list.append, extend, rename

property arr_names

Names of the arrays (!not of the variables!) in this list

This attribute can be set with an iterable of unique names to change the array names of the data objects in this list.

property axes

A mapping from axes to data objects with the plotter in this axes

property barplot

List of data arrays that are plotted by psy_simple.plotters.BarPlotter plotters

block_signals(value=None)

Wrapper around a boolean defining an __enter__ and __exit__ method

Notes

If you want to use this class as an instance property, rather use the _temp_bool_prop() because this class as a descriptor is ment to be a class descriptor

close(figs=True, data=False, ds=False, remove_only=False)[source]

Close this project instance

Parameters:
  • figs (bool) – Close the figures

  • data (bool) – delete the arrays from the (main) project

  • ds (bool) – If True, close the dataset as well

  • remove_only (bool) – If True and figs is True, the figures are not closed but the plotters are removed

property combined

List of data arrays that are plotted by psy_simple.plotters.CombinedSimplePlotter plotters

property datasets

A mapping from dataset numbers to datasets in this list

property density

List of data arrays that are plotted by psy_simple.plotters.DensityPlotter plotters

disable()[source]

Disables the plotters in this list

docs(*args, **kwargs)[source]

Show the available formatoptions in this project and their full docu

Parameters:
  • keys (list of str or None) – If None, the all formatoptions of the given class are used. Group names from the psyplot.plotter.groups mapping are replaced by the formatoptions

  • indent (int) – The indentation of the table

  • grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the Formatoption.groupname attribute

  • func (function or None) – The function the is used for returning (by default it is printed via the print() function or (when using the gui) in the help explorer). The given function must take a string as argument

  • include_links (bool or None, optional) – Default False. If True, links (in restructured formats) are included in the description. If None, the behaviour is determined by the psyplot.plotter.Plotter.include_links attribute.

Returns:

The enhanced list of the formatoptions

Return type:

list of str

property dsnames

The set of dataset names in this instance

property dsnames_map

A dictionary from the dataset numbers in this list to their filenames

enable()[source]
export(output, tight=False, concat=True, close_pdf=None, use_time=False, **kwargs)[source]

Exports the figures of the project to one or more image files

Parameters:
  • output (str, iterable or matplotlib.backends.backend_pdf.PdfPages) – if string or list of strings, those define the names of the output files. Otherwise you may provide an instance of matplotlib.backends.backend_pdf.PdfPages to save the figures in it. If string (or iterable of strings), attribute names in the xarray.DataArray.attrs attribute as well as index dimensions are replaced by the respective value (see examples below). Furthermore a single format string without key (e.g. %i, %s, %d, etc.) is replaced by a counter.

  • tight (bool) – If True, it is tried to figure out the tight bbox of the figure (same as bbox_inches=’tight’)

  • concat (bool) – if True and the output format is pdf, all figures are concatenated into one single pdf

  • close_pdf (bool or None) – If True and the figures are concatenated into one single pdf, the resulting pdf instance is closed. If False it remains open. If None and output is a string, it is the same as close_pdf=True, if None and output is neither a string nor an iterable, it is the same as close_pdf=False

  • use_time (bool) – If True, formatting strings for the datetime.datetime.strftime() are expected to be found in output (e.g. '%m', '%Y', etc.). If so, other formatting strings must be escaped by double '%' (e.g. '%%i' instead of ('%i'))

  • **kwargs – Any valid keyword for the matplotlib.pyplot.savefig() function

Returns:

a PdfPages instance if output is a string and close_pdf is False, otherwise None

Return type:

matplotlib.backends.backend_pdf.PdfPages or None

Examples

Simply save all figures into one single pdf:

>>> p = psy.gcp()
>>> p.export('my_plots.pdf')

Save all figures into separate pngs with increasing numbers (e.g. 'my_plots_1.png'):

>>> p.export('my_plots_%i.png')

Save all figures into separate pngs with the name of the variables shown in each figure (e.g. 'my_plots_t2m.png'):

>>> p.export('my_plots_%(name)s.png')

Save all figures into separate pngs with the name of the variables shown in each figure and with increasing numbers (e.g. 'my_plots_1_t2m.png'):

>>> p.export('my_plots_%i_%(name)s.png')

Specify the names for each figure directly via a list:

>>> p.export(['my_plots1.pdf', 'my_plots2.pdf'])
extend(*args, **kwargs)[source]

Add further arrays from an iterable to this list

Parameters:
  • iterable – Any iterable that contains InteractiveBase instances

  • new_name (bool or str) – If False, and the arr_name attribute of the new array is already in the list, a ValueError is raised. If True and the arr_name attribute of the new array is not already in the list, the name is not changed. Otherwise, if the array name is already in use, new_name is set to ‘arr{0}’. If not True, this will be used for renaming (if the array name of arr is in use or not). '{0}' is replaced by a counter

Raises:
  • ValueError – If it was impossible to find a name that isn’t already in the list

  • ValueError – If new_name is False and the array is already in the list

See also

list.extend, append, rename

static extract_fmts_from_preset(preset: str, plotmethod: str)[source]

Extract the formatoptions for a plotmethod from a given preset

This method takes the preset and extracts the formatoptions valid for the given plotmethod

Parameters:
  • %(Project._load_preset.parameters)s

  • plotmethod (str) – The plotmethod to use

property figs

A mapping from figures to data objects with the plotter in this figure

property fldmean

List of data arrays that are plotted by psy_simple.plotters.FldmeanPlotter plotters

format_string(s, use_time=False, format_args=None, *args, **kwargs)[source]

Format a string with the attributes in this project

Parameters:
  • s (str) – The string that is subject to be formatted

  • use_time (bool) – If True, formatting strings for the datetime.datetime.strftime() are expected to be found in output (e.g. '%m', '%Y', etc.). If so, other formatting strings must be escaped by double '%' (e.g. '%%i' instead of ('%i'))

  • format_args (tuple) – A tuple of arguments that shall be inserted in s via s % format_args. (There will be no error, when this fails!)

  • delimiter (str) – The string that shall be used as the delimiter in case that there are multiple values for one attribute in the arrays. If None, they will be returned as sets

  • enhanced (bool) – If True, the psyplot.plotter.Plotter.get_enhanced_attrs() method is used, otherwise the xarray.DataArray.attrs attribute is used.

  • plot_data (bool) – It True, use the psyplot.plotter.Plotter.plot_data attribute of the plotters rather than the raw data in this project

  • keep_all (bool) – If True, all formatoptions are kept. Otherwise only the intersection

Returns:

The formatted string s

Return type:

str

classmethod from_dataset(*args, **kwargs)[source]

Construct an ArrayList instance from an existing base dataset

Parameters:
  • base (xarray.Dataset) – Dataset instance that is used as reference

  • method ({'isel', None, 'nearest', ...}) – Selection method of the xarray.Dataset to be used for setting the variables from the informations in dims. If method is ‘isel’, the xarray.Dataset.isel() method is used. Otherwise it sets the method parameter for the xarray.Dataset.sel() method.

  • auto_update (bool) – Default: None. A boolean indicating whether this list shall automatically update the contained arrays when calling the update() method or not. See also the no_auto_update attribute. If None, the value from the 'lists.auto_update' key in the psyplot.rcParams dictionary is used.

  • prefer_list (bool) – If True and multiple variable names pher array are found, the InteractiveList class is used. Otherwise the arrays are put together into one InteractiveArray.

  • default_slice (indexer) – Index (e.g. 0 if method is ‘isel’) that shall be used for dimensions not covered by dims and furtherdims. If None, the whole slice will be used. Note that the default_slice is always based on the isel method.

  • decoder (CFDecoder or dict) –

    Arguments for the decoder. This can be one of

    • an instance of CFDecoder

    • a subclass of CFDecoder

    • a dictionary with keyword-arguments to the automatically determined decoder class

    • None to automatically set the decoder

  • squeeze (bool, optional) – Default True. If True, and the created arrays have a an axes with length 1, it is removed from the dimension list (e.g. an array with shape (3, 4, 1, 5) will be squeezed to shape (3, 4, 5))

  • attrs (dict, optional) – Meta attributes that shall be assigned to the selected data arrays (additional to those stored in the base dataset)

  • load (bool or dict) – If True, load the data from the dataset using the xarray.DataArray.load() method. If dict, those will be given to the above mentioned load method

  • main (Project) – The main project that this project corresponds to

  • arr_names (string, list of strings or dictionary) –

    Set the unique array names of the resulting arrays and (optionally) dimensions.

    • if string: same as list of strings (see below). Strings may include {0} which will be replaced by a counter.

    • list of strings: those will be used for the array names. The final number of dictionaries in the return depend in this case on the dims and **furtherdims

    • dictionary: Then nothing happens and an dict version of arr_names is returned.

  • sort (list of strings) – This parameter defines how the dictionaries are ordered. It has no effect if arr_names is a dictionary (use a dict for that). It can be a list of dimension strings matching to the dimensions in dims for the variable.

  • dims (dict) – Keys must be variable names of dimensions (e.g. time, level, lat or lon) or ‘name’ for the variable name you want to choose. Values must be values of that dimension or iterables of the values (e.g. lists). Note that strings will be put into a list. For example dims = {‘name’: ‘t2m’, ‘time’: 0} will result in one plot for the first time step, whereas dims = {‘name’: ‘t2m’, ‘time’: [0, 1]} will result in two plots, one for the first (time == 0) and one for the second (time == 1) time step.

  • **kwargs – The same as dims (those will update what is specified in dims)

Returns:

The newly created project instance

Return type:

Project

property is_cmp

Boolean that is True if the project is the current main project

property is_csp

Boolean that is True if the project is the current subproject

property is_main

bool. True if this Project is a main project

joined_attrs(delimiter=', ', enhanced=True, plot_data=False, keep_all=True)[source]

Join the attributes of the arrays in this project

Parameters:
Returns:

A mapping from the attribute to the joined attributes which are either strings or (if there is only one attribute value), the data type of the corresponding value

Return type:

dict

keys(*args, **kwargs)[source]

Show the available formatoptions in this project

Parameters:
  • keys (list of str or None) – If None, the all formatoptions of the given class are used. Group names from the psyplot.plotter.groups mapping are replaced by the formatoptions

  • indent (int) – The indentation of the table

  • grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the Formatoption.groupname attribute

  • func (function or None) – The function the is used for returning (by default it is printed via the print() function or (when using the gui) in the help explorer). The given function must take a string as argument

  • include_links (bool or None, optional) – Default False. If True, links (in restructured formats) are included in the description. If None, the behaviour is determined by the psyplot.plotter.Plotter.include_links attribute.

Returns:

The enhanced list of the formatoptions

Return type:

list of str

property lineplot

List of data arrays that are plotted by psy_simple.plotters.LinePlotter plotters

load_preset(preset: str, **kwargs)[source]

Load a preset from disk and apply it to the open project.

This method loads a preset and updates the corresponding plots

Parameters:
  • preset (str or dict) – The filename or identifier of a preset. If the given preset is the path to an existing yaml file, it will be loaded. Otherwise we look up the preset in the psyplot configuration directory (see get_configdir()). If a dictionary is provided, we assume that this is the preset

  • **kwargs – Any other parameter that shall be passed to the update() method

Notes

An identifier is the filename without extension. If you want to list the available presets, run psyplot -lp from the command-line

classmethod load_project(fname, auto_update=None, make_plot=True, draw=False, alternative_axes=None, main=False, encoding=None, enable_post=False, new_fig=True, clear=None, **kwargs)[source]

Load a project from a file or dict

This classmethod allows to load a project that has been stored using the save_project() method and reads all the data and creates the figures.

Since the data is stored in external files when saving a project, make sure that the data is accessible under the relative paths as stored in the file fname or from the current working directory if fname is a dictionary. Alternatively use the alternative_paths parameter or the pwd parameter

Parameters:
  • fname (str or dict) – The string might be the path to a file created with the save_project() method, or it might be a dictionary from this method

  • auto_update (bool) – Default: None. A boolean indicating whether this list shall automatically update the contained arrays when calling the update() method or not. See also the no_auto_update attribute. If None, the value from the 'lists.auto_update' key in the psyplot.rcParams dictionary is used.

  • make_plot (bool) – If True, the data is plotted at the end. Otherwise you have to call the psyplot.plotter.Plotter.initialize_plot() method or the psyplot.plotter.Plotter.reinit() method by yourself

  • draw (bool or None) – Boolean to control whether the figure of this array shall be drawn at the end. If None, it defaults to the ‘auto_draw’` parameter in the psyplot.rcParams dictionary

  • alternative_axes (dict, None or list) –

    alternative axes instances to use

    • If it is None, the axes and figures from the saving point will be reproduced.

    • a dictionary should map from array names in the created project to matplotlib axes instances

    • a list should contain axes instances that will be used for iteration

  • main (bool, optional) – If True, a new main project is created and returned. Otherwise (by default default) the data is added to the current main project.

  • encoding (str) – The encoding to use for loading the project. If None, it is automatically determined by pickle. Note: Set this to 'latin1' if using a project created with python2 on python3.

  • enable_post (bool) – If True, the post formatoption is enabled and post processing scripts are allowed. Do only set this parameter to True if you know you can trust the information in fname

  • new_fig (bool) – If True (default) and alternative_axes is None, new figures are created if the figure already exists

  • clear (bool) – If True, axes are cleared before making the plot. This is only necessary if the ax keyword consists of subplots with projection that differs from the one that is needed

  • pwd (str) – Path to the working directory from where the data can be imported. If None and fname is the path to a file, pwd is set to the directory of this file. Otherwise the current working directory is used.

  • alternative_paths (dict or list or str) – A mapping from original filenames as used in d to filenames that shall be used instead. If alternative_paths is not None, datasets must be None. Paths must be accessible from the current working directory. If alternative_paths is a list (or any other iterable) is provided, the file names will be replaced as they appear in d (note that this is very unsafe if d is not and dict)

  • datasets (dict or list or None) – A mapping from original filenames in d to the instances of xarray.Dataset to use. If it is an iterable, the same holds as for the alternative_paths parameter

  • ignore_keys (list of str) – Keys specified in this list are ignored and not seen as array information (note that attrs are used anyway)

  • only (string, list or callable) –

    Can be one of the following three things:

    • a string that represents a pattern to match the array names that shall be included

    • a list of array names to include

    • a callable with two arguments, a string and a dict such as

      def filter_func(arr_name: str, info: dict): -> bool
          '''
          Filter the array names
      
          This function should return True if the array shall be
          included, else False
      
          Parameters
          ----------
          arr_name: str
              The array name (i.e. the ``arr_name`` attribute)
          info: dict
              The dictionary with the array informations. Common
              keys are ``'name'`` that points to the variable name
              and ``'dims'`` that points to the dimensions and
              ``'fname'`` that points to the file name
          '''
          return True or False
      

      The function should return True if the array shall be included, else False. This function will also be given to subsequents instances of InteractiveList objects that are contained in the returned value

  • chname (dict) – A mapping from variable names in the project to variable names that should be used instead

  • d (dict) – The dictionary holding the data

  • alternative_paths – A mapping from original filenames as used in d to filenames that shall be used instead. If alternative_paths is not None, datasets must be None. Paths must be accessible from the current working directory. If alternative_paths is a list (or any other iterable) is provided, the file names will be replaced as they appear in d (note that this is very unsafe if d is not and dict)

  • datasets – A mapping from original filenames in d to the instances of xarray.Dataset to use. If it is an iterable, the same holds as for the alternative_paths parameter

  • pwd – Path to the working directory from where the data can be imported. If None, use the current working directory.

  • ignore_keys – Keys specified in this list are ignored and not seen as array information (note that attrs are used anyway)

  • only

    Can be one of the following three things:

    • a string that represents a pattern to match the array names that shall be included

    • a list of array names to include

    • a callable with two arguments, a string and a dict such as

      def filter_func(arr_name: str, info: dict): -> bool
          '''
          Filter the array names
      
          This function should return True if the array shall be
          included, else False
      
          Parameters
          ----------
          arr_name: str
              The array name (i.e. the ``arr_name`` attribute)
          info: dict
              The dictionary with the array informations. Common
              keys are ``'name'`` that points to the variable name
              and ``'dims'`` that points to the dimensions and
              ``'fname'`` that points to the file name
          '''
          return True or False
      

      The function should return True if the array shall be included, else False. This function will also be given to subsequents instances of InteractiveList objects that are contained in the returned value

  • chname – A mapping from variable names in the project to variable names that should be used instead

Returns:

The project in state of the saving point

Return type:

Project

property logger

logging.Logger of this instance

property main

Project. The main project of this subproject

property mapcombined

List of data arrays that are plotted by psy_maps.plotters.CombinedPlotter plotters

property mapplot

List of data arrays that are plotted by psy_maps.plotters.FieldPlotter plotters

property maps

List of data arrays that are plotted by psy_maps.plotters.MapPlotter plotters

property mapvector

List of data arrays that are plotted by psy_maps.plotters.VectorPlotter plotters

classmethod new(num=None, *args, **kwargs)[source]

Create a new main project

Parameters:
  • num (int) – The number of the project

  • iterable (iterable) – The iterable (e.g. another list) defining this list

  • attrs (dict-like or iterable, optional) – Global attributes of this list

  • auto_update (bool) – Default: None. A boolean indicating whether this list shall automatically update the contained arrays when calling the update() method or not. See also the no_auto_update attribute. If None, the value from the 'lists.auto_update' key in the psyplot.rcParams dictionary is used.

  • new_name (bool or str) – If False, and the arr_name attribute of the new array is already in the list, a ValueError is raised. If True and the arr_name attribute of the new array is not already in the list, the name is not changed. Otherwise, if the array name is already in use, new_name is set to ‘arr{0}’. If not True, this will be used for renaming (if the array name of arr is in use or not). '{0}' is replaced by a counter

  • main (Project) – The main project this subproject belongs to (or None if this project is the main project)

Returns:

The with the given num (if it does not already exist, it is created)

Return type:

Project

See also

scp

Sets the current project

gcp

Returns the current project

oncpchange

signal to be emiitted when the current main and/or subproject changes

property plot

Plotting instance of this Project. See the ProjectPlotter class for method documentations

property plot2d

List of data arrays that are plotted by psy_simple.plotters.Simple2DPlotter plotters

property plotters

A list of all the plotters in this instance

save_preset(fname=None, include_defaults=False, update=False)[source]

Save the formatoptions of this project as a preset

This method takes the formatoptions in the plotters of this project and saves it as a preset file

save_project(fname=None, pwd=None, pack=False, **kwargs)[source]

Save this project to a file

Parameters:
  • fname (str or None) – If None, the dictionary will be returned. Otherwise the necessary information to load this project via the load() method is saved to fname using the pickle module

  • pwd (str or None, optional) – Path to the working directory from where the data can be imported. If None and fname is the path to a file, pwd is set to the directory of this file. Otherwise the current working directory is used.

  • pack (bool) – If True, all datasets are packed into the folder of fname and will be used if the data is loaded

  • dump (bool) – If True and the dataset has not been dumped so far, it is dumped to a temporary file or the one generated by paths is used. If it is False or both, dump and paths are None, no data will be stored. If it is None and paths is not None, dump is set to True.

  • paths (iterable or True) – An iterator over filenames to use if a dataset has no filename. If paths is True, an iterator over temporary files will be created without raising a warning

  • attrs (bool, optional) – If True (default), the ArrayList.attrs and xarray.DataArray.attrs attributes are included in the returning dictionary

  • standardize_dims (bool, optional) – If True (default), the real dimension names in the dataset are replaced by x, y, z and t to be more general.

  • use_rel_paths (bool, optional) – If True (default), paths relative to the current working directory are used. Otherwise absolute paths to pwd are used

  • ds_description ('all' or set of {'fname', 'ds', 'num', 'arr', 'store'}) –

    Keys to describe the datasets of the arrays. If all, all keys are used. The key descriptions are

    fname

    the file name is inserted in the 'fname' key

    store

    the data store class and module is inserted in the 'store' key

    ds

    the dataset is inserted in the 'ds' key

    num

    The unique number assigned to the dataset is inserted in the 'num' key

    arr

    The array itself is inserted in the 'arr' key

  • full_ds (bool) – If True and 'ds' is in ds_description, the entire dataset is included. Otherwise, only the DataArray converted to a dataset is included

Notes

You can also store the entire data in the pickled file by setting ds_description={'ds'}

classmethod scp(project)[source]

Set the current project

Parameters:

project (Project or None) – The project to set. If it is None, the current subproject is set to empty. If it is a sub project (see:attr:Project.is_main), the current subproject is set to this project. Otherwise it replaces the current main project

See also

scp

The global version for setting the current project

gcp

Returns the current project

project

Creates a new project

share(base=None, keys=None, by=None, **kwargs)[source]

Share the formatoptions of one plotter with all the others

This method shares specified formatoptions from base with all the plotters in this instance.

Parameters:
  • base (None, Plotter, xarray.DataArray, InteractiveList, or list of them) – The source of the plotter that shares its formatoptions with the others. It can be None (then the first instance in this project is used), a Plotter or any data object with a psy attribute. If by is not None, then it is expected that base is a list of data objects for each figure/axes

  • keys (string or iterable of strings) – The formatoptions to share, or group names of formatoptions to share all formatoptions of that group (see the fmt_groups property). If None, all formatoptions of this plotter are unshared.

  • by ({'fig', 'figure', 'ax', 'axes'}) – Share the formatoptions only with the others on the same 'figure' or the same 'axes'. In this case, base must either be None or a list of the types specified for base

  • draw (bool or None) – Boolean to control whether the figure of this array shall be drawn at the end. If None, it defaults to the ‘auto_draw’` parameter in the psyplot.rcParams dictionary

  • auto_update (bool) – Boolean determining whether or not the start_update() method is called at the end. This parameter has no effect if the no_auto_update attribute is set to True.

See also

psyplot.plotter.share

static show()[source]

Shows all open figures

property simple

List of data arrays that are plotted by psy_simple.plotters.SimplePlotterBase plotters

summaries(*args, **kwargs)[source]

Show the available formatoptions and their summaries in this project

Parameters:
  • keys (list of str or None) – If None, the all formatoptions of the given class are used. Group names from the psyplot.plotter.groups mapping are replaced by the formatoptions

  • indent (int) – The indentation of the table

  • grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the Formatoption.groupname attribute

  • func (function or None) – The function the is used for returning (by default it is printed via the print() function or (when using the gui) in the help explorer). The given function must take a string as argument

  • include_links (bool or None, optional) – Default False. If True, links (in restructured formats) are included in the description. If None, the behaviour is determined by the psyplot.plotter.Plotter.include_links attribute.

Returns:

The enhanced list of the formatoptions

Return type:

list of str

unshare(**kwargs)[source]

Unshare the formatoptions of all the plotters in this instance

This method uses the psyplot.plotter.Plotter.unshare_me() method to release the specified formatoptions in keys.

Parameters:
  • keys (string or iterable of strings) – The formatoptions to unshare, or group names of formatoptions to unshare all formatoptions of that group (see the fmt_groups property). If None, all formatoptions of this plotter are unshared.

  • draw (bool or None) – Boolean to control whether the figure of this array shall be drawn at the end. If None, it defaults to the ‘auto_draw’` parameter in the psyplot.rcParams dictionary

  • auto_update (bool) – Boolean determining whether or not the start_update() method is called at the end. This parameter has no effect if the no_auto_update attribute is set to True.

property vector

List of data arrays that are plotted by psy_simple.plotters.SimpleVectorPlotter plotters

property violinplot

List of data arrays that are plotted by psy_simple.plotters.ViolinPlotter plotters

property with_plotter

The arrays in this instance that are visualized with a plotter

class psyplot.project.ProjectPlotter(project=None)[source]

Bases: object

Plotting methods of the psyplot.project.Project class

Attributes:

barplot(*args, **kwargs)

Make a bar plot of one-dimensional data

combined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field

density(*args, **kwargs)

Make a density plot of point data

fldmean(*args, **kwargs)

Calculate and plot the mean over x- and y-dimensions

lineplot(*args, **kwargs)

Make a line plot of one-dimensional data

mapcombined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field on a map

mapplot(*args, **kwargs)

Plot a 2D scalar field on a map

mapvector(*args, **kwargs)

Plot a 2D vector field on a map

plot2d(*args, **kwargs)

Make a simple plot of a 2D scalar field

project

vector(*args, **kwargs)

Make a simple plot of a 2D vector field

violinplot(*args, **kwargs)

Make a violin plot of your data

Methods:

show_plot_methods()

Print the plotmethods of this instance

barplot(*args, **kwargs)

Make a bar plot of one-dimensional data

This plotting method adds data arrays and plots them via psy_simple.plotters.BarPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.barplot(filename, name=['my_variable'], ...)

Possible formatoptions are

alpha

axiscolor

background

categorical

color

coord

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

widths

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.barplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.barplot.summaries('title')

# show the full documentation
>>> psy.plot.barplot.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.barplot.plot
combined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field

This plotting method adds data arrays and plots them via psy_simple.plotters.CombinedSimplePlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.combined(filename, name=[['my_variable', ['u_var', 'v_var']]], ...)

Possible formatoptions are

arrowsize

arrowstyle

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

linewidth

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

vbounds

vcbar

vcbarspacing

vclabel

vclabelprops

vclabelsize

vclabelweight

vcmap

vcticklabels

vctickprops

vcticks

vcticksize

vctickweight

vplot

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.combined.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.combined.summaries('title')

# show the full documentation
>>> psy.plot.combined.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.combined.plot
density(*args, **kwargs)

Make a density plot of point data

This plotting method adds data arrays and plots them via psy_simple.plotters.DensityPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.density(filename, name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

bins

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

coord

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

normed

plot

post

post_timing

precision

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrange

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrange

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.density.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.density.summaries('title')

# show the full documentation
>>> psy.plot.density.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.density.plot
fldmean(*args, **kwargs)

Calculate and plot the mean over x- and y-dimensions

This plotting method adds data arrays and plots them via psy_simple.plotters.FldmeanPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.fldmean(filename, name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

color

coord

err_calc

error

erroralpha

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

linewidth

marker

markersize

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

mean

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.fldmean.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.fldmean.summaries('title')

# show the full documentation
>>> psy.plot.fldmean.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.fldmean.plot
lineplot(*args, **kwargs)

Make a line plot of one-dimensional data

This plotting method adds data arrays and plots them via psy_simple.plotters.LinePlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.lineplot(filename, name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

color

coord

error

erroralpha

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

linewidth

marker

markersize

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.lineplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.lineplot.summaries('title')

# show the full documentation
>>> psy.plot.lineplot.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.lineplot.plot
mapcombined(*args, **kwargs)

Plot a 2D scalar field with an overlying vector field on a map

This plotting method adds data arrays and plots them via psy_maps.plotters.CombinedPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.mapcombined(filename, name=[['my_variable', ['u_var', 'v_var']]], ...)

Possible formatoptions are

arrowsize

arrowstyle

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

interp_bounds

levels

linewidth

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

vbounds

vcbar

vcbarspacing

vclabel

vclabelprops

vclabelsize

vclabelweight

vcmap

vcticklabels

vctickprops

vcticks

vcticksize

vctickweight

vplot

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.mapcombined.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.mapcombined.summaries('title')

# show the full documentation
>>> psy.plot.mapcombined.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.mapcombined.plot
mapplot(*args, **kwargs)

Plot a 2D scalar field on a map

This plotting method adds data arrays and plots them via psy_maps.plotters.FieldPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.mapplot(filename, name=['my_variable'], ...)

Possible formatoptions are

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

interp_bounds

levels

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.mapplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.mapplot.summaries('title')

# show the full documentation
>>> psy.plot.mapplot.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.mapplot.plot
mapvector(*args, **kwargs)

Plot a 2D vector field on a map

This plotting method adds data arrays and plots them via psy_maps.plotters.VectorPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.mapvector(filename, name=[['u_var', 'v_var']], ...)

Possible formatoptions are

arrowsize

arrowstyle

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

clat

clip

clon

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

google_map_detail

grid_color

grid_labels

grid_labelsize

grid_settings

linewidth

lonlatbox

lsm

map_extent

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

projection

stock_img

text

tight

title

titleprops

titlesize

titleweight

transform

transpose

xgrid

ygrid

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.mapvector.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.mapvector.summaries('title')

# show the full documentation
>>> psy.plot.mapvector.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.mapvector.plot
plot2d(*args, **kwargs)

Make a simple plot of a 2D scalar field

This plotting method adds data arrays and plots them via psy_simple.plotters.Simple2DPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.plot2d(filename, name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

interp_bounds

labelprops

labelsize

labelweight

levels

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

miss_color

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.plot2d.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.plot2d.summaries('title')

# show the full documentation
>>> psy.plot.plot2d.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.plot2d.plot
property project
show_plot_methods()[source]

Print the plotmethods of this instance

vector(*args, **kwargs)

Make a simple plot of a 2D vector field

This plotting method adds data arrays and plots them via psy_simple.plotters.SimpleVectorPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.vector(filename, name=[['u_var', 'v_var']], ...)

Possible formatoptions are

arrowsize

arrowstyle

axiscolor

background

bounds

cbar

cbarspacing

clabel

clabelprops

clabelsize

clabelweight

cmap

color

cticklabels

ctickprops

cticks

cticksize

ctickweight

datagrid

density

extend

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

linewidth

mask

mask_datagrid

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.vector.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.vector.summaries('title')

# show the full documentation
>>> psy.plot.vector.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.vector.plot
violinplot(*args, **kwargs)

Make a violin plot of your data

This plotting method adds data arrays and plots them via psy_simple.plotters.ViolinPlotter plotters

To plot data from a netCDF file type:

>>> psy.plot.violinplot(filename, name=['my_variable'], ...)

Possible formatoptions are

axiscolor

background

color

figtitle

figtitleprops

figtitlesize

figtitleweight

grid

labelprops

labelsize

labelweight

legend

legendlabels

mask

maskbetween

maskgeq

maskgreater

maskleq

maskless

plot

post

post_timing

sym_lims

text

ticksize

tickweight

tight

title

titleprops

titlesize

titleweight

transpose

xlabel

xlim

xrotation

xticklabels

xtickprops

xticks

ylabel

ylim

yrotation

yticklabels

ytickprops

yticks

Examples

To explore the formatoptions and their documentations, use the keys, summaries and docs methods. For example:

>>> import psyplot.project as psy

# show the keys corresponding to a group or multiple
# formatopions
>>> psy.plot.violinplot.keys('labels')

# show the summaries of a group of formatoptions or of a
# formatoption
>>> psy.plot.violinplot.summaries('title')

# show the full documentation
>>> psy.plot.violinplot.docs('plot')

# or access the documentation via the attribute
>>> psy.plot.violinplot.plot
psyplot.project.close(num=None, figs=True, data=True, ds=True, remove_only=False)[source]

Close the project

This method closes the current project (figures, data and datasets) or the project specified by num

Parameters:
  • num (int, None or 'all') – if int, it specifies the number of the project, if None, the current subproject is closed, if 'all', all open projects are closed

  • figs (bool) – Close the figures

  • data (bool) – delete the arrays from the (main) project

  • ds (bool) – If True, close the dataset as well

  • remove_only (bool) – If True and figs is True, the figures are not closed but the plotters are removed

See also

Project.close

psyplot.project.gcp(main=False)[source]

Get the current project

Parameters:

main (bool) – If True, the current main project is returned, otherwise the current subproject is returned.

See also

scp

Sets the current project

project

Creates a new project

psyplot.project.get_project_nums()[source]

Returns the project numbers of the open projects

psyplot.project.multiple_subplots(rows=1, cols=1, maxplots=None, n=1, delete=True, for_maps=False, *args, **kwargs)[source]

Function to create subplots.

This function creates so many subplots on so many figures until the specified number n is reached.

Parameters:
  • rows (int) – The number of subplots per rows

  • cols (int) – The number of subplots per column

  • maxplots (int) – The number of subplots per figure (if None, it will be row*cols)

  • n (int) – number of subplots to create

  • delete (bool) – If True, the additional subplots per figure are deleted

  • for_maps (bool) – If True this is a simple shortcut for setting subplot_kw=dict(projection=cartopy.crs.PlateCarree()) and is useful if you want to use the mapplot, mapvector or mapcombined plotting methods

  • **kwargs (*args and) – anything that is passed to the matplotlib.pyplot.subplots() function

Returns:

list of maplotlib.axes.SubplotBase instances

Return type:

list

psyplot.project.plot = <psyplot.project.ProjectPlotter object>

ProjectPlotter of the current project. See the class documentation for available plotting methods

psyplot.project.project(num=None, *args, **kwargs)[source]

Create a new main project

Parameters:
  • num (int) – The number of the project

  • iterable (iterable) – The iterable (e.g. another list) defining this list

  • attrs (dict-like or iterable, optional) – Global attributes of this list

  • auto_update (bool) – Default: None. A boolean indicating whether this list shall automatically update the contained arrays when calling the update() method or not. See also the no_auto_update attribute. If None, the value from the 'lists.auto_update' key in the psyplot.rcParams dictionary is used.

  • new_name (bool or str) – If False, and the arr_name attribute of the new array is already in the list, a ValueError is raised. If True and the arr_name attribute of the new array is not already in the list, the name is not changed. Otherwise, if the array name is already in use, new_name is set to ‘arr{0}’. If not True, this will be used for renaming (if the array name of arr is in use or not). '{0}' is replaced by a counter

  • main (Project) – The main project this subproject belongs to (or None if this project is the main project)

Returns:

The with the given num (if it does not already exist, it is created)

Return type:

Project

See also

scp

Sets the current project

gcp

Returns the current project

psyplot.project.register_plotter(identifier, module, plotter_name, plotter_cls=None, sorter=True, plot_func=True, import_plotter=None, **kwargs)[source]

Register a psyplot.plotter.Plotter for the projects

This function registers plotters for the Project class to allow a dynamical handling of different plotter classes.

Parameters:
  • identifier (str) – Name of the attribute that is used to filter for the instances belonging to this plotter

  • module (str) – The module from where to import the plotter_name

  • plotter_name (str) – The name of the plotter class in module

  • sorter (bool, optional) – If True, the Project class gets a new property with the name of the specified identifier which allows you to access the instances that are plotted by the specified plotter_name

  • plot_func (bool, optional) – If True, the ProjectPlotter (the class that holds the plotting method for the Project class and can be accessed via the Project.plot attribute) gets an additional method to plot via the specified plotter_name (see Other Parameters below.)

  • import_plotter (bool, optional) – If True, the plotter is automatically imported, otherwise it is only imported when it is needed. If import_plotter is None, then it is determined by the psyplot.rcParams 'project.auto_import' item.

  • prefer_list (bool) – Determines the prefer_list parameter in the from_dataset method. If True, the plotter is expected to work with instances of psyplot.InteractiveList instead of psyplot.InteractiveArray.

  • default_slice (indexer) – Index (e.g. 0 if method is ‘isel’) that shall be used for dimensions not covered by dims and furtherdims. If None, the whole slice will be used. Note that the default_slice is always based on the isel method.

  • default_dims (dict) – Default dimensions that shall be used for plotting (e.g. {‘x’: slice(None), ‘y’: slice(None)} for longitude-latitude plots)

  • show_examples (bool, optional) – If True, examples how to access the plotter documentation are included in class documentation

  • example_call (str, optional) – The arguments and keyword arguments that shall be included in the example of the generated plot method. This call will then appear as >>> psy.plot.%(identifier)s(%(example_call)s) in the documentation

  • plugin (str) – The name of the plugin

psyplot.project.scp(project)[source]

Set the current project

Parameters:

%(Project.scp.parameters)s

See also

gcp

Returns the current project

project

Creates a new project

psyplot.project.unregister_plotter(identifier, sorter=True, plot_func=True)[source]

Unregister a psyplot.plotter.Plotter for the projects

Parameters:
  • identifier (str) – Name of the attribute that is used to filter for the instances belonging to this plotter or to create plots with this plotter

  • sorter (bool) – If True, the identifier will be unregistered from the Project class

  • plot_func (bool) – If True, the identifier will be unregistered from the ProjectPlotter class