<----- Return to Excel Statistics Page
(c) 2020 by Keith Greiner
This essay describes the unique coxcomb plots published by Florence Nightingale in 1858 and uses her original data to create coxcomb plots using Excel, Tableau Public, and R. The essay includes an overview and instructions on how to create charts that originate in Excel and are completed in Tableau Public and R. There is information on how to construct single-series charts, two-series charts, and three-series charts.
The final resulting charts are summarized in the following image. Details are in the following text on this page and on the supporting pages.
One hundred sixty-two years ago, Florence Nightingale published her analysis of deaths among the British forces during the Crimean War. The 1,076 pages of text, charts, and tables describes the terrible conditions of soldiers in one of the most devastating military campaigns in British history. Amid the dreadful conditions, Florence Nightingale assisted the injured and emerged as an advocate for nursing professionalism, improved sanitation, and statistics.
The report has the daunting title: “Notes on matters affecting the health, efficiency and hospital administration of the British Army: founded chiefly on the experience of the late war.” A copy can may be found at archive.org or at WelcomeLibrary.org. The text includes extensive commentary, supported by tables and graphs. Those graphs have become iconic in the world of statistics. I am including images from the book because they have historical value, and were first published in 1858.
Below is an image of the graph from page 310 of the report:
Data for the graph may be found on page 312. As you read the table, note the way that decimals are shown. The third from right column of the table, and the graph show annualized estimates to the nearest tenth. The first number is 1.4, the second is 6.2 and so on. The graph is the sum of the three right-most columns, with selections that include 12 months from April, 1854 through March, 1855.
The graph is an interesting presentation of 12 months of data. It shows the months as a series of 12 equal-size (30 degrees) pie wedges, with the radius of each wedge showing the number values. Beginning with the annualized number of January deaths (1,173.6) at the six o’clock position, the chart proceeds around clockwise with July at the top, and December at the bottom right.
Statisticians admire the Nightingale Rose graph because it effectively communicates her point that most of the fatalities were from disease instead of military engagements. Some appreciate the artistic design so much that they use a framed copy as wall art.
Unfortunately, the most commonly used spreadsheet and graphics program (the one that nearly everyone uses) won’t create a graph in the Nightingale Rose format. As an homage to Nightingale’s contribution to statistics, and as an aid to analysts, it would be nice if the design were available. Until then, there are some other ways to make a modern adaptation of a Nightingale style graph. Below are examples of modern renditions of the chart using Tableau Public and R.
This discussion needs to begin with a one-series chart and then build upon that to create two-series and three-series charts.
So, as we begin to look at Nightingale's coxcomb charts, lets first look at single series charts.
Below are four examples of single series charts.
In this example, you may notice that the pie segments in the upper left quadrant are substantially larger than Nightingale's image. This is an indication that some rescaling would be helpful. Information on rescaling is shown in the section on how to create a two-level chart.
Below is the series constructed in R. This version is built on a flat background of concentric circles.
The graphs shown, above, were created in several general steps: First, I used the mathematical features of Microsoft Excel to prepare the data. I verified the calculation of the annualized mortality rate, and summed the annualized rates for deaths from disease, conflict, and other causes. The summed, annualized, rate matches the numbers shown in the graph. The summed values were entered directly into an R program.
For Tableau Public, the following steps were used.
In Excel, a VBA program was created to convert the list of months, and totals, into 384 records. Each of the 384 records contained the assigned degrees of a circle, the value to be plotted, the degrees converted to radians, and an [x,y] point value. The circle was divided into twelve, 30-degree segments with pie shapes that begin and end at point [0,0]. The calculations produced 32 points for each pie segment having a radius equivalent to the number to be plotted. Tableau did the work of fitting all those points onto an , y background. Although I used a VBA program, there is now a list of points that can be used for the Nightingale data and adapted to any set of graph that needs 12 slices. Tableau Public converted the points into an on-screen chart. In this presentation, unlike Nightingale’s circle, the graph appears to be tilted slightly as in a three-dimensional setting. That is an artifact of the way Tableau plots points, shapes, and areas onto a screen. By adjusting the length and width of the output frame, any number of presentations can be obtained. For those who are not familiar the Tableau Public software, the necessary steps may seem to be a bit daunting, but they are made a lot easier by looking at examples.
Here are two examples using data from COVID-19 cases in Iowa between March 2020 and part of October, 2020.
Following are detailed instructions on how to create a coxcomb chart in Tableau Public.
1. Set up a spreadsheet that has columns A through H and 384 rows. Use the comma-delimited data at this link to set up the spreadsheet. Do not put anything to the right of column H or below the spreadsheet row 384. Click here to see what my spreadsheet looks like when it is set up for export to Tableau Public.
At this link there is a list of Points in Excel that can be used to create a coxcomb plot in Tableau Public. Copy and paste the records into a spreadsheet and convert from comma-delimited to a sheet. Columns should be A through H and rows should be 1 through 384. The list as presented here in Google sites appears to be double spaced. If that turns out to be true for you, be sure to make sure the data are single spaced in Excel. If this is the first time you have used Tableau Public, I suggest you watch some videos and practice with some bar graphs and line graphs before attempting this step. If this is your first experience with the software, you may find it a bit daunting.
2. The spreadsheet has 384 rows of degrees numbered 1 through 360 and some repeated numbers as described below.
3. There are up to three rows for 30, 60, 90, 120, 150, 180, 210, 240, and 360. One row for 1, and 360.
4. Keep columns A, B, C, E, and H exactly as shown.
5. Column E may be calculated using the following example for row 3.
6. Keep the column headings exactly as shown.
7. In column D, replace each "value" corresponding to a month with the value for that month that you want to graph. by that I mean, if the value for January is 200 instead of 159.6 shown in the table, then change it to 200.
8. For the Nightingale example, the monthly numbers are...
9. If a monthly value was zero, I gave it a value of 1 as a place holder. For most charts with large numbers, that won't affect the appearance of the final chart. For a chart with smaller numbers, say 1.0 or less, I use a very small number of .0001 or something like that that will act as a non-zero place-holder that won’t affect the appearance of the chart. In the two-layer and three-layer examples I set the zero values to zero.
10. Calculate the values of x and y using the following spreadsheet code. This code is shown for row 3. As you will see, row 2 has been set to zero for both x and y. So, do these calculations for every point that isn't set to x = 0 and y = 0.
F3 = cos(E3) * D3
G3 = sin(E3) * D3
11. Copy the formulas to all rows in column F and G.
12. This creates a complete 30-degree pie shape for each value to be graphed.
13. Name the sheet as you wish. I call it Data2.
14. Open up a new Tableau Public file. The following statements assume you have a basic understanding of how Tableau Public works.
15. Set this file sheet as an input source.
16. Drag the sheet name (ie: Data2) onto a sheet.
17. Use the settings shown in the image below.
18. Set attributes of Y value to Dimension, Continuous.
19. Set attributes of X value to Dimension, Continuous.
20. Filter to Month1.
22. Set Marks to "Polygon."
23. Set Month1 with four dots to Dimension
24. Set MonthN with three dots to Dimension, Discrete
25. Set Month1 with three dots to Dimension
26. Set Sum(Value) to Measure(sum), Continuous
27. Set Path1 to "Path" with tilde line, and attributes to Dimension, Continous.
28. Proceed to make changes and adjustments as your creativity inspires.
29. This worked for me. If it does not work for you, check to be sure you have made all the steps exactly as shown, and use your skills at problem solving as needed.
30. It is possible that I omitted something, or you missed a step. These instructions have no warranty, but should at least get you close.
The coxcomb charts shown above do some nice things as they present data in a circular format. However, Florence Nightingale's chart has three layers. One is for deaths from disease, one is for deaths from conflict wounds, and the third is for an "other" causes. The whole point of her chart is that the number of deaths from disease far outnumbers those from conflict wounds. On the way to a chart with three levels, we need to make sure we can create a two-level chart that works. In this example, we make a coxcomb chart with two series. I use the terms "series" and "level" interchangeably in this discussion, and the chart coding uses the term "level".
The document at this link provides a more details on how to create a two-level chart. Once you see how to create a two-level chart, the creation of a three-level chart follows the pattern used to set up the data. The Tableau Public coding should be able to handle that data without changes.
After creating a two-series chart, it is an easy step to create a three-series chart. All you need to do, in Excel, is take the Level "2" list of points created in Excel for the two-level example, and paste a copy below the second level. Recode the columns "Level" and "Series" to values of 3 for that new segment, and update the Value1, column for that section, to show the values you intend to have displayed in the chart.
The document at this link provides a more details on how to create a three-level chart.
Following is an image of the code that will create a single level coxcomb chart in R.
Because this is an image, you can type the code into your R-Studio development tool. Typing it is a good thing to do because it allows you to check each step as you go along, and in the end you have a better understanding of how the coding creates a coxcomb chart.
Be sure you have installed ggplot2 and its dependencies. Note that there are two statements for MLabels. This one starts with July because the data in the "Total" variable start with July. Be sure the order of these two arrays are aligned together. July is listed first because the plotting begins at the top, 12 o'clock, position. If we wanted January to be listed first, then it would need to be first in the Total and MLabels arrays.
Below are three images of code that will create a three-level coxcomb plot in R using the Nightingale data.
The ggplot statement is shown with the original relationship between the value and radius in the statement;
p <- ggplot( plot1.night, aes(x = Month0, y = value , fill = fill , order = fill))
to rescale the variable "value" to make it more consistent with Nightingale's original, change the code to the following;
p <- ggplot( plot1.night, aes(x = Month0, y = (value/3.1415925)^0.5, fill = fill , order = fill))
The examples, described here, take the "y" value of the data and use that for the radius of each pie slice. That is not an entirely accurate representation of Florence Nightingale's chart. Nightingale understood that the area of a pie slice becomes larger by a factor of r squared as the radius is increased. In Tableau Public charts, having only one series of variables to be plotted, the radius of each pie segment is set at the value to be plotted. That doesn't take into account that a pie slice gets larger as it extends away from the central point. That doesn't matter much when a single series is graphed, but it can cause problems when two or more series are graphed. When there is more than one series to be plotted, there may be an under-representation of values with radius near zero, and an over-representation of values near the maximum.
The solution is to rescale the "y" value so that it is more linear. The "y" value may be rescaled with the following formula:
New_Y_Value = (Y_Value/3.141529265)^0.5
That is, it is the square root of the original value divided by the pi constant.
The page at this link shows the affect that a rescaling of "y" has on the appearance of the chart.
Click here to see my LinkedIn article on this topic.
<----- Return to Excel Statistics Page
-- 30 --