I tried compiling a bunch of files today, all of which use tikzpictures and pgfplots. Something truly odd is happening with how the y-axis label is being positioned.

I took the MWE from Positioning of Pgfplot axis labels (copied below) as a starting point -- expecting the figure to be rendered looking just like the following:

what it should look like

However, when I compile the MWE using latest and greatest MikTeX (crucially, by using the .tex -> .dvi -> .ps -> .pdf compilation sequence), and tikz and pgfplot packages, this is what I'm now getting -- notice that the y-axis label is waaay off to the left, and not centred wrt to the y-axis. At all...

this is the bug

This is a huge issue for me, since I have files with many such diagrams -- when I compile them, every one of this sort of figure has a wonky axis label, which changes the size of the image when rendered, and throws off the formatting altogether.

I don't really know what the culprit is, but...I can try rolling back to earlier versions of tiks, and pgfplot, and see if that matters.

In the meantime -- comments? Suggestions?

Here is the MWE code:




   axis lines=middle,
   axis line style={->},
   x label style={at={(axis description cs:0.5,-0.1)},anchor=north},
   y label style={at={(axis description 
   xlabel={$u$ unemployment},
   ylabel={$\pi$ inflation}]
   \addplot[black,samples=100,domain=0:1] {120*(1-x)^(1/3)-1};


As per request: here is the output from \listfiles, using the MikTeX install with the update to pgf installed:

*File List*
article.cls    2018/09/03 v1.4i Standard LaTeX document class
size12.clo    2018/09/03 v1.4i Standard LaTeX file (size option)
tikz.sty    2019/07/17 v3.1.4a (3.1.4a)
 pgf.sty    2019/07/17 v3.1.4a (3.1.4a)
pgfrcs.sty    2019/07/17 v3.1.4a (3.1.4a)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
pgfcore.sty    2019/07/17 v3.1.4a (3.1.4a)
graphicx.sty    2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
dvips.def    2017/06/20 v3.1d Graphics/color driver for dvips
pgfsys.sty    2019/07/17 v3.1.4a (3.1.4a)
pgfsyssoftpath.code.tex    2019/07/17 v3.1.4a (3.1.4a)
pgfsysprotocol.code.tex    2019/07/17 v3.1.4a (3.1.4a)
xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg    2016/01/02 v1.6 sample color configuration
pgfcomp-version-0-65.sty    2019/07/17 v3.1.4a (3.1.4a)
pgfcomp-version-1-18.sty    2019/07/17 v3.1.4a (3.1.4a)
pgffor.sty    2019/07/17 v3.1.4a (3.1.4a)
pgfplots.sty    2018/03/28 v1.16 Data Visualization (1.16)
  • 1
    The example works fine for me, with an up to date TeX Live 2019. Could you add \listfiles before \documentclass, recompile, and then add the .log file to your question? Perhaps there are some hints there, as to what is wrong. – Torbjørn T. Jul 26 at 19:28
  • Will do, but I'd already switched back to a MikTeX install I archeved back in early June. Compilation went perfectly, and the plot looks exactly like it should. So, something happened between June -> present. – Johnny Canuck Jul 26 at 19:36
  • 1
    The example work fine with my recent MikTeX (64-bit) installation. – Zarko Jul 26 at 19:39
  • 1
    Ah, I see you anticipated my comment. I can reproduce the output with the DVI -> PS -> PDF route (latex file, dvips file, ps2pdf file). Please add that crucial info directly to your question. – moewe Jul 26 at 20:06
  • 1
    I posted a bug report on the github site for pgf/tikz (they lkeft SourceForge for Github). The report can be found here: github.com/pgf-tikz/pgf/issues/722 – Johnny Canuck Jul 26 at 21:36

Your Answer

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

Browse other questions tagged or ask your own question.