1
$\begingroup$

I have a list of points I want to plot. I'm trying to use BubbleChart because I want to assign to each point a different shape.

How do I plot a BubbleChart with each point drawn with a different shape?

I tried this but it doesn't work:

BubbleChart[{{1, 2, 2}, {1, 1, 1}, {2, 3, 3}}, 
 ChartElements -> {\[EmptySquare], \[EmptyUpTriangle], \
\[EmptyCircle]}] 
$\endgroup$
1
$\begingroup$
BubbleChart[{{1, 2, 2}, {1, 1, 1}, {2, 3, 3}}, 
 ChartElements -> (Graphics@Text[Style[ToString@#, FontSize->Scaled[1]]] & /@ {□, △, ○})]

enter image description here

Alternatively, turning the example from FilledCurve >> Applications >> Text Effects into a function:

toGraphics = Graphics[{EdgeForm[], First[First[
   ImportString[ExportString[Style[ToString@#, FontSize -> 64], "PDF"], 
       "PDF", "TextMode" -> "Outlines"]]]}] &;

BubbleChart[{{1, 2, 2}, {1, 1, 1}, {2, 3, 3}}, 
 ChartElements -> (toGraphics /@ {□, △,  ○}), 
 ChartStyle -> {Red, Green, Blue}]

enter image description here

Note: the second approach works in v9. In v12 (Wolfram Cloud Front End) it produces error messages.

$\endgroup$
  • $\begingroup$ With the first solution the size of the shape does not change correctly. Try data values of {{1, 2, 2}, {1, 1, 1}, {2, 3, 30}} $\endgroup$ – Rohit Namjoshi Oct 15 at 16:59
  • $\begingroup$ Thank you @Rohit; good catch. Changed the font size specification to Scaled[1]. $\endgroup$ – kglr Oct 15 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.