Menu

#28 enlarge limits distorts rel axis cs

open-accepted
nobody
None
2
2011-01-31
2011-01-30
Anonymous
No

See the example below. What i expect is in the upper plot. The only difference between the plots is the value of enlarge x limits.

Just to explain why i cant use extra x ticks:
My real plot is a ybar interval and the area below the plot is so filled with ticks, that i want to place some important extra ticks above the plot. Hence i want a straight line up from some point defined in axis cs.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlarge x limits=false, extra description/.code={\draw[very thick] (axis cs:2.5,0) -- ++(rel axis cs:0,1.1) node[above,align=center,font=\small]{important};} ]
\addplot coordinates{
(0,1)
(1,2)
(2,3)
(3,4)
(4,5)};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[enlarge x limits=true, extra description/.code={\draw[very thick] (axis cs:2.5,0) -- ++(rel axis cs:0,1.1) node[above,align=center,font=\small]{important};} ]
\addplot coordinates{
(0,1)
(1,2)
(2,3)
(3,4)
(4,5)};
\end{axis}
\end{tikzpicture}
\end{document}

Discussion

  • Christian Feuersänger

    • priority: 5 --> 2
    • status: open --> open-accepted
     
  • Christian Feuersänger

    Hello,

    thank you for reporting the issue; I agree that it should be fixed.

    The bug is caused by the rescaling of axes -- the "0" is an absolute coordinate, not a relative one. In other words "0" denotes something in the picture, not just "0pt horizontally".

    Until the bug is fixed, it may help to use one of the tikz coordinate systems, for example (0pt,10cm) or something like that. If you really need precise measurements, you may use 'scale only axis,height=9cm' as well.

    I hope that helps in the meantime.

    Best regards

    Christian

     
  • Nobody/Anonymous

    Using tikz coordinate systems also does not work which can be verified with the example :)

    But using only axis cs works fine...you just have to adapt it everytime you change the y values (or copy&paste the line into another plot...).

    BTW: I also posted this to de.comp.text.tex with another example/use case some days ago, just in case you need some test cases.

    Greetings
    Jan

     
  • Nobody/Anonymous

    thanks anyway for the great work, I love this package!

    Jan (sorry for 2 comments)

     
  • Nobody/Anonymous

    Its really a nice and useful piece of info. I am happy that you simply shared this useful information with us. Please keep us up to date like this. Thanks for sharing.
    where get Gucci Top Handle Bags http://fashionguccibag.insanejournal.com/

     
  • Nobody/Anonymous

    Great post. I was checking constantly this blog and I'm impressed! Extremely useful info specifically the last part :) I care for such information much. I was looking for this certain information for a very long time. Thank you and good luck.
    diablo 3 gold http://www.d3eye.com

     
  • Nobody/Anonymous

    I found the merchandise to be a great deal. The Lida lida daidaihua makes me less hungry and the fat burn is helping me blast away my flab. The instructions that came with it told me that getting my eating at hand was necessary for a winning approach. I really took that to heart and have owned a lot more discipline when I am eating and the hoodia makes all that easier. I am doing sit ups and taking the merchandise every day and so far, My flab is disappearing. I dont own a working scale but most likely that things are improving podedsja.
    Pai You Guo Capsule http://www.2daydietbase.com/pai-you-guo-tea-p-14.html

     
  • Nobody/Anonymous

    I think you have noted some very interesting details , thankyou for the post.
    derrick rose shoes http://derrickroseshoes0.webnode.com

     
  • Nobody/Anonymous

    Thank you incredibly substantially for your exciting text. I have been looking for these types of message to get a definitely very long time. Thank you.
    charles barkley shoes http://charlesbarkleyshoes.webnode.com

     
  • Nobody/Anonymous

    I've been browsing online more than three hours nowadays, yet I by no means found any interesting article like yours. It is lovely value enough for me. In my opinion, if all site owners and bloggers made excellent content as you did, the internet might be much more helpful than ever before. Miu Miu Bags http://miumiubags1.cabanova.com

     
  • Nobody/Anonymous

    I like this post, enjoyed this one thankyou for putting up. akb48 http://www.uonobu.co.jp/shop/akb48.html