Find a published plot that does not follow the best practice of showing numbers. Here is a brief visual guide to help you: https://www.data-to-viz.com/caveats.html
Attach the picture or link to it. Name what is wrong.
Suggest the solution.
Show it! Use the data and the graph at hand to produce a better plot for the same data. If the source data are not available, approximate the numbers.
Submit your answer here (remember to press the button ‘turn in’ after you upload the files), attach the knitted HTML with the code visible. Copy your submission to the folder Viz Quiz 5 in the group files.
For the last task, as an example, I decided to choose a not very nice-looking pie chart. In fact, I understand that the pie charts in principle do not win, but I saw the usual article with such a graph and I urgently wanted to change it.
The current graph I have found here. Just click it and you will automatically follow the link to the article.
Let’s look at the current graph.
So, what’s wrong with this chart? Everything…
The idea of displaying 6 decades on the chart is unsuccessful. Pie chart is more suitable for showing the distribution of a single variable, and then, it will not be the best solution for a good visualization. In this case, we are looking at distributions of several decades and the graph looks overloaded, messy and difficult to understand.
Since the decades are only signed in the title of the chart, the eye constantly falls on the title to match these circles and understand something.
Some percentages are signed in bold, some are not. How is this done? Are the percentages signed in staggered order? This is also distracting.
These diagonal shifts in each share are the worst thing about this chart. I understand that they are built depending on the percentage of a particular food in a particular decade, but…
It seems to me a strange idea to specify 6 decades in the title of the chart, and the reader begins to count these steps in the pie chart, and does not understand what the problem is? And then he comes across a note at the bottom that says 2 decades are missing.
It feels like the graph itself is cropped at the bottom.
I do not like names of the filled shares in the right of the graph. Maybe we can delete some words to simplify it.
In fact, somewhere I love pie charts, even though everyone else does not like them. However specifically in this example, I don’t like everything: this white circle in the center of the graph, the font of the captions and colors as well.
I think that bar charts are the best for this task. Stacked bar plot is a best way to represent such information, because here we have several groups that needed to be stacked on the same bar for better visualization.
I will represent data, but without 1980 and 1990, so I would not needed to add extra text on the title and make some notes.
I will show percentages, but not making it bold.
I will cut some names for filling it to barchart.
Let’s make new graph.
food2$Date = as.factor(food2$Date)
p2 <- ggplot(food2, aes(x = Date, y = Percentage, fill = Food)) +
geom_col(colour = "black", position = "fill") +
#geom_text(data=food2, aes(x = Date, y = Share, label = Percentage),
#colour="#116315", family="Tahoma", size=3.5)+
geom_text(aes(label = Share),position = position_stack(vjust = 0.5)) +
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Pastel1") +
theme_classic() +
coord_flip() +
labs(
title = "World Dietary Shares",
subtitle = "Demand for meat and dairy is set to increase, while
demand for cereals, roots and tubers is set to decline") +
theme(legend.position="bottom", legend.direction="horizontal",
legend.title = element_blank()) +
theme(plot.title = element_text(size = 12, family = "TimesNewRoman", face = "bold", hjust = 0.5),
text=element_text(family="TimesNewRoman"),
axis.text.x=element_text(colour="black", size = 10),
axis.text.y=element_text(colour="black", size = 10)) +
theme(plot.subtitle = element_text(hjust = 0.5))
p2Coclusion:
Now we clearly see the distribution and can make conlusion looking at current graph. While previosly it was hard, now we can exactly say that demand for vegetable oils, dairy and meat is tend to increase, demand for roots and tubers, cereals and pulses is tend to decrease. The demand for sugar is set to remain the same in 30 years.
With stacked barchart everything looks fine. I made meaningful subtitle, deleted not used decades in the graph and made data clear and visually better.
Hope you like it!