matplotlib: Group boxplots

How about using colors to differentiate between “apples” and “oranges” and spacing to separate “A”, “B” and “C”? Something like this: from pylab import plot, show, savefig, xlim, figure, \ hold, ylim, legend, boxplot, setp, axes # function for setting the colors of the box plots pairs def setBoxColors(bp): setp(bp[‘boxes’][0], color=”blue”) setp(bp[‘caps’][0], color=”blue”) setp(bp[‘caps’][1], color=”blue”) … Read more

Labeling Outliers of Boxplots in R

The following is a reproducible solution that uses dplyr and the built-in mtcars dataset. Walking through the code: First, create a function, is_outlier that will return a boolean TRUE/FALSE if the value passed to it is an outlier. We then perform the “analysis/checking” and plot the data — first we group_by our variable (cyl in … Read more

Put stars on ggplot barplots and boxplots – to indicate the level of significance (p-value)

I know that this is an old question and the answer by Jens Tierling already provides one solution for the problem. But I recently created a ggplot-extension that simplifies the whole process of adding significance bars: ggsignif Instead of tediously adding the geom_line and geom_text to your plot you just add a single layer geom_signif: … Read more

JFreeChart scaling of Boxplots with several Categories

Set the preferred size of the containing ChartPanel, not the chart, as shown here and here. Addendum: I don’t think you can usefully add a chart to a scroll pane. Instead, create a class similar to SlidingCategoryDataset that implements BoxAndWhiskerCategoryDataset. Add a scroll bar to the frame that controls the first displayed index. Addendum: A … Read more

Plot multiple boxplot in one graph

You should get your data in a specific format by melting your data (see below for how melted data looks like) before you plot. Otherwise, what you have done seems to be okay. require(reshape2) df <- read.csv(“TestData.csv”, header=T) # melting by “Label”. `melt is from the reshape2 package. # do ?melt to see what other … Read more