[pstricks] A little help deciphering code and a question

Scott, Randy Scott_Randy at sccollege.edu
Mon May 5 19:34:57 CEST 2014

Hi Thomas,

I resolved the problem myself after reading the \pscustom documentation about 10 times. (I'm a slow learner :) ) I had originally written

\definecolor{SuperLightBlue}{cmyk}{0.2,0,0,0}
\pscustom[fillstyle=solid,fillcolor=SuperLightBlue,
linestyle=none]
{
\psplot{0}{2}{2}
\psplot{0}{2}{0.25*x^2+1}
}

And finally realized that \pscustom was finishing the horizontal line at (2,2), then jumping down to (0,2) to begin the parabola.

When I changed this to

\definecolor{SuperLightBlue}{cmyk}{0.2,0,0,0}
\pscustom[fillstyle=solid,fillcolor=SuperLightBlue,
linestyle=none]
{
\psplot{0}{2}{2}
\psplot{2}{0}{0.25*x^2+1}
}

so the parabola is being drawn from (2,2) to (0,2), everything worked great.

Thanks again,

Randy Scott
Dept. Chair, Mathematics
Santiago Canyon College

-----Original Message-----
From: PSTricks [mailto:pstricks-bounces at tug.org] On Behalf Of Thomas Söll
Sent: Friday, May 02, 2014 10:49 AM
To: Graphics with PSTricks
Subject: Re: [pstricks] A little help deciphering code and a question

Hallo Randy,

here ist a solution for your problem with calculatet intersection point.

Thomas

\documentclass[pstricks,border=12pt]{standalone}

\begin{document}

\begin{pspicture}[showgrid=false,saveNodeCoors](-1,-1)(10,6)
\psset{xunit=2 ,yunit=0.6}
\psset{algebraic,plotstyle=curve}

\def\xE{4}

\definecolor{SuperLightBlue}{cmyk}{0.2,0,0,0}
\pstInterFF[dotscale=0.6]{0.25*x^2+1}{0.5*(x-4)^2}{3}{S}

\pscustom[fillstyle=solid,fillcolor=SuperLightBlue,linestyle=none]{%
\psplot{0}{N-S.x}{0.25*x^2+1}
\psline(*{N-S.x} {0.25*x^2+1})(0,0|*{N-S.x} {0.25*x^2+1})
\closepath
}
\pscustom[fillstyle=solid,fillcolor=green!10,linestyle=none]{%
\psplot{0}{N-S.x}{0.5*(x-4)^2}
\psline(*{N-S.x} {0.5*(x-4)^2})(0,0|*{N-S.x} {0.5*(x-4)^2})
\closepath
}
\pscustom[fillstyle=solid,fillcolor=yellow!40,linestyle=none]{%
\psplot{N-S.x}{4}{0.25*x^2+1}
\lineto(*{\xE} {0.5*(x-4)^2})
\psplot{\xE}{N-S.x}{0.5*(x-4)^2}
\closepath
}
\pscustom[fillstyle=solid,fillcolor=orange!40,linestyle=none]{%
\psplot{0}{N-S.x}{0.25*x^2+1}
\psplot{N-S.x}{\xE}{0.5*(x-4)^2}
\lineto(\xE,0)
\lineto(0,0)
\closepath
}
\pscustom[fillstyle=solid,fillcolor=magenta!10,linestyle=none]{%
\psplot{0}{N-S.x}{0.5*(x-4)^2}
\psplot{N-S.x}{\xE}{0.25*x^2+1}
\lineto(\xE,0|*{0} {0.5*(x-4)^2})
\closepath
}

\psaxes[labels=none, ticks=none, linewidth=0.25pt](0,0)(4.5,8.25)% [\footnotesize $q$ \textsf{(quantity)},90]% [\footnotesize $p$ \textsf{(price/unit)},90]

\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)

\rput(1.3,6.25){\rnode{A}{\footnotesize \textsf{Producer Surplus}}} \pnode(0.5,1.35){B} \nccurve[angleA=180, angleB=135]{->}{A}{B}

\rput[r](-0.05,1){\footnotesize $p_0$}
\rput[r](-0.05,2){\footnotesize $p*$}
\rput[r](-0.05,8){\footnotesize $p_1$}
\rput[t](2,-0.1){\footnotesize $q*$}
\rput[t](4,-0.1){\footnotesize $q_1$}
\rput(3.3,3){\footnotesize \textsf{Supply}} \rput(1.5,4.25){\footnotesize\textsf{Demand}}
\end{pspicture}

\end{document}

_______________________________________________
PSTricks mailing list
PSTricks at tug.org
http://tug.org/mailman/listinfo/pstricks
archive: http://www.tug.org/pipermail/pstricks/