Hi Xavier,

welcome to "the wonderful world" (and thanks for the praise) :-)

You already distilled the right piece of information for your use-case: 
changing the 'every axis y label' style is precisely what you need.

Here is a little bit more background information which hopefully leads 
to the desired positioning:
the 'ticklabel cs:0.5' means that that is is positioned
a) on the same axis as tick labels (in your case yticklabels)
b) "adjacent" to the tick labels (i.e. leaving enough room such that it 
does not overlap)
c) 50% of the axis containing tick labels (the 0.5).

Since you would like to position it at the top of the y axis, you may 
want to consider 'ticklabel cs:1' or 'ticklabel cs:0.9'.

The choice 'anchor=top' means that the "top" position *inside* of the 
ylabel is placed at the position identified by 'at'.
Pgfplots comes with the choice 'anchor=near ticklabel' which might be 
more adequate here.

So, my advice would be

every axis y label/.style={at={(ticklabel cs:0.8)},anchor=near ticklabel}

perhaps together with a "xshift=-0.2em" or something like that.

The interaction between 'at={..}' and 'anchor' is explained in more detail in 
the tikz manual, but the pgfplots section "Alignment" also explains these 
concepts (the alignment concept comes with tikz; pgfplots "only" uses it).

Your approach with<key>/.style={}  means to replace the style named '<key>' 
with new options -- in your case the 'every axis y label'.
In your use-case, this is precisely what you needed. Note that in general, 
*appending* new options (like<key>/.append style={}) is the preferred way to 
change styles - but again, you have the correct approach here.


Best regards

Christian

Am 18.12.2011 15:01, schrieb Xavier Scheuer:
> Hello,
>
> I'm new to this wonderful world of TikZ/pgfplots.  :-)
> I'd like to have the label of the y-axis (ylabel) horizontal and at
> the top of the y-axis (left to the axis).
>
> Currently the ylabel is vertical, in the middle of the y-axis.
> I searched in the manual and I tried things like
>
>    every axis y label/.style={at={(ticklabel cs:0.5)},anchor=top}
>
> but I must be missing somewhere (in fact I do not understand many
> things).
>
> Anyone could help?
> Thanks in advance.
>
> Cheers,
> Xavier
>


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to