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:
|
Interface between the |
|
Interface for the |
|
Interface between the |
|
Interface for the |
The project class that is used for creating new projects |
|
|
Base class for visualizing a data array from an predefined plotter |
|
A manager of multiple interactive data projects |
|
Plotting methods of the |
Functions:
|
Close the project |
|
Get the current project |
Returns the project numbers of the open projects |
|
|
Function to create subplots. |
|
Create a new main project |
|
Register a |
|
Set the current project |
|
Unregister a |
Data:
|
- class psyplot.project.DataArrayPlotter(da, *args, **kwargs)[source]
Bases:
ProjectPlotterInterface between the
xarray.Datasetand the psyplot projectThis 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.BarPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.barplot()
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexrotationxtickpropsyrotationytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.CombinedSimplePlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.combined()
Possible formatoptions are
arrowsizearrowstyleaxiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcolorcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridinterp_boundslabelpropslabelsizelabelweightlevelslinewidthmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposevboundsvcbarvcbarspacingvclabelvclabelpropsvclabelsizevclabelweightvcmapvcticklabelsvctickpropsvcticksvcticksizevctickweightxlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.DensityPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.density()
Possible formatoptions are
axiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridinterp_boundslabelpropslabelsizelabelweightlevelsmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorplotpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.FldmeanPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.fldmean()
Possible formatoptions are
axiscolorbackgroundcolorerrorerroralphafigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelslinewidthmarkermarkersizeplotpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.LinePlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.lineplot()
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.CombinedPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.mapcombined()
Possible formatoptions are
arrowsizearrowstylebackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcolorcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingsinterp_boundslevelslinewidthlonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposevboundsvcbarvcbarspacingvclabelvclabelpropsvclabelsizevclabelweightvcmapvcticklabelsvctickpropsvcticksvcticksizevctickweightExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.FieldPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.mapplot()
Possible formatoptions are
backgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingslonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposexgridygridExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.VectorPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.mapvector()
Possible formatoptions are
arrowsizearrowstylebackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingslinewidthlonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposexgridygridExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.Simple2DPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.plot2d()
Possible formatoptions are
axiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweightxlabelxrotationxticklabelsxtickpropsylabelyrotationyticklabelsytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.SimpleVectorPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.vector()
Possible formatoptions are
arrowsizearrowstyleaxiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcolorcticklabelsctickpropsctickscticksizectickweightdatagriddensityextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlinewidthmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxrotationxticklabelsxtickpropsylabelyrotationyticklabelsytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.ViolinPlotterplottersTo plot a variable in this dataset, type:
>>> da.psy.plot.violinplot()
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxrotationxtickpropsylabelyrotationytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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:
PlotterInterfaceInterface for the
DataArrayPlotterto a plotterMethods:
check_data(*args, **kwargs)Check whether the plotter of this plot method can visualize the data
- class psyplot.project.DatasetPlotter(ds, *args, **kwargs)[source]
Bases:
ProjectPlotterInterface between the
xarray.Datasetand the psyplot projectThis 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.BarPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.barplot(name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexrotationxtickpropsyrotationytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.CombinedSimplePlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.combined(name=[['my_variable', ['u_var', 'v_var']]], ...)
Possible formatoptions are
arrowsizearrowstyleaxiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcolorcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridinterp_boundslabelpropslabelsizelabelweightlevelslinewidthmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposevboundsvcbarvcbarspacingvclabelvclabelpropsvclabelsizevclabelweightvcmapvcticklabelsvctickpropsvcticksvcticksizevctickweightxlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.DensityPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.density(name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridinterp_boundslabelpropslabelsizelabelweightlevelsmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorplotpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.FldmeanPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.fldmean(name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorerrorerroralphafigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelslinewidthmarkermarkersizeplotpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.LinePlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.lineplot(name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.CombinedPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.mapcombined(name=[['my_variable', ['u_var', 'v_var']]], ...)
Possible formatoptions are
arrowsizearrowstylebackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcolorcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingsinterp_boundslevelslinewidthlonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposevboundsvcbarvcbarspacingvclabelvclabelpropsvclabelsizevclabelweightvcmapvcticklabelsvctickpropsvcticksvcticksizevctickweightExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.FieldPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.mapplot(name=['my_variable'], ...)
Possible formatoptions are
backgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingslonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposexgridygridExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.VectorPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.mapvector(name=[['u_var', 'v_var']], ...)
Possible formatoptions are
arrowsizearrowstylebackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingslinewidthlonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposexgridygridExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.Simple2DPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.plot2d(name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweightxlabelxrotationxticklabelsxtickpropsylabelyrotationyticklabelsytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.SimpleVectorPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.vector(name=[['u_var', 'v_var']], ...)
Possible formatoptions are
arrowsizearrowstyleaxiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcolorcticklabelsctickpropsctickscticksizectickweightdatagriddensityextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlinewidthmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxrotationxticklabelsxtickpropsylabelyrotationyticklabelsytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.ViolinPlotterplottersTo plot a variable in this dataset, type:
>>> ds.psy.plot.violinplot(name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxrotationxtickpropsylabelyrotationytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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:
PlotterInterfaceInterface for the
DatasetPlotterto 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_namesNames of the arrays (!not of the variables!) in this list
axesA mapping from axes to data objects with the plotter in this axes
barplotList of data arrays that are plotted by
psy_simple.plotters.BarPlotterplottersblock_signals([value])Wrapper around a boolean defining an __enter__ and __exit__ method
combinedList of data arrays that are plotted by
psy_simple.plotters.CombinedSimplePlotterplottersdatasetsA mapping from dataset numbers to datasets in this list
densityList of data arrays that are plotted by
psy_simple.plotters.DensityPlotterplottersdsnamesThe set of dataset names in this instance
dsnames_mapA dictionary from the dataset numbers in this list to their filenames
figsA mapping from figures to data objects with the plotter in this figure
fldmeanList of data arrays that are plotted by
psy_simple.plotters.FldmeanPlotterplottersis_cmpBoolean that is True if the project is the current main project
is_cspBoolean that is True if the project is the current subproject
is_mainbool.lineplotList of data arrays that are plotted by
psy_simple.plotters.LinePlotterplottersloggerlogging.Loggerof this instancemainmapcombinedList of data arrays that are plotted by
psy_maps.plotters.CombinedPlotterplottersmapplotList of data arrays that are plotted by
psy_maps.plotters.FieldPlotterplottersmapsList of data arrays that are plotted by
psy_maps.plotters.MapPlotterplottersmapvectorList of data arrays that are plotted by
psy_maps.plotters.VectorPlotterplottersoncpchangesignal to be emiitted when the current main and/or subproject changes
plotPlotting instance of this
Project.plot2dList of data arrays that are plotted by
psy_simple.plotters.Simple2DPlotterplottersplottersA list of all the plotters in this instance
simpleList of data arrays that are plotted by
psy_simple.plotters.SimplePlotterBaseplottersvectorList of data arrays that are plotted by
psy_simple.plotters.SimpleVectorPlotterplottersviolinplotList of data arrays that are plotted by
psy_simple.plotters.ViolinPlotterplotterswith_plotterThe arrays in this instance that are visualized with a plotter
- class psyplot.project.PlotterInterface(methodname, module, plotter_name, project_plotter=None)[source]
Bases:
objectBase 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:
True if the module for this plot method has been imported already
The plotter class
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 theplotter_clsattribute 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 thepsyplot.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.groupsmapping are replaced by the formatoptionsindent (int) – The indentation of the table
grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the
Formatoption.groupnameattributefunc (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 argumentinclude_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_linksattribute.
- Returns:
The enhanced list of the formatoptions
- Return type:
- 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.groupsmapping are replaced by the formatoptionsindent (int) – The indentation of the table
grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the
Formatoption.groupnameattributefunc (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 argumentinclude_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_linksattribute.
- Returns:
The enhanced list of the formatoptions
- Return type:
- 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.groupsmapping are replaced by the formatoptionsindent (int) – The indentation of the table
grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the
Formatoption.groupnameattributefunc (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 argumentinclude_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_linksattribute.
- Returns:
The enhanced list of the formatoptions
- Return type:
- class psyplot.project.Project(*args, **kwargs)[source]
Bases:
ArrayListA 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 theno_auto_updateattribute. If None, the value from the'lists.auto_update'key in thepsyplot.rcParamsdictionary is used.new_name (bool or str) – If False, and the
arr_nameattribute of the new array is already in the list, a ValueError is raised. If True and thearr_nameattribute 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 countermain (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:
Names of the arrays (!not of the variables!) in this list
A mapping from axes to data objects with the plotter in this axes
List of data arrays that are plotted by
psy_simple.plotters.BarPlotterplottersblock_signals([value])Wrapper around a boolean defining an __enter__ and __exit__ method
List of data arrays that are plotted by
psy_simple.plotters.CombinedSimplePlotterplottersA mapping from dataset numbers to datasets in this list
List of data arrays that are plotted by
psy_simple.plotters.DensityPlotterplottersThe set of dataset names in this instance
A dictionary from the dataset numbers in this list to their filenames
A mapping from figures to data objects with the plotter in this figure
List of data arrays that are plotted by
psy_simple.plotters.FldmeanPlotterplottersBoolean that is True if the project is the current main project
Boolean that is True if the project is the current subproject
bool.List of data arrays that are plotted by
psy_simple.plotters.LinePlotterplotterslogging.Loggerof this instanceList of data arrays that are plotted by
psy_maps.plotters.CombinedPlotterplottersList of data arrays that are plotted by
psy_maps.plotters.FieldPlotterplottersList of data arrays that are plotted by
psy_maps.plotters.MapPlotterplottersList of data arrays that are plotted by
psy_maps.plotters.VectorPlotterplotterssignal to be emiitted when the current main and/or subproject changes
Plotting instance of this
Project.List of data arrays that are plotted by
psy_simple.plotters.Simple2DPlotterplottersA list of all the plotters in this instance
List of data arrays that are plotted by
psy_simple.plotters.SimplePlotterBaseplottersList of data arrays that are plotted by
psy_simple.plotters.SimpleVectorPlotterplottersList of data arrays that are plotted by
psy_simple.plotters.ViolinPlotterplottersThe 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_nameattribute of the new array is already in the list, a ValueError is raised. If True and thearr_nameattribute 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.BarPlotterplotters
- 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
- property combined
List of data arrays that are plotted by
psy_simple.plotters.CombinedSimplePlotterplotters
- 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.DensityPlotterplotters
- 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.groupsmapping are replaced by the formatoptionsindent (int) – The indentation of the table
grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the
Formatoption.groupnameattributefunc (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 argumentinclude_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_linksattribute.
- Returns:
The enhanced list of the formatoptions
- Return type:
- 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
- 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.PdfPagesto 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 asclose_pdf=Falseuse_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:
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
InteractiveBaseinstancesnew_name (bool or str) – If False, and the
arr_nameattribute of the new array is already in the list, a ValueError is raised. If True and thearr_nameattribute 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.FldmeanPlotterplotters
- 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 thexarray.DataArray.attrsattribute is used.plot_data (bool) – It True, use the
psyplot.plotter.Plotter.plot_dataattribute of the plotters rather than the raw data in this projectkeep_all (bool) – If True, all formatoptions are kept. Otherwise only the intersection
- Returns:
The formatted string s
- Return type:
- 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 thexarray.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 theno_auto_updateattribute. If None, the value from the'lists.auto_update'key in thepsyplot.rcParamsdictionary is used.prefer_list (bool) – If True and multiple variable names pher array are found, the
InteractiveListclass is used. Otherwise the arrays are put together into oneInteractiveArray.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.
Arguments for the decoder. This can be one of
an instance of
CFDecodera subclass of
CFDecodera 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. Ifdict, those will be given to the above mentionedloadmethodmain (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
**furtherdimsdictionary: Then nothing happens and an
dictversion 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
dictfor 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:
- 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
- joined_attrs(delimiter=', ', enhanced=True, plot_data=False, keep_all=True)[source]
Join the attributes of the arrays in this project
- Parameters:
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 thexarray.DataArray.attrsattribute is used.plot_data (bool) – It True, use the
psyplot.plotter.Plotter.plot_dataattribute of the plotters rather than the raw data in this projectkeep_all (bool) – If True, all formatoptions are kept. Otherwise only the intersection
- 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:
- 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.groupsmapping are replaced by the formatoptionsindent (int) – The indentation of the table
grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the
Formatoption.groupnameattributefunc (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 argumentinclude_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_linksattribute.
- Returns:
The enhanced list of the formatoptions
- Return type:
- property lineplot
List of data arrays that are plotted by
psy_simple.plotters.LinePlotterplotters
- 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 -lpfrom 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 methodauto_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 theno_auto_updateattribute. If None, the value from the'lists.auto_update'key in thepsyplot.rcParamsdictionary 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 thepsyplot.plotter.Plotter.reinit()method by yourselfdraw (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.rcParamsdictionaryalternative_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
postformatoption is enabled and post processing scripts are allowed. Do only set this parameter toTrueif you know you can trust the information in fnamenew_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.Datasetto use. If it is an iterable, the same holds as for the alternative_paths parameterignore_keys (list of str) – Keys specified in this list are ignored and not seen as array information (note that
attrsare 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
Trueif the array shall be included, elseFalse. This function will also be given to subsequents instances ofInteractiveListobjects 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.Datasetto use. If it is an iterable, the same holds as for the alternative_paths parameterpwd – 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
attrsare 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
Trueif the array shall be included, elseFalse. This function will also be given to subsequents instances ofInteractiveListobjects 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:
- property logger
logging.Loggerof this instance
- property mapcombined
List of data arrays that are plotted by
psy_maps.plotters.CombinedPlotterplotters
- property mapplot
List of data arrays that are plotted by
psy_maps.plotters.FieldPlotterplotters
- property maps
List of data arrays that are plotted by
psy_maps.plotters.MapPlotterplotters
- property mapvector
List of data arrays that are plotted by
psy_maps.plotters.VectorPlotterplotters
- 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 theno_auto_updateattribute. If None, the value from the'lists.auto_update'key in thepsyplot.rcParamsdictionary is used.new_name (bool or str) – If False, and the
arr_nameattribute of the new array is already in the list, a ValueError is raised. If True and thearr_nameattribute 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 countermain (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:
- oncpchange
signal to be emiitted when the current main and/or subproject changes
- property plot
Plotting instance of this
Project. See theProjectPlotterclass for method documentations
- property plot2d
List of data arrays that are plotted by
psy_simple.plotters.Simple2DPlotterplotters
- 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 thepicklemodulepwd (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 warningattrs (bool, optional) – If True (default), the
ArrayList.attrsandxarray.DataArray.attrsattributes are included in the returning dictionarystandardize_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
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
Plotteror 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/axeskeys (string or iterable of strings) – The formatoptions to share, or group names of formatoptions to share all formatoptions of that group (see the
fmt_groupsproperty). 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 beNoneor a list of the types specified for basedraw (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.rcParamsdictionaryauto_update (bool) – Boolean determining whether or not the
start_update()method is called at the end. This parameter has no effect if theno_auto_updateattribute is set toTrue.
See also
psyplot.plotter.share
- property simple
List of data arrays that are plotted by
psy_simple.plotters.SimplePlotterBaseplotters
- 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.groupsmapping are replaced by the formatoptionsindent (int) – The indentation of the table
grouped (bool, optional) – If True, the formatoptions are grouped corresponding to the
Formatoption.groupnameattributefunc (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 argumentinclude_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_linksattribute.
- Returns:
The enhanced list of the formatoptions
- Return type:
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_groupsproperty). 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.rcParamsdictionaryauto_update (bool) – Boolean determining whether or not the
start_update()method is called at the end. This parameter has no effect if theno_auto_updateattribute is set toTrue.
- property vector
List of data arrays that are plotted by
psy_simple.plotters.SimpleVectorPlotterplotters
- property violinplot
List of data arrays that are plotted by
psy_simple.plotters.ViolinPlotterplotters
- property with_plotter
The arrays in this instance that are visualized with a plotter
- class psyplot.project.ProjectPlotter(project=None)[source]
Bases:
objectPlotting methods of the
psyplot.project.ProjectclassAttributes:
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
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.BarPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.barplot(filename, name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexrotationxtickpropsyrotationytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.CombinedSimplePlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.combined(filename, name=[['my_variable', ['u_var', 'v_var']]], ...)
Possible formatoptions are
arrowsizearrowstyleaxiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcolorcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridinterp_boundslabelpropslabelsizelabelweightlevelslinewidthmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposevboundsvcbarvcbarspacingvclabelvclabelpropsvclabelsizevclabelweightvcmapvcticklabelsvctickpropsvcticksvcticksizevctickweightxlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.DensityPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.density(filename, name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridinterp_boundslabelpropslabelsizelabelweightlevelsmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorplotpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.FldmeanPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.fldmean(filename, name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorerrorerroralphafigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelslinewidthmarkermarkersizeplotpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.LinePlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.lineplot(filename, name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxlimxrotationxticklabelsxtickpropsxticksylabelylimyrotationyticklabelsytickpropsyticksExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.CombinedPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.mapcombined(filename, name=[['my_variable', ['u_var', 'v_var']]], ...)
Possible formatoptions are
arrowsizearrowstylebackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcolorcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingsinterp_boundslevelslinewidthlonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposevboundsvcbarvcbarspacingvclabelvclabelpropsvclabelsizevclabelweightvcmapvcticklabelsvctickpropsvcticksvcticksizevctickweightExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.FieldPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.mapplot(filename, name=['my_variable'], ...)
Possible formatoptions are
backgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingslonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposexgridygridExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.VectorPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.mapvector(filename, name=[['u_var', 'v_var']], ...)
Possible formatoptions are
arrowsizearrowstylebackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightclatclipcloncmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgoogle_map_detailgrid_colorgrid_labelsgrid_labelsizegrid_settingslinewidthlonlatboxlsmmap_extentmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingprojectionstock_imgtexttighttitletitlepropstitlesizetitleweighttransformtransposexgridygridExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.Simple2DPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.plot2d(filename, name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcticklabelsctickpropsctickscticksizectickweightdatagridextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklessmiss_colorpostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweightxlabelxrotationxticklabelsxtickpropsylabelyrotationyticklabelsytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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
- 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.SimpleVectorPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.vector(filename, name=[['u_var', 'v_var']], ...)
Possible formatoptions are
arrowsizearrowstyleaxiscolorbackgroundboundscbarcbarspacingclabelclabelpropsclabelsizeclabelweightcmapcolorcticklabelsctickpropsctickscticksizectickweightdatagriddensityextendfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlinewidthmaskmask_datagridmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxrotationxticklabelsxtickpropsylabelyrotationyticklabelsytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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.ViolinPlotterplottersTo plot data from a netCDF file type:
>>> psy.plot.violinplot(filename, name=['my_variable'], ...)
Possible formatoptions are
axiscolorbackgroundcolorfigtitlefigtitlepropsfigtitlesizefigtitleweightgridlabelpropslabelsizelabelweightlegendlegendlabelsmaskmaskbetweenmaskgeqmaskgreatermaskleqmasklesspostpost_timingsym_limstextticksizetickweighttighttitletitlepropstitlesizetitleweighttransposexlabelxrotationxtickpropsylabelyrotationytickpropsExamples
To explore the formatoptions and their documentations, use the
keys,summariesanddocsmethods. 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 closedfigs (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
- 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.
- 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 themapplot,mapvectorormapcombinedplotting methods**kwargs (*args and) – anything that is passed to the
matplotlib.pyplot.subplots()function
- Returns:
list of maplotlib.axes.SubplotBase instances
- Return type:
- psyplot.project.plot = <psyplot.project.ProjectPlotter object>
ProjectPlotterof 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 theno_auto_updateattribute. If None, the value from the'lists.auto_update'key in thepsyplot.rcParamsdictionary is used.new_name (bool or str) – If False, and the
arr_nameattribute of the new array is already in the list, a ValueError is raised. If True and thearr_nameattribute 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 countermain (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:
- 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.Plotterfor the projectsThis function registers plotters for the
Projectclass 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
Projectclass 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_nameplot_func (bool, optional) – If True, the
ProjectPlotter(the class that holds the plotting method for theProjectclass and can be accessed via theProject.plotattribute) 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.InteractiveListinstead ofpsyplot.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 documentationplugin (str) – The name of the plugin
- psyplot.project.scp(project)[source]
Set the current project
- Parameters:
%(Project.scp.parameters)s
- psyplot.project.unregister_plotter(identifier, sorter=True, plot_func=True)[source]
Unregister a
psyplot.plotter.Plotterfor 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
Projectclassplot_func (bool) – If True, the identifier will be unregistered from the
ProjectPlotterclass