Hi,

I'm trying to write a custom drawing routine.  I want to specify
coordinates relative to the point in the axis coordinate system, but I
find that when I do so, the points are displaced by (-xmin, -ymin).

In the following example, I plot a point at (1, .2) and I try to place
a node one unit to the right of that point, i.e., at (2, .2).  When I
do:

  \path ##1 ++(axis cs:1,0) node {o};

The o mark ends up not at (2, .2), but at (3, .3), i.e., displaced by
(-xmin, -ymin).

Am I doing something wrong or is this a bug?

I'm using Debian stable's texlive, except for pgfplots.  I am using
version 1.5.1 of pgfplots, which is installed locally.  I have nothing
else installed locally.

Thanks,

Neal


  \documentclass{article}
  
  \usepackage{filecontents}
  
  \usepackage{pgfplots} 
  \pgfplotsset{compat=1.5.1}
  \pgfplotsset{
    myplot/.style={
      only marks,
      /pgfplots/error bars/.cd,
      % Only draw draw the x + \epsilon error bar.
      y dir=plus,
      y explicit,
      % Override the default error bar drawing routine.
      /pgfplots/error bars/draw error bar/.code 2 args={%
           % (1,1) in the canvas vs. the axis coordinate system.
           \node at (1, 1) {C};
           \node at (axis cs:1, 1) {X};
  
           # My base.
           \path ##1 node[anchor=north] {##1};

           # The point I get.
           \path ##1 ++(axis cs:1,0) node {o} node[anchor=south] {Bad};

           % The point I want.
           \path (axis cs:2,.2) node {o} node[anchor=south] {Want};

           % What I get is the point I want displaced by (-xmin, -ymin)!
           \path (axis cs:3,.3) node {x};
      },
      /pgfplots/table/.cd,
      y index=1,
      y error index=2,
    },
  }
  
  \begin{document}
  
  \begin{tikzpicture}
  \begin{filecontents}{filecontents-4426618062d2918a0559d4bc3e6c12e1.table}
  1 .2 .4
  \end{filecontents}

  \begin{axis}[xmin=-1, xmax=6, ymin=-0.1, ymax=1.1]
  \addplot [myplot] table {filecontents-4426618062d2918a0559d4bc3e6c12e1.table};
  \end{axis}
  \end{tikzpicture}
  
  
  \end{document}

Attachment: mwe.pdf
Description: Adobe PDF document

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to