STEM

Creating a half-circle and a rainbow chart

In this blog, I demonstrate creating a half-circle, and then a rainbow chart in Excel using data. The charts are dynamic and fully customizable. Other than just being pretty, they have plenty of uses (e.g. for seating arrangements in an arena, for showing counts of seats occupied by different parties, and much more. Besides, they’re a lot of fun to create. Let’s take a look at them at a high-level.

The formulas for the x,y coordinates for a half-circle with radius (r) and center at (h, k) are:
x = h + r * cos(theta)
y = k + r *sin(theta)

where theta is the angle parameter that varies from 0 to pi. I used 101 data points, evenly spaced between 0 and pi. They are added as a series into the chart. For a rainbow, using the same principles and formulas, I created a total of 7 series, with a small gap or distance between the adjacent series. The layout looks something like this. For a simple half-circle, I just use the x,y column values, whereas for the rainbow, I used all of the following x,y columns. Using 101 rows of data balances the left and right tails perfectly.

Plotting just the x,y data points in a scatter plot yields a chart as shown below.

To create the rainbow, I added 6 additional series from the table shown above. The chart at this point looks like this:

Note that these are in polar coordinates with 0,0 at the center of the x-axis. After that, I changed the markers from to lines, and then changed each series colors to match the approximate rainbow colors.

To clean up the chart, I remove the axes, and gridlines, and resized it to look a little wider.

But why stop there? We can add a background image to the plot, and why not add a pot of gold at the end of the rainbow too? I set up a couple of cells for the pot’s x,y coordinates so that it aligns nicely with the rainbow and added those data points as yet another series. The final result is shown below:

Understandably, there are lots of intermediate steps here that’s too much to explain here, but you can download the complete workbook with detailed step-by-step guide and with deeper explanation for yourself. Head over here to download it! Unleash your creativity and create your own versions.

I hope it was interesting and educational. Happy charting!

Related:


Interested in creating programmable, cool electronic gadgets? Give my newest book on Arduino a try: Hello Arduino!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top