9
$\begingroup$

I have a big list that I'd want to plot using 'Listplot.' I replaced it with

list = Table[{x, -10 + Abs@(x^2)}, {x, -3, 3, 0.3}]

I wish to have a plot as the below picture

enter image description here

in which the symbols have been replaced by empty circles with a gradient color change. Furthermore, the radius of these circles ranges from little to huge. It is preferable to make these radii a factor of their value. In paint I could present what I mean. I searched a lot on this site but did not find what I was looking for. can anyone reach me to the goal!? Because I must use ListPlot and not Plot I generated a list at the first.

$\endgroup$

2 Answers 2

8
$\begingroup$

BubbleChart

list2 = Join[list, List /@ Normalize[Abs @ list[[All, 2]], Total], 2];

bubblechart = BubbleChart[list2, 
 ColorFunction -> "Rainbow", 
 ChartStyle -> FaceForm[Opacity[.5]], 
 BubbleSizes -> {.01, .05}]

enter image description here

If desired you can post-process to replace disks with circles and points:

bubblechart /. d_Disk :> {Circle @@ d, Point @ d[[1]]}

enter image description here

PointValuePlot

list3 = list -> Transpose[{#, #} &@Normalize[Abs@list[[All, 2]], Total]];

PointValuePlot[list3, {1 -> "Color", 2 -> "Size"}, 
 ColorFunction -> "TemperatureMap", BubbleSizes -> {.01, .05}]

enter image description here

$\endgroup$
5
  • $\begingroup$ It is very good but can they be empty and just the line around the circle be colored? $\endgroup$ May 3, 2022 at 10:26
  • $\begingroup$ I am trying to understand what did you do!!! I get stuck to generate list2 and list3. I cannot understand their roles!!! $\endgroup$ May 3, 2022 at 10:31
  • 1
    $\begingroup$ @InzoBabaria, for BubbleChart input data should be a list of triples {{x1,y1,z1}, {x2,y2,z2}...} where the third coordinate indicates the bubble size (which can also be used for controlling color when the option ColorFunction is used) So used the the normalized absolute values of the second column of your list to generate z values and append them to the x-y coordinates. For PointValueChart I used the input data in the form list of x-y coordinates -> lists of point-values with each point-value being a pair {v1, v2} and used v1 to code color and v2 to code bubble size. $\endgroup$
    – kglr
    May 3, 2022 at 10:38
  • $\begingroup$ Your explanations are very useful. $\endgroup$ May 3, 2022 at 11:24
  • $\begingroup$ The last changes gets it improved $\endgroup$ May 4, 2022 at 10:28
9
$\begingroup$
list = Table[{x, -10 + Abs@(x^2)}, {x, -3, 3, 0.3}]
cols1 = ColorData["Rainbow"][1 - #] & /@ Subdivide[1, 10]
cols2 = ColorData["Rainbow"][#] & /@ Subdivide[1, 9]
cols = Join[cols1, cols2]
Length /@ {list, cols}

You can choose your own color scheme. The lists called list and cols should be the same length.

ListPlot[list
 , AspectRatio -> Automatic
 , Epilog -> {Transpose[{cols, Circle[#, Abs@#[[2]]/50] & /@ list}]}
 ]

enter image description here


EDIT

Or follow this variation using Thread:

ListPlot[list
 , AspectRatio -> Automatic
 , Epilog -> {Thread[{Hue[Abs@#[[2]]], Circle[#, Abs@#[[2]]/40]}] & /@
     list}
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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