[tor-commits] [support-tools/master] Pie charts are better for response time graphs

lunar at torproject.org lunar at torproject.org
Thu Mar 27 20:25:41 UTC 2014


commit ce2a876bc0dfc4ff5cc600ab74a1a52e57a41543
Author: Lunar <lunar at torproject.org>
Date:   Thu Mar 27 21:25:28 2014 +0100

    Pie charts are better for response time graphs
---
 response-time/time-to-reply.R |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/response-time/time-to-reply.R b/response-time/time-to-reply.R
index dcbf000..bb41cbd 100644
--- a/response-time/time-to-reply.R
+++ b/response-time/time-to-reply.R
@@ -27,11 +27,15 @@ data <- aggregate(list(requests = data$requests),
 
 # Plot the data
 ggplot(data,
-  aes(x = month,                  # Month on the x axis
+  aes(x = factor(1),              # Single value on x axis
       y = requests,               # Number of requests on y axis
       fill = interval)) +         # Different colours for response time
-# Make a dodged bar chart
-geom_bar(stat = "identity", position = "dodge") +
+geom_bar(                         # Start with a bar plot
+  stat = "identity",              # Make y represent values in the data
+  position = "fill",              # Make all bars the same length
+  width = 1) +                    # Make all pies the same size
+facet_grid(. ~ month) +           # Make 1 chart per month
+coord_polar(theta = "y") +        # Change y coordinates for pie chart
 scale_x_discrete("") +            # No x axis label
 scale_y_continuous("") +          # No y axis label
 # No legend title
@@ -39,5 +43,8 @@ scale_y_continuous("") +          # No y axis label
 # http://vis.supstat.com/2013/04/plotting-symbols-and-color-palettes/
 scale_fill_brewer("", palette = "Set2") +
 ggtitle("Time to respond to support requests per month\n") +
-theme_bw()
+theme_bw() +
+theme(axis.text = element_blank(),        # No tick labels
+      axis.ticks = element_blank(),       # No ticks
+      panel.grid.major = element_blank()) # No axis lines
 ggsave(args[2], width = 8, height = 4, dpi = 100)



More information about the tor-commits mailing list