Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

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 a BubbleChart, how can influence the elements plotted depending on a value in the tuple plotted?

I want to create a BubbleChart from the following data:

 lines = {{1, 10, 2}, {2, 15, 1}, {3, 27, 4}, {4, 35, 2}}

but instead of the bubbles, I want to draw a line as long as z.

share|improve this question
had to reward myself by smarty-pantsing the answer right away, as it took some reading the documentation. Sadly, the predictive interface did not do my homework for me... – Florenz Kley Nov 13 '13 at 22:45

ChartElementFunction to the rescue! It not only has a couple of builtin functions to change the plotted elements


{"Bubble", "FadingBubble", "GradientBubble", "MarkerBubble", \
"NoiseBubble", "OscillatingBubble", "PolyhedronBubble", \
"SphereBubble", "SquareWaveBubble", "TriangleWaveBubble"}

but it's also possible to define a custom function that will be fed by BubbleChart. For each plotted tuple, it receives [region, values, metadata] and can be used to plot lines like

lines = {{1, 10, 2}, {2, 15, 1}, {3, 27, 4}, {4, 35, 2}}
doline[___, {x_, y_, z_}, ___] :=
 Line[{{x, y}, {x + z, y}}]
BubbleChart[lines, ChartElementFunction -> doline]

enter image description here

share|improve this answer

Your Answer


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.