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 attempting to answer this question from @Cam on BubbleCharts with elliptical bubbles, I suggested using separate ChartElements which themselves could be ellipses. My idea was to define them as regular graphics objects and use them like this:

datatoplot = {{1, 2, 0.5, 0.7}, {10, 5, 10, 0.2}};
ellipse[v_] := Disk[{v[[1]], v[[2]]}, {v[[3]]/10, v[[4]]/10}];
ce = Graphics[Style[ellipse[#], Blue]] & /@ datatoplot;
Show[BubbleChart[{datatoplot[[;; , ;; 3]][[#]]},ChartElements->ce[[#]]]&/@{1,2}, PlotRange -> All]

However, while the objects I've called ce above are indeed ellipses, they get rescaled when they are used as ChartElements and their ellipsicity is undone (or at least altered).

It seems in the help section for ChartElements that the format to define the width and height is to give

ChartElements->{g,{w,h}}

but this gives an error message when I try and implement it naively (with an arbitrary scaling of {0.3,0.6}). Trying it by hand:

Show[BubbleChart[{datatoplot[[;; , ;; 3]][[#]]},ChartElements -> {ce[[#]], {0.3, 0.6}}]&/@{1,2}, PlotRange -> All]

gives me the error shown here:

error message

Does anyone know how to correctly implement the scaling for ChartElements? Is it that the elements should somehow be different from regular Graphics objects?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I'm guessing the error is because BubbleChart doesn't let you specify the width and height of chart elements because it determines them itself. You can do it with ChartElementFunction though.

data = {{1, 2, 0.5, 0.7}, {10, 5, 10, 0.2}};
cef[___] := Disk[{#1, #2}, {#3, #4}] & @@ data[[++i]]
BubbleChart[i = 0; data[[All, ;; 3]], ChartElementFunction -> cef]

bubble chart with ellipses

share|improve this answer
    
Yes, I think you are probably right on this. The whole point of the BubbleChart is that it specifies the size by the third elements in the list of data that you give it. I hadn't thought of that. I'll see if anyone else answers, but this sounds like a fair response. –  Jonathan Shock May 1 '13 at 6:59
add comment

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.