[pstricks] A little help deciphering code and a question

Scott, Randy Scott_Randy at sccollege.edu
Fri May 2 02:38:57 CEST 2014


Hi,

I am modifying a graph that I borrowed from a colleague. I hope some of you might be able to help me figure out the following questions I have.

1. What is the purpose of

\makebox(0,0)[cc]{\footnotesize{$p_0$}}

I know what \makebox does but I'm not sure what (0,0) is doing or why there are two c's in the position parameter.

2. Is there a better way to handle the coordinates in the \put commands? If I change the xunit or yunit, then all the positions must be individually adjusted.

Any other suggestions to streamline the code would be appreciated.

Thanks,

Randy Scott
Santiago Canyon College
Orange, CA

\documentclass{article}
\usepackage[pdf]{pstricks}
\usepackage{pst-plot}

\begin{document}  
\begin{pspicture}
	\psset{xunit=2 cm,yunit=0.75 cm}
	\psaxes[labels=none, ticks=none]{-}(0,0)(0,0)(4.75,8.25)
	
	\psset{algebraic=true,plotstyle=curve,linestyle=solid}
	\psplot[linecolor=blue]{0}{4}{0.5*(x-4)^2}
	\psplot[linecolor=blue]{0}{4}{0.25*x^2+1}
	
	\psline[linestyle=dotted](2,0)(2,2)
	\psline[linestyle=dotted](0,2)(2,2)
	
	\put(-0.25,0.75){\makebox(0,0)[cc]{\footnotesize{$p_0$}}}
	\put(-0.25,1.5){\makebox(0,0)[cc]{\footnotesize{$p*$}}}
	\put(-0.25,6){\makebox(0,0)[cc]{\footnotesize{$p_1$}}}
	\put(4,-0.25){\makebox(0,0)[cc]{\footnotesize{$q*$}}}
	\put(7.75,-0.25){\makebox(0,0)[cc]{\footnotesize{$q_1$}}}
	\put(8.7,0.25){\makebox(0,0)[cc]{\footnotesize{$q$ \textsf{(quantity)}}}}
	\put(0,6.375){\makebox(0,0)[cc]{\footnotesize{$p$ \textsf{(price/unit)}}}}
	\put(6.1,3){\makebox(0,0)[cc]{\footnotesize{\textsf{Supply}}}}
	\put(2,4.25){\makebox(0,0)[cc]{\footnotesize{\textsf{Demand}}}}
\end{pspicture}
\end{document}




More information about the PSTricks mailing list