# Using Cleveland dot plots to visualize time-series data

When I'm dealing with time-series data I'm generally thinking about visualizing that data with a bar graph (small n) or a line plot (large n). For example, I might create something like the below: However, is there any instance in which a dot plot can be used to visualize time-series data? ( a clevland dot-plot is what I mean, with dates on y-axis and values on the x-axis)

Here's the data and code I used for the previous graph.

conv = c(10, 4.76, 17.14, 25, 26.47, 37.5, 20.83, 25.53, 32.5, 16.7, 27.33)
click = c(20, 42, 35, 28, 34, 48, 48, 47, 40, 30, 30)

dat <- data.frame(date=c("July 7", "July 8", "July 9", "July 10", "July 11", "July 12", "July 13",
"July 14", "July 15", "July 16", "July 17"), click=c(click), conv=c(conv),
stringsAsFactors = FALSE)

dat

ggplot(dat, aes(as.character(date), conv)) +  geom_bar(fill="#336699", colour="black") + ylim(c(0,50)) +
opts(title="Conversion Rate") +
opts(axis.text.y=theme_text(family="sans", face="bold", size=10)) +
opts(axis.text.x=theme_text(family="sans", face="bold", size=8)) +
opts(plot.title = theme_text(size=15, face="bold")) +
xlab("") + ylab("")


EDIT:

My question may not have been clear. I'm NOT asking how to generate a cleveland dot plot. I'm asking whether it's all right to use a cleveland dot plot to visualize time series data. According to the 'statistical visualization rulebook', are cleveland dot plots a good way to represent time series data?

I don't have a copy handy, but I believe in Edward Tufte's The visual display of quantitative information, he suggests that for time series charts the X axis should be reserved for the temporal dimension (simply for familiarity). He also has an example where connecting the lines between the observations one is able to discern periodicity in the observations that would be difficult to detect simply observing the dots.

So I would just suggest a simple line plot, which with your above data could be graphed in R as;

plot(x = 1:11, y = dat$conv, type = "l", xaxt='n') axis(1, 1:11, as.character(dat$date))


Considering the nature of the data another question suggesting to graph confidence intervals for estimates may be of interest as well.

I think dot-chart is the best while visualizing categorical data vs numeric observations on these categorical data. You would keep the categorical data on the y-axis and the x-axis has the numeric observations. Ordering of the categories is recommended to let the patterns be clearer. Therefore, I don't think you'd get much out of dot-plot for time-series data. You can definitely draw it, but there are better ways to represent time-series data. However, I must point out that your hunch was right in replacing a bar chart with a dot-chart. In fact, dot-chart can replace every bar-chart and pie chart in a much better way! (unfortunately, I don't see people doing it though).

Time-series data come with the natural uni-directional time axis and you'd lose key patterns if they weren't on the x-axis. Check out the excellent STL decomposition here in stats package of R and in latticeExtra package here. They are time-series-specific visualization methods. They are also emphasized in Cleveland's Visualizing Data book in Chapter 4.

As Andy W points out, line plots are the best! Like Gelman and Fung, I also think line plots are under-rated.

plot(x = dat$conv, y = 1:11, yaxt = 'n', xlab = 'Conversion Rate', ylab = '', panel.first = abline(h=1:11, col = 'lightgray', lty = 2), bty = 'n') axis(2, 1:11, as.character(dat$date), las = 1)


That's with just using plot. There's a convenience function for more complex examples if they're laid out in a matrix. Try ?dotchart.

EDIT:

Sure it's OK. It's probably better either with dates on the y or the x simply because the implications of a bar that goes to 0 are removed.

I wouldn't use a bar graph, regardless of the sample size, I'd use a line plot.

But I'm not sure WHY you would want a Cleveland plot of time series data. Line plots seem like the right tool; if you have more time points, you can look at smoothed curves of various types, and seasonality and all sorts of things, but I would start with a line plot