4

I'm using XeTex for Truetypefonts.

It appears as if the color output in pgfplots is not correct. Is that a bug? Or do I have some misconfiguration?

For other colors than black (e.g. red for the axis line color) it actually works as expected...

My pgfversion: 3.0.1a

MWE:

\documentclass{scrartcl}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{axis line style=black}
\color{green}
\begin{document}
    \begin{tikzpicture}
        \begin{axis}
         \addplot {x*x};
        \end{axis}
    \end{tikzpicture}
\end{document}

With XeLaTex: enter image description here Expected behaviour (with pdflatex): enter image description here

3
  • Interesting question. I think this could reasonably be seen as a bug in pgfplots. I suggest you report it and see. As a workaround, load xcolor with an explicit colour model: \usepackage[rgb]{xcolor}. Commented Aug 15, 2019 at 7:39
  • 1
    Try - \pgfplotsset{axis line style={color=black}}
    – nidhin
    Commented Aug 15, 2019 at 8:15
  • That works indeed. Thanks a lot.
    – san04
    Commented Aug 15, 2019 at 8:22

2 Answers 2

2

Workaround. Use

\pgfplotsset{axis line style={color=black}}

instead.

2

I asked on the dvipdfmx list and Shunsaku Hirata confirmed my suspicion that it is a dvipdfmx failure. A similar problem can be shown with this smaller example:

\documentclass{article}
\begin{document}
\special{pdf:bcolor [0]}
\special{pdf:code q 1 0 0 rg 1 0 0 RG}
text in red
\special{color push gray 0} %switch back to black
Text in black.
\special{color pop}
\special{pdf:code Q}
\special{pdf:ecolor}
\end{document}

enter image description here

"Text in black" should be black but is red. The source of the problem is that dvipdfmx doesn't know that the color has been changed to red with the pdf:code special - it only keeps track of the color specials - and so assumes that the color has not changed and that it can ignore the color push gray 0.

The problem will be resolved in a future version.

https://tug.org/pipermail/dvipdfmx/2019-August/000030.html

You must log in to answer this question.

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