I’m still going through Nathan Yau’s book ‘Visualise This’. Today I was reading about illustration software and the ugliness of python graphs. He’s right. Graphs made using matplotlib don’t usually have a polished look. For my work (beavering Phd student in materials physics), I care little about polish. As long as it is publishable quality, clean to look at and conveys the information correctly, I’m sold. But if I want to put that scripted graph into National Geographic (for example.. I wish!), no one would look twice at it. Most people would probably scrunch up their eyes and turn away. Speaking of matplotlib graphs for the general audience, I did spy them all over Geoffrey Rush’s TED talk. My inner geek was singing for joy! I digress. So, in the name of learning and a sad lack of things to do at home (anything but the dishes!), I decided to try my hand at converting a relatively “unsexy” matplotlib graph into a sexy, appealing one using Inkscape. The data is flawed so please ignore it. I was trying to compare vegetable prices across different stores but I failed to normalise price to weight. Doh!
The process of “prettification” was relatively easy. I did a gaffe and removed the y axis by mistake so I had to recreate it manually but everything else was easy peasy. I stuck to a pastel theme and muted all the colours. I also decided to remove the highlighted regions indicating seasonal and non seasonal vegetables and removed the error bars. I think the final result looks good but I am sure Nathan can teach me plenty more tips on making visualisations look good.


Looks cool. Including the date (or date range) would add more value. I know it is a snapshot in time but pisitioning it that way would help,
Maybe the price comparison between different groups is not crucial, so perhaps you could place them in different panels with varying scales. Here’s a ggplot version, each panel being ordered from cheaper to most expensive
library(ggplot2)
set.seed(123)
d <- data.frame(market = LETTERS[1:4],
radish = runif(4, 0.2, 3),
spinach = runif(4, 0.2, 5),
carrots = runif(4, 0.2, 4),
mushroom = runif(4, 0.5, 15))
m <- melt(d, id="market")
m <- m[order(m$variable, m$value), ]
p <- ggplot(m) + facet_wrap(~variable, scales="free", ncol=1) +
geom_bar(aes(x = market, y=value, fill = market), stat="identity") +
labs(y="price /NZD", fill = "marketplace") +
scale_x_discrete(breaks=NA)+
scale_fill_brewer(palette="Pastel1") +
opts(axis.line = theme_blank(), #axis.ticks = theme_blank(),
legend.background = theme_rect(colour = NA),
axis.title.x = theme_blank(),
axis.text.x = theme_blank(),
legend.key = theme_rect(colour = NA),
panel.background = theme_rect(fill = "white", colour = NA),
panel.border = theme_blank(),
panel.grid.major = theme_blank(),
panel.grid.minor = theme_blank(),
strip.background = theme_blank(),
plot.background = theme_blank())
ggsave("groceries.pdf", p, height=12, width=5)
Very nice! That’s a very cool suggestion and it looks pretty too
. I think I could extend your suggestion to do a similar structure but facet according to the market.
Oops … you’ll probably need data.frame(…, stringsAsFactors=FALSE ) to have the correct order.
I’m pretty sure (at least at this point) all of the final graph can be done in Matplotlib without needing to resort to Inkscape or anything else.