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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In pgfplots, is it possible to have meta data affect the size of markers instead of their colour?

I am referring to the set of commands described in section 4.4.10 about scatter plots in the pgfplots manual.

Here is one of the provided examples :

\begin{tikzpicture}
\begin{axis}
\addplot+[scatter,
samples=50,scatter src=y]
{x^3};
\end{axis}
\end{tikzpicture}
share|improve this question
up vote 12 down vote accepted

Yes, by using the scatter/@pre marker code to adjust the value of mark size depending on \pgfplotspointmetatransformed (which by default contains the y value scaled to a range from 0 to 1000):

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[
    scatter,
    scatter src=y,
    samples=40,
    scatter/@pre marker code/.append style=
        {/tikz/mark size=2+\pgfplotspointmetatransformed/300}
]
{sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
Knowing, thanks to Jake's answer, where to seek, I found that the issue is treated on page 283 of the manual. – Alfred M. Sep 29 '12 at 15:20

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.