[pstricks] log-log-plot

Poul Riis Poul.Riis at skolekom.dk
Wed Feb 6 20:34:31 CET 2008


Ooops - there was a typing error in the time of revolution of Venus.
Inspecting the graph carefully this was quite obvious!

Poul Riis



\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage[dvipsnames,svgnames,x11names]{pstricks}
\usepackage{pstricks-add}
\usepackage{geometry}
\geometry{tmargin=1cm,textwidth=19.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}[8]{%no of x-decades, no of y-decades, minimum
x-power, minimum y-power,gridcolor, subgridcolor, xaxislabel, yaxislabel
\tiny%
\multido{\nxdec=#1+-1}{#1}{\multido{\nx=1.1+0.1}{39}{\psline[linewidth=0.1pt,linecolor=#6](!\nx\space
log #3 add \nxdec\space add 1 sub #4)(!\nx\space log #3 add \nxdec\space
add 1 sub #4 #2 add)}%
\multido{\nx=5.2+0.2}{24}{\psline[linewidth=0.1pt,linecolor=#6](!\nx\space
log #3 add \nxdec\space add 1 sub #4)(!\nx\space log #3 add \nxdec\space
add 1 sub #4 #2 add)}%
\multido{\nx=1.5+1.0}{4}{\psline[linewidth=0.3pt,linecolor=#6](!\nx\space
log #3 add \nxdec\space add 1 sub #4)(!\nx\space log #3 add \nxdec\space
add 1 sub #4 #2 add)}%
\multido{\nx=2+1}{9}{\psline[linewidth=0.5pt,linecolor=#5](!\nx\space log
#3 add \nxdec\space add 1 sub #4)(!\nx\space log #3 add \nxdec\space add 1
sub #4 #2 add)}%
\multido{\nx=2+1}{8}{\uput{3pt}[270](!\nx\space log #3 add \nxdec\space
add 1 sub  #4){\nx}}%
\uput{8pt}[270](!#3 \nxdec\space add 1 sub 1 add #4){$10^{\nxdec}$}}%
\uput{8pt}[270](!#3 #4){$10^{#3}$}%
\psline[linewidth=0.5pt,linecolor=#5](!#3 #4)(!#3 #4 #2 add)%
\multido{\nydec=#2+-1}{#2}{\multido{\ny=1.1+0.1}{39}{\psline[linewidth=0.1pt,linecolor=#6](!#3
\ny\space log #4 add \nydec\space add 1 sub)(!#3 #1 add \ny\space log #4
add \nydec\space add 1 sub)}%
\multido{\ny=5.2+0.2}{24}{\psline[linewidth=0.3pt,linecolor=#6](!#3
\ny\space log #4 add \nydec\space add 1 sub)(!#3 #1 add \ny\space log #4
add \nydec\space add 1 sub)}%
\multido{\ny=1.5+1.0}{4}{\psline[linewidth=0.1pt,linecolor=#6](!#3
\ny\space log #4 add \nydec\space add 1 sub)(!#3 #1 add \ny\space log #4
add \nydec\space add 1 sub)}%
\multido{\ny=2+1}{9}{\psline[linewidth=0.5pt,linecolor=#5](!#3 \ny\space
log #4 add \nydec\space add 1 sub)(!#3 #1 add \ny\space log #4 add
\nydec\space add 1 sub)}%
\multido{\ny=2+1}{8}{\uput{3pt}[180](!#3 \ny\space log #4 add \nydec\space
add 1 sub){\ny}}%
\uput{8pt}[180](!#3 #4 \nydec\space add){$10^{\nydec}$}}%
\uput{8pt}[180](!#3 #4){$10^{#4}$}%
\psline[linewidth=0.5pt,linecolor=#5](!#3 #4)(!#3 #1 add #4)%
\footnotesize%
\uput{16pt}[270](!#1 2 div #3 add #4){#7}%
\uput{16pt}[180]{90}(!#3 #2 2 div #4 add){#8}%
}

\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=3.5cm}
\pspicture(-1.15,-0.15)(4,5)
\loglogpaper{5}{5}{-1}{0}{HotPink1}{LightPink1}{Radius of orbit (mill.
km)}{Siderical time of revolution (days)}%no of x-decades, no of
y-decades, minimum x-power, minimum y-power,gridcolor, subgridcolor,
xaxislabel, yaxislabel

\normalsize
\loglogplotlabeled{0.422}{1.76914}{2.0}{Green4}{Io}
\loglogplotlabeled{0.671}{3.55118}{2.0}{Green4}{Europa}
\loglogplotlabeled{1.070}{7.15455}{2.0}{Green4}{Ganymede}
\loglogplotlabeled{1.883}{16.68902}{2.0}{Green4}{Callisto}
\pstVerb{/bb 0.810186 def}
\psline[linewidth=0.2pt,linecolor=Green4](!bb 2 mul 3 div neg 0)(!bb neg 5
add 2 mul 3 div 5)
\pstVerb{/bb 0.69971 neg def}
\psline[linewidth=0.2pt,linecolor=Blue2](!bb 2 mul 3 div neg 0)(!bb neg 5
add 2 mul 3 div 5)
\loglogplotlabeled{57.9}{88.0}{2.0}{Blue2}{Mercury}
\loglogplotlabeled{108.2}{225}{2.0}{Blue2}{Venus}
\loglogplotlabeled{149.6}{365.25}{2.0}{Blue2}{Earth}
\loglogplotlabeled{228.0}{687}{2.0}{Blue2}{Mars}
\loglogplotlabeled{778.3}{4333}{2.0}{Blue2}{Jupiter}
\loglogplotlabeled{1427.0}{10760}{2.0}{Blue2}{Saturn}
\loglogplotlabeled{2869}{30686}{2.0}{Blue2}{Uranus}
\loglogplotlabeled{4497}{60191}{2.0}{Blue2}{Neptun}
\endpspicture
\end{center}

\end{document}





More information about the PSTricks mailing list