# too tricky for pstricks?

I'm trying to copy the graph of a piecewise function created in GeoGebra into a LaTeX document but all I see are the axes -- no curves. I'm running TexShop and compiling with XeLaTex. In the log file I get the following ominous messages:

** WARNING ** Image format conversion for PSTricks failed.
** WARNING ** Interpreting special command pst: (ps:) failed.


The thing is that simpler graphs, like parabolae and lines seem to be ok --- is this one just way too complicated?

\documentclass[10pt]{article}
%\usepackage{pst-plot}
\pagestyle{empty}
\begin{document}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{algebraic=true}
\psset{xunit=2.0cm,yunit=2.0cm}
\begin{pspicture*}(-3.94,-5.35)(7.93,3.35)
\psgrid[subgriddiv=0,gridlabels=0,gridcolor=lightgray](0,0)(-3.94,-5.35)(7.93,3.35)
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=2,Dy=2,ticksize=-2pt 0,subticks=2]{->}(0,0)(-7.88,-10.7)(15.86,6.69)
\psplot[plotpoints=200]{-7.883107654532565}{0.95999979546005}{(x*<*0.96)*(x^2+1)}
\psplot[plotpoints=200]{1.0800001247036413}{6.999999907292117}{((1.08*<*x)*∧*(x*<*7))*(x-1)*(x-2)*(x-5)/(x-4)}
\begin{scriptsize}
\psdots[dotstyle=*,linecolor=blue](1,4)
\psdots[dotsize=4pt 0,linecolor=xdxdff](1,2)
\psdots[linecolor=xdxdff](1,0)
\end{scriptsize}
\end{pspicture*}
\end{document}

-
Welcome to the site! GeoGebra is a good tool for interaction, but like most export feature, the code is not clean. Have a look at What is the clearest way to graph a piecewise function? for home-made, clean code :) Welcome! –  cmhughes Sep 16 '13 at 3:21

There are optional arguments <x|y>MaxValue (see documentation)

\documentclass[10pt]{article}
%\usepackage{pst-plot}
\pagestyle{empty}
\begin{document}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{algebraic,unit=2.0cm}
\begin{pspicture*}(-3.94,-5.35)(7.93,3.35)
\psgrid[subgriddiv=0,gridlabels=0,gridcolor=lightgray](0,0)(-3.94,-5.35)(7.93,3.35)
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=2,Dy=2,ticksize=-2pt 0,
subticks=2]{->}(0,0)(-7.88,-10.7)(15.86,6.69)
\psplot[plotpoints=200,linewidth=2pt]{-7.883107654532565}{0.95999979546005}{(x^2+1)}
\psplot[plotpoints=200,linewidth=2pt,
yMaxValue=7,yMinValue=-10]{1.0800001247036413}{6.999999907292117}{(x-1)*(x-2)*(x-5)/(x-4)}
\psline[linestyle=dashed,linewidth=1.5pt](4,-11)(4,7)
\psdots[dotstyle=*,linecolor=blue](1,4)
\psdots[dotsize=4pt 0,linecolor=xdxdff](1,2)
\psdots[linecolor=xdxdff](1,0)
\end{pspicture*}

\end{document}


-

It looks to me as if the x range has been duplicated from the first two mandatory arguments into a spurious subterm of the function in the last argument

{-7.883107654532565}{0.95999979546005}{(x*<*0.96)*
-7.9 < x < .96                     ???????

{1.0800001247036413}{6.999999907292117}{((1.08*<*x)*∧*(x*<*7))
1.08 < x < 7                   ????????????????????


anyway deleting that makes it run without error:

\documentclass[10pt]{article}
%\usepackage{pst-plot}

\pagestyle{empty}

\begin{document}

\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{algebraic=true}
\psset{xunit=2.0cm,yunit=2.0cm}
\begin{pspicture*}(-3.94,-5.35)(7.93,3.35)
\psgrid[subgriddiv=0,gridlabels=0,gridcolor=lightgray](0,0)(-3.94,-5.35)(7.93,3.35)
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=2,Dy=2,ticksize=-2pt 0,subticks=2]{->}(0,0)(-7.88,-10.7)(15.86,6.69)
\psplot[plotpoints=200]{-7.883107654532565}{0.95999979546005}{(x^2+1)}
\psplot[plotpoints=200]{1.0800001247036413}{6.999999907292117}{(x-1)*(x-2)*(x-5)/(x-4)}
\begin{scriptsize}
\psdots[dotstyle=*,linecolor=blue](1,4)
\psdots[dotsize=4pt 0,linecolor=xdxdff](1,2)
\psdots[linecolor=xdxdff](1,0)
\end{scriptsize}
\end{pspicture*}
\end{document}

-
Thanks David, ! –  liam Sep 16 '13 at 10:50