Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

1 Answer 1

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

ChartElementData["BubbleChart"]

{"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

 
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.