5

This question is regarding pst-plot and more specifically \pslegend. The code below produces the two following plots:

enter image description here enter image description here

One of these figures is generated without the \pslegend and it appears to have the correct bounding box. The figure which includes the \pslegend appears not to have the correct bounding box.

The two .txt data files can be found at this address.

Could anyone explain what I have done to cause this? I'm on pdfTeX, version 3.1415926-2.4-1.40.13 (TeX Live 2012)

The code which surrounds everything from the first \readdata to \end{psgraph} is lifted from Cirkuit's pstricks wrapper (see http://kde-apps.org/content/show.php/?content=107098). Cirkuit is a Qt GUI front end for preparation of circuit diagrams pstricks and TikZ diagrams.

I'm fairly sure it's something in the wrapper commands that's giving me problems, not the pstricks stuff.

\documentclass{article}
\usepackage[utf8x]{inputenc}

\usepackage{multido,pst-all,graphicx,amsmath}
\pagestyle{empty}
\thispagestyle{empty}

\begin{document}
\newbox\graph
\begin{TeXtoEPS}
\readdata{\ihigh}{halfwavehighimpedanceid.txt}
\readdata{\ilow}{halfwavelowimpedanceid.txt}

% Remove this \pslegend in the correct box example...
\pslegend[rt]{\blue\rule[1ex]{2em}{1pt} & $I_D$ Lower Z\\
\red\rule[1ex]{2em}{1pt} & $I_D$ Higher Z
}

\psset{llx=-1cm,lly=-1cm, xAxisLabel={Time [ms]}, xAxisLabelPos={c,-0.3in}, yAxisLabel={Voltage [V]}, yAxisLabelPos={-0.3in,c}}

\begin{psgraph}[axesstyle=axes,xticksize=0 10,yticksize=0 50,subticks=0,Dx=10, Dy=2, Oy=0](0,0)(50,10){7cm}{5cm}
\pstScalePoints(1e3,1e0){}{}
\listplot[linecolor=blue,linewidth=2pt]{\ilow}
\listplot[linecolor=red,linewidth=2pt]{\ihigh}

\end{psgraph}

\box
\graph
\end{TeXtoEPS}
\end{document}

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • Welcome to TeX.sx! A tip: You can use backticks ` to mark your inline code as I did in my edit. Also, it's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. – Corentin Dec 9 '12 at 23:20
  • Thank you for making the question look neater than I did. I will take note of what you have said for the future. – James E Green Dec 9 '12 at 23:38
  • I've decided it's not a bounding box problem because the answer to [tex.stackexchange.com/questions/29747/… allows me to see the bounding box. – James E Green Dec 11 '12 at 23:28
  • When I generate a dvi of some pstricks (including the above code) by calling (latex on it), and then run dvips -E input.dvi -o output.eps my output eps also has a white space on the lhs of the drawing (as per the original question). I'm no closer to knowing if it's a dvips, latex or pstricks problem. But I do know it's not a Cirkuit problem. My dvips version is dvips(k) 5.992. – James E Green Dec 12 '12 at 0:43
  • I came up against this again tonight, and it felt familiar somehow. I still don't know why it happens but using for example: \pslegend[r](50,50){\blue\rule[1ex]{2em}{1pt} & $I_D$ Lower Z\\ \red\rule[1ex]{2em}{1pt} & $I_D$ Higher Z Seems to do the trick. The 50 and 50 are x and y axis offset respectively. I'd still like to know why using tr and lt as the reference cause problems whereas using r and l do not. Perhaps @Herbert could explain it? – James E Green Apr 18 '14 at 0:00
1

Running it with xelatex and an up-to-date TeXLive:

\documentclass{article}
\usepackage{pst-plot}
\pagestyle{empty}

\begin{document}
\readdata{\ihigh}{/tmp/halfwavehighimpedanceid.txt}
\readdata{\ilow}{/tmp/halfwavelowimpedanceid.txt}

\psset{llx=-1cm,lly=-1cm, xAxisLabel={Time [ms]}, 
       xAxisLabelPos={c,-0.3in}, yAxisLabel={Voltage [V]}, 
       yAxisLabelPos={-0.3in,c}}

\begin{psgraph}[axesstyle=axes,xticksize=0 10,yticksize=0 50,
       subticks=0,Dx=10, Dy=2,Oy=0](0,0)(50,10){7cm}{5cm}
  \pstScalePoints(1e3,1){}{}
  \listplot[linecolor=blue,linewidth=2pt]{\ilow}
  \listplot[linecolor=red,linewidth=2pt]{\ihigh}
\end{psgraph}

\pslegend[rt]{\blue\rule[1ex]{2em}{1pt} & $I_D$ Lower Z\\
    \red\rule[1ex]{2em}{1pt} & $I_D$ Higher Z
}

\begin{psgraph}[axesstyle=axes,xticksize=0 10,yticksize=0 50,
      subticks=0,Dx=10, Dy=2,Oy=0](0,0)(50,10){7cm}{5cm}
  \pstScalePoints(1e3,1){}{}
  \listplot[linecolor=blue,linewidth=2pt]{\ilow}
  \listplot[linecolor=red,linewidth=2pt]{\ihigh}
\end{psgraph}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.