Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

is it possible to close the path from the coordinate frame in pgfplots? If I plot something, the frame rectangle of the coordinate system looks fine except the bottom left corner: the lines do not nicely consolidate (so the path looks "unclosed"). Is there a way to do so? This looks especially weird when you use a big line width.

I'll uploaded a screenshot here. As you might see, the top corner looks nice, the bottom don't.

EDIT: Screenshot

Now the direct screenshot directly here :)

enter image description here

As mentioned above: the top corner looks nice, the bottom don't.

share|improve this question
    
Search for the boxed option in the manual for axis lines. –  percusse Feb 1 '13 at 12:18
    
@percuße: I found \begin{axis}[axis lines=box]... but it won't compile correct. –  DaPhil Feb 1 '13 at 12:33
    
Welcome to TeX.SX. –  Claudio Fiandrino Feb 1 '13 at 12:33
    
Ok, the problem was an outdated version of pgfplots. But still, no change when I choose axis lines=box. Since it is the default value, it is no surprise to me. –  DaPhil Feb 1 '13 at 13:10
    
A screenshot would probably help. –  quinmars Feb 1 '13 at 13:18
show 3 more comments

1 Answer

up vote 4 down vote accepted

I believe this is a bug in PGFPlots. The axis is meant to be closed, but the conditional that checks whether there are axis discontinuities (in which case the axis line should not be closed) has its \else conditions mixed up (I think...)

You can fix the function by pasting the following chunk into your preamble:

\makeatletter
\def\pgfplots@drawaxis@outerlines@cycledpath{%
    \draw[
        /pgfplots/every outer x axis line, % using these outer styles is only useful in conjunction with 'separate axis lines=true'
        /pgfplots/every outer y axis line]
    \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra
\ifpgfplots@hide@y
    { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra }
\else
    decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}]
    % { -- (\pgfplots@xmin, \pgfplots@ymax) }
    { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra }
\fi
\ifpgfplots@hide@x
    %{ (\pgfplots@xmax, \pgfplots@ymax) }
    { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra }
\else
    decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] 
    %{ -- (\pgfplots@xmax,  \pgfplots@ymax) }
    { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra }
\fi
\ifpgfplots@hide@y
    %{ (\pgfplots@xmax, \pgfplots@ymin) }
    { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra }
\else
    decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] 
    %{ -- (\pgfplots@xmax,  \pgfplots@ymin) }
    { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra }
\fi
\ifpgfplots@hide@x
    %{ (\pgfplots@xmin, \pgfplots@ymin) }
    { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra }
\else
    decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] 
    %{ -- (\pgfplots@xmin,  \pgfplots@ymin) }
    { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra }
\fi
    % make sure that we do not have any of the axis discontinuities
    % here - they should not be closed.
    \if0\pgfplots@xaxisdiscontnum
        \if0\pgfplots@yaxisdiscontnum
            -- cycle
        \fi
    \fi
    ;%
}%

share|improve this answer
    
Thanks! I will try to give the developer a hint that there might be a bug. –  DaPhil Feb 1 '13 at 14:15
    
@DaPhil: Glad it helps! I just filed a bug report –  Jake Feb 1 '13 at 14:17
1  
Yeah and I just saw that :) –  DaPhil Feb 1 '13 at 14:20
    
@DaPhil: ...and it has been fixed! –  Jake Feb 2 '13 at 12:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.