![]() |
KerMor
0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
|
PlotManager: Small class that allows the same plots generated by some script to be either organized as subplots or single figures. More...
PlotManager: Small class that allows the same plots generated by some script to be either organized as subplots or single figures.
The key feature of this is that you can call your plotting methods with differently configured PlotManagers, so one time you have it plotting to subplots (=development time) and the next you create single plots with specific export settings (=publication/report time).
This class needs a working export_fig
tool that is available at http://www.mathworks.com/matlabcentral/fileexchange/23629
Any openend figure using nextPlot can be exported to a directory using a specified format (any allowed by export_fig).
%
%
%
createZoom
to easily copy a Figure (only in 'Single'-mode) and zoom into a specified area.separate_legends
, that specifies for which selected figure to save the legend should be created as extra file (made for too large legends)axes tight
if no manual changes have been made to the axis limitsnextPlot
/done
.Copyright (c) 2012, Daniel Wirtz All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted only in compliance with the BSD license, see http://www.opensource.org/licenses/bsd-license.php
Definition at line 17 of file PlotManager.m.
Public Member Functions | |
PlotManager (logical single,integer rows,integer cols) | |
Creates a new PlotManager. More... | |
function axes ax_handle = | nextPlot (char tag,char caption,char xlab,char ylab,cell< char > leg_str,integer numsubplots) |
Creates a new axis to plot in. Depending on the property tools.PlotMananger.Single this will either advance to the next subplot or open up a new figure window of size FigureSize in the center of the main screen. More... | |
function h = | copyFigure (nr, newtag) |
Copies the plot with the given number and returns the handle to its axis. More... | |
function h = | createZoom (nr, area, tagextra, withlegend) |
function | done () |
Finishes the current plotting process. More... | |
function | savePlots (char folder, varargin) |
Saves all plots that have been created thus far to a given folder with given format. More... | |
function | closeAll (selection) |
Closes all currently openend plots and resets the Handles property. More... | |
function | resetCount () |
Resets the current axes handle count so that subsequent calls to "nextPlot" will result re-returning the current subplot's axes. More... | |
function | delete () |
function | setFigureNames (name) |
function | matchPlotAxes (ax_handles, varargin) |
Static Public Member Functions | |
static function pm = | demo_SinglePlots () |
Create a new PlotManager. More... | |
static function pm = | demo_Subplots () |
static function pm = | demo_SavePlots () |
static function pm = | demo_SavePlots_Details () |
You can also override some settings or specify what should be saved. More... | |
static function pm = | demo_Zoom () |
Public Attributes | |
logical | Single = true |
Flag if single plots shall be used for subsequent calls to nextPlot. More... | |
integer | MaxFigures = Inf |
Controls the maximum number of simultaneously opened figures. More... | |
rowvec< double > | FigureSize = "[]" |
The figure size for each newly created figure. Set to [] to use system default. More... | |
char | FilePrefix = "" |
A prefix that has to be put before each file name for exported plots. More... | |
integer | ExportDPI = get("0,'ScreenPixelsPerInch'") |
DPI used for export. See export_fig settings. More... | |
char | JPEGQuality = "95" |
JPEG quality used for export. See export_fig settings. More... | |
logical | UseFileTypeFolders = true |
Affects the savePlots behaviour. This flag lets the PlotManager create subfolders in the target folder according to the specified file extensions and places any images of that type inside it. More... | |
logical | NoTitlesOnSave = false |
Flag that determines if any figures title's are removed when using savePlots. More... | |
SaveFont = struct("'FontWeight','bold','FontSize',16") | |
logical | LeaveOpen = false |
Flag indicating if the plots should be left open once the PlotManager is deleted (as variable) More... | |
cell< char > | SaveFormats = {"'jpg'"} |
The image formats to use when savePlots is called. More... | |
rowvec< integer > | AutoTickMarks = true |
An integer number to enforce a minimum number of tickmarks on the respective axes. More... | |
logical | DoubleSaveJPG = true |
For some reason on unix machines export_fig sometimes uses the last image saved to as the next one. More... | |
logical | WhiteBackground = true |
Flag that determines if a white 'figure' background should be used instead of any set or default (grey) one. More... | |
rowvec< double > | Figures |
Provides access to all figure handles created using nextPlot. More... | |
![]() | |
addlistener | |
Creates a listener for the specified event and assigns a callback function to execute when the event occurs. More... | |
notify | |
Broadcast a notice that a specific event is occurring on a specified handle object or array of handle objects. More... | |
delete | |
Handle object destructor method that is called when the object's lifecycle ends. More... | |
disp | |
Handle object disp method which is called by the display method. See the MATLAB disp function. More... | |
display | |
Handle object display method called when MATLAB software interprets an expression returning a handle object that is not terminated by a semicolon. See the MATLAB display function. More... | |
findobj | |
Finds objects matching the specified conditions from the input array of handle objects. More... | |
findprop | |
Returns a meta.property objects associated with the specified property name. More... | |
fields | |
Returns a cell array of string containing the names of public properties. More... | |
fieldnames | |
Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames function. More... | |
isvalid | |
Returns a logical array in which elements are true if the corresponding elements in the input array are valid handles. This method is Sealed so you cannot override it in a handle subclass. More... | |
eq | |
Relational functions example. See details for more information. More... | |
transpose | |
Transposes the elements of the handle object array. More... | |
permute | |
Rearranges the dimensions of the handle object array. See the MATLAB permute function. More... | |
reshape | |
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape function. More... | |
sort | |
ort the handle objects in any array in ascending or descending order. More... | |
Creates a new PlotManager.
single | If to create single figures for each call to nextPlot. Default: true |
rows | If on non-single mode, the number of rows to pass to subplot. Default: 2 |
cols | If on non-single mode, the number of columns to pass to subplot. Default: 2 |
Definition at line 335 of file PlotManager.m.
function PlotManager.closeAll | ( | selection | ) |
Closes all currently openend plots and resets the Handles property.
Definition at line 680 of file PlotManager.m.
References Figures.
Referenced by delete(), and savePlots().
function h = PlotManager.copyFigure | ( | nr, | |
newtag | |||
) |
Copies the plot with the given number and returns the handle to its axis.
Definition at line 448 of file PlotManager.m.
References Figures, handle.findobj, and isposintscalar().
Referenced by createZoom().
function h = PlotManager.createZoom | ( | nr, | |
area, | |||
tagextra, | |||
withlegend | |||
) |
Definition at line 479 of file PlotManager.m.
References copyFigure(), Figures, handle.findobj, isposintscalar(), and handle.reshape.
function PlotManager.delete | ( | ) |
Definition at line 717 of file PlotManager.m.
References closeAll().
|
static |
Definition at line 1093 of file PlotManager.m.
|
static |
You can also override some settings or specify what should be saved.
Definition at line 1106 of file PlotManager.m.
|
static |
|
static |
Definition at line 1078 of file PlotManager.m.
|
static |
Definition at line 1129 of file PlotManager.m.
function PlotManager.done | ( | ) |
Finishes the current plotting process.
Important to call afterwards as the last plot might not get finished off (currently, only "axis tight" is invoked automatically)
Definition at line 515 of file PlotManager.m.
function PlotManager.matchPlotAxes | ( | ax_handles, | |
varargin | |||
) |
Definition at line 734 of file PlotManager.m.
References k.
function axes ax_handle = PlotManager.nextPlot | ( | char | tag, |
char | caption, | ||
char | xlab, | ||
char | ylab, | ||
cell< char > | leg_str, | ||
integer | numsubplots | ||
) |
Creates a new axis to plot in. Depending on the property tools.PlotMananger.Single this will either advance to the next subplot or open up a new figure window of size FigureSize in the center of the main screen.
If you specify a tag it will be used upon exporting created plots to the file system as filename of the plot.
tag | The tag to use for the axes. Default: ' |
caption | The caption for the axes. Default: [] |
xlab | The xlabel for the axes. Default: [] |
ylab | The ylabel for the axes. Default: [] |
leg_str | The legend entry strings for the axes. Default: {} |
numsubplots | The number of subplots to use up for this next plot. Works only if the number of subplots is contained in the current subplot row (i.e. there are sufficient columns left over to use up the required number of subplots.) Default: 1 |
ax_handle | The handle to the new axes object. |
Definition at line 365 of file PlotManager.m.
References Figures, FigureSize, and Single.
Referenced by demos.Basics5_KernelsAndApprox(), and demos.SVR.EpsLoss().
function PlotManager.resetCount | ( | ) |
Resets the current axes handle count so that subsequent calls to "nextPlot" will result re-returning the current subplot's axes.
Definition at line 706 of file PlotManager.m.
function PlotManager.savePlots | ( | char | folder, |
varargin | |||
) |
Saves all plots that have been created thus far to a given folder with given format.
folder | The folder to save the current plots to. Default: pwd |
varargin | Different options for saving. [, "Selection", Selection_value ] [, "SeparateLegends", SeparateLegends_value ]
[, "XArgs", XArgs_value ] )
|
Definition at line 529 of file PlotManager.m.
References all(), closeAll(), Figures, FilePrefix, handle.findobj, SaveFormats, and UseFileTypeFolders.
function PlotManager.setFigureNames | ( | name | ) |
Definition at line 724 of file PlotManager.m.
References Figures.
PlotManager.AutoTickMarks = true |
An integer number to enforce a minimum number of tickmarks on the respective axes.
Set this property to a three element vector containing the numbers of how many tick marks are desired for the X,Y and Z axis.
When a plot is finished (i.e. nextPlot or done is called), it is checked if enough tickmarks are present. If not, the given number of tickmarks is inserted, according to the current -Lim and -Scale property. Set to zero to let MatLab control how many tickmarks are used for the respective axis.
Default: [0 0 0] MinTickMarks = [0 0 0];
Definition at line 236 of file PlotManager.m.
Referenced by models.wh10.WH10Experiment.Experiment1().
PlotManager.DoubleSaveJPG = true |
For some reason on unix machines export_fig sometimes uses the last image saved to as the next one.
As a workaround, images to be stored as jpg are saved twice in a row to avoid that.
Default: true
Definition at line 255 of file PlotManager.m.
PlotManager.ExportDPI = get("0,'ScreenPixelsPerInch'") |
DPI used for export. See export_fig settings.
Defaults to the current pixels per inch resolution of the screen.
Default: get(0,ScreenPixelsPerInch
)
Definition at line 157 of file PlotManager.m.
PlotManager.Figures |
Provides access to all figure handles created using nextPlot.
Transient
set to true. SetAccess = Private, GetAccess = Public
Definition at line 288 of file PlotManager.m.
Referenced by closeAll(), copyFigure(), createZoom(), nextPlot(), PlotManager(), savePlots(), and setFigureNames().
PlotManager.FigureSize = "[]" |
The figure size for each newly created figure. Set to [] to use system default.
Is a two dimensional row vector with width and height
Default: []
Definition at line 133 of file PlotManager.m.
Referenced by models.motoneuron.experiments.FrequencyLearning(), and nextPlot().
PlotManager.FilePrefix = "" |
A prefix that has to be put before each file name for exported plots.
Default: '
Definition at line 146 of file PlotManager.m.
Referenced by models.mathmod2012.MathMODMain(), and savePlots().
PlotManager.JPEGQuality = "95" |
JPEG quality used for export. See export_fig settings.
Default: 95
Definition at line 169 of file PlotManager.m.
PlotManager.LeaveOpen = false |
Flag indicating if the plots should be left open once the PlotManager is deleted (as variable)
Default: false
Definition at line 213 of file PlotManager.m.
Referenced by testing.DEIM.getDEIMErrorsAtXForParams_plots(), models.motorunit.experiments.MaxForce(), DEIMEstimatorAnalyzer>btnApproxLogNorm_Callback(), DEIMEstimatorAnalyzer>btnVisResult_Callback(), DEIMEstimatorAnalyzer>getDEIMErrorsOnTraj(), DEIMEstimatorAnalyzer>pushbutton5_Callback(), models.motoneuron.experiments.ParamDomainDetection(), models.muscle.MusclePlotter.plot(), models.pcd.PCDSystem2D.plot(), models.pcdi.PCDISystem2D.plot(), models.burgers.Burgers.plot(), fem.geometry.BaseGeometry.plot(), models.golf.Model.plot(), models.muscle.Model.plotActivation(), models.pcd.BaseCoreFun.plotActivationFun(), models.pcdi.BaseCoreFun.plotActivationFun(), models.muscle.Model.plotAnisotropicPressure(), models.pcdi.PCDISystem2D.plotDiffusionCoeff(), models.BaseModel.plotInputs(), models.BaseFirstOrderSystem.plotInputs(), models.motorunit.Shorten.plotMotoSacroLinkFactorCurve(), spacereduction.PODGreedy.plotSummary(), models.muscle.examples.MuscleTendonMix.plotTMRFun(), demos.SVR.ScalarEpsSVR_SMO(), demos.BellFunctions.SecantGradientPlots(), dscomponents.ACoreFun.test_Jacobian(), and general.interpolation.KernelInterpol.test_KernelInterpolationError().
PlotManager.MaxFigures = Inf |
Controls the maximum number of simultaneously opened figures.
Set to a finite number to make the PlotManager re-use currently openend figures. Has NO effect if Single is set to true.
Default: Inf
Definition at line 120 of file PlotManager.m.
PlotManager.NoTitlesOnSave = false |
Flag that determines if any figures title's are removed when using savePlots.
Default: false
Definition at line 199 of file PlotManager.m.
Referenced by models.burgers.Tests.createMoRePaSIIPlots().
PlotManager.SaveFont = struct("'FontWeight','bold','FontSize',16") |
Definition at line 210 of file PlotManager.m.
PlotManager.SaveFormats = {"'jpg'"} |
The image formats to use when savePlots is called.
Default: {jpg
}
Definition at line 224 of file PlotManager.m.
Referenced by savePlots().
PlotManager.Single = true |
Flag if single plots shall be used for subsequent calls to nextPlot.
Default: true
Definition at line 109 of file PlotManager.m.
Referenced by nextPlot(), and PlotManager().
PlotManager.UseFileTypeFolders = true |
Affects the savePlots behaviour. This flag lets the PlotManager create subfolders in the target folder according to the specified file extensions and places any images of that type inside it.
This is especially useful for use with LaTeX, as during production simple and fast jpeg-versions of plots can be used and later a single path change includes pdf or eps files.
This setting is only used if more than one file type have been specified.
Default: true
Definition at line 179 of file PlotManager.m.
Referenced by savePlots().
PlotManager.WhiteBackground = true |
Flag that determines if a white 'figure' background should be used instead of any set or default (grey) one.
Default: true
Definition at line 268 of file PlotManager.m.