I've made box and whisker plots of how fish prices vary in a rural African market (as a way of detecting change in food security). My data are skewed to the left-and so my lower whiskers are right at the bottom of the axis. I tried log-transforming but it looks even worse. Is this the best way to present my data? Thanks.

enter image description here

  • $\begingroup$ Have you tried a Box-Cox transformation? $\endgroup$ – tchakravarty Aug 13 '16 at 13:10
  • $\begingroup$ Welcome to SE.Stats. Which statistical values did you use for the box and whiskers? What is the objective in representing your data, especially at the low price end? $\endgroup$ – Laurent Duval Aug 13 '16 at 13:22
  • 2
    $\begingroup$ By the usual terminology, this is actually "skewed to the right" (which may seem counter-intuitive, but that's how it is). What did the log-transform look like? $\endgroup$ – Glen_b Aug 13 '16 at 13:56
  • 1
    $\begingroup$ What do you mean by "looks even worse"? $\endgroup$ – Peter Flom Aug 13 '16 at 14:45
  • 1
    $\begingroup$ This plot suggests that the results will look much better on a log scale. However, its information is limited because it does not draw the boxplots correctly. One purpose of boxplots is to identify and highlight outliers, which is done by not extending the whiskers this high. Instead, the whiskers are supposed to terminate not too far from either end of the box. Beyond that, the plot should mark individual data with point symbols. Thus, one useful step would be to find software that will draw these plots correctly. $\endgroup$ – whuber Aug 13 '16 at 17:14

Box-plots are an anachronism --- use a violin plot instead: Given the skew of your price data, I would recommend you plot it on a logarithmic scale, and use a violin plot. This plot shows a density estimate of the data at each time point, which gives a clearly depiction of the shape of the distribution than the box-plot. If desired, you can include the quantiles in the violin plot, but this is generally unnecessary, since the shape gives the viewer a reasonable depiction of the changes in location over time. I would also recommend that when you plot on a logarithmic scale, you still label the plot with the original price values (not their logarithm), but just show this via appropriate logarithmic values on the axis. Here is an example of implementation of this kind of plot in R.

#Load libraries and set theme
THEME <- theme(plot.title    = element_text(hjust = 0.5, size = 14, face = 'bold'),
               plot.subtitle = element_text(hjust = 0.5, face = 'bold'));

#Generate mock data set (since you haven't given your data)
YEARS    <- c('2002-3', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015');
MU       <- c(1.03, 1.02, 1.28, 1.01, 0.99, 1.04, 1.24, 1.35, 1.29);
SIG      <- c(0.61, 0.65, 0.66, 0.62, 0.59, 0.62, 0.63, 0.63, 0.60);
N        <- c(132, 130, 128, 138, 140, 131, 133, 138, 142);
LOGPRICE <- sapply(N, rnorm);
for (n in 1:length(N)) { LOGPRICE[[n]] <- LOGPRICE[[n]]*SIG[n] + MU[n]; }
DATA  <- data.frame(Year  = rep(YEARS, N),
                    Price = exp(LOGPRICE));

#Generate violin plot of data
FIGURE <- ggplot(data = DATA, aes(x = Year, y = Price)) + 
            geom_violin(fill = 'blue', draw_quantiles = c(0.25, 0.5, 0.75)) + 
            scale_y_log10(breaks = scales::trans_breaks("log10", function(x) 10^x),
                labels = scales::trans_format("log10", scales::math_format(10^.x))) +
            expand_limits(y = c(10^(-0.5), 10^(1.5))) + THEME + 
            ggtitle('Fish Price - Katima Mulilo Market') + 
            xlab(NULL) + ylab('Price - $/kg');

#Print the plot

enter image description here

You can see that this price data shows up pretty well on a logarithmic scale, which means that the variations in price tend to be scale variations. Also note that the vertical axis on this plot still shows the values in dollars-per-kilogram, but the measurement labels are in powers of ten, putting it on a logarithmic scale, but with labels in the original measurement unit. This is generally the most useful way to present data of this kind.


I transformed the data taking the log(10) of N$/m (top) and N$/kg (below). It does improve the presentation, although the data are still not normally distributed, so I will do a Kruskal-Wallis analysis to compare between years. enter image description here

  • $\begingroup$ There appear to be many problems with your graphics. (1) The sequence of years in your plots is unusual! (And connecting the boxes according to this sequence would appear to be meaningless.) (2) The near-uniform distributions of prices exhibited in the first plot are obviously incorrect. I suspect there may be a great deal of overplotting of coincident values. (3) Because the two plots should be identical except for the labeling of the vertical axes, at least one of them is (very) wrong. $\endgroup$ – whuber Aug 24 '16 at 16:04
  • $\begingroup$ The horizontal axis categories were in the incorrect order-thank you for pointing that out. Notwithstanding the issues with using Excel, the two plots aren't necessarily identical. Fish grow linearly (length-weight) up to a point, then start putting on more weight than length (kind of like us). $\endgroup$ – James Abbott Aug 25 '16 at 1:12
  • $\begingroup$ I see now--you are normalizing the price by weight and by length. (Normalizing by length was so unexpected that I misread it as a normalization by some other unit of weight.) Prices, weights, and ratios should routinely be expressed as logarithms unless the data indicate otherwise, so it's no surprise that using logs helped the visualization. $\endgroup$ – whuber Aug 25 '16 at 12:44

Depending on what you are interested in, it might be better to plot several quantiles as lines over time, possibly on a log scale, possibly on the raw scale. Since you are interested in food security, I am guessing you would be especially interested in the behavior at the highest quantiles.

Another point is that you should make the gap between 2002/3 and 2008 5 times as large as the other gaps, or maybe just delete the earliest time point.

  • $\begingroup$ The current graphic already "plots several quantiles ... over time;" namely, the quartiles and medians. What purpose would connecting them serve? Incidentally, what do the highest quantiles have to do with food security? $\endgroup$ – whuber Aug 13 '16 at 17:16
  • $\begingroup$ It gets rid of the problem the original post complains about. And food will be least secure when prices are high. $\endgroup$ – Peter Flom Aug 13 '16 at 17:31
  • $\begingroup$ I'm not understanding: which specific problem are you referring to? That logs don't work? Now I believe understand your reasoning about food security, but it seems to depend on an assumption that the extremes correspond to temporal variations (which is plausible!) and not to variations among sellers (and perhaps types of fish) within the market (which is equally plausible). If the high extremes are primarily the latter, then their association with food security would be difficult to establish. $\endgroup$ – whuber Aug 13 '16 at 17:37
  • $\begingroup$ Well, the question isn't entirely clear on exactly what the problem is. But it seems that the OP is concerned about the low value of the boxplot being near 0 and he asks if this is the best way to plot his data. So, I think he might even get rid of the lowest quantiles and plot the others. And a line plot seems to me to emphasize change over time, which seems important. $\endgroup$ – Peter Flom Aug 13 '16 at 17:53
  • $\begingroup$ As to food scarcity, he definitely needs something more than what he's presented, but he only asked about plotting, not modeling. $\endgroup$ – Peter Flom Aug 13 '16 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.