Hi Christian,

Thanks for the detailed reply.

Joel.

--- On Mon, 1/8/11, Christian Feuersaenger <cfeuersaen...@googlemail.com> wrote:

> From: Christian Feuersaenger <cfeuersaen...@googlemail.com>
> Subject: Re: Fixed-width axis tick labels
> To: jtzzaa11-pgf...@yahoo.com, "'PGFplots mailing list'" 
> <pgfplots-features@lists.sourceforge.net>
> Date: Monday, 1 August, 2011, 1:02 AM
> Hi Joel,
> 
> you can
> a) manually fix your tick labels using
> ytick={0,1,...,5},
> yticklabels={00,01,02,03,04,05},
> or
> b) make a more-or-less general approach which fixes it
> automatically using
>     \begin{axis}[yticklabel={%
>         $
>         \ifdim\tick pt<10pt
>             0%
>         \fi
>         \pgfmathprintnumber{\tick}$%
>     },%
>     ]
> ...
> Here, the \ifdim\tick pt < 10pt  is a TeX
> comparison which works if the numbers are small. The 'pt'
> suffix is here because TeX can only compare in units of
> point.
> 
> The approach will probably fit into your approach, although
> it needs to be modified for negative numbers.
> 
> c) try to experiment with the sizes of the label nodes
> which is preferrable over a) and b). Tikz offers the minimum
> width approach:
> yticklabel style={minimum width=3em}
> 
> d) exclude the axis descriptions explicitly from the
> external image's bounding box. This last approach is what I
> have done to fix the alignment in such cases.
> 
> To do so, you can use the 'trim axis right' and/or 'trim
> axis left'  features. The following example is copied
> from the manual, section "Alignment":
> 
> \begin{center}
> \begin{tabular}{rl}
>     \begin{tikzpicture}[baseline,trim axis left]
>         \begin{axis}
>          
>    \addplot {x};
>         \end{axis}
>     \end{tikzpicture}
> &
>     \begin{tikzpicture}[baseline,trim axis
> right]
>     \begin{axis}[
>         ylabel={$f(x)=x^2$},
>         yticklabel pos=right,
>         ylabel style={font=\Huge}]
>         \addplot {x^2};
>     \end{axis}
>     \end{tikzpicture}
>     \\
>     %
>     \begin{tikzpicture}[baseline,trim axis left]
>     \begin{axis}[xlabel=$x$,xlabel
> style={font=\Huge}]
>         \addplot {x^3};
>     \end{axis}
>     \end{tikzpicture}%
> &
>     \begin{tikzpicture}[baseline,trim axis
> right]
>     \begin{axis}[yticklabel pos=right]
>         \addplot {x^4};
>     \end{axis}
>     \end{tikzpicture}%
>     \\
> \end{tabular}%
> \end{center}
> 
> I hope one of the approaches is what you had in mind. I
> encourage you to consider the last one.
> 
> Best regards
> 
> Christian
> 
> PS
> I posted a copy of this reply to the mailing list since it
> might be of general interest.


------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to