2

I have been hunting all over for a tutorial on how to build arc/rainbow graphs like the one in the picture.enter image description here I'm confident that I could make paths line up with one another like that but I need a way to get the paths to be sized proportionally to corresponding data. Any ideas?


4
  • Related: Is math needed for graphic design?. If you mention any specific software, it could be scriptable for that. The math ain't that hard.
    – Jongware
    Oct 10, 2018 at 21:12
  • 1
    What software are you using?
    – Billy Kerr
    Oct 10, 2018 at 21:43
  • 1
    as a sidenote: if you actually need people to read/understand your data easily and "accurately", this seems like a pretty bad kind of chart to use. (if you just go for "ooh, pretty!", then go ahead ☺)
    – J.E
    Oct 11, 2018 at 9:06
  • I am using illustrator. It does not need automatic redrawing. Oct 17, 2018 at 20:57

2 Answers 2

1

This plot can be made quite easily in R's ggplot package. I presume python and other's would also be able to do it quite easily.

<I agree with J.E's comment that this graph is not ideal for interpreting values accurately, but it is very handy to enable quick comparisons- especially when the bar lengths vary widely as in the example here. This uses much less space compared to a regular bar chart and also makes it easy to directly label the bars as done in the magazine image above>

Basic idea is quite simple: draw a regular barplot and transform it into polar co-ordinates.

To reproduce the look from the above image:

  • I arranged the shortest bar on the outer edge of the circle
  • Made the longest bar go only half the circle (defaul will make it full circle)
  • Moved all the points away from the origin R-ggplot's circular barplot

Here's the code

dset <- data.frame(score = c(1,5,8,9,13,15)) # load dummy data

# make the plot as a bar graph, add points and transform to polar coordinates. 
# To make the longest bar span only half a circle, I made the total y axis length 30
# To move points away from origin so it's easier to see the lengths, I increased range of x values from 11 to 16 (rather than 1 to 6)

ggplot(data = dset, mapping = aes(y = score, x = c(16:11))) + 
geom_bar(stat = 'identity') + # plot the bars
geom_point(size = 5, fill = 'white', shape = 21) + # the circle at the end of bars
coord_polar(theta = 'y') + # polar coordinates, making the bar height into 'angle'
ylim(c(0,30)) + xlim(c(0,17)) # setting limits the x and y
1

An old case.

The given automatic drawing method generates the arcs, but it has nothing about the straight tailpieces. This answer has them.

There's a comment which says you do not need automatic drawing. Obviously you know how to draw it manually, only proportional endpoint placements are problematic.

enter image description here

  1. The curves at their maximum lengths are half circles which have at both ends joined straight tailpieces. The tailpieces have equal lengths (=S) but the arc radiuses have differences =W. Only the edge curves must be drawn. The intermediate curves have got by Blending with specified steps. In this case there's 4 intermediate steps. W=(R6-R1)/5 ; the divisor is the number of the gaps between the curves.

  2. The blend is expanded, ungrouped and a little smaller stroke with than W is inserted. The curves are splitted with the Scissors at the wanted endpoints and the extra parts are deleted.

  3. Circles which have the same width as the strokes are inserted. They snap at the endpoints of the curves if you have Snap to point and Smart guides =ON and drag a circle from the centerpoint with the direct selection tool.

  4. Calculating the places of the endpoints is tiresome if you have several arcs. Using a spreadsheet (Excel or OpenOffice Calc) helps substantially.

You must calculate for every presented value what is its proportion (0...1) of the full scale. For ex. if your full scale is $10000,- and you want to present $5670,- its proportion is 5670/10000 = 0.567

If you calculate the proportions with 3 decimals like 0.567 there's surely caused no visible inaccuracy.

For every curve proportion=0 is at point A and proportion=1 is at D. To have some quick comparability between the curves you cannot select the places of the endpoints entirely based on path lengths. On the straight parts of the curves the proportion should grow along the line length, but on the curved part the proportion should grow along the angle X from point B to the endpoint. In this way equal proportions are visually side by side.

So, you should decide what proportion (=Pb) is presented by point B. It's fully arbitary. I suggest it's the same as which part S is of the full curve length on the outermost track.

Calculate the full length (=Lo) of the outermost track.

Lo=2S+Pi*Rmax where Rmax is the radius of the arc of the outermost track. => Pb=S/Lo

To have symmetric scale let point C present proportion Pc=1-Pb.

Let Px be one proportion which needs an endpoint. If Px is less than Pb the endpoint should be between A and B; the distance from A to the endpoint should be Px*S/Pb

If Px is between Pb and Pc the angle (=X) from B to the endpoint should be (Px-Pb)*(180 degrees)/(Pc-Pb)

You can draw a vertical line and rotate it angle X around the centerpoint. Send the line to back and cut the arc at the crossing with the Scissors.

If Px is more than Pc the endpoint is at distance (Px-Pc)*S/Pb to the right from point C or as well it's at distance (1-Px)*S/Pb to the left from point D.

A calculation example:

Let Rmax=30mm and S=12mm => Lo=118.25mm and Pb=0.102

Pb was arbitary, it can well be rounded to 0.1 if it makes possibly shown numbers more easy to read. Less error than 0.01 shouldn't look offensive. Let's do it. Then Pc=0.9

To test let Px be 0.5 and calculate X.

X=(0.5-0.1)*180 degrees/(0.9-0.1) = 90 degrees. The result is in accordance wit the expected half scale place.

ADD: There's a very useful comment which suggests to draw an ordinary bar graph and to use it as an art brush.

It works. The lengths of the tracks must still be calculated or they must be copied from an existing bar graph. But number Pi nor divisions are not needed, so one can easily estimate the the needed lengths in his head within plusminus 5%. An example:

enter image description here

The green bars in the left are the actual bar graph. The grey bar is a dummy bar which shows which length presents proportion 1.0

The vertical red line is a dummy which is inserted to make sure that the grey bar is vertically in the middle of the pattern. Grey bars and the dummies are dragged to the brushes collection and defined to be an art brush. The horizontal direction is reversed in the brush definition dialog.

The blue curve is a half circle+joined horizontal tailpieces. The grey bar will replace it.

In the right the brush is applied to the blue curve. One can delete the dummies as soon as the shape is expanded (Object > Expand Appearance) and ungrouped.

The art brush method has substantial advantages. It's easy to draw also scale numbers and class borders. The bars can even be chains of differently colored shorter bars which show how the bars are sums of different factors.

1
  • 1
    Hmm... But if we think this way wouldnt it mean that a value in the outer race would be behing the smaller value simply because the outer race is longer. Wouldnt it just be easier to make full paths then draw a straight barchart then turn each bar plus empty to a art brush and let illustrator calculate
    – joojaa
    Nov 20, 2020 at 19:56

Your Answer

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

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