XeLaTex with pgfplots displays wrong color?

Workaround. Use

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


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:

\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}

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.