PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Daten zoomen mit pscustom und listplot



Finntheone
08-01-2014, 12:22
Hallo zusammen,

ich möchte Daten in einem Graph darstellen. Dazu möchte ich einen bestimmten Ausschnitt noch genauer heranzoomen. Nun stehe ich aber beim heranzoomen an.
Die Daten sollten dann formatmässig genau gleich wie im "Original" dargestellt werden. Zusätlich möchte ich auch wieder die Achsen mit \psaxes einblenden.
Das Problem ist, dass wenn ich in der \pscustom Umgebung die Achsen einblende, zwei Fehler auftreten (unterhalb des Minimalbeispiels). Zudem wird der Ausschnitt der Daten nicht mit dem entsprechenden Offset dargestellt.
Könnt ihr mir weiterhelfen?

Viele Grüsse

Finntheone



\documentclass[a4paper]{scrreprt}

\usepackage[dvipsnames, pologue]{pstricks}
\usepackage{pst-plot}
\usepackage{filecontents}

\begin{filecontents*}{data1.dat}
0 420 0.1 750 0.2 755 0.3 745 3.5 760 3.6 740 3.7 742 3.8 748 3.9 751 4.0 753 4.1 755 4.2 748 4.3 756 4.4 750 4.5 752 4.6 756 4.7 758 4.8 759 4.9 746 5.0 761
\end{filecontents*}
\begin{filecontents*}{dataII.dat}
0 422 0.1 754 0.2 758 0.3 740 3.5 752 3.6 748 3.7 746 3.8 744 3.9 755 4.0 757 4.1 745 4.2 749 4.3 750 4.4 752 4.5 758 4.6 744 4.7 753 4.8 755 4.9 749 5.0 752
\end{filecontents*}

\begin{document}
\psset{xunit=2.06cm,yunit=0.02cm}
\begin{pspicture}(-0.45,370)(6.0,850)
\readdata{\data}{data1.dat}
\readdata{\dataII}{dataII.dat}
\listplot[showpoints, plotstyle=line, linecolor=red]{\data}
\listplot[showpoints, dotstyle=SolidTriangle, plotstyle=line, linecolor=blue]{\dataII}
\psaxes[Oy=400,Dx=0.5,Dy=50]{->}(0,400)(5.5,825)
\rput[lb](1,500){%
\pscustom[xunit=1cm, yunit=0.01cm]{
\listplot[showpoints, plotstyle=line, linecolor=red, xStart=3.6, xEnd=4.9]{\data}
\listplot[showpoints, dotstyle=SolidTriangle, plotstyle=line, linecolor=blue, xStart=3.6, xEnd=4.9]{\dataII}
\psaxes[Ox=4, Oy=725,Dx=0.5, Dy=25]{->}(4,725)(5.5,775)
}
}
\end{pspicture}
\end{document}


Fehler:


! Misplaced special graphics object command.
\@pstrickserr ... immediate help.}\errmessage {#1}
\endgroup
l.37 }

Your command was ignored. Will recover best I can.
Type <return> to procede.

PSTricks error. See User's Guide for further information.
Type H <return> for immediate help.
! Misplaced special graphics object command.
\@pstrickserr ... immediate help.}\errmessage {#1}
\endgroup
l.37 }

Your command was ignored. Will recover best I can.
Type <return> to procede.

Finntheone
13-01-2014, 08:34
Mittlerweile habe ich herausgefunden, dass das Problem eigentlich ausschliesslich an psaxes liegt. Irgendwie können keine Koordinatenachsen in der pscustom umgebung gezeichnet werden. Weiss irgendjemand Rat? Zudem werden in der pscustom-Umgebung die Datenpunkte nicht dargestellt. Ich kann die Option showpoints sowohl in pscustom als auch in listplot ohne Erfolg einfügen.

Angepasstes Minimalbeispiel:

\documentclass[a4paper]{scrreprt}

\usepackage[dvipsnames, pologue]{pstricks}
\usepackage{pst-plot}
\usepackage{filecontents}

\begin{filecontents*}{data1.dat}
0 420 0.1 750 0.2 755 0.3 745 3.5 760 3.6 740 3.7 742 3.8 748 3.9 751 4.0 753 4.1 755 4.2 748 4.3 756 4.4 750 4.5 752 4.6 756 4.7 758 4.8 759 4.9 746 5.0 761
\end{filecontents*}
\begin{filecontents*}{dataII.dat}
0 422 0.1 754 0.2 758 0.3 740 3.5 752 3.6 748 3.7 746 3.8 744 3.9 755 4.0 757 4.1 745 4.2 749 4.3 750 4.4 752 4.5 758 4.6 744 4.7 753 4.8 755 4.9 749 5.0 752
\end{filecontents*}

\begin{document}
\psset{xunit=2.06cm,yunit=0.02cm}
\begin{pspicture}(-0.45,370)(6.0,850)
\readdata{\data}{data1.dat}
\readdata{\dataII}{dataII.dat}
\listplot[showpoints, plotstyle=line, linecolor=red]{\data}
\listplot[showpoints, dotstyle=SolidTriangle, plotstyle=line, linecolor=blue]{\dataII}
\psaxes[Oy=400,Dx=0.5,Dy=50]{->}(0,400)(5.5,825)
\rput[lb](-8,-3200){%
\pscustom[xunit=5cm, yunit=0.1cm, showpoints, plotstyle=line, linecolor=red]{
\listplot[showpoints, xStart=3.6, xEnd=4.9]{\data}
}
\pscustom[xunit=5cm, yunit=0.1cm, showpoints, plotstyle=line, linecolor=blue]{
\listplot[showpoints, dotstyle=SolidTriangle, xStart=3.6, xEnd=4.9]{\dataII}
}
\pscustom[xunit=5cm, yunit=0.1cm]{
%\psaxes[Ox=4, Oy=725,Dx=0.5, Dy=25]{->}(4,725)(5.5,775)
}
}
\end{pspicture}
\end{document}


Grüsse

Finntheone

FelixT
14-01-2014, 08:29
Hallo Finntheone,

pstricks und pst-plot sind super Pakete - nur falls Du nicht auf pstricks und pst-plot festgelegt bist und evtl. eine Alternative probieren willst: das Paket pgfplots ist eine sehr gute Möglichkeit zum Plotten, basiert auf pgf, daher sollte auch die sogennannte spy-Library von pgf/TikZ funktionieren zur Ausschnittvergrößerung.

Felix

Finntheone
14-01-2014, 14:02
Hallo Felix,

besten Dank für dein Feedback. Muss mir mal das Paket pgfplots anschauen.

Ich habe das Problem nun so gelöst, dass ich psgraph verwende. So habe ich alles was ich wollte.

Viele Grüsse

Finntheone

Minimalbeispiel:


\documentclass[a4paper]{scrreprt}

\usepackage[dvipsnames, pologue]{pstricks}
\usepackage{pst-plot}
\usepackage{filecontents}

\begin{filecontents*}{data1.dat}
0 420 0.1 750 0.2 755 0.3 745 3.5 760 3.6 740 3.7 742 3.8 748 3.9 751 4.0 753 4.1 755 4.2 748 4.3 756 4.4 750 4.5 752 4.6 756 4.7 758 4.8 759 4.9 746 5.0 761
\end{filecontents*}
\begin{filecontents*}{dataII.dat}
0 422 0.1 754 0.2 758 0.3 740 3.5 752 3.6 748 3.7 746 3.8 744 3.9 755 4.0 757 4.1 745 4.2 749 4.3 750 4.4 752 4.5 758 4.6 744 4.7 753 4.8 755 4.9 749 5.0 752
\end{filecontents*}

\begin{document}
\psset{xAxisLabel={$x_1$}, yAxisLabel={$y_1$}}
\psgraph[Oy=400, Dx=0.5, Dy=50]{->}(0,400)(5.5,825){12cm}{9cm}
\listplot[showpoints, plotstyle=line, linecolor=red]{\data}
\listplot[showpoints, dotstyle=SolidTriangle, plotstyle=line, linecolor=blue]{\dataII}
\rput[lb](1.5,470){
\psset{xAxisLabel={$x_2$}, yAxisLabel={$y_2$}}
\psgraph[Ox=3.5, Oy=740, Dx=0.5, Dy=7.5]{->}(3.5,740)(5.1,765){7.5cm}{4.8cm}
\listplot[showpoints, linecolor=red, xStart=3.5, xEnd=4.9]{\data}
\listplot[showpoints, dotstyle=SolidTriangle, linecolor=blue, xStart=3.5, xEnd=4.9]{\dataII}
\endpsgraph
}
\endpsgraph
\end{document}