3

This question relates to the use of pst-plot with datasets that have x axis values starting from a positive number for example x = 0.5 -> 0.8.

In the case below, on two separate computers both running Texlive (pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)), the dvi output is shifted to the right by about the width of the graph.

If DVIPS -E is used to extract the picture to an EPS file this too has extra white space on the left of the graph.

It's quite likely that this is a problem in which I don't understand the options I’m setting properly and the behaviour is expected.

Some example code:

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage{pstricks,pst-eps,graphicx,pst-grad,amsmath,pst-all}
\pagestyle{empty}
\thispagestyle{empty}

\begin{document}
\readdata{\OPA}{transferCharacteristics.txt}
\readdata{\OPB}{transferCharacteristics2.txt}
\readdata{\OPC}{transferCharacteristics3.txt}
\readdata{\OPD}{transferCharacteristics4.txt}

\pslegend[lt]{\black\rule[1ex]{2em}{1pt} & 10~V\\
\red\rule[1ex]{2em}{1pt} & 30~V\\
\green\rule[1ex]{2em}{1pt} & 50~V\\
\blue\rule[1ex]{2em}{1pt} & 70~V}

\psset{llx=0cm,lly=0cm, xAxisLabel={$V_{\mathrm{BE}}$ [V]}, xAxisLabelPos={c,-0.3in}, yAxisLabel={$I_\mathrm{C}$ [A]}, yAxisLabelPos={-0.5in,c},ury=0.0cm,urx=0cm}

\begin{psgraph}[axesstyle=axes,xticksize=0 0.20,yticksize=0 0.30,subticks=0, Dx=0.1, Dy=0.02, Oy=0, Ox=0.5](0.5,0)(0.5,0)(0.801,0.201){6cm}{5cm}
\pstScalePoints(1,1){}{}

\listplot[linecolor=black,linewidth=1pt]{\OPA}
\listplot[linecolor=red,linewidth=1pt]{\OPB}
\listplot[linecolor=green,linewidth=1pt]{\OPC} 
\listplot[linecolor=blue,linewidth=1pt]{\OPD}

\end{psgraph}
\end{document}

where transferCharacteristics.txt etc. are in the form:

5.500000000000000e-001,2.631940e-005
5.512678809428449e-001,2.764127e-005
5.525386846531173e-001,2.903280e-005
5.538124178684922e-001,3.049784e-005
5.550890873421763e-001,3.204043e-005
5.563686998429440e-001,3.366487e-005
5.576512621551735e-001,3.537569e-005

and are each 153 lines in length.

The image below is a JPEG created from the EPS.
example white space on left

Everything is available from: http://www.iceamplifiers.co.uk/randomstuff/pstplotwhitespace/

2 Answers 2

3

For a single image use documentclass standalone:

\documentclass[pstricks,border=2mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pst-plot}

\begin{document}
    \readdata{\OPA}{transferCharacteristics.txt}
    \readdata{\OPB}{transferCharacteristics2.txt}
    \readdata{\OPC}{transferCharacteristics3.txt}
    \readdata{\OPD}{transferCharacteristics4.txt}

    \pslegend[lt]{\black\rule[1ex]{2em}{1pt} & 10~V\\
    \red\rule[1ex]{2em}{1pt} & 30~V\\
    \green\rule[1ex]{2em}{1pt} & 50~V\\
    \blue\rule[1ex]{2em}{1pt} & 70~V}
    \psset{llx=-1.5cm,lly=-1cm, xAxisLabel={$V_{\mathrm{BE}}$ [V]}, xAxisLabelPos={c,-0.3in}, yAxisLabel={$I_\mathrm{C}$ [A]}, yAxisLabelPos={-0.5in,c},ury=0.0cm,urx=0cm}
    \begin{psgraph}[axesstyle=axes,xticksize=0 0.20,yticksize=0 0.30,
      subticks=0, Dx=0.1, Dy=0.02, Oy=0, Ox=0.5](0.5,0)(0.5,0)(0.801,0.201){6cm}{5cm}
    \listplot[linecolor=black,linewidth=1pt]{\OPA}
    \listplot[linecolor=red,linewidth=1pt]{\OPB}
    \listplot[linecolor=green,linewidth=1pt]{\OPC} 
    \listplot[linecolor=blue,linewidth=1pt]{\OPD}
    \end{psgraph}

\end{document}

enter image description here

6
  • Just in case you're wondering, this problem in my understanding has come about because I use Cirkuit. http://wwwu.uni-klu.ac.at/magostin/cirkuit.html Most of the time it works fine to preview and extract to EPS using the article class and a \begin{TeXtoEPS} and \end{TeXtoEPS} environment. That's why I thought the problem above worked ok with numbers starting from zero at the origin but not 0.55. It seems that your method with the standalone class is more general. I'll modify my Cirkuit back-end accordingly. Oct 6, 2014 at 21:53
  • I've been unable to get Cirkuit to play ball even with the standalone class instead of article. I've filed bug report 339735 at https://bugs.kde.org/show_bug.cgi?id=339735. I may get told off... we'll see. Oct 6, 2014 at 23:07
  • I cannot see any advantage of using circuitk for creating an image. The preamble of the documents with pst-eps is totally outdated.
    – user2478
    Oct 7, 2014 at 8:21
  • Fair enough... I only use it because I do a lot of electrical circuit diagrams as well. I will move my PSTricks coding to Kile, unless something better is suggested. Oct 8, 2014 at 10:45
  • You should write to the maintainer of circuitk that they should update the templates.
    – user2478
    Oct 8, 2014 at 15:53
1

Or you can use preview package plus article class instead of standalone class to get the same (based on our bare eyes) result.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pst-plot}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=12pt\relax % if you need 12pt border around the output


\begin{document}
    \readdata{\OPA}{transferCharacteristics.txt}
    \readdata{\OPB}{transferCharacteristics2.txt}
    \readdata{\OPC}{transferCharacteristics3.txt}
    \readdata{\OPD}{transferCharacteristics4.txt}

    \pslegend[lt]{\black\rule[1ex]{2em}{1pt} & 10~V\\
    \red\rule[1ex]{2em}{1pt} & 30~V\\
    \green\rule[1ex]{2em}{1pt} & 50~V\\
    \blue\rule[1ex]{2em}{1pt} & 70~V}
    \psset{llx=-1.5cm,lly=-1cm, xAxisLabel={$V_{\mathrm{BE}}$ [V]}, xAxisLabelPos={c,-0.3in}, yAxisLabel={$I_\mathrm{C}$ [A]}, yAxisLabelPos={-0.5in,c},ury=0.0cm,urx=0cm}
    \begin{psgraph}[axesstyle=axes,xticksize=0 0.20,yticksize=0 0.30,
      subticks=0, Dx=0.1, Dy=0.02, Oy=0, Ox=0.5](0.5,0)(0.5,0)(0.801,0.201){6cm}{5cm}
    \listplot[linecolor=black,linewidth=1pt]{\OPA}
    \listplot[linecolor=red,linewidth=1pt]{\OPB}
    \listplot[linecolor=green,linewidth=1pt]{\OPC} 
    \listplot[linecolor=blue,linewidth=1pt]{\OPD}
    \end{psgraph}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .