2

Consider the following example:

\documentclass{article}

\usepackage{pst-plot}

\begin{document}

\psset{xunit=0.1,yunit=0.002}
\savedata{\data}[{1924,300},{1928,510},{1932,310},{1936,880},{1948,700},
{1952,730},{1956,820},{1960,660},{1964,1100},{1968,1160},
{1972,1220},{1976,1130},{1980,1070},{1984,1300},{1988,1430},
{1992,1810},{1994,1750},{1998,2176},{2002,2399}]
\begin{pspicture}(-9,-240)(102,2950)
  \psaxes[
    dx=10,
    dy=500,
    labels=none,
    ticklinestyle=dotted,
    tickwidth=0.5pt,
    xticksize=0 2500,
    yticksize=0 90
  ]{->}(0,0)(0,0)(95,2750)[Year,0][Participants,90]
  \psaxes[
    Ox=1920,
    Dx=10,
    Dy=500
  ](0,0)(0,0)(95,2750)
  % Data (NOT working)
  \dataplot[
    plotstyle=dots,
    dotstyle=o,
    fillcolor=red
  ]{\data}
  % Years 1924--1976
  \psplot[
    linecolor=blue,
    algebraic
  ]{4}{56}{15.6394*x+303.3}% Regression with Mathematica
  % Years 1980--2002
  \psplot[
    linecolor=blue,
    algebraic
  ]{60}{82}{60.793*x-2619.99}% Regression with Mathematica
\end{pspicture}

\end{document}

output

How do I show the data in the plot?

I was thinking of using \pstScalePoints to scale the data on the x-axis but this only works with listplot according to the manual.

P.S. I will really like not to use psgraph; I'm not a big fan of the syntax.

3
\documentclass{article}
\usepackage{pst-plot}
\begin{document}

\savedata{\data}[{1924,300},{1928,510},{1932,310},{1936,880},{1948,700},
{1952,730},{1956,820},{1960,660},{1964,1100},{1968,1160},
{1972,1220},{1976,1130},{1980,1070},{1984,1300},{1988,1430},
{1992,1810},{1994,1750},{1998,2176},{2002,2399}]
\newpsstyle{gridstyle}{gridlabels=0pt,griddots=5,subgriddiv=0}

\begin{pspicture}[showgrid](-0.5,-0.5)(9.49,5.49)
  \psaxes[Ox=1920,Dx=10,dx=1,Dy=500,dy=1]{->}(0,0)(9.4,5.4)[Year,0][Participants,90]
  \pstScalePoints(1,1){ 1920 sub 10 div}{ 500 div }
  \listplot[plotstyle=dots,dotstyle=*,linecolor=red]{\data}
  % Years 1924--1976
  \psplot[linecolor=blue,algebraic]{0.4}{5.6}{(15.6394*x*10+303.3)/500}% Regression with Mathematica
  % Years 1980--2002
\psplot[linecolor=blue,algebraic]{6}{8.2}{(60.793*x*10-2619.99)/500}% Regression with Mathematica
\end{pspicture}

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.