[pstricks] problem with def and dataplot

Jean-Côme Charpentier jean-come.charpentier at wanadoo.fr
Sat Mar 28 15:01:05 CET 2015


Le 28/03/2015 08:12, cyrille piatecki a écrit :
> In the following exemple
> [...]
>
> the plot is not done. But without the defininition and the scalebox it
> works
>

   It doesn't make sense to put a \savedata command inside the argument 
of \psscalebox (nor inside argument of \rput). Defining \savedata 
outside the \gu command works:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{pstricks,pst-plot,pstricks-add}
\begin{document}
\begin{center}
\begin{pspicture}(0,0)(14,6)
\savedata{\hellcl}[%
{{1, 0.840},
{2, 0.779},
{3, 0.704},
{4, 0.598}}]
\savedata{\hellcs}[%
{{1, 0.529},
{2, 0.523},
{3, 0.582},
{4, 0.833}}]
\psgrid
\def\gu{%
\psline{<->}(3,5)(3,2)(10,2)
\rput(10.2,2){\tiny$n$}
\rput(2.8,5){\tiny$\mathcal{H}$}
\rput(2.6,4.35){\tiny$0.840$}
\rput(9.5,3.35){\tiny$0.779$}
\rput(7.,4.05){\tiny$0.704$}
\rput(5.,4.3){\tiny$0.589$}
\rput(2.6,3.1){\tiny$0.529$}
\rput(5,3.3){\tiny$0.523$}
\rput(7,3.1){\tiny$0.582$}
\rput(9.5,4.3){\tiny$0.833$}
\rput(4,4.5){\tiny Greedy}
\rput(4,2.785){\tiny Simulation}
% 1\ = 10, 2 = 50, 3 = 100, 4 = 1000
\dataplot[origin={1,1}, xunit=2cm, 
yunit=4cm,showpoints=true,linecolor=red]{\hellcl}
\dataplot[origin={1,1}, xunit=2cm, 
yunit=4cm,linecolor=blue,showpoints=true]{\hellcs}
}
\rput(0,0){\psscalebox{.8 .8}{\gu}}
\end{pspicture}
\end{center}
\end{document}

   Jean-Côme Charpentier


More information about the PSTricks mailing list