function plotVolumes(OPT,volumes) %PLOTVOLUMES Plot the given volume series % % The call was done because OPT.plotname was given. Now the available % series are plotted. If volumes is empty nothing is plotted. The legend % is predefined for a specific volume type. % % Syntax: % plotVolumes(OPT,volumes) % % Input: % OPT = options used to inform what plotting is asked for % volumes = possible series to be plotted % % Output: % varargout = % % Example % plotVolumes % % See also %% Copyright notice % -------------------------------------------------------------------- % Copyright (C) 2010 % Lou Verhage % % % %
% % This library is free software: you can redistribute it and/or % modify it under the terms of the GNU Lesser General Public % License as published by the Free Software Foundation, either % version 2.1 of the License, or (at your option) any later version. % % This library is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % Lesser General Public License for more details. % % You should have received a copy of the GNU Lesser General Public % License along with this library. If not, see . % -------------------------------------------------------------------- % This tool is part of OpenEarthTools. % OpenEarthTools is an online collaboration to share and manage data and % programming tools in an open source, version controlled environment. % Sign up to recieve regular updates of this function, and to contribute % your own tools. %% Version % Created: 08 Sep 2010 % Created with Matlab version: 7.8.0.347 (R2009a) % $Id: $ % $Date: $ % $Author: $ % $Revision: $ % $HeadURL: $ % $Keywords: $ %% initialize if isempty(volumes) return end theTitle = 'Westerschelde: Zandvolumes t.o.v. 1955'; % legend texts theLegend.name = []; theLegend.text = []; theLegend.linespec = []; nrLegends = 7; theLegend.name{1} = 'ingreep'; theLegend.name{2} = 'cum. ingreep'; theLegend.name{3} = 'total'; theLegend.name{4} = 'diep'; theLegend.name{5} = 'ondiep'; theLegend.name{6} = 'plaat'; theLegend.name{7} = 'tussen'; theLegend.text{1} = 'ingreep per jaar'; theLegend.text{2} = 'cumulatie ingrepen'; theLegend.text{3} = 'totaal'; theLegend.text{4} = 'beneden -5m NAP'; theLegend.text{5} = 'beneden -2m NAP'; theLegend.text{6} = 'boven -2m NAP'; theLegend.text{7} = 'tussen -2m en -5m NAP'; theLegend.linespec{1} = 'k'; theLegend.linespec{2} = 'xk'; theLegend.linespec{3} = '-sr'; theLegend.linespec{4} = '-^g'; theLegend.linespec{5} = '-ok'; theLegend.linespec{6} = '-dm'; theLegend.linespec{7} = '-xb'; theLegend.linewidth{1} = 2; theLegend.linewidth{2} = 1; theLegend.linewidth{3} = 1; theLegend.linewidth{4} = 1; theLegend.linewidth{5} = 1; theLegend.linewidth{6} = 1; % plot first = true; dates = datenum(volumes.date,'dd/mm/yyyy'); for n = 1 : nrLegends [ok,nr] = found(theLegend.name(n),volumes.names); if ok y=cell2num(volumes.series(nr).data); if n == 1 maxy = max(y); miny = min(y); else maxy = max(max(y),maxy); miny = min(min(y),miny); end if n > 1 plot(dates,y,theLegend.linespec{n},'LineWidth',theLegend.linewidth{n}); else bar(gca,dates,y,'facecolor',[.75 .75 .75],'edgecolor','k'); end if first hold on grid on first = false; end end end % !! zetten van de y tick labels [labels,yy] = setYLabels(gca,10,maxy,miny); set(gca,'ylim',[yy(1) yy(end)]); set(gca,'ytick',yy); set(gca,'YTickLabel',labels) legend(theLegend.text,'location',OPT.legend); set(gca,'GridLineStyle','-') xlabel(['\bf\fontsize{10}' OPT.x]); ylabel(['\bf\fontsize{10}' OPT.y]); xTicks = cell2num(getDateticks(dates,{'year','interval'},5)); set(gca,'xlim',[xTicks(1) xTicks(length(xTicks))]); set(gca,'XTick',xTicks); title(['\bf\fontsize{18}' theTitle sprintf('\n') OPT.subtitle]); datetick('x',10,'keeplimits','keepticks') plotName = [OPT.plotname{1} '.' OPT.plotname{2}]; if ~isempty(OPT.cd) current = pwd; cd(OPT.cd); end % if strcmpi(OPT.plotname{2},'jpg') % print('-djpeg' ,'-r72' ,plotName); % else % print(['-d' OPT.plotname{2}] ,'-r72' ,plotName); % end if ~iscell(OPT.plotname) plotName = [OPT.plotname '.png']; print('-dpng' ,'-r72' ,plotName); else if length(OPT.plotname) == 2 plotName = [OPT.plotname{1} '.' OPT.plotname{2}]; print(['-d' OPT.plotname{2}] ,'-r72' ,plotName); else plotName = [OPT.plotname{1} '.png']; print('-dpng' ,'-r72' ,plotName); end end if ~isempty(OPT.cd) cd(current); end close;