4

I am using TikZ for ternary plots and have problems with a misalignment of ticks after changing the axis range. An example is given below where ymax is set to 0.8 but actually seem to get a maximum value of 0.8/0.99 in the plot. It is however only the ticks that are in the wrong position. The plotted values are in the correct position as demonstrated by the x in the minimal working example. This misalignment is value dependent and does for example not happen if ymax is set to 0.6. How can I get rid of this misalignment?

Minimal working example is given below.

\documentclass[10pt]{scrartcl}

\usepackage[utf8x]{inputenc}

\pagestyle{empty}

\usepackage{pgfplots}

\pgfplotsset{compat=newest}

\usepgfplotslibrary{ternary}

\usepackage{tikz}

\usepackage{tikz-3dplot}

\usepackage[active,tightpage]{preview}

\PreviewEnvironment{tikzpicture}

\begin{document}

\begin{tikzpicture}

\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=0.8,
]

\addplot3[only marks, mark = x]
table{
0    0.8    0
};

\end{ternaryaxis}

\end{tikzpicture}

\end{document}
10
  • 1
    This doesn't compile for me.
    – dustin
    Aug 12, 2013 at 14:30
  • 1
    @dustin: I can, if I remove the empty line between \addplot and table.
    – Jake
    Aug 12, 2013 at 14:50
  • Lars, welcome to the site!
    – Jake
    Aug 12, 2013 at 14:57
  • I discovered the same empty line myself and removed it. It should compile now. Aug 12, 2013 at 14:58
  • IMO that is a bug. Set ternary limits relative=true and you will see the actual values being calculated (99 % for the last one)! It seems that it likes splitting in 5 or 3 parts on each axis, but not into 4. In all case you should take ranges which are dividable by the same value. Your MWE tries fitting 5 to 4 ticks.
    – LaRiFaRi
    Aug 12, 2013 at 15:48

1 Answer 1

4

This is a bug. I have fixed it in the developer version (will become part of the next stable release).

A work-around for version 1.8 (and older) is to add the switch disabledatascaling:

\documentclass{standalone}

\usepackage{pgfplots}

\pgfplotsset{compat=1.8}

\usepgfplotslibrary{ternary}

\begin{document}

\begin{tikzpicture}

\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=0.8,
clip=false,
disabledatascaling,
]

\addplot3[only marks, mark = x]
table{
0    0.8    0
};

\end{ternaryaxis}

\end{tikzpicture}

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