From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- .../numericplots/MatlabFunctions/LatexFilter.m | 79 + .../numericplots/MatlabFunctions/LatexFilterHull.m | 104 + .../MatlabFunctions/LatexFilterMinMax.m | 104 + .../numericplots/MatlabFunctions/dspace2latex.m | 90 + .../numericplots/MatlabFunctions/dspace2struct.m | 147 + .../numericplots/MatlabFunctions/export2latex.m | 386 + .../numericplots/MatlabFunctions/export2pst.m | 332 + .../numericplots/MatlabFunctions/genlatexnames.m | 38 + .../contrib/numericplots/MatlabFunctions/roman.m | 58 + .../numericplots/MatlabFunctions/struct2latex.m | 187 + .../numericplots/MatlabFunctions/struct2pst.m | 127 + graphics/pstricks/contrib/numericplots/README | 30 + .../pstricks/contrib/numericplots/doc/License.txt | 674 ++ .../contrib/numericplots/doc/NumericPlots.pdf | Bin 0 -> 370930 bytes .../numericplots/doc/src/BasicFunctionality.tex | 621 ++ .../numericplots/doc/src/FurtherExamples.tex | 306 + .../contrib/numericplots/doc/src/MatlabSupport.tex | 137 + .../contrib/numericplots/doc/src/MultiplePlots.tex | 45 + .../numericplots/doc/src/NumericPlotsDoc.tex | 210 + .../numericplots/doc/src/Roll406_Ref2288.tex | 1759 ++++ .../numericplots/doc/src/TechnicalDetails.tex | 254 + .../contrib/numericplots/doc/src/TestPlots.tex | 122 + .../numericplots/doc/src/examples/BodeDiagramm.tex | 44 + .../doc/src/examples/DataTestRealData.tex | 174 + .../numericplots/doc/src/examples/DefineData.tex | 47 + .../doc/src/examples/LabelsNTickLabels.tex | 49 + .../numericplots/doc/src/examples/NyquistPlot.tex | 76 + .../doc/src/examples/Sprungantwort_PT1Glied.tex | 39 + .../numericplots/doc/src/examples/basic_Boxes.tex | 22 + .../doc/src/examples/basic_EasyPlot.tex | 9 + .../numericplots/doc/src/examples/basic_Grid.tex | 13 + .../numericplots/doc/src/examples/basic_Labels.tex | 17 + .../numericplots/doc/src/examples/basic_Legend.tex | 3 + .../doc/src/examples/basic_LegendI.tex | 4 + .../doc/src/examples/basic_LegendII.tex | 8 + .../doc/src/examples/basic_LegendIII.tex | 7 + .../doc/src/examples/basic_LineStyles.tex | 27 + .../numericplots/doc/src/examples/basic_Lines.tex | 18 + .../doc/src/examples/basic_LogarithmicI.tex | 8 + .../doc/src/examples/basic_LogarithmicII.tex | 8 + .../doc/src/examples/basic_LogarithmicIII.tex | 8 + .../doc/src/examples/basic_MultipleData.tex | 20 + .../doc/src/examples/basic_Objects.tex | 29 + .../doc/src/examples/basic_PlaceObjects.tex | 31 + .../doc/src/examples/basic_PlaceObjectsII.tex | 25 + .../doc/src/examples/basic_PlotWHoles.tex | 8 + .../doc/src/examples/basic_UseRput.tex | 29 + .../doc/src/examples/basic_UserLinestyles.tex | 27 + .../src/examples/data_BodeDiagrammLinearerTerm.tex | 1028 +++ .../numericplots/doc/src/examples/data_Nyquist.tex | 302 + .../src/examples/data_SprungantwortPT1Glied.tex | 69 + .../doc/src/examples/furtherEx_TickLabels.tex | 18 + .../doc/src/examples/multiplots_exampleI.tex | 76 + .../doc/src/examples/multiplots_exampleII.tex | 24 + .../doc/src/examples/multiplots_exampleIII.tex | 24 + .../doc/src/fig_NoiseData_ClosedLine.eps | 8412 +++++++++++++++++++ .../doc/src/fig_NoiseData_OpenLine.eps | 8413 ++++++++++++++++++++ .../contrib/numericplots/doc/src/history.tex | 171 + .../numericplots/doc/src/keys_NumericDataPlot.tex | 73 + .../contrib/numericplots/doc/src/options.tex | 44 + .../numericplots/tex/latex/NumericPlots.sty | 957 +++ .../tex/latex/NumericPlots_TickLabels.tex | 144 + .../numericplots/tex/latex/NumericPlots_labels.tex | 156 + .../numericplots/tex/latex/NumericPlots_legend.tex | 112 + .../numericplots/tex/latex/NumericPlots_macros.tex | 155 + .../numericplots/tex/latex/NumericPlots_styles.tex | 70 + 66 files changed, 26808 insertions(+) create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilter.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilterHull.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilterMinMax.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/dspace2latex.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/dspace2struct.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/export2latex.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/export2pst.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/genlatexnames.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/roman.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2latex.m create mode 100644 graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2pst.m create mode 100644 graphics/pstricks/contrib/numericplots/README create mode 100644 graphics/pstricks/contrib/numericplots/doc/License.txt create mode 100644 graphics/pstricks/contrib/numericplots/doc/NumericPlots.pdf create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/BasicFunctionality.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/FurtherExamples.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/MatlabSupport.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/MultiplePlots.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/NumericPlotsDoc.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/Roll406_Ref2288.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/TechnicalDetails.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/TestPlots.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/BodeDiagramm.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/DataTestRealData.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/DefineData.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/LabelsNTickLabels.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/NyquistPlot.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/Sprungantwort_PT1Glied.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_Boxes.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_EasyPlot.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_Grid.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_Labels.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_Legend.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_LegendI.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_LegendII.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_LegendIII.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_LineStyles.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_Lines.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_LogarithmicI.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_LogarithmicII.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_LogarithmicIII.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_MultipleData.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_Objects.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_PlaceObjects.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_PlaceObjectsII.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_PlotWHoles.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_UseRput.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/basic_UserLinestyles.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/data_BodeDiagrammLinearerTerm.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/data_Nyquist.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/data_SprungantwortPT1Glied.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/furtherEx_TickLabels.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/multiplots_exampleI.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/multiplots_exampleII.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/examples/multiplots_exampleIII.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/fig_NoiseData_ClosedLine.eps create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/fig_NoiseData_OpenLine.eps create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/history.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/keys_NumericDataPlot.tex create mode 100644 graphics/pstricks/contrib/numericplots/doc/src/options.tex create mode 100644 graphics/pstricks/contrib/numericplots/tex/latex/NumericPlots.sty create mode 100644 graphics/pstricks/contrib/numericplots/tex/latex/NumericPlots_TickLabels.tex create mode 100644 graphics/pstricks/contrib/numericplots/tex/latex/NumericPlots_labels.tex create mode 100644 graphics/pstricks/contrib/numericplots/tex/latex/NumericPlots_legend.tex create mode 100644 graphics/pstricks/contrib/numericplots/tex/latex/NumericPlots_macros.tex create mode 100644 graphics/pstricks/contrib/numericplots/tex/latex/NumericPlots_styles.tex (limited to 'graphics/pstricks/contrib/numericplots') diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilter.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilter.m new file mode 100644 index 0000000000..ea0c0899eb --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilter.m @@ -0,0 +1,79 @@ +%------------------------------------------------ +% 2011/01/02 version 1.0 +% +% [xxx, yyy] = LatexFilter(x, y, tol) +% +% This function may be used before exporting data to latex for intelligent +% filtering. +% If you want to plot data with NumericPlots one problem might be that you +% have to plot way to many points and get an TexCapacityExceeded-Error. One +% way to address this is this filter. Given x- and y-data and a tolerance +% tol, unnecessary data may be removed without changing the look of your +% plot. +% Example: +% x=[1 2 3 4 5 6 7 8 9 10]; +% y=[0.01 -0.01 0.02 0.04 -0.03 100.03 100.01 99.97 99.98 100.01]; +% [a b] = LatexFilter(x,y, 0.5) +% returns +% a = 1 5 6 10 +% b = 0.0100 -0.0300 100.0300 100.0100 +% thus preserving the step from 0 to 100 at x=5 but removing the 'noise'. +%------------------------------------------------ +% output: +% xxx, yyy: filtered data +% input: +% x, y: data to be filtered +% tol: tolerance + +% author: Thomas Koenig +% date: 2011/01/02 +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + +function [xxx, yyy] = LatexFilter(x, y, tol) + +% fprintf('LatexFilter: Input - %i ...', length(x)); + +xx = zeros(size(x)); +yy = zeros(size(y)); +xx(:,1) = x(:,1); +yy(:,1) = y(:,1); +k = 1; +LastI = 1; +for i=2:length(x)-1 + if max(abs(y(:,i) - yy(:,k)))>tol + if LastI. + +function [xx, yy] = LatexFilterHull(x, y, NumberOfPoints) + +% fprintf('LatexFilter: Input - %i ...', size(x,2)); + + if (NumberOfPoints - round(NumberOfPoints))~=0 + error('NumberOfPoints must be an integer.'); + end + if NumberOfPoints<3 + error('NumberOfPoints<3 does not make much sense.'); + end + if NumberOfPoints>size(x, 2)/2 + % This would mean, that the filtered data would have more points than + % the input data. This filter is not meant to do that. + error('NumberOfPoints>length(x)'); + end + + IntLength = floor(size(x, 2)/NumberOfPoints); + % The last NrLongInt intervals are enlarged by one to get all points in + % x. + NrLongInt = size(x,2)-(IntLength*NumberOfPoints); + IntLengthLong = IntLength+1; + + xx = nan(size(x, 1), NumberOfPoints*2+2); + yy = nan(size(y, 1), NumberOfPoints*2+2); + + xxx = nan(size(x, 1), NumberOfPoints*2); + yyy = nan(size(y, 1), NumberOfPoints*2); + + % Search maximum and minimum in each interval of length IntLength + a = 1; + b = 2; % always minimum first! -> easier to reorder + for k=0:NumberOfPoints-NrLongInt-1 + [mi, mi_idx] = min(y(:,(k*IntLength+1):(k+1)*IntLength), [], 2); + [ma, ma_idx] = max(y(:,(k*IntLength+1):(k+1)*IntLength), [], 2); + xxx(:, 2*k+a) = x(:, k*IntLength+mi_idx); + xxx(:, 2*k+b) = x(:, k*IntLength+ma_idx); + yyy(:, 2*k+a) = mi; + yyy(:, 2*k+b) = ma; + end + sIdx = (NumberOfPoints-NrLongInt)*IntLength; + for k=0:NrLongInt-1 + [mi, mi_idx] = min(y(:,(sIdx+k*IntLengthLong+1):(sIdx+(k+1)*IntLengthLong)), [], 2); + [ma, ma_idx] = max(y(:,(sIdx+k*IntLengthLong+1):(sIdx+(k+1)*IntLengthLong)), [], 2); + xxx(:, 2*(k+NumberOfPoints-NrLongInt)+a) = x(:, sIdx+k*IntLengthLong+mi_idx); + xxx(:, 2*(k+NumberOfPoints-NrLongInt)+b) = x(:, sIdx+k*IntLengthLong+ma_idx); + yyy(:, 2*(k+NumberOfPoints-NrLongInt)+a) = mi; + yyy(:, 2*(k+NumberOfPoints-NrLongInt)+b) = ma; + end + + % always use first and last value + xx(:, 1) = x(:, 1); + yy(:, 1) = y(:, 1); + xx(:, NumberOfPoints+2) = x(:, end); + yy(:, NumberOfPoints+2) = y(:, end); + % re-order points for use as a hull in latex + for k=0:NumberOfPoints-1 + % minima + xx(:, k+1+1) = xxx(:, 2*k+1); + yy(:, k+1+1) = yyy(:, 2*k+1); + % maxima + xx(:, 2*NumberOfPoints-k+2) = xxx(:, 2*k+2); + yy(:, 2*NumberOfPoints-k+2) = yyy(:, 2*k+2); + end + +% fprintf(' Output - %i .\n', length(xx)); +% +% figure; +% plot(x, y, 'r'); +% hold on; +% plot(xx, yy); + +end \ No newline at end of file diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilterMinMax.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilterMinMax.m new file mode 100644 index 0000000000..33418fbc95 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/LatexFilterMinMax.m @@ -0,0 +1,104 @@ +%------------------------------------------------ +% 2011/01/02 version 1.0 +% +% [xxx, yyy] = LatexFilterHullCurve(x, y, NumberOfPoints) +% +%------------------------------------------------ +% output: +% xxx, yyy: filtered data +% input: +% x, y: data to be filtered +% tol: tolerance + +% author: Thomas Koenig +% date: 2011/01/02 +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + +function [xxx, yyy] = LatexFilterMinMax(x, y, NumberOfPoints) + +% fprintf('LatexFilter: Input - %i ...', size(x,2)); + + if (NumberOfPoints - round(NumberOfPoints))~=0 + error('NumberOfPoints must be an integer.'); + end + if NumberOfPoints<3 + error('NumberOfPoints<3 does not make much sense.'); + end + if NumberOfPoints>size(x, 2)/2 + % This would mean, that the filtered data would have more points than + % the input data. This filter is not meant to do that. + error('NumberOfPoints>length(x)'); + end + + IntLength = floor(size(x, 2)/NumberOfPoints); + % The last NrLongInt intervals are enlarged by one to get all points in + % x. + NrLongInt = size(x,2)-(IntLength*NumberOfPoints); + IntLengthLong = IntLength+1; + + xxx = nan(size(x, 1), NumberOfPoints*2+2); + yyy = nan(size(y, 1), NumberOfPoints*2+2); + + % always use first and last value + xxx(:,1) = x(:,1); + yyy(:,1) = y(:,1); + xxx(:,end) = x(:,end); + yyy(:,end) = y(:,end); + % Search maximum and minimum in each interval of length IntLength + for k=0:NumberOfPoints-NrLongInt-1 + [mi, mi_idx] = min(y(:,(k*IntLength+1):(k+1)*IntLength), [], 2); + [ma, ma_idx] = max(y(:,(k*IntLength+1):(k+1)*IntLength), [], 2); + if mi_idx. + + + +% choose dSpace File +if(nargin<1) + data = dspace2struct; +else + data = dspace2struct(dspacename); +end + + +% define begin, end and downsampling +options.Resize='on'; +options.WindowStyle='normal'; +options.Interpreter='tex'; +prompt={'t0','t1','downsampling'}; +title=['define datapoints. sampling time = ' num2str(data.time(2)-data.time(1)) ' s']; +numlines=1; +defaultanswer={num2str(data.time(1)),num2str(data.time(end)),'1'}; + +answer=inputdlg(prompt,title,numlines,defaultanswer,options); +starttime = str2double(answer{1}); +endtime = str2double(answer{2}); +downsample = str2double(answer{3}); + +% define downsampling +istart = find(data.time<=starttime); +istart = istart(end); +iend = find(data.time<=endtime); +iend = iend(end); + +idx = istart:downsample:iend; + +% choose data which should be exportet +fnames = fieldnames(data); +idxtimename = strmatch('time',fnames,'exact'); +idxdatanames = setdiff(1:length(fnames),idxtimename); + +[iplots,selected] = listdlg('PromptString','choose data for export:','ListString',fnames(idxdatanames)); +if (selected==0) + error('no data chosen'); +end + +dat.time = data.time; +for ii = iplots + dat = setfield(dat,fnames{ii},getfield(data,fnames{ii})); +end + +% export data +if(nargin<2) + num = struct2latex(dat,'time',downsample); +else + num = struct2latex(dat,'time',downsample,texname); +end + \ No newline at end of file diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/dspace2struct.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/dspace2struct.m new file mode 100644 index 0000000000..f1195fc933 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/dspace2struct.m @@ -0,0 +1,147 @@ +function dat = dspace2struct(filename,version,alternative_struct_name) +% ------------------------------------------------ +% dat = dspace2struct(dspacename,version) +% Function to export dSPACE-mat-file to Matlab struct. +% The fieldnames of the struct are the same as the dSPACE-signalnames. +% ------------------------------------------------ +% Output: +% dat ... matlab struct +% +% Input: +% filename ... (optional) .mat-File generated by dSPACE (string) ( +% version ... (optional) version = 'NG' if using dSpace Next Genertion +% alternative_struct_name ...(optional) needed if structname is different +% from filename. Often caused by renaming .mat +% files after saving. +% +% author: Alexander Michel +% date: 2010/08/09 +% +% changes: - 2011/06/29 Alexander Michel: - customized for dSpace Next +% Generation data structure +% - 2011/07/29 Alexander Michel: - GUI added when no file is +% provided +% - Path can be provided +% - 2012/05/02 Alexander Michel: - Bug fixing for dSpace NG naming +% of calculations +% - Multiple XData for dSpace NG +% added +% - 2013/06/17 Alexander Michel: - Array out for dSpace NG support +% added +% - 2013/07/11 Alexander Michel: - alternative structname support +% +% Copyright 2012 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + +if(nargin<1 || strcmp(filename,'')) + [fname datapath] = uigetfile('*.mat','choose .mat-file generated by dSPACE'); + filename = fullfile(datapath, fname); + if isequal(fname,0) || isequal(datapath,0) + disp('User pressed cancel') + return; + else + disp(['User selected ', filename]) + end +end + +if(isempty(strfind(filename,'\'))) + idx1name = 1; +else + idxes = strfind(filename,'\'); + idx1name = idxes(end)+1; +end + +if(nargin>2) + dspacename = alternative_struct_name; +else + if(isempty(strfind(filename,'.mat'))) + dspacename = filename(idx1name:end); + else + dspacename = filename(idx1name:end-4); + end +end + + +if(nargin<2) + version = 'OG'; +end + +load(filename); + +dspace = eval(genvarname(dspacename)); +if(strcmp(version,'NG')) + for ii = 1:length(dspace.X) + dat.time{ii} = dspace.X(ii).Data; + end +else + dat.time = dspace.X.Data; +end +validx = []; +for ii = 1:length(dspace.Y) + if(strcmp(version,'NG')) + if(isempty(dspace.Y(ii).Path)) + newfieldname = dspace.Y(ii).Name; + else + stridx = strfind(dspace.Y(ii).Path,'/'); + newfieldname = dspace.Y(ii).Path(stridx(end)+1:end); + end + else + stridx = strfind(dspace.Y(ii).Name,'"'); + lastname = dspace.Y(ii).Name(stridx(end-1)+1:stridx(end)-1); + stridxM1 = strfind(lastname,'['); + if(~isempty(stridxM1)) + stridxM2 = strfind(lastname,']'); + if(~isempty(stridxM2)) + validx = sscanf(lastname(stridxM1:stridxM2),'[%i,%i]'); + possiblefieldname = lastname(1:stridxM1-1); + end + else + possiblefieldname = lastname; + end + if(isempty(strfind(possiblefieldname,'In1')) && isempty(strfind(possiblefieldname,'Out1'))) + newfieldname = possiblefieldname; + else + newfieldname = dspace.Y(ii).Name(stridx(end-3)+1:stridx(end-2)-1); + end + end + if(isvarname(newfieldname) == 0) + newfieldname = newfieldname(isstrprop(newfieldname,'alphanum')); + if(isvarname(newfieldname) == 0) + newfieldname = newfieldname(2:end); + end + end + if(strcmp(version,'NG')) + if(isfield(dat,newfieldname)) + dat.(newfieldname).Data = [dat.(newfieldname).Data; dspace.Y(ii).Data]; + else + dat.(newfieldname).Data = dspace.Y(ii).Data; + end + dat.(newfieldname).timeidx = dspace.Y(ii).XIndex; + else + if(isempty(validx)) + dat.(newfieldname) = dspace.Y(ii).Data; + else + dat.(newfieldname){validx(2)} = dspace.Y(ii).Data; + validx = []; + end + end +end +if(~strcmp(version,'NG')); + dat.dSPACESettings.Capture = dspace.Capture; + dat.dSPACESettings.Description = dspace.Description; + dat.dSPACESettings.RTProgram = dspace.RTProgram; +end diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/export2latex.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/export2latex.m new file mode 100644 index 0000000000..a0da1e8dd8 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/export2latex.m @@ -0,0 +1,386 @@ +% export2latex(EPLdata, filename, options) +% +% This function may be used to export numeric data in a latex file for later +% use with, e.g., NumericPlots.sty. +% If the data is provided as an 1xK array, each entry of the array will be exported +% to the file . Each entry of the array must be a structure which contains +% x, y and ident. x and y must be arrays of the same size MxN. If M>1, each column +% of the array is exported to the file and may later be used by \Data, where +% is the roman representation of the column number. If M=1, the data may later +% be used with the latex command \Data +% +% EPLdata(1, i).x = x-matrix +% EPLdata(1, i).y = y-matrix +% EPLdata(1, i).ident = identifier (has to be a string without numbers -> +% latex command name) +% EPLdata(1, i).descr = description (optional) +% EPLdata(1, i).group = GroupNr (optional) use numbers from 1 to n to define groups. For +% each group, the maximum and minimum values will be written to the output file and may be +% accessed with identifier Group where RomanNumber is the roman represenation +% of the group number. All data without group or with group number 0 is put into the group +% Dummy +% EPLdata(1, i).precision (optional) = number of decimal places to be written +% filename = filename (with path, without extension) +% options (optional) define which output is required +% - options.DataBoundaries [true]: if true, the min/max values of the data +% will be written to the output file. +% - options.AxisBoundaries [false]: if true, values which may be set as +% min/max values for the axis are written to the output file. These are +% the min/max values -/+ a gap. +% - options.AxisBoundariesGap [10]: defines the gap used for the axis +% min/max values in percent of the total range of the data. +% - options.SuppressWarning [false]: suppresses the warning about max/min values being to +% close together +% - options.precision [empty]: how many decimal places should be printed for x and y +% values. Will be calculated automatically if left empty. +% - options.NaNsplit [false]: if true, the data will be split at NaN +% values. See \multilistplot for how to plot them. +% +% function roman.m required to convert a number to its roman representation. +% + +% author: Thomas König +% date: 2010/04/01 +% ed. by Pfeffer Andreas July 2010 ->Axis nearly tight -> xMaxAxis,xMinAxis,... added +% 2010/08/03 Thomas König: Options added +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + + +function ret = export2latex(EPLdata, filename, options) + if size(EPLdata, 1)>1 + error('EPLdata must be of size [1, n]'); + end + + % define standard options + if ((nargin<3) || ~isfield(options, 'DataBoundaries')) + % DataBoundaries should be in the output file (xMin, xMax, yMin, + % yMax) + options.DataBoundaries = true; + end + if ~isfield(options, 'AxisBoundaries') + % axis boundaries (xMinAxis, xMaxAxis, yMinAxis, yMaxAxis) + options.AxisBoundaries = false; + end + if ~isfield(options, 'AxisBoundariesGap') + % gap for the axis boundaries in percent of full scale + options.AxisBoundariesGap = 10; + end + if ~isfield(options, 'SuppressWarning') + options.SuppressWarning = false; + end + if ~isfield(options, 'NaNsplit') + options.NaNsplit = false; + end + + % open file if possible + [pathstr, ~, ext] = fileparts(filename); + if ~isempty(pathstr) && ~exist(pathstr, 'dir') + mkdir(pathstr); + end + if strcmp(ext, '.tex') + fname = fullfile(filename); + else + fname = fullfile([filename, '.tex']); + end + [fid, msg] = fopen(fname, 'wt'); + if fid<0 + display(msg); + error('Matlab:FileError', 'Could not open the file %s.', fname); + end + + % write file header + fprintf(fid, '%% EPLdata written by export2latex\n'); + fprintf(fid, '%% date: %s\n\n', date); + fprintf(fid, '\\def\\ExpDate{%s}\n', date); + fclose(fid); + + % process data + for i=1:size(EPLdata,2) + % Ident=''; + My = size(EPLdata(i).y, 1); + Mx = size(EPLdata(i).x, 1); + if ( Mx>1 && Mx~=My ) + error('Matlab:export2latex', 'EPLdata.x and EPLdata.y must have the same size or EPLdata.x must have one column only'); + end + if (any(any(isnan(EPLdata(i).x))) || any(any(isnan(EPLdata(i).y)))) && ~options.NaNsplit + error('Matlab:export2latex', 'EPLdata.x or EPLdata.y contain NaN which Latex cannot process. Consider setting options.NaNsplit = true.'); + end + if ( Mx==1 ) + idx_x = ones(1, My); + else + idx_x = 1:Mx; + end + + % data header + if(isfield(EPLdata(1,i), 'descr')) + fid = fopen(fname, 'at'); + fprintf(fid, '\\expandafter\\def\\csname Descr%s\\endcsname{%s}\n', EPLdata(1,i).ident, EPLdata(1,i).descr); + fclose(fid); + end + if ~isfield(EPLdata(1,i), 'group') + EPLdata(1,i).group = 0; + end + if isempty(EPLdata(1,i).group) + EPLdata(1,i).group = 0; + end + + % xMax, xMin, Dx + fid = fopen(fname, 'at'); + xMax = max(max(EPLdata(1,i).x)); + xMin = min(min(EPLdata(1,i).x)); + + % axis boundaries + xMinAxis = xMin-(xMax-xMin)*options.AxisBoundariesGap/100; % -10% axis nearly tight + xMaxAxis = xMax+(xMax-xMin)*options.AxisBoundariesGap/100; % +10% axis nearly tight + + + if (abs(xMax-xMin)<1e-16) + xMax = 1.0; + xMin = -1.0; + if ~options.SuppressWarning + fprintf('export2latex - Warning: |xMax-xMin|<1e-16\n'); + end + end + DxV = (xMax-xMin)/5; + NrUnsigX = 0; + while (fix(DxV*10^(NrUnsigX)) == 0) + NrUnsigX = NrUnsigX+1; + end + + % yMin, yMax, Dy + yMax = max(max(EPLdata(1,i).y)); + yMin = min(min(EPLdata(1,i).y)); + + % axis boundaries + yMinAxis = yMin-(yMax-yMin)*options.AxisBoundariesGap/100; % -10% axis nearly tight + yMaxAxis = yMax+(yMax-yMin)*options.AxisBoundariesGap/100; % +10% axis nearly tight + + % save min/max values for groupes + group(i) = EPLdata(1,i).group+1; + groupXmax(i) = xMax; + groupXmin(i) = xMin; + groupYmax(i) = yMax; + groupYmin(i) = yMin; + + if (abs(yMax-yMin)<1e-16) + yMax = 1.0; + yMin = -1.0; + if ~options.SuppressWarning + fprintf('export2latex - Warning: |yMax-yMin|<1e-16\n'); + end + end + DyV = (yMax-yMin)/5; + + DxVAxis = (xMaxAxis-xMinAxis)/5; + DyVAxis = (yMaxAxis-yMinAxis)/5; + NrUnsigYAxis = 0; + while (fix(DyVAxis*10^(NrUnsigYAxis)) == 0) + NrUnsigYAxis = NrUnsigYAxis+1; + end + NrUnsigXAxis = 0; + while (fix(DxVAxis*10^(NrUnsigXAxis)) == 0) + NrUnsigXAxis = NrUnsigXAxis+1; + end + + % check how many significant numbers DyV has. This number will be used for the precision of all Min/Max values so + % latex prints all of them with the same number of decimal places. + NrUnsigY = 0; + while (fix(DyV*10^(NrUnsigY)) == 0) + NrUnsigY = NrUnsigY+1; + end + + if options.DataBoundaries + fprintf(fid, ['\\expandafter\\def\\csname Data%sXmin\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, floor(xMin*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sXmax\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, ceil(xMax*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYmin\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, floor(yMin*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYmax\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, ceil(yMax*10^NrUnsigY)/(10^NrUnsigY)); + end + fprintf(fid, ['\\expandafter\\def\\csname Data%sDxV\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, DxV); + fprintf(fid, ['\\expandafter\\def\\csname Data%sDyV\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, DyV); + if options.AxisBoundaries + fprintf(fid, ['\\expandafter\\def\\csname Data%sXminAxis\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, floor(xMinAxis*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sXmaxAxis\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, ceil(xMaxAxis*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYminAxis\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, floor(yMinAxis*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYmaxAxis\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, ceil(yMaxAxis*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sDxV\\endcsname{%1.', num2str(NrUnsigXAxis), 'f}\n'], EPLdata(1,i).ident, DxVAxis); + fprintf(fid, ['\\expandafter\\def\\csname Data%sDyV\\endcsname{%1.', num2str(NrUnsigYAxis), 'f}\n'], EPLdata(1,i).ident, DyVAxis); + end + fclose(fid); + + % write actual data + for j=1:My + % what precision is needed to output the data? + yyMax = max(EPLdata(1,i).y(idx_x(j),:)); + yyMin = min(EPLdata(1,i).y(idx_x(j),:)); + if (abs(yyMax-yyMin)<1e-16) + yNrPrecision = 1; + else + yNrPrecision = ceil(log10(10000/(yyMax-yyMin))); + end + xxMax = max(EPLdata(1,i).x(idx_x(j),:)); + xxMin = min(EPLdata(1,i).x(idx_x(j),:)); + if (abs(xxMax-xxMin)<1e-16) + xNrPrecision = 1; + else + xNrPrecision = ceil(log10(10000/(xxMax-xxMin))); + end + if isfield(EPLdata(1,i), 'precision') + NrPrecision = EPLdata(1,i).precision; + if isempty(NrPrecision) + NrPrecision = max(yNrPrecision, xNrPrecision); + end + else + NrPrecision = max(yNrPrecision, xNrPrecision); + end + + % write the data to the file + xData = EPLdata(1,i).x(idx_x(j),:); + yData = EPLdata(1,i).y(j,:); + if My > 1; Ident = roman(num2str(j)); else Ident=''; end; + + if options.NaNsplit + % look for the ranges where the data exists (~isnan) + yData(isnan(xData)) = NaN; + + KeepLooking = true; + nrRanges = 0; + Ranges = zeros(0); + b = 0; + while KeepLooking + a = find(~isnan(yData((b+1):end)), 1, 'first') + b; + if ~isempty(a) + b = find(isnan(yData(a:end)), 1, 'first') + a-1; + if isempty(b) + b = length(yData); + KeepLooking = false; + end + nrRanges = nrRanges+1; + Ranges(nrRanges, :) = [a, b-1]; + else + KeepLooking = false; + end + end + + % data does not contain NaN: + if nrRanges<1 + nrRanges = 1; + Ranges(1, :) = [1, length(yData)]; + end + + fid = fopen(fname, 'at'); + fprintf(fid, '\\expandafter\\def\\csname Data%s%sNrRanges\\endcsname{%i}\n', EPLdata(1,i).ident, Ident, nrRanges); + fclose(fid); + for iRange = 1:nrRanges + fid = fopen(fname, 'at'); + fprintf(fid, '\\expandafter\\def\\csname Data%s%s%i\\endcsname{\n', EPLdata(1,i).ident, Ident, iRange); + fclose(fid); + dlmwrite(fname, [xData(Ranges(iRange,1):Ranges(iRange,2)); yData(Ranges(iRange,1):Ranges(iRange,2))]', '-append', 'delimiter', ' ', 'precision', ['%.', num2str(NrPrecision), 'f']); + fid = fopen(fname, 'at'); + fprintf(fid, '}\n\n'); + fclose(fid); + end + + else + % options.NaN = false + + fid = fopen(fname, 'at'); + fprintf(fid, '\\expandafter\\def\\csname Data%s%s\\endcsname{\n', EPLdata(1,i).ident, Ident); + fclose(fid); + dlmwrite(fname, [xData; yData]', '-append', 'delimiter', ' ', 'precision', ['%.', num2str(NrPrecision), 'f']); + fid = fopen(fname, 'at'); + fprintf(fid, '}\n\n'); + fclose(fid); + end + end + end + + % write group values + fid = fopen(fname, 'at'); + for i = 1:max(group) + xMax = max(groupXmax(group==i)); + xMin = min(groupXmin(group==i)); + yMax = max(groupYmax(group==i)); + yMin = min(groupYmin(group==i)); + if (abs(yMax-yMin)<1e-16) + yMax = 1.0; + yMin = -1.0; + end + if (abs(xMax-xMin)<1e-16) + xMax = 1.0; + xMin = -1.0; + end + + + % axis boundaries + xMinAxis = xMin-(xMax-xMin)*options.AxisBoundariesGap/100; + xMaxAxis = xMax+(xMax-xMin)*options.AxisBoundariesGap/100; + yMinAxis = yMin-(yMax-yMin)*options.AxisBoundariesGap/100; + yMaxAxis = yMax+(yMax-yMin)*options.AxisBoundariesGap/100; + + DxV = (xMax-xMin)/5; + DyV = (yMax-yMin)/5; + DxVAxis = (xMaxAxis-xMinAxis)/5; + DyVAxis = (yMaxAxis-yMinAxis)/5; + + % check how many significant numbers DyV has. This number will be used for the precision of all Min/Max values so + % latex prints all of them with the same number of decimal places. + NrUnsigY = 0; + while (fix(DyV*10^(NrUnsigY)) == 0) + NrUnsigY = NrUnsigY+1; + end + NrUnsigX = 0; + while (fix(DxV*10^(NrUnsigX)) == 0) + NrUnsigX = NrUnsigX+1; + end + NrUnsigYAxis = 0; + while (fix(DyVAxis*10^(NrUnsigYAxis)) == 0) + NrUnsigYAxis = NrUnsigYAxis+1; + end + NrUnsigXAxis = 0; + while (fix(DxVAxis*10^(NrUnsigXAxis)) == 0) + NrUnsigXAxis = NrUnsigXAxis+1; + end + + if i>1.5 + ident = strcat('Group', roman(num2str(i-1))); + else + ident = 'GroupDummy'; + end + + if options.DataBoundaries + fprintf(fid, ['\\expandafter\\def\\csname Data%sXmin\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], ident, floor(xMin*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sXmax\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], ident, ceil(xMax*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYmin\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], ident, floor(yMin*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYmax\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], ident, ceil(yMax*10^NrUnsigY)/(10^NrUnsigY)); + end + fprintf(fid, ['\\expandafter\\def\\csname Data%sDxV\\endcsname{%1.', num2str(NrUnsigX), 'f}\n'], ident, DxV); + fprintf(fid, ['\\expandafter\\def\\csname Data%sDyV\\endcsname{%1.', num2str(NrUnsigY), 'f}\n'], ident, DyV); + if options.AxisBoundaries + fprintf(fid, ['\\expandafter\\def\\csname Data%sXminAxis\\endcsname{%1.', num2str(NrUnsigXAxis), 'f}\n'], ident, floor(xMinAxis*10^NrUnsigXAxis)/(10^NrUnsigXAxis)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sXmaxAxis\\endcsname{%1.', num2str(NrUnsigXAxis), 'f}\n'], ident, ceil(xMaxAxis*10^NrUnsigXAxis)/(10^NrUnsigXAxis)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYminAxis\\endcsname{%1.', num2str(NrUnsigYAxis), 'f}\n'], ident, floor(yMinAxis*10^NrUnsigYAxis)/(10^NrUnsigYAxis)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sYmaxAxis\\endcsname{%1.', num2str(NrUnsigYAxis), 'f}\n'], ident, ceil(yMaxAxis*10^NrUnsigYAxis)/(10^NrUnsigYAxis)); + fprintf(fid, ['\\expandafter\\def\\csname Data%sDxVAxis\\endcsname{%1.', num2str(NrUnsigXAxis), 'f}\n'], ident, DxVAxis); + fprintf(fid, ['\\expandafter\\def\\csname Data%sDyVAxis\\endcsname{%1.', num2str(NrUnsigYAxis), 'f}\n'], ident, DyVAxis); + end + + end + fclose(fid); + ret = 1; +end \ No newline at end of file diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/export2pst.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/export2pst.m new file mode 100644 index 0000000000..4c1aadfe34 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/export2pst.m @@ -0,0 +1,332 @@ +% export2pst(EPLdata, projectname, options) +% +% This function may be used to export numeric data in a latex file for later +% use with, e.g., NumericPlots.sty. +% If the data is provided as an 1xK array, each entry of the array will be exported +% to the file . Each entry of the array must be a structure which contains +% x, y and ident. x and y must be arrays of the same size MxN. If M>1, each column +% of the array is exported to the file and may later be used by \Data, where +% is the roman representation of the column number. If M=1, the data may later +% be used with the latex command \Data +% +% EPLdata(1, i).x = x-matrix +% EPLdata(1, i).y = y-matrix +% EPLdata(1, i).ident = identifier (has to be a string without numbers -> +% latex command name) +% EPLdata(1, i).descr = description (optional) +% EPLdata(1, i).Group = GroupNr (optional) use numbers from 1 to n to define groups. For +% each group, the maximum and minimum values will be written to the output file and may be +% accessed with identifier Group where RomanNumber is the roman represenation +% of the group number. All data without group or with group number 0 is put into the group +% Dummy +% EPLdata(1, i).precision (optional) = number of decimal places to be written +% projectname = projectname (with path, without extension) +% options (optional) define which output is required +% - options.DataBoundaries [true]: if true, the min/max values of the data +% will be written to the output file. +% - options.AxisBoundaries [false]: if true, values which may be set as +% min/max values for the axis are written to the output file. These are +% the min/max values -/+ a gap. +% - options.AxisBoundariesGap [10]: defines the gap used for the axis +% min/max values in percent of the total range of the data. +% - options.SuppressWarning [false]: suppresses the warning about max/min values being to +% close together +% - options.precision [empty]: how many decimal places should be printed for x and y +% values. Will be calculated automatically if left empty. +% +% function roman.m required to convert a number to its roman representation. +% + +% author: Alexander Michel +% date: 2011/08/26 +% based on export2pst created by Thomas König +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + + +function ret = export2pst(EPLdata, projectname, options) + workpath = cd; + Extension = 'tex'; + if size(EPLdata, 1)>1 + error('EPLdata must be of size [1, n]'); + end + + % define standard options + if ((nargin<3) || ~isfield(options, 'DataBoundaries')) + % DataBoundaries should be in the output file (xMin, xMax, yMin, + % yMax) + options.DataBoundaries = true; + end + if ~isfield(options, 'AxisBoundaries') + % axis boundaries (xMinAxis, xMaxAxis, yMinAxis, yMaxAxis) + options.AxisBoundaries = false; + end + if ~isfield(options, 'AxisBoundariesGap') + % gap for the axis boundaries in percent of full scale + options.AxisBoundariesGap = 10; + end + if ~isfield(options, 'SuppressWarning') + options.SuppressWarning = false; + end + if ~isfield(options, 'FastRead') + options.FastRead = true; + end + + % create datafolder if necessary + datapath = [projectname '_data']; + if(exist(datapath,'dir')) + cd(datapath) + delete(['*.' Extension]); + cd(workpath); + else + mkdir(datapath); + end + % open file if possible + if strcmp(projectname(end-3:end), '.tex') + fname = fullfile(projectname); + else + fname = fullfile([projectname, '.tex']); + end + [fid, msg] = fopen(fname, 'wt'); + if fid<0 + display(msg); + error('Matlab:FileError', ['Could not open the file ', fname '.']); + end + + % write file header + fprintf(fid, '%% EPLdata written by export2pst\n'); + fprintf(fid, '%% date: %s\n\n', date); + fprintf(fid, '\\def\\ExpDate{%s}\n', date); + fclose(fid); + + % process data + for i=1:size(EPLdata,2) + % Ident=''; + My = size(EPLdata(i).y, 1); + Mx = size(EPLdata(i).x, 1); + if ( Mx>1 && Mx~=My ) + error('Matlab:export2pst', 'EPLdata.x and EPLdata.y must have the same size or EPLdata.x must have one column only'); + end + if ( Mx==1 ) + idx_x = ones(1, My); + else + idx_x = 1:Mx; + end + + % data header + if(isfield(EPLdata(1,i), 'descr')) + fid = fopen(fname, 'at'); + fprintf(fid, '\\def\\Descr%s{%s}\n', EPLdata(1,i).ident, EPLdata(1,i).descr); + fclose(fid); + end + if ~isfield(EPLdata(1,i), 'group') + EPLdata(1,i).group = 0; + end + if isempty(EPLdata(1,i).group) + EPLdata(1,i).group = 0; + end + + % xMax, xMin, Dx + xMax = max(max(EPLdata(1,i).x)); + xMin = min(min(EPLdata(1,i).x)); + + % axis boundaries + xMinAxis = xMin-(xMax-xMin)*options.AxisBoundariesGap/100; % -10% axis nearly tight + xMaxAxis = xMax+(xMax-xMin)*options.AxisBoundariesGap/100; % +10% axis nearly tight + + + if (abs(xMax-xMin)<1e-16) + xMax = 1.0; + xMin = -1.0; + if ~options.SuppressWarning + fprintf('export2pst - Warning: |xMax-xMin|<1e-16\n'); + end + end + DxV = (xMax-xMin)/5; + NrUnsigX = 0; + while (fix(DxV*10^(NrUnsigX)) == 0) + NrUnsigX = NrUnsigX+1; + end + + % yMin, yMax, Dy + yMax = max(max(EPLdata(1,i).y)); + yMin = min(min(EPLdata(1,i).y)); + + % axis boundaries + yMinAxis = yMin-(yMax-yMin)*options.AxisBoundariesGap/100; % -10% axis nearly tight + yMaxAxis = yMax+(yMax-yMin)*options.AxisBoundariesGap/100; % +10% axis nearly tight + + % save min/max values for groupes + group(i) = EPLdata(1,i).group+1; + groupXmax(i) = xMax; + groupXmin(i) = xMin; + groupYmax(i) = yMax; + groupYmin(i) = yMin; + + if (abs(yMax-yMin)<1e-16) + yMax = 1.0; + yMin = -1.0; + if ~options.SuppressWarning + fprintf('export2pst - Warning: |yMax-yMin|<1e-16\n'); + end + end + DyV = (yMax-yMin)/5; + + % check how many significant numbers DyV has. This number will be used for the precision of all Min/Max values so + % latex prints all of them with the same number of decimal places. + NrUnsigY = 0; + while (fix(DyV*10^(NrUnsigY)) == 0) + NrUnsigY = NrUnsigY+1; + end + + fid = fopen(fname, 'at'); + if options.DataBoundaries + fprintf(fid, ['\\def\\Data%sXmin{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, floor(xMin*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sXmax{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, ceil(xMax*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sYmin{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, floor(yMin*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\def\\Data%sYmax{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, ceil(yMax*10^NrUnsigY)/(10^NrUnsigY)); + end + fprintf(fid, ['\\def\\Data%sDxV{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, DxV); + fprintf(fid, ['\\def\\Data%sDyV{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, DyV); + if options.AxisBoundaries + fprintf(fid, ['\\def\\Data%sXminAxis{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, floor(xMinAxis*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sXmaxAxis{%1.', num2str(NrUnsigX), 'f}\n'], EPLdata(1,i).ident, ceil(xMaxAxis*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sYminAxis{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, floor(yMinAxis*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\def\\Data%sYmaxAxis{%1.', num2str(NrUnsigY), 'f}\n'], EPLdata(1,i).ident, ceil(yMaxAxis*10^NrUnsigY)/(10^NrUnsigY)); + end + fclose(fid); + + cd(datapath); + % write actual data + for j=1:My + yyMax = max(EPLdata(1,i).y(idx_x(j),:)); + yyMin = min(EPLdata(1,i).y(idx_x(j),:)); + if (abs(yyMax-yyMin)<1e-16) + yNrPrecision = 1; + else + yNrPrecision = ceil(log10(10000/(yyMax-yyMin))); + end + xxMax = max(EPLdata(1,i).x(idx_x(j),:)); + xxMin = min(EPLdata(1,i).x(idx_x(j),:)); + if (abs(xxMax-xxMin)<1e-16) + xNrPrecision = 1; + else + xNrPrecision = ceil(log10(10000/(xxMax-xxMin))); + end + if isfield(EPLdata(1,i), 'precision') + NrPrecision = EPLdata(1,i).precision; + if isempty(NrPrecision) + NrPrecision = max(yNrPrecision, xNrPrecision); + end + else + NrPrecision = max(yNrPrecision, xNrPrecision); + end + + if(My > 1) + Ident = roman(num2str(j)); + else + Ident=''; + end; + datafilename = [EPLdata(1,i).ident Ident '.' Extension]; + fid = fopen(datafilename, 'w+'); + fclose(fid); + if(options.FastRead) + fid = fopen(datafilename, 'w+'); + fprintf(fid, '%% EPLdata written by export2pst\n'); + fprintf(fid, '%% date: %s\n\n', date); + fprintf(fid,'\\def\\FigureToPlot{'); + %fprintf(fid,'['); + fclose(fid); + dlmwrite(datafilename, [EPLdata(1,i).x(idx_x(j),:); EPLdata(1,i).y(j,:)]','-append', 'delimiter', ' ', 'precision', ['%.', num2str(NrPrecision), 'f']); + fid = fopen(datafilename, 'a'); + fprintf(fid,'}'); + %fprintf(fid,']'); + fclose(fid); + else + fid = fopen(datafilename, 'w+'); + fprintf(fid, '%% EPLdata written by export2pst\n'); + fprintf(fid, '%% date: %s\n\n', date); + fclose(fid); + dlmwrite(datafilename, [EPLdata(1,i).x(idx_x(j),:); EPLdata(1,i).y(j,:)]','-append', 'delimiter', ' ', 'precision', ['%.', num2str(NrPrecision), 'f']); + end + end + cd(workpath) + end + + + % write group values + for i = 1:max(group) + xMax = max(groupXmax(group==i)); + xMin = min(groupXmin(group==i)); + yMax = max(groupYmax(group==i)); + yMin = min(groupYmin(group==i)); + if (abs(yMax-yMin)<1e-16) + yMax = 1.0; + yMin = -1.0; + end + if (abs(xMax-xMin)<1e-16) + xMax = 1.0; + xMin = -1.0; + end + + + % axis boundaries + xMinAxis = xMin-(xMax-xMin)*options.AxisBoundariesGap/100; + xMaxAxis = xMax+(xMax-xMin)*options.AxisBoundariesGap/100; + yMinAxis = yMin-(yMax-yMin)*options.AxisBoundariesGap/100; + yMaxAxis = yMax+(yMax-yMin)*options.AxisBoundariesGap/100; + + DxV = (xMax-xMin)/5; + DyV = (yMax-yMin)/5; + + % check how many significant numbers DyV has. This number will be used for the precision of all Min/Max values so + % latex prints all of them with the same number of decimal places. + NrUnsigY = 0; + while (fix(DyV*10^(NrUnsigY)) == 0) + NrUnsigY = NrUnsigY+1; + end + NrUnsigX = 0; + while (fix(DxV*10^(NrUnsigX)) == 0) + NrUnsigX = NrUnsigX+1; + end + + if i>1.5 + ident = strcat('Group', roman(num2str(i-1))); + else + ident = 'GroupDummy'; + end + + fid = fopen(fname, 'at'); + if options.DataBoundaries + fprintf(fid, ['\\def\\Data%sXmin{%1.', num2str(NrUnsigX), 'f}\n'], ident, floor(xMin*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sXmax{%1.', num2str(NrUnsigX), 'f}\n'], ident, ceil(xMax*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sYmin{%1.', num2str(NrUnsigY), 'f}\n'], ident, floor(yMin*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\def\\Data%sYmax{%1.', num2str(NrUnsigY), 'f}\n'], ident, ceil(yMax*10^NrUnsigY)/(10^NrUnsigY)); + end + fprintf(fid, ['\\def\\Data%sDxV{%1.', num2str(NrUnsigX), 'f}\n'], ident, DxV); + fprintf(fid, ['\\def\\Data%sDyV{%1.', num2str(NrUnsigY), 'f}\n'], ident, DyV); + if options.AxisBoundaries + fprintf(fid, ['\\def\\Data%sXminAxis{%1.', num2str(NrUnsigX), 'f}\n'], ident, floor(xMinAxis*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sXmaxAxis{%1.', num2str(NrUnsigX), 'f}\n'], ident, ceil(xMaxAxis*10^NrUnsigX)/(10^NrUnsigX)); + fprintf(fid, ['\\def\\Data%sYminAxis{%1.', num2str(NrUnsigY), 'f}\n'], ident, floor(yMinAxis*10^NrUnsigY)/(10^NrUnsigY)); + fprintf(fid, ['\\def\\Data%sYmaxAxis{%1.', num2str(NrUnsigY), 'f}\n'], ident, ceil(yMaxAxis*10^NrUnsigY)/(10^NrUnsigY)); + end + + fclose(fid); + ret = 1; +end \ No newline at end of file diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/genlatexnames.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/genlatexnames.m new file mode 100644 index 0000000000..0e48e8b2ea --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/genlatexnames.m @@ -0,0 +1,38 @@ +function latexnames = genlatexnames(names) +%------------------------------------------------ +%2013/06/26 version 1.0 +%latexnames = genlatexnames(names) +%Generates proper names for latex commandos +%------------------------------------------------ +% author: Alexander Michel +% date: 2013/06/26 +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . +% + +excludelist = {'\','_','-','1','2','3','4','5','6','7','8','9','0'}; +for ii = 1:length(names) + idx = []; + teststr = names{ii}; + strlength = length(teststr); + for jj=1:length(excludelist) + idx = [idx strfind(teststr,excludelist{jj})]; + end + latexnames{ii} = teststr(setdiff(1:strlength,idx)); +end + \ No newline at end of file diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/roman.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/roman.m new file mode 100644 index 0000000000..1642a917e6 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/roman.m @@ -0,0 +1,58 @@ +function [romnum] = roman(num) +% ------------------------------------------------ +% [romnum] = int2roman(num) +% Function converts a integer 2 a roman number (string) +% ------------------------------------------------ +% output: +% num ...roman number to be converted (number or string) +% + +% author: Alexander Michel +% date: 2010/08/09 +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + +if(isstr(num)) + numint = str2num(num); +else + numint = num; +end +numint = round(numint); + +rest = numint; +div = [1000 900 500 400 100 90 50 40 10 9 5 4 1]; +letters = {'M','CM','D', 'CD','C','XC','L','XL','X','IX','V','IV','I'}; +ii = 1; +while(rest~=0) + z(ii) = floor(rest/div(ii)); + rest = mod(rest,div(ii)); + ii = ii+1; +end +romnum = ''; + +for(ii=1:length(z)); + for(jj=1:z(ii)) + romnum = [romnum letters{ii}]; + end +end + +end + + + + \ No newline at end of file diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2latex.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2latex.m new file mode 100644 index 0000000000..8edb5d543a --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2latex.m @@ -0,0 +1,187 @@ +function num = struct2latex(data,xname,downsample,filtertype,filename,postfix,options) +%------------------------------------------------ +%2010/09/14 version 1.0 +%num = struct2latex(data,xname,downsample,filename,postfix,options) +%Function to export a matlabstruct to a tex-file for using NumericPlots. +%xname, downsample, filename, postfix and options are optional parameters. +%struct2latex is based on the function export2latex. +%------------------------------------------------ +%output: +%num ...number of y-data exported +%input: +%data ...datastruct +%xname ...name of the x-Axis +%downsample ...downsampling factor (optional, default = 1) +%filtertype ...using filtering data {'none','MinMax','Hull'}(optional, default = 'none') +%filename ...name of the tex-file (optional, default io) +%postfix ...postfix for fieldnames in the tex-file (optional, default '') +%options ...options for export2latex (optional) +% + +% author: Alexander Michel +% date: 2010/08/09 +% changed by Alexander Michel: +% 2010/09/14 mapping of column-vectors +% 2010/09/14 postfix option added +% 2012/08/03 filters added +% 2013/06/26 data consistency check added +% 2013/08/09 data consistency check for x-vector dimension added +% bugfixing of mapping of column-vectors +% bugfixing of fnamesExcludelist +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + + +%choose x-Axis +allfnames = fieldnames(data); +if(nargin<2) + [xnamenum,selected] = listdlg('PromptString','Choose x-Axis:','SelectionMode','single','ListString',allfnames(1:end)); + if (selected==0) + error('No x-Axis chosen!'); + end + xname = allfnames{xnamenum}; +end + +%exclude special fields from export +fnamesExcludelist = {xname,'dSPACESettings'}; +kk = 1; +for ii = 1:length(allfnames) + if(~strcmp(allfnames{ii},fnamesExcludelist)) + fnames{kk} = allfnames{ii}; + kk = kk+1; + end +end + + +% check x data consistency and +% convert to column vectors if necessary +[nor,noc] = size(data.(xname)); +if(nor>1) + if(noc>1) + error('struct2latex supports only vectors as x-vectors'); + else + data.(xname) = data.(xname)'; + end +end + +% check y data consistency and +% convert to column vectors if necessary +for ii = 1:length(fnames) + [nor,noc] = size(data.(fnames{ii})); + if(nor>1) + if(noc>1) + error('struct2latex supports only vectors as y-vectors'); + else + data.(fnames{ii}) = data.(fnames{ii})'; + end + end + if(length(data.(xname))~=length(data.(fnames{ii}))) + error(['Error in ' fnames{ii} '! Only vectors of the same length are supported!']); + end +end + +%downsample +if(nargin<3) + downsample = 1; +end +idx = 1:downsample:length(data.(xname)); + +%downsample +if(nargin<4) + filtertype = 'none'; +end + + +%postfix +if(nargin<6) + postfix = ''; +end + +if(length(idx)>5000) + buttonname = questdlg('Warning! Number of points exceeds 5000! It is recommended to increase the downsampling factor!','Increase the downsampling factor?','Yes','No','Yes'); + switch buttonname + case 'Yes' + dlgoptions.Resize='on'; + dlgoptions.WindowStyle='normal'; + dlgoptions.Interpreter='tex'; + defans{1} = num2str(ceil(length(data.(xname))/5000)); + answer = inputdlg('Downsampling factor','Input Downsampling factor',1,defans,dlgoptions); + downsample = str2num(answer{1}); + idx = 1:downsample:length(data.(xname)); + case 'No' + warning('number of points exceeds 5000'); + end +end + + +% get x-data +xbuffer = data.(xname); +[nor,noc] = size(xbuffer); +if(nor>1) + if(noc>1) + error('struct2latex supports only vectors'); + else + xbuffer = xbuffer'; + end +end + +% get y-data +latexfnames = genlatexnames(fnames); +for ii = 1:length(fnames) + ybuffer = data.(fnames{ii}); + switch(filtertype) + case{'none'} + ydata = ybuffer(idx); + xdata = xbuffer(idx); + case{'MinMax'} + [xdata,ydata] = LatexFilterMinMax(xbuffer,ybuffer,floor(length(idx)/2)); + case{'Hull'} + [xdata,ydata] = LatexFilterHull(xbuffer,ybuffer,floor(length(idx)/2)); + otherwise + ydata = ybuffer(idx); + xdata = xbuffer(idx); + end + texdata(ii).x = xdata; + texdata(ii).y = ydata; + texdata(ii).ident = [latexfnames{ii} postfix]; +end + +if(nargin<4) + [texname,texpname] = uiputfile('*.tex','Save Tex-File as ...','data'); + filename = [texpname texname(1:end-4)]; +end +if(ischar(filename)) + if(exist('options','var')) + export2latex(texdata,filename,options); + else + export2latex(texdata,filename); + end +else + error('no savefile chosen or illegal name'); +end + +% output info +num = length(fnames); +disp([num2str(length(fnames)) ' data sets exported.']); +disp(['x-data name:']); +disp(['''' xname '''']); +disp(['y-data name:']); +for ii=1:length(latexfnames) + fprintf(['''' latexfnames{ii} '''' ' ']); +end +fprintf(['\n']); diff --git a/graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2pst.m b/graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2pst.m new file mode 100644 index 0000000000..478ec75d9f --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/MatlabFunctions/struct2pst.m @@ -0,0 +1,127 @@ +function num = struct2pst(data,xname,downsample,filename,postfix,options) +%------------------------------------------------ +%2011/09/08 version 1.0 +%num = struct2pst(data,xname,downsample,filename,postfix,options) +%Function to export a matlabstruct to a tex-file for using NumericPlots. +%xname, downsample, filename, postfix and options are optional parameters. +%struct2pstis based on the function export2latex. +%------------------------------------------------ +%output: +%num ...number of y-data exported +%input: +%data ...datastruct +%xname ...name of the x-Axis +%downsample ...downsampling factor (optional, default = 1) +%filename ...name of the tex-file (optional, default io) +%postfix ...postfix for fieldnames in the tex-file (optional, default '') +%options ...options for export2latex (optional) +% + +%author: Alexander Michel +% date: 2010/08/09 +% changed by Alexander Michel: +% 2010/09/14 mapping of column-vectors +% 2010/09/14 postfix option added +% +% Copyright 2010 Thomas König, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + + +%choose x-Axis +fnames = fieldnames(data); +if(nargin<2) + [xnamenum,selected] = listdlg('PromptString','Choose x-Axis:','SelectionMode','single','ListString',fnames(1:end)); + if (selected==0) + error('No x-Axis chosen!'); + end + xname = fnames{xnamenum}; +end + +%downsample +if(nargin<3) + downsample = 1; +end +idx = 1:downsample:length(data.(xname)); + +%postfix +if(nargin<5) + postfix = ''; +end + +if(length(idx)>5000) + buttonname = questdlg(['Warning! Number of points exceeds 5000 and is equal to ' num2str(length(idx)) '! It is recommended to increase the downsampling factor!'],'Increase the downsampling factor?','Yes','No','Yes'); + switch buttonname + case 'Yes' + dlgoptions.Resize='on'; + dlgoptions.WindowStyle='normal'; + dlgoptions.Interpreter='tex'; + defans{1} = num2str(ceil(length(data.(xname))/5000)); + answer = inputdlg('Downsampling factor','Input Downsampling factor',1,defans,dlgoptions); + downsample = str2double(answer{1}); + idx = 1:downsample:length(data.(xname)); + case 'No' + warning(['number of points exceeds 5000 and is equal to ' num2str(length(idx))]); + end +end + + +% get x-data +xdata = data.(xname); +[nor noc] = size(xdata); +if(nor>1) + if(noc>1) + error('struct2latex supports only vectors'); + else + xdata = xdata'; + end +end + +% get y-data +jj = 1; +for ii = 1:length(fnames) + if(strcmp(xname,fnames{ii})~=1 && strcmp('dSPACESettings',fnames{ii})~=1) + texdata(jj).x = xdata(idx); + buffer = data.(fnames{ii}); + [nor noc] = size(buffer); + if(nor>1) + if(noc>1) + error('struct2latex supports only vectors'); + else + buffer = buffer'; + end + end + texdata(jj).y = buffer(idx); + texdata(jj).ident = [fnames{ii} postfix]; + jj = jj+1; + end +end + +if(nargin<4) + [texname texpname] = uiputfile('*.tex','Save Tex-File as ...','data'); + filename = [texpname texname(1:end-4)]; +end +if(isstr(filename)) + if(exist('options','var')) + export2pst(texdata,filename,options); + else + export2pst(texdata,filename); + end +else + error('no savefile chosen or illegal name'); +end + +num = jj-1; \ No newline at end of file diff --git a/graphics/pstricks/contrib/numericplots/README b/graphics/pstricks/contrib/numericplots/README new file mode 100644 index 0000000000..9642772a09 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/README @@ -0,0 +1,30 @@ +--------------------------------------------------------------------------- +The NumericPlots package --- LaTeX package to plot numeric data using pstricks +Maintained by Thomas Koenig, Alexander Michel, Michael Baumgart +E-mail: NumericPlots@tikey.de +Released under the GNU General Public License version 3 or later +See +---------------------------------------------------------------------------- + +Copyright 2010 Thomas Koenig, Alexander Michel, Michael Baumgart + +Plotting numeric data is a task which often has to be done for scientific +papers. In \LaTeX, however, it is only possible to include graphics created with +an external program. The pstricks-packages provide very many commands to +generate graphics in \LaTeX. To generate simple graphics from numeric data, +however, it is difficult to use. This package provides a simpler interface for +the pstricks-package to plot numeric data. + +NumericPlots is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +NumericPlots 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with NumericPlots. If not, see . + diff --git a/graphics/pstricks/contrib/numericplots/doc/License.txt b/graphics/pstricks/contrib/numericplots/doc/License.txt new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/doc/License.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/graphics/pstricks/contrib/numericplots/doc/NumericPlots.pdf b/graphics/pstricks/contrib/numericplots/doc/NumericPlots.pdf new file mode 100644 index 0000000000..48f441583a Binary files /dev/null and b/graphics/pstricks/contrib/numericplots/doc/NumericPlots.pdf differ diff --git a/graphics/pstricks/contrib/numericplots/doc/src/BasicFunctionality.tex b/graphics/pstricks/contrib/numericplots/doc/src/BasicFunctionality.tex new file mode 100644 index 0000000000..b1550768f4 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/doc/src/BasicFunctionality.tex @@ -0,0 +1,621 @@ +% Copyright 2010 Thomas Koenig, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + +\part{Using the package} + +\section{Basic Functionality} + +The package NumericPlots\\ +\verb+\usepackage{NumericPlots}+ +\\ +is intended to be used to plot numeric data which +may, e.g., be exported from Matlab by export2latex.m. The data must be defined +in the form +\lstinputlisting[lastline=9]{examples/DefineData} +where the first column contains the x, the second column the y-data. + +\emph{Please note that the package relies on the \texttt{listplot}-command from +pstricks!} + +\subsection{plots} + + +The easiest plot may be done by + +\begin{minipage}[T]{0.45\linewidth} + \lstinputlisting{examples/basic_EasyPlot} +\end{minipage} +\hspace{0.05\linewidth} +\begin{minipage}[T]{0.45\linewidth} + \input{examples/basic_EasyPlot} +\end{minipage} + +if you want to add a legend, you simply call + +\begin{minipage}[T]{0.45\linewidth} + \lstinputlisting{examples/basic_Legend} +\end{minipage} +\hspace{0.05\linewidth} +\begin{minipage}[T]{0.45\linewidth} + \input{examples/basic_Legend} +\end{minipage} + +To plot multiple data in one plot call + +\begin{minipage}[T]{0.45\linewidth} + \lstinputlisting{examples/basic_MultipleData} +\end{minipage} +\hspace{0.05\linewidth} +\begin{minipage}[T]{0.45\linewidth} + \centering + \input{examples/basic_MultipleData} +\end{minipage} + + +\subsection{Label and TickLabels} + +The commands \texttt{plotxAxis} and \texttt{plotyAxis} take the options +\texttt{NoLabel}, \texttt{NoTicks}, \texttt{NoTickLabel} as well as +\texttt{LabelOption} and \texttt{TickLabelOption} which may be used to eliminate +or change the look of the labels. + +Standard values for \texttt{LabelOption} and \texttt{TickLabelOption} may be set\\ +by \verb|\newcommand{\StdLabelOption}{\color{blue}|\\ +and \verb|\newcommand{\StdTickLabelOption}{\small}|. + +The option \texttt{LabelSep} may be used for \verb|\plotxAxis| and +\verb|\plotyAxis| to set the seperation between the axis and the label. Standard +value is \verb|\baselineskip+1ex| for the x-label and \verb|7ex| for the +y-label. + +\begin{minipage}[T]{0.45\linewidth} + \lstinputlisting{examples/basic_Labels} +\end{minipage} +\hspace{0.05\linewidth} +\begin{minipage}[T]{0.45\linewidth} + \input{examples/basic_Labels} +\end{minipage} + +It is furthermore possible to change the position and the rotation of the labels +and tick labels, see the example in section \ref{sec:Details:Labels}. + +It is also possible to put single tick labels, see the example in section +\ref{sec:Details:Labels}. + +\subsection{Place ``Objects'' in the plot.}\label{sec:PlaceObjects} + +There are basically two different options to place objects in the plot. To +understand the difference one has to keep in mind that the axis have two +different coordinate systems. One is the system defined by xMin, xMax, yMin and +yMax (refered to as ``DataCoordinateSystem''), the other ist the system defined +by xCoordMin, xCoordMax, yCoordMin and yCoordMax (refered to as +``PictureCoordinateSystem''), see section \ref{sec:MultiplePlots}. + +It is now possible to place stuff in the graph with the DataCoordinates with the +command NDPput, see the following example. + +\begin{minipage}[T]{0.45\linewidth} + \lstinputlisting{examples/basic_PlaceObjects} +\end{minipage} +\hspace{0.05\linewidth} +\begin{minipage}[T]{0.45\linewidth} + \input{examples/basic_PlaceObjects} +\end{minipage} + + +For convenience the commands \verb|\putXX{object}| where +$XX\in\left(N,S,E,W,NW,NE,SW,SE\right)$ are defined to place something in the +North, South,\ldots, SouthEast corner of the plot. Also, the command +\verb|\putExpY{xx}| and \verb|\putExpX{xx}| may be used to place exponents at +the axes. + +\begin{minipage}[T]{0.45\linewidth} + \lstinputlisting[firstline=14,lastline=24]{examples/basic_PlaceObjectsII} +\end{minipage} +\hspace{0.05\linewidth} +\begin{minipage}[T]{0.45\linewidth} + \input{examples/basic_PlaceObjectsII} +\end{minipage} + +Alternatively, stuff can be placed +within the plot with \verb|\rput|. + + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting[firstline=14,lastline=28]{examples/basic_UseRput} +\end{minipage} +\begin{minipage}[T]{0.5\linewidth} + \input{examples/basic_UseRput} +\end{minipage} + + +% ================================= +% | | +% | Linestyles and colors | +% | | +% ================================= + +\subsection{Linestyles and colors} + +While using the package, there are predefined linestyles which may be used: + +\begin{minipage}{0.55\linewidth} + \centering + \small + + \begin{NumericDataPlot}[lly=1cm,llx=1cm,urx=0.25cm,ury=0.25cm]{\linewidth}{0.85\linewidth} + \setxAxis{xMin=2, xMax=17, xO=5, Dx=4} + \setyAxis{yMin=20, yMax=70, yO=20, Dy=20} + + \plotxAxis[NoLabel, AxisStyle=Boxed]{} + \plotyAxis[NoLabel, AxisStyle=Boxed]{} + + \listplot[style=StdLineStyA]{\DataA} + \listplot[style=StdLineStyB]{\DataB} + \listplot[style=StdLineStyC]{\DataC} + \listplot[style=StdLineStyD]{\DataD} + \listplot[style=StdLineStyE]{\DataE} + \listplot[style=StdLineStyF]{\DataF} + \listplot[style=StdLineStyG]{\DataG} + \end{NumericDataPlot} +\end{minipage} +\begin{minipage}{0.4\linewidth} + \centering + \LegendDefinition{ + \LegLine{style=StdLineStyA} & StdLineStyA \\ + \LegLine{style=StdLineStyB} & StdLineStyB \\ + \LegLine{style=StdLineStyC} & StdLineStyC \\ + \LegLine{style=StdLineStyD} & StdLineStyD \\ + \LegLine{style=StdLineStyE} & StdLineStyE \\ + \LegLine{style=StdLineStyF} & StdLineStyF \\ + \LegLine{style=StdLineStyG} & StdLineStyG \\ + } +\end{minipage} + +When using the package option \texttt{BW} the standard line styles will be +replaced by their black and white counterparts: + +\begin{minipage}{0.6\linewidth} + \centering + \small + + \begin{NumericDataPlot}[lly=1cm,llx=1cm,urx=0.25cm,ury=0.25cm]{\linewidth}{0.85\linewidth} + \setxAxis{xMin=2, xMax=17, xO=5, Dx=4} + \setyAxis{yMin=20, yMax=70, yO=20, Dy=20} + + \plotxAxis[NoLabel, AxisStyle=Boxed]{} + \plotyAxis[NoLabel, AxisStyle=Boxed]{} + + \listplot[style=BWStdLineStyA]{\DataA} + \listplot[style=BWStdLineStyB]{\DataB} + \listplot[style=BWStdLineStyC]{\DataC} + \listplot[style=BWStdLineStyD]{\DataD} + \listplot[style=BWStdLineStyE]{\DataE} + \listplot[style=BWStdLineStyF]{\DataF} + \listplot[style=BWStdLineStyG]{\DataG} + \end{NumericDataPlot} +\end{minipage} +\begin{minipage}{0.4\linewidth} + \centering + \LegendDefinition{ + \LegLine{style=BWStdLineStyA} & BWStdLineStyA \\ + \LegLine{style=BWStdLineStyB} & BWStdLineStyB \\ + \LegLine{style=BWStdLineStyC} & BWStdLineStyC \\ + \LegLine{style=BWStdLineStyD} & BWStdLineStyD \\ + \LegLine{style=BWStdLineStyE} & BWStdLineStyE \\ + \LegLine{style=BWStdLineStyF} & BWStdLineStyF \\ + \LegLine{style=BWStdLineStyG} & BWStdLineStyG \\ + } +\end{minipage} + +For values which are nearly the same (reference and measurement, e.g.) the +following line styles may be used: + +\begin{minipage}{0.58\linewidth} + \centering + \small + + \begin{NumericDataPlot}[lly=1cm,llx=1cm,urx=0.25cm,ury=0.25cm]{\linewidth}{0.85\linewidth} + \setxAxis{xMin=2, xMax=17, xO=5, Dx=4} + \setyAxis{yMin=20, yMax=70, yO=20, Dy=20} + + \plotxAxis[NoLabel, AxisStyle=Boxed]{} + \plotyAxis[NoLabel, AxisStyle=Boxed]{} + + \listplot[style=StdLineStyX]{\DataC} + \listplot[style=StdLineStyY]{\DataC} + + \listplot[style=BWStdLineStyX]{\DataD} + \listplot[style=BWStdLineStyY]{\DataD} + \end{NumericDataPlot} +\end{minipage} +\begin{minipage}{0.38\linewidth} + \centering + \LegendDefinition{ + \LegLine{style=StdLineStyX} & StdLineStyX \\ + \LegLine{style=StdLineStyY} & StdLineStyY \\ + \LegLine{style=BWStdLineStyX} & BWStdLineStyX \\ + \LegLine{style=BWStdLineStyY} & BWStdLineStyY \\ + } +\end{minipage} + +It is, of course, possible to redefine the available linestyles or to define new +linestyles. + +\begin{minipage}[T]{0.48\linewidth} + \lstinputlisting[firstline=4,lastline=26]{examples/basic_UserLinestyles} +\end{minipage} +\begin{minipage}[T]{0.48\linewidth} + \input{examples/basic_UserLinestyles} +\end{minipage} + + + +% ================================= +% | | +% | Legend | +% | | +% ================================= + +\subsection{Legend} + +The legend may be created with \verb|\LegendDefinition|. The command takes the +two optional arguments \texttt{nrCols} and \texttt{LabelOrientation=[l|c|r]}. +The mandatory argument is the definition of a table as demonstrated in the +follwing examples. + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_LegendI} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_LegendI} +\end{minipage} + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_LegendII} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_LegendII} +\end{minipage} + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_LegendIII} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_LegendIII} +\end{minipage} + + +\subsection{Add Lines to the Plot} + +Horizontal and vertical lines may be added to the plot with the commands +\verb|\NDPhline{coord}|, \verb|\NDPvline{coord}| and \verb|\NDPline{coord}|. It is also possible to put +nodes and draw lines between them, see section \ref{sec:PlaceObjects}. + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting[firstline=14,lastline=17]{examples/basic_Lines} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_Lines} +\end{minipage} + + +\subsection{Add Boxes to the Plot} + +Horizontal and vertical boxes may be added to the plot with the commands +\verb|\NDPhbox{coord}|, \verb|\NDPvbox{coord}| and \verb|\NDPbox{coord}|. It is also possible to put +nodes and draw lines between them, see section \ref{sec:PlaceObjects}. + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting[firstline=11,lastline=21]{examples/basic_Boxes} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_Boxes} +\end{minipage} + + +\subsection{Grid} + +As shwon in the example below, it is possible to plot a fine grid but not have a +tick label at each of the grid lines. While the options \texttt{Dx} and +\texttt{Dy} define the distance between the grid lines, the options \texttt{DDx} +and \texttt{DDy} define the distance between the tick labels. If \texttt{DDx} or +\texttt{DDy} are not set, they take the values of \texttt{Dx} and \texttt{Dy}. + +One may choose not to plot the grid with +the option \texttt{NoGrid} for the commands \verb|\plotxAxis| and \verb|\plotyAxis|. + +If the grid is plottet with the axis it may happen that the grid is plottet over +the axis. To avoid this, plot the grid first and then plot the axis as shown. + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_Grid} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_Grid} +\end{minipage} + + + +\subsection{Logarithmic axes} + + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_LogarithmicI} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_LogarithmicI} +\end{minipage} + + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_LogarithmicII} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_LogarithmicII} +\end{minipage} + + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_LogarithmicIII} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_LogarithmicIII} +\end{minipage} + + +\subsection{plots with holes} + +If plotting data, one might not want to plot some part of this data, e.g. if +only the data in a certain y-range is interesting. If one chooses to eliminate the +invalid data either by using \verb+yStart+ or \verb+yEnd+ or by eliminating the +data before the export, pstricks will always connect the last valid point of an +interval with the first valid point of the next interval. In Matlab e.g., +invalid data (NaN) is just ignored. This behavior is also possible with NumericPlots and +export2latex. If export2latex is called with data which contains NaN and with +the option.NaNsplit=true, it will split the data in several intervals and append +a consecutive number to the identifier for each interval. The exported yMax, +yMin values etc. will still be valid for the whole data-vector. The exported +data might look like: + +\begin{verbatim} +\expandafter\def\csname DataIdentNrRanges\endcsname{3} +\expandafter\def\csname DataIdent1\endcsname{ +560.00 5.40 +... +574.72 6.25 +} + +\expandafter\def\csname DataIdent2\endcsname{ +588.73 4.78 +... +609.53 12.09 +} + + +\expandafter\def\csname DataIdent3\endcsname{ +620.56 27.81 +... +649.56 27.32 +} +\end{verbatim} + + +\expandafter\def\csname DataIdentNrRanges\endcsname{3} +\expandafter\def\csname DataIdent1\endcsname{ +560.00 5.40 +560.30 6.25 +560.59 4.74 +560.90 6.25 +561.60 5.18 +561.65 6.25 +561.70 4.73 +562.60 4.75 +562.63 6.06 +563.75 6.12 +563.75 5.00 +564.50 6.25 +564.76 4.71 +564.90 4.88 +565.51 6.25 +565.63 5.00 +566.13 5.69 +566.61 6.78 +567.10 4.88 +567.60 4.89 +567.66 6.25 +568.30 4.88 +568.31 6.25 +569.10 4.77 +569.51 6.25 +569.60 6.13 +570.35 4.85 +570.63 6.25 +570.71 5.00 +571.30 4.64 +571.31 6.25 +572.30 4.66 +572.62 6.06 +572.90 5.00 +572.93 5.61 +573.68 5.00 +574.11 6.25 +574.66 4.76 +574.72 6.25 +} + +\expandafter\def\csname DataIdent2\endcsname{ +588.73 4.78 +588.90 6.15 +589.50 4.76 +589.67 4.90 +589.74 6.25 +590.66 5.96 +590.73 4.55 +591.25 6.25 +591.69 4.68 +592.10 4.91 +592.31 6.25 +593.20 6.25 +593.55 5.36 +593.64 4.79 +593.74 6.25 +594.64 4.74 +594.75 6.11 +595.25 4.67 +595.31 6.12 +596.00 5.84 +596.30 11.90 +597.10 10.69 +597.20 12.00 +597.69 12.00 +598.15 10.00 +598.50 11.97 +598.67 10.00 +599.31 10.00 +599.69 11.91 +600.13 12.22 +600.79 10.79 +600.83 10.31 +600.86 11.72 +601.74 10.56 +601.80 11.25 +602.78 11.98 +602.94 10.00 +603.72 12.08 +603.94 10.00 +604.54 10.00 +604.70 11.96 +605.14 11.25 +605.24 10.83 +605.69 11.92 +605.80 10.00 +606.70 11.72 +607.03 10.00 +607.49 11.15 +607.54 10.00 +608.23 12.15 +608.72 10.00 +609.30 10.87 +609.53 12.09 +} + +\expandafter\def\csname DataIdent3\endcsname{ +620.56 27.81 +620.78 26.25 +620.85 27.80 +621.56 27.32 +621.74 27.78 +622.00 27.32 +622.74 26.36 +623.08 28.75 +623.31 27.79 +623.71 26.31 +624.05 27.32 +624.65 27.79 +625.18 27.83 +625.45 27.35 +625.95 27.74 +626.28 27.30 +626.75 26.34 +626.88 27.81 +627.54 28.75 +627.72 26.38 +628.23 27.29 +628.36 27.74 +628.88 26.25 +629.28 27.82 +629.78 28.84 +629.93 27.32 +631.13 26.27 +631.22 27.76 +631.94 28.75 +631.98 27.33 +632.54 26.25 +632.66 27.78 +632.89 27.29 +633.33 28.88 +633.76 26.45 +633.94 27.85 +634.76 26.33 +635.14 27.74 +635.68 27.82 +635.84 26.35 +636.08 27.84 +636.46 27.34 +637.04 27.74 +637.19 27.32 +637.70 27.34 +638.31 27.84 +638.50 27.78 +638.65 27.33 +639.45 27.79 +639.83 26.34 +640.03 27.38 +640.68 27.83 +641.45 27.31 +641.50 27.77 +642.08 27.80 +642.18 27.32 +642.76 27.93 +642.86 26.25 +643.75 27.32 +643.91 27.76 +644.38 27.30 +644.74 27.83 +645.06 27.37 +645.08 27.80 +645.80 28.80 +646.13 26.47 +646.76 26.57 +647.09 27.81 +647.26 27.83 +647.98 26.25 +648.20 27.33 +648.34 28.75 +648.93 28.91 +649.56 27.32 +} + +This data can then easily be plotted using the command\\ +\verb+\multilistplot{}{}+\footnote{Please notice, that the +first argument of multilistplot is a mandatory argument. Also notice, that the +second argument ist only the name of the data including ``Data'' but not the +command as it would be for the listplot command}. +The command will call\\ +\verb+\listplot[]{\}+ for each of +the intervals. The first argument is directly passed to the listplot command which is part of the +pstricks package. The second argument is the identifier of the data that should +be plotted. + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting{examples/basic_PlotWHoles} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/basic_PlotWHoles} +\end{minipage} + diff --git a/graphics/pstricks/contrib/numericplots/doc/src/FurtherExamples.tex b/graphics/pstricks/contrib/numericplots/doc/src/FurtherExamples.tex new file mode 100644 index 0000000000..14ba60b090 --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/doc/src/FurtherExamples.tex @@ -0,0 +1,306 @@ +\section{Further Examples} + +\def\MoreData{ +0 5 +1 7 +2 10 +3 11 +4 11.5 +5 10 +6 5 +7 4 +8 9 +9 12 +10 11 +11 5 +} + +\def\MoreDataI{ +0 -5 +1 -7 +2 -10 +3 -11 +4 -11.5 +5 -10 +6 10 +7 15 +8 10 +9 -12 +10 -11 +11 -5 +} + +\def\NoiseData{ +0 5 +0.1 5.4 +0.2 4.6 +0.3 5.3 +0.4 4.9 +0.5 4.6 +} +Here, some features of the pst-plot command \verb|listplot| are illustrated. With xStart, xEnd (yStart, yEnd), the data can be truncated. Note that all visible data points are connected by a straight line which may render a misleading plot, cf. the blue and green line in the next plot below. + +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + \listplot + [style=StdLineStyA] + {\MoreData} + \listplot + [style=StdLineStyB, yEnd=10] + {\MoreData} + \listplot + [style=StdLineStyC, xStart=5, xEnd=9] + {\MoreData} + \listplot + [style=StdLineStyD, showpoints=true, nStep=2] + {\MoreData} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.45\linewidth} +\centering +\begin{NumericDataPlot}{\textwidth}{5cm} + \setxAxis{xMin=0, xMax=15, Dx=5, xO=0} + \setyAxis{yMin=0, yMax=15, Dy=5, yO=0} + + \plotxAxis[NoLabel]{x-axis label} + \plotyAxis[NoLabel]{y-axis label} + + \listplot[style=StdLineStyA]{\MoreData} + \listplot[style=StdLineStyB, yEnd=10]{\MoreData} + \listplot[style=StdLineStyC, xStart=5, xEnd=9]{\MoreData} + \listplot[style=StdLineStyD, showpoints=true, nStep=2]{\MoreData} +\end{NumericDataPlot} +\end{minipage} + + + +\subsection{Fill area between plots} +\label{sec:FillArea} + +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + \begin{NumericDataPlot}% + {\textwidth}{5cm} + \setxAxis + {xMin=0, xMax=15, Dx=5, xO=0} + \setyAxis + {yMin=-15, yMax=15, Dy=5, yO=10} + + \plotxAxis{x-axis label} + \plotyAxis[NoLabel]{} + + \pscustom% + [style=StdLineStyA, fillstyle=solid, % + fillcolor=blue!40]{% + \listplot{\MoreData}% + \listplot[ChangeOrder]{\MoreDataI}% + } + \end{NumericDataPlot} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.45\linewidth} +\centering + \begin{NumericDataPlot}{\textwidth}{5cm} + \setxAxis{xMin=0, xMax=15, Dx=5, xO=0} + \setyAxis{yMin=-15, yMax=15, Dy=5, yO=10} + + \plotxAxis{x-axis label} + \plotyAxis[NoLabel]{} + + \pscustom[style=StdLineStyA, fillstyle=solid, fillcolor=blue!40]{% + \listplot{\MoreData}% + \listplot[ChangeOrder]{\MoreDataI}% + } + \end{NumericDataPlot} +\end{minipage} + + + + + + +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + ... + \pscustom% + [style=StdLineStyA, fillstyle=solid, % + fillcolor=green!40]{% + \NDPhline{0} + \listplot[ChangeOrder]{\MoreDataI}% + } + ... +\end{verbatim} +\end{minipage}\begin{minipage}{0.45\linewidth} +\centering + \begin{NumericDataPlot}{\textwidth}{5cm} + \setxAxis{xMin=0, xMax=15, Dx=5, xO=0} + \setyAxis{yMin=-15, yMax=15, Dy=5, yO=10} + + \plotxAxis{x-axis label} + \plotyAxis[NoLabel]{} + + \pscustom% + [style=StdLineStyA, fillstyle=solid, % + fillcolor=green!40]{% + \NDPhline{0} + \listplot[ChangeOrder]{\MoreDataI}% + } + \end{NumericDataPlot} +\end{minipage} + + +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + ... + \pscustom% + [style=StdLineStyA, fillstyle=solid, % + fillcolor=red!40]{% + \NDPline{0}{5}{11}{10} + \listplot[ChangeOrder]{\MoreDataI}% + } + ... +\end{verbatim} +\end{minipage} +\begin{minipage}{0.45\linewidth} +\centering + \begin{NumericDataPlot}{\textwidth}{5cm} + \setxAxis{xMin=0, xMax=15, Dx=5, xO=0} + \setyAxis{yMin=-15, yMax=15, Dy=5, yO=10} + + \plotxAxis{x-axis label} + \plotyAxis[NoLabel]{} + + \pscustom% + [fillstyle=solid, linestyle=none,% + fillcolor=red!40]{% + \NDPline{0}{5}{11}{10} + \listplot[ChangeOrder]{\MoreDataI}% + } + \listplot[style=StdLineStyB]{\MoreDataI} + \end{NumericDataPlot} +\end{minipage} + + +\subsection{Custom Grid} + +To plot a custom grid (grid-lines are not equidistant) the following procedure +may be used if working with Matlab: + +Add the following code after export2latex (XTick is a vector containing the +positions of the desired x-gridlines): +\begin{verbatim} + % export positions of the x-Tick-Marks + fid = fopen(TargetTexFile, 'at'); + fprintf(fid, '\n\\def\\CustomXGrid{\n'); + for i=1:length(XTick) + fprintf(fid, ... + '\\NDPvline[style=CustomXGridStyle]{%f}\n', adj.XTick(i)); + end + fprintf(fid, '}\n'); + fclose(fid); +\end{verbatim} + +In Latex just define the style ``CustomXGridStyle'' and use the command +\verb+\CustomXGrid+ after defining the axis. + + +\subsection{Plotting noisy data} +\label{sec:FurtherExamples:NoisyData} + +Plotting measurement data with a lot of noise may be a little tricky. First, you +often have a lot of data to plot which may lead to memory problems in \TeX. +When filtering the data, the appearance of the noise may change which is not +what you intend to do. To solve this problem, the two Matlab-functions +``LatexFilterMinMax'' and ``LatexFilterHull'' are provided. Both take x- and +y-data and divide it in NrOfPoints equally intervals. The filter returns the +maximum and the minimum value of each interval. + +The filter ``LatexFilterHull'' returns a vector which contains the minima first +and then the maxima. This data may be plotted with ``fillstyle=solid'' as in +section~\ref{sec:FillArea}. + +The filter ``LatexFilterMinMax'' returns maximum and minimum value of each +interval (with corresponding x-data). This data may be plotted as a ``normal +line''. As pstricks-lines are normally closed lines, this may lead to a plot +where the noise seems exagerated. You may therefore use the option linejoin as +demonstrated in the following examples. The red dots mark the actual data. +Notice that the measurement data seems noisier than it is if it is plotted with +linejoin=0. Plotting with linejoin=2 represents the data much better. The +standard for linejoin is 0. The StdLineStyXX defined in this package are defined +with linejoin=1. + +\begin{minipage}{0.4\linewidth} +\begin{verbatim} + ... + % linejoin=0: + \listplot[linewidth=5pt]% + {\NoiseData}% + ... + % linejoin=1: + \listplot[linejoin=1, % + linewidth=5pt]{\NoiseData}% + ... + % linejoin=2: + \listplot[linejoin=1, % + linewidth=5pt]{\NoiseData}% + ... +\end{verbatim} +\end{minipage} +\begin{minipage}{0.55\linewidth} +\centering + \begin{NumericDataPlot}{\textwidth}{5cm} + \setxAxis{xMin=0.00, xMax=0.5, Dx=0.25, xO=0.00, + xCoordMin=0, xCoordMax=300} + \setyAxis{yMin=4.5, yMax=5.5, Dy=0.5} + + \plotxAxis{linejoin=0} + \plotyAxis[NoLabel]{} + + \listplot[linewidth=5pt]{\NoiseData}% + \listplot[plotstyle=dots, linecolor=red, dotsize=2pt]{\NoiseData} + + \setxAxis{xMin=0.00, xMax=0.5, Dx=0.25, xO=0.00, + xCoordMin=330, xCoordMax=630} + \setyAxis{yMin=4.5, yMax=5.5, Dy=0.5} + + \plotxAxis{linejoin=1} + \plotyAxis[NoTickLabel,NoLabel]{} + + \listplot[linejoin=1, linewidth=5pt]{\NoiseData}% + \listplot[plotstyle=dots, linecolor=red, dotsize=2pt]{\NoiseData} + + \setxAxis{xMin=0.00, xMax=0.5, Dx=0.25, xO=0.00, + xCoordMin=660, xCoordMax=1000} + \setyAxis{yMin=4.5, yMax=5.5, Dy=0.5} + + \plotxAxis{linejoin=2} + \plotyAxis[NoTickLabel,NoLabel]{} + + \listplot[linejoin=2, linewidth=5pt]{\NoiseData}% + \listplot[plotstyle=dots, linecolor=red, dotsize=2pt]{\NoiseData} + + \end{NumericDataPlot} +\end{minipage} + +\begin{minipage}{0.48\linewidth} + \centering + \includegraphics{fig_NoiseData_ClosedLine} +\end{minipage} +\begin{minipage}{0.48\linewidth} + \centering + \includegraphics{fig_NoiseData_OpenLine} +\end{minipage} + + + +\subsection{Customized Tick Labels}\label{sec:CustomTickLabels} + +A common task is to plot a graph without numeric tick labels but with selected customized labels. This is easily accomplished by setting the option \verb|NoTickLabel| when plotting the axis and adding the customized labels with the commands \verb|PutTickLabelXaxis| and \verb|PutTickLabelYaxis|. Note that when setting \verb|NoTickLabel| for an axis, the option \verb|ax| has to be set in each call of \verb|PutTickLabelXaxis| and \verb|PutTickLabelYaxis| according to the axis one wishes to place the label at. This is also required if only the lower x-axis or left y-axis are plotted and tick labelled. + +\begin{minipage}[T]{0.5\linewidth} + \lstinputlisting[linerange=5-12]{examples/furtherEx_TickLabels} +\end{minipage} +\hspace{1ex} +\begin{minipage}[T]{0.4\linewidth} + \input{examples/furtherEx_TickLabels} +\end{minipage} diff --git a/graphics/pstricks/contrib/numericplots/doc/src/MatlabSupport.tex b/graphics/pstricks/contrib/numericplots/doc/src/MatlabSupport.tex new file mode 100644 index 0000000000..6d6a5fe80d --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/doc/src/MatlabSupport.tex @@ -0,0 +1,137 @@ + +\section{Matlab Support} + + +\subsection{export2latex.m} +The function \texttt{export2latex(data, filename, [options])} may be used to +export data from Matlab to be used with NumericPlots.sty. The function takes the +two parameters data and filename, where filename is the name of the file where +the data should be stored with full path but without extension. Data is a +structure with the three entries x, y, and ident, where x are the x-data, y the +y-data and ident is an identifier to have access to the data in Latex. To access +the data in Latex the command \verb+\Data+ is used. + +The parameter data may be provided as an 1xK array if each entry of the array is +a structure with the entries x, y and ident. There may be an additional entry +descr. +\begin{itemize} + \item data(1,i).x = $X_i$ + \item data(1,i).y = $Y_i$ + \item data(1,i).ident = Identifier + \item (data(1,i).descr = Description) + \item (data(1,i).group = GroupNr) +\end{itemize} +Identifier must be a valid Latex command name, which basically means it must be +a string without numbers. + +For every entry of data, $X$ and $Y$ must be arrays of the same size +$M\text{x}N$. If $M>1$, each column of the array is exported to the file and the +identifier is expanded by the roman representation of the column number. + +It might be useful to do a \texttt{interp1} before exporting the data to get +smaller files and to use less of \TeX's memory. ($\rightarrow$ script +Patrick?!?) + +The optional parameter \texttt{options} might be used to control which +additional information is provided in the output file. +\begin{itemize} + \item \texttt{options.DataBoundaries} [true] If set to true, the output file + contains the commands \verb+\DataXmin+, \verb+\DataXmax+, \verb+\DataYmin+ and + \verb+\DataYmax+ which may be used to define the axis. + \item \texttt{options.AxisBoundaries} [false] If set to true, the output file + contains the commands \verb+\DataXminAxis+, \verb+\DataXmaxAxis+, + \verb+\DataYminAxis+ and \verb+\DataYmaxAxis+ which may be used to define the + axis. In contrary to the DataBoundaries the AxisBoundaries add an additional + gap of \texttt{options.AxisBoundariesGap} [10] percent of the full scale to + the data boundaries such that the plot doesn't touch the axis. + \item \texttt{options.SuppressWarning} [false] suppresses the warning about + max/min values being to close together + \item \texttt{options.precision} [empty] how many decimal places should be + printed for x and y values. Will be calculated automatically if left empty. + \item \texttt{options.NaNsplit [false]} if true, the data will be split at NaN + values. See \verb+\multilistplot+ for how to plot them. +\end{itemize} + +\subsection{struct2latex.m} +The function\\ +\texttt{struct2latex(data,[xname],[downsample],[filtertype],[filename],[postfix],[options])}\\ +may be used to export a Matlab struct to be used with NumericPlots.sty. The +function is based on export2latex and the \verb+options+ argument is given to +export2latex. The optional argument \verb+xname+ specifies the fieldname of the +x-data. If no \verb+xname+ is given, you have to chose one via popup. All other +fields are treated like y-data. Furthermore, the identifier of the y-data are +equal to the fieldnames and have to be valid Latex commands (fieldnames with +numbers are not supported). The struct2latex command only supports 1 dimensional +arrays (row vectors). Column vectors are mapped for propper export without +warning. With the optional argument \verb+downsample+ (integer$>0$) it is +possible to downsample the data for smaller files. A warning is given when data +points exceed $5000$. Usually $1000$ data points are enough for a propper plot +in latex. The optional argument \verb+filename+ specifies the outputname with +path of the texfile. If no filename is given, it has to be chosen via popup. The +optional argument \verb+postfix+ can be used to put a postfix after the +fieldname in the identifier of the y-data. The \verb+options+ argument is also +optional and equal to the options argument of the function export2latex. + +Filter may be one of \verb+{'none','MinMax','Hull'}+. The corresponding +filter will be applied to the data before exporting it. See +\ref{sec:FurtherExamples:NoisyData} for further details. + +Matlab example. +\begin{verbatim} + % data for struct2latex should be row-vectors. anyway, column-vectors are + % mapped to row-vectors. matrices are not supported + + %% export row-vectors + t = [1:0.1:10]; + + data.time = t; + data.sin = sin(t); + data.cos = cos(t); + data.exp = exp(t); + data.tan = tan(t); + + %struct2latex(data,xname,downsample,filename,filtertype,postfix,options) + %downsample,filename,postfix,options are optional arguments + struct2latex(data,'time',1,'none','texdataA','row'); +\end{verbatim} + +\subsection{dspace2struct} +The function \texttt{dspace2struct(dataname,version)} may be used to import +\texttt{.mat} created by \textsc{dSpace} to \textsc{Matlab}. It returns a +\textsc{Matlab} struct out of the provided variables \verb+dataname+ and +\verb+version+. Thereby \verb+dataname+ is the name of the \textsc{dSpace} +\verb+.mat+ file and the optional string argument \verb+version+ has to be equal +\verb+version = 'NG'+ if \textsc{dSpace Control Desk Next Generation} is used. +It is convenient to chose a unique signal name in \textsc{Matlab/Simulink} +because they will be the same in \textsc{dSpace}. The function +\texttt{dspace2struct(dataname,version)} just adopts the names provided by +\textsc{dSpace} and use them as fieldnames. The time vector will always be +called \verb+.time+. + +Matlab example: +\begin{verbatim} + % Old Control Desk: + dataOG = dspace2struct(measurements) + % Control Desk Next Generation: + dataNG = dspace2struct(measurements,'NG') +\end{verbatim} + +The resulting structs \verb+dataOG+ and \verb+dataNG+ differ in way of +structuring. In the older versions of \textsc{dSpace} it was only possible to +save one time vector. The \textsc{dSpace Control Desk Next Generation} allows to +save several time vectors. So it was necessary to save the index of the time +vector with the signal name. Typical plot commands for the two data structures +look as follows: +\begin{verbatim} + %Old Control Desk + plot(dataOG.time,dataOG.signalname); + + %Control Desk Next Generation + plot(dataNG.time(dataNG.signalname.timeidx),dataNG.signalname.Data); +\end{verbatim} +\subsection{dspace2latex} +The function \texttt{dspace2latex} is just a combination of +\texttt{dspace2struct} and \texttt{struct2latex} with commonly used arguments. +It is a simple and quick way to export measurements from \textsc{dSpace} to +\LaTeX{} without any revision of the data. However, the current implementation +allows only data structures of the old version of \textsc{dSpace Control Desk}. diff --git a/graphics/pstricks/contrib/numericplots/doc/src/MultiplePlots.tex b/graphics/pstricks/contrib/numericplots/doc/src/MultiplePlots.tex new file mode 100644 index 0000000000..9985b8614e --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/doc/src/MultiplePlots.tex @@ -0,0 +1,45 @@ +% Copyright 2010 Thomas Koenig, Alexander Michel +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + + +\section{Multiple plots in one picture}\label{sec:MultiplePlots} + +xPicMin, xPicMax, yPicMin and yPicMax are the inner coordinates of one picture. +The position of the axes are defined in this coordinate system via xCoordMin, +xCoordMax, yCoordMin and yCoordMax. + +Example: + + +\lstinputlisting[firstline=8]{examples/multiplots_exampleI} + +\input{examples/multiplots_exampleI} + + +An example with different y-axes on the left and on the right side: + +\lstinputlisting{examples/multiplots_exampleII} + +\input{examples/multiplots_exampleII} + + +It is also possible to rotate the labels of the axes (LabelRot and LabelRefPt +have to be set after AxisStyle!): + +\lstinputlisting[firstline=12, lastline=20]{examples/multiplots_exampleIII} + +\input{examples/multiplots_exampleIII} diff --git a/graphics/pstricks/contrib/numericplots/doc/src/NumericPlotsDoc.tex b/graphics/pstricks/contrib/numericplots/doc/src/NumericPlotsDoc.tex new file mode 100644 index 0000000000..8ce4b122bd --- /dev/null +++ b/graphics/pstricks/contrib/numericplots/doc/src/NumericPlotsDoc.tex @@ -0,0 +1,210 @@ +% Copyright 2013 Thomas Koenig, Alexander Michel, Michael Baumgart +% +% This file is part of NumericPlots. +% +% NumericPlots is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% any later version. +% +% NumericPlots 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with NumericPlots. If not, see . + + +\documentclass[parskip]{scrartcl} + +\usepackage[ansinew]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} + +\usepackage{amsmath} +\usepackage{siunitx} +% \usepackage{floatbarrier} +% \usepackage{showexpl} +\usepackage{etex} % use e-TeX’s extended register set + +% options for package: +% BW: black and white +% AxisStyle=