Dear Matthias,

I'm glad my tips proved to be valuable.

Concerning your question to combine "nodes near coords" and some sort of dictionary as in the preceeding mail: yes, that is possible: simply provide the dictionary evaluation as argument to nodes near coords like

nodes near coords=\csname dict.\pgfplotspointmeta\endcsname

Note that in this context, '\pgfplotspointmeta' contains your "explicit symbolic" point meta data.

For example for \addplot coordinates {(0,0) [a]}, the macro \pgfplotspointmeta will contain the 'a' -- and the dictionary will work as in the preceeding example. For convenience (and for other people), I copy the listing again here:

====================================
\documentclass[a4paper]{article}

\usepackage{pgfplots}

\begin{document}

% Task: symbolic coordinates which can be formatted somehow.
% %
% % Problem: coordinates must be expandable (i.e. no formatting
% % instructions allowed).
% %
% % Suggested approach: define a dictionary which is only used for
% tick
% % labels:
%
\expandafter\newcommand\csname dict.a\endcsname{$\alpha$}
\expandafter\newcommand\csname dict.b\endcsname{$\beta$}
\expandafter\newcommand\csname dict.c\endcsname{$\xi$}
%
% Explanation:
% \expandafter replaces the *second* following token by its
% "top-level" expansion:
% \expandafter\newcommand\csname dicta\endcsname{...}
% -->
% \newcommand\dicta{...}
%
% \csname ...\endcsname is, in principle, the same as '\...'. But you
% can use any characters inside of '...', including commands.
%
\begin{tikzpicture}
\begin{axis}[
symbolic x coords={a,b,c},xticklabel=\csname dict.\tick\endcsname,
xtick=data,
nodes near coords=\csname dict.\pgfplotspointmeta\endcsname,
point meta=explicit symbolic,
]
\addplot coordinates {(a,2) [a] (b,3) [b] (c,4) [c]};
\end{axis}
\end{tikzpicture}
\end{document}
==============================================
compare the attached .pdf file.

Is this what you had in mind?

Best regards

Christian

Am 02.02.2011 22:15, schrieb Matthias Katerbow:
Hi Christian,
super, das war genau der richtige Hinweis! Vielen Dank :-)
In der Zwischenzeit hat sich noch ein Frage mit ähnlichem Hintergrund aufgetan. Bei der Erstellung von Scattergrammen würde ich ebenfalls gerne in den "nodes near coords" mittels "point meta=explicit symbolic" phonetische Schriftzeichen ausgeben. Wie könnte ich denn hier auf das nun bereits angelegte dict verweisen, sodass die nodes ebenfalls mit expandafter kompiliert werden? Nochmals vielen, vielen Dank! pgfplots und deine Hilfe dazu sind einfach perfekt :-)
Lieber Gruß,
Matthias

Am 02.02.11 21:34, schrieb Christian Feuersaenger:
Hi Matthias,

probiere es am Besten mal mit 'xtick=data'. Das macht einen tick pro
auftretende x koordinate. Ansonsten kannst Du auch mit 'xtick={a,b,c,d}'
oder so ausgewaehlte ticks waehlen.

Mit liebem Gruss

Christian

Am 02.02.2011 12:34, schrieb Matthias Katerbow:
Hi Christian,
ich habe doch noch eine Frage zu deiner Lösung. Wie kann ich es bei
symbolic coords verhindern, dass die Skala der x-Achse reduziert wird.
Es werden alle Säulen im Diagramm angezeigt, aber leider wird derzeit
nur jeder zweite x-tick angezeigt, die dazwischen liegenden werden
ausgeblendet, aber das macht ja bei symbolic coords eigentlich keinen
Sinn. Hast du hierzu auch einen Vorschlag?
Danke und Grüße, Matthias

Am 02.02.11 10:48, schrieb Matthias Katerbow:
Hi Christian,

thanks for that solution, it works great for me!

Best regards,

Matthias

Am 31.01.11 20:14, schrieb Christian Feuersaenger:
Dear Matthias,

I took the freedom to post the suggested answer to the mailing list, I
hope you don't mind.

You idea to provide formatting instructions or other complicated
control
sequences as part of symbolic coordinates can be realized, yes. As you
correctly pointed out, symbolic coordinates should not contain
formatting instructions. However, you can freely format your tick
labels
- and there is a very simple way to realize a dictionary. The
dictionary
then maps your symbolic coordinates to formatting instructions.

Here is an example with in-line comments describing the approach:

=====================
\documentclass[a4paper]{article}

\usepackage{pgfplots}

\begin{document}

% Task: symbolic coordinates which can be formatted somehow.
%
% Problem: coordinates must be expandable (i.e. no formatting
% instructions allowed).
%
% Suggested approach: define a dictionary which is only used for tick
% labels:

\expandafter\newcommand\csname dict.a\endcsname{$\alpha$}
\expandafter\newcommand\csname dict.b\endcsname{$\beta$}
\expandafter\newcommand\csname dict.c\endcsname{$\xi$}

% Explanation:
% \expandafter replaces the *second* following token by its
% "top-level" expansion:
% \expandafter\newcommand\csname dicta\endcsname{...}
% -->
% \newcommand\dicta{...}
%
% \csname ...\endcsname is, in principle, the same as '\...'. But you
% can use any characters inside of '...', including commands.

\begin{tikzpicture}
\begin{axis}[
symbolic x coords={a,b,c},xticklabel=\csname dict.\tick\endcsname,
xtick=data,
]
\addplot coordinates {(a,2) (b,3) (c,4)};
\end{axis}
\end{tikzpicture}
\end{document}
=====================

Is this close to what you had in mind?

Best regards

Christian

PS
There is also a simple way to realize that sort of stuff with pgfkeys:
use
\pgfkeyssetvalue{/dict/a}{$\alpha$}
\pgfkeyssetvalue{/dict/b}{$\beta$}
...
and later
xticklabel=\pgfkeysvalueof{/dict/\tick}

This is probably easier to read.

Am 28.01.2011 09:59, schrieb Matthias Katerbow:
Guten Tag Herr Feuersänger,

ich würde gerne bei der Nutzung des pgfplost-packages in der Angabe
von symbolic coords phonetische Schriftzeichen mittels Tipa
(http://www.ctan.org/tex-archive/fonts/tipa/) darstellen. Allerdings
scheint es mir so zu sein, dass in den symbolic coords keine Befehle
verwendet werden können (z.B. funktioniert \textit{} auch nicht).
Haben Sie einen Lösungsvorschlag?

Vielen Dank und freundliche Grüße,
Matthias Katerbow

---
Philipps-Universität Marburg
Forschungszentrum Deutscher Sprachatlas
Matthias Katerbow, M.A.
Hermann-Jacobsohn-Weg 3
D 35032 Marburg
Tel.: +49 (0)6421-2824408
Fax.: +49 (0)6421-2828936
Sprechstunde: dienstags 9-10 Uhr
http://www.deutscher-sprachatlas.de/mitarbeiter/katerbow/




Attachment: PP.pdf
Description: Adobe PDF document

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to