Mercurial > hg > ltpda
view m-toolbox/classes/@plotter/plotter.m @ 41:6def6533cb16 database-connection-manager
Report authentication errors to user
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 18:04:34 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% PLOTTER base class for different plotter objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: PLOTTER base class for different plotter objects. % % This class defines the basic properties of a plot or series of plots. % Namely, the data and the properties of the figure(s), axes, lines, and % legends. % % The defaults for the various properties (except the data) are taken from % the LTPDA preferences. % % CONSTRUCTOR: % % p = plotter(objects) % p = plotter(objects, pl) % % <a href="matlab:utils.helper.displayMethodInfo('plotter', 'plotter')">Parameters Description</a> % % VERSION: $Id: plotter.m,v 1.3 2011/04/08 08:56:26 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% classdef plotter < ltpda_obj properties % Cell array of data objects to plot data; % output outputdir; filename; % figure % axis properties axisFontSize; axisFontWeight; axisFontName; axisLineWidth; labelFontSize; % Grid gridLineStyle; minorGridLineStyle; showXGrid; showXMinorGrid; showYGrid; showYMinorGrid; % line properties lineStyle; lineWidth; marker; markerSize; plotinfoOverride; % Legend legendFontSize; includeLegend; legendLocation; includeDescription; plotcolors; end methods % Constructor function p = plotter(varargin) % Collect all ltpda_uoh objects objs = {}; for kk=1:nargin if isa(varargin{kk}, 'ltpda_uoh') objs = [objs varargin(kk)]; end end p.data = objs; % Process the input plist pl = utils.helper.collect_objects(varargin(:), 'plist'); pl = combine(pl, plotter.getDefaultPlist('Default')); % Set properties from the plist plotter.setPropertiesFromPlist(p, pl); end % End of constructor end methods (Static=true, Access=private) % Set the object properties from the plist function setPropertiesFromPlist(p, pl) p.outputdir = pl.find('output directory'); p.filename = pl.find('filename'); p.axisFontSize = pl.find('axis FontSize'); p.axisFontWeight = pl.find('axis FontWeight'); p.axisFontName = pl.find('axis fontname'); p.axisLineWidth = pl.find('axis LineWidth'); p.gridLineStyle = pl.find('grid LineStyle'); p.minorGridLineStyle = pl.find('minor Grid LineStyle'); p.legendFontSize = pl.find('legend FontSize'); p.lineWidth = pl.find('lineWidth'); p.lineStyle = pl.find('linestyle'); p.markerSize = pl.find('marker Size'); p.marker = pl.find('marker'); p.includeDescription = pl.find('include Description'); p.includeLegend = pl.find('include Legend'); p.plotinfoOverride = pl.find('plotinfo override'); p.showXGrid = pl.find('Show X Grid'); p.showXMinorGrid = pl.find('Show X Minor Grid'); p.showYGrid = pl.find('Show Y Grid'); p.showYMinorGrid = pl.find('Show Y Minor Grid'); p.plotcolors = pl.find('plot colors'); p.labelFontSize = pl.find('label fontsize'); p.legendLocation = pl.find('legend location'); end end methods (Static=true) function out = VEROUT() out = '$Id: plotter.m,v 1.3 2011/04/08 08:56:26 hewitson Exp $'; end function ii = getInfo(varargin) ii = utils.helper.generic_getInfo(varargin{:}, 'plotter'); end function out = SETS() out = {'Default'}; end function out = getDefaultPlist(set) if ~utils.helper.ismember(lower(smodel.SETS), lower(set)) error('### Unknown set [%s]', set); end out = plist(); % output directory p = param({'output directory','A directory for use when plotting to files.'}, paramValue.EMPTY_STRING); out.append(p); % output filename p = param({'filename','A filename for use when plotting to files.'}, paramValue.EMPTY_STRING); out.append(p); % axis font size p = param({'axis FontSize','The font size for axis numbers.'}, LTPDAprefs.axesFontSize); out.append(p); % label font size p = param({'label FontSize','The font size for axis labels.'}, LTPDAprefs.axesFontSize); out.append(p); % axis font name p = param({'axis fontname','The font name for axis labels.'}, 'default'); out.append(p); % axis font weight default = LTPDAprefs.axesFontWeight; defaultIndex = find(strcmpi(default, plotter.fontweights)); if isempty(defaultIndex) defaultIndex = 1; end p = param({'axis FontWeight','The font weight for axis labels.'}, {defaultIndex, plotter.fontweights, paramValue.SINGLE}); out.append(p); % axis line width p = param({'axis LineWidth','The line width for the axes.'}, LTPDAprefs.axesLineWidth); out.append(p); % grid style default = LTPDAprefs.gridStyle; defaultIndex = find(strcmpi(default, plotter.linestyles)); p = param({'grid LineStyle','The major grid line style.'}, {defaultIndex, plotter.linestyles, paramValue.SINGLE}); out.append(p); % minor grid style default = LTPDAprefs.minorGridStyle; defaultIndex = find(strcmpi(default, plotter.linestyles)); p = param({'minor Grid LineStyle','The minor grid line style.'}, {defaultIndex, plotter.linestyles, paramValue.SINGLE}); out.append(p); % legend font size p = param({'legend FontSize','The font size for legends.'}, LTPDAprefs.legendFontSize); out.append(p); % line width p = param({'lineWidth','The width of data lines.'}, LTPDAprefs.lineLineWidth); out.append(p); % line style p = param({'linestyle','The style of data lines.'}, {1, plotter.linestyles, paramValue.SINGLE}); out.append(p); % Include description p = param({'include Description','Include object description in the legend.'}, paramValue.TRUE_FALSE); out.append(p); % Include legend p = param({'include Legend','Include legend on the plot.'}, paramValue.TRUE_FALSE); out.append(p); % Legend locations default = 'NorthWest'; defaultIndex = find(strcmpi(default, plotter.legendLocations)); p = param({'legend location','Include legend on the plot.'}, {defaultIndex, plotter.legendLocations, paramValue.SINGLE}); out.append(p); % Allow plotinfo override p = param({'plotinfo override','Allow plotinfo to override settings.'}, paramValue.TRUE_FALSE); out.append(p); % marker size p = param({'marker Size','The size of markers.'}, LTPDAprefs.lineMarkerSize); out.append(p); % marker p = param({'marker','The default marker for traces.'}, {1, plotter.markers, paramValue.SINGLE}); out.append(p); % Show X grid p = param({'Show X Grid','Show the X major grid lines.'}, paramValue.TRUE_FALSE); out.append(p); % Show Y minor grid p = param({'Show X Minor Grid','Show the X minor grid lines.'}, paramValue.TRUE_FALSE); out.append(p); % Show grid p = param({'Show Y Grid','Show the Y major grid lines.'}, paramValue.TRUE_FALSE); out.append(p); % Show minor grid p = param({'Show Y Minor Grid','Show the Y minor grid lines.'}, paramValue.TRUE_FALSE); out.append(p); % Plot colors p = param({'plot colors', 'A cell-array of plot colors to cycle through for multi-trace plots'}, getappdata(0, 'ltpda_default_plot_colors')); out.append(p); end % function out = getDefaultPlist(varargin) function obj = initObjectWithSize(n,m) obj = smodel.newarray([n m]); for ii = 1:numel(obj) obj(ii).UUID = char(java.util.UUID.randomUUID); end end function out = linestyles() out = {'-', '--', ':', '-.'}; end function out = fontweights out = {'normal', 'bold', 'light', 'demi'}; end function out = markers out = {'none', '+', 'o', '*', '.', 'x', 's', 'd', '^', 'v', '>', '<', 'p', 'h'}; end function out = legendLocations out = {'North', 'South', 'East', 'West', 'NorthEast', 'NorthWest', 'SouthEast', ... 'SouthWest', 'NorthOutside', 'SouthOutside', 'EastOutside', 'WestOutside', ... 'NorthEastOutside', 'NorthWestOutside', 'SouthEastOutside', 'SouthWestOutside', ... 'Best', 'BestOutside'}; end end end