[pstricks] log-log-plot

Poul Riis Poul.Riis at skolekom.dk
Wed Feb 6 16:48:07 CET 2008


Thank you, Herbert!
The version below is pretty close to what I actually want.
What remains is to include automatic labeling in the loglogpaper macro.
I'm afraid that's a rather tedious task...

Yours,
Poul Riis



\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames,svgnames,x11names]{pstricks}
\usepackage{pstricks-add}
\usepackage{geometry}
\geometry{tmargin=1cm,textwidth=17.0cm,textheight=25.5cm,headheight=15pt}

\newcommand{\loglogplot}[4]{\pscircle*[linecolor=#4](!#1 log #2
log){0.5pt}\pscircle[linecolor=#4,linewidth=0.5pt](!#1 log #2 log){#3pt}}
\newcommand{\loglogplotlabeled}[5]{\pscircle*[linecolor=#4](!#1 log #2
log){0.5pt}\pscircle[linecolor=#4,linewidth=0.5pt](!#1 log #2
log){#3pt}\uput{5pt}[0](!#1 log #2 log){\color{#4}#5}}
\newcommand{\loglogpaper}[6]{%no of x-decades,no of y-decades, minimum
x-power, minimum y-power,gridcolor, subgridcolor
\multido{\nxdec=0+1}{#1}{\multido{\nx=1.1+0.1}{39}{\psline[linewidth=0.1pt,linecolor=#6](!\nx\space
log #3 add \nxdec\space add #4)(!\nx\space log #3 add \nxdec\space add #4
#2 add)}%
\multido{\nx=5.2+0.2}{24}{\psline[linewidth=0.1pt,linecolor=#6](!\nx\space
log #3 add \nxdec\space add #4)(!\nx\space log #3 add \nxdec\space add #4
#2 add)}%
\multido{\nx=1.5+1.0}{4}{\psline[linewidth=0.3pt,linecolor=#6](!\nx\space
log #3 add \nxdec\space add #4)(!\nx\space log #3 add \nxdec\space add #4
#2 add)}%
\multido{\nx=1+1}{9}{\psline[linewidth=0.5pt,linecolor=#5](!\nx\space log
#3 add \nxdec\space add #4)(!\nx\space log #3 add \nxdec\space add #4 #2
add)}}\psline[linewidth=0.5pt,linecolor=#5](!#3 #1 add #4)(!#3 #1 add #4
#2 add)
\multido{\nydec=0+1}{#2}{\multido{\ny=1.1+0.1}{39}{\psline[linewidth=0.1pt,linecolor=#6](!#3
\ny\space log #4 add \nydec\space add)(!#3 #1 add \ny\space log #4 add
\nydec\space add)}%
\multido{\ny=5.2+0.2}{24}{\psline[linewidth=0.3pt,linecolor=#6](!#3
\ny\space log #4 add \nydec\space add)(!#3 #1 add \ny\space log #4 add
\nydec\space add)}%
\multido{\ny=1.5+1.0}{4}{\psline[linewidth=0.1pt,linecolor=#6](!#3
\ny\space log #4 add \nydec\space add)(!#3 #1 add \ny\space log #4 add
\nydec\space add)}%
\multido{\ny=1+1}{9}{\psline[linewidth=0.5pt,linecolor=#5](!#3 \ny\space
log #4 add \nydec\space add)(!#3 #1 add \ny\space log #4 add \nydec\space
add)}}\psline[linewidth=0.5pt,linecolor=#5](!#3 #4 #2 add)(!#3 #1 add #4
#2 add)}

\pagestyle{empty}
\parindent=0em

\def\xUPut#1{\uput{3pt}[270](!#1 log 0){#1}}
\def\yUPut#1{\uput{3pt}[180](!1 neg #1 log){#1}}

\begin{document}
\begin{center}
\psset{unit=7.5cm}
\pspicture(-1.15,-0.15)(1,3)
\loglogpaper{2}{3}{-1}{0}{Red1}{LightPink1}
\tiny
\multido{\nA=1+1,\nB=10+10,\nC=100+100}{9}{%
	\yUPut{\nA}\yUPut{\nB}\yUPut{\nC}}
\yUPut{1000}
%\psforeach{\nA}{8, 80, 800, 1000}{\yUPut{\nA}}
%
\multido{\nA=0.1+0.1}{9}{\xUPut{\nA}}
\multido{\nA=1+1}{10}{\xUPut{\nA}}
%\psforeach{\nA}{0.1, 8, 10}{\xUPut{\nA}}
%
\footnotesize
\uput{15pt}[270](!1 log 0){Radius of orbit (mill. km)}
\uput{15pt}[180]{90}(!0.1 log 40 log){Siderical time of revolution (days)}
\normalsize
\loglogplotlabeled{0.422}{1.76914}{2.0}{Green1}{Io}
\loglogplotlabeled{0.671}{3.55118}{2.0}{Green2}{Europa}
\loglogplotlabeled{1.070}{7.15455}{2.0}{Green3}{Ganymede}
\loglogplotlabeled{1.883}{16.68902}{2.0}{Green4}{Callisto}
\endpspicture
\end{center}

\end{document}




More information about the PSTricks mailing list