function plotIngrepen(OPT,ingrepen) %PLOTIngrepen Plot the given ingreep series % % The call was done because OPT.plotname was given. Now the available % series are plotted. If ingrepen is empty nothing is plotted. The legend % is predefined. % % Syntax: % plotIngrepen(OPT,ingrepen) % % Input: % OPT = options used to inform what plotting is asked for % ingrepen = possible series to be plotted % % Output: % varargout = % % Example % plotIngrepen % % 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: 14 Oct 2010 % Created with Matlab version: 7.8.0.347 (R2009a) % $Id: $ % $Date: $ % $Author: $ % $Revision: $ % $HeadURL: $ % $Keywords: $ %% initialize if isempty(ingrepen) return end theTitle = 'Westerschelde: Ingrepen t.o.v. 1955'; % legend texts theLegend.name = []; theLegend.text = []; theLegend.linespec = []; nrLegends = 6; theLegend.name{1} = 'baggeren'; theLegend.name{2} = 'storten'; theLegend.name{3} = 'zandwinning'; theLegend.name{4} = 'wrak'; theLegend.name{5} = 'totaal'; theLegend.name{6} = 'cumulatief'; theLegend.text{1} = 'baggeren'; theLegend.text{2} = 'storten'; theLegend.text{3} = 'zandwinning'; theLegend.text{4} = 'wrak'; theLegend.text{5} = 'totale ingreep'; theLegend.text{6} = 'cumulatieve ingreep'; theLegend.linespec{1} = 'xg'; theLegend.linespec{2} = 'or'; theLegend.linespec{3} = '^m'; theLegend.linespec{4} = '+b'; theLegend.linespec{5} = '-dk'; theLegend.linespec{6} = '-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(ingrepen.date,'dd/mm/yyyy'); maxy = 0.0; miny = 0.0; for n = 1 : nrLegends [ok,nr] = found(theLegend.name(n),ingrepen.names); if ok % y=cell2num(ingrepen.series(nr).data); y=ingrepen.series(nr).data; if n == 1 maxy = max(y); miny = min(y); else maxy = max(max(y),maxy); miny = min(min(y),miny); end plot(dates,y,theLegend.linespec{n},'LineWidth',theLegend.linewidth{n}); 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') if ~isempty(OPT.cd) current = pwd; cd(OPT.cd); 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;