FAQ Database Discussion Community


Color bar graph according to grouping variable

r,colors,boxplot
I have been looking for some time on stack, but no answer correspond directly to what i am looking for. I want to plot some results in a bar graph, and color the bars according to the grouping values in another column of my dataset. So, column 1 is the...

python: error setting whisker bounds in boxplot

python,numpy,boxplot
I'm getting a perplexing error when I attempt to adjust the whisker length in boxplot -- I'd like to have the whiskers extend from the 5th to 95th percentile values, using the kwarg whis = [5,95]. When I do so I get the following error (copying the entire traceback): >...

How to add inbetween space in nested boxplots ggplot2

r,ggplot2,boxplot
I would like to added a marginal space between groups of box plots by using the stats_summary method. Here is a small example of my problem library(ggplot2) library(reshape2) data1 <- (lapply(letters[1:5], function(l1) return(matrix(rt(5*3, 1), nrow = 5, ncol = 3, dimnames = list(cat2=letters[6:10], cat3=letters[11:13]))))) names(data1) <- letters[1:5] data2 <- melt(data1)...

How to make highcharts boxplot with drilldown?

javascript,highcharts,boxplot,drilldown
I am new with highcharts and javascript. I am trying to make a boxplot with drilldown. Chart type 'boxplot' requires data to be a array of 5 element(min 1st-quatile median 3st-quatile max), as follows: data: [ [760, 801, 848, 895, 965], [733, 853, 939, 980, 1080], [834, 836, 864, 882,...

How to plot categorical vs numerical data with vioplot in R?

r,boxplot,categorical-data
I have a data set with a categorical column "colors", which has 4 colors. One of the other 2 columns is quantitative, and is called "pollen". I am trying to get vioplot to make 4 separate violin plots color vs pollen. Here is a data sample The data is available...

Pandas secondary y axis for boxplots

python,pandas,boxplot
I'd like to use a secondary y-axis for some boxplots in pandas, but it doesn't seem available. import numpy as np import pandas as pd data = np.random.random((10, 5)) data[:,-1] += 10 # offset one column df = pd.DataFrame(data) Now, using the default line plot it's easy enough to plot...

Matplotlib boxplot show only max and min fliers

python,matplotlib,boxplot
I am making standard Matplotlib boxplots using the plt.boxplot() command. My line of code that creates the boxplot is: bp = plt.boxplot(data, whis=[5, 95], showfliers=True) Because my data has a large distribution, I am getting a lot of fliers outside the range of the whiskers. To get a cleaner publication...

R ggplot2 boxplot not properly shown when knitting html

r,ggplot2,boxplot
tried a simply boxplot with ggplo2 ggplot(aes(x = quality, y = residual.sugar),data=data)+ geom_boxplot(fill="#9999CC")+scale_y_continuous(limits =c (0,20)) when i exucute it in R itself, it looks like want it , like this: but when i knit it to get my html file, it looks like this : Anyone knows how to fix...

R boxplot with different sizes

r,boxplot
I would like to make a boxplot of the counts on y axis and the position on the axis.But the counts have different amount of counts, how can I plot it? Thanks! I'd also like to take the absolute value of the counts. Thanks! > mat.count[1:50,] position count 1 136873135...

Overlaying jittered points on boxplot conditioned by a factor using ggplot2

r,ggplot2,overlay,boxplot,jitter
I am making a boxplot conditioned by a factor similar to this example: p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot(aes(fill = factor(am))) There are few points in the data set, and I'd like to express this visually by overlaying the data points. I want to overlay the points colored...

R: why is boxplot(x,log=“y”) different from boxplot(log(x))?

r,boxplot
delme <- exp(rnorm(1000,1.5,0.3)) boxplot(delme,log="y") boxplot(log10(delme)) Why are the whiskers different in this 2 plots? Thanks Agus...

R - getting box plot to work

r,boxplot
boxplot(data=max_urkoma[[2]]) I have a data set max_urkoma[[2]] that I'd like to put into a box plot, but it won't show at all unless I give it the formula max_urkoma[[1]]~max_urkoma[[2]], and then it'll basically just become a set of points on a plot. What am I doing wrong? The plot is...

Boxplots where date grouped by year

sas,boxplot
I recently asked a question about grouping in SAS. Drawing on that question, and using the same data set, I am struggling to make a box plot. The data look like this: Date Close Volume 12/31/2014 222.41 2402097 12/30/2014 222.23 2903242 12/29/2014 225.71 2811828 12/26/2014 227.82 3327016 12/24/2014 222.26 1333518...

Matplotlib, shift boxplots along x-axis?

python,matplotlib,plot,boxplot,figure
I am plotting multiple boxplots along two different axes. My code looks like: fig, (ax1, ax2) = plt.subplots(2, sharex=True, sharey=False) data_1 = [array1, array2, array3] ax1.boxplot(data_1, whis=[5,95], showfliers=True) data_2 = [array4, array5] ax2.boxplot(data_2, whis=[5,95], showfliers=True) ax2.set_xlim(0,4) This produces a plot (substituting in my actual data) that looks like: However, I...

Changing whisker definition in facet'ed geom_boxplot

r,ggplot2,boxplot,outliers
I created a facet_grid with boxplots of multiple variables. To give an example, the graph can be reproduced by following dummy data require(ggplot2) require(plyr) library(reshape2) set.seed(1234) x<- rnorm(100) y.1<-rnorm(100) y.2<-rnorm(100) y.3<-rnorm(100) y.4<-rnorm(100) df<- (as.data.frame(cbind(x,y.1,y.2,y.3,y.4))) dfmelt<-melt(df, measure.vars = 2:5) and creating the resulting graph as dfmelt$bin <- factor(round_any(dfmelt$x,0.5)) ggplot(dfmelt, aes(x=bin, y=value,...

R boxplot: How to customize the appearance of the box-and-whisker plots (e.g., remove lines or borders, change symbol of outliers)

r,shape,boxplot,appearance,linestyle
Today, I was wondering how to customize the appearance of the box-and-whisker plots. E.g., I wanted to remove the line around the box. However, the problem is, that the border argument changes the color of all lines of the box-and-whisker plots simultaneously. So, if one has the create idea to...

full text label on Boxplot, with added mean point

r,ggplot2,boxplot
Am trying to get text label similar to what this http://stats.stackexchange.com/questions/8206/labeling-boxplots-in-r, but I cant get it to work. MWE similar to what I have is this: data <- data.frame(replicate(5,sample(0:100,100,rep=TRUE))) meanFunction <- function(x){ return(data.frame(y=round(mean(x),2),label=round(mean(x,na.rm=T),2)))} ggplot(melt(data), aes(x=variable, y=value)) + geom_boxplot(aes(fill=variable), width = 0.7) + stat_summary(fun.y = mean, geom="point",colour="darkred", size=4) + stat_summary(fun.data =...

How to boxplot a subgroup in presence of the formula in R

r,boxplot
Neither this post nor this post apply to my case. Assume: set.seed(42) x<-rep(c("A","B","C"), c(3,4,1)) y<-rep(c("V","W"),c(5,3)) z<-rnorm(8,-2,1) df<-data.frame(x,y,z) boxplot(z~x+y,df) I want my plot to include groups with more than, say, one element. This means that I want my plot show only A.V, B.V and B.W. Furthermore, since my graph has about...

Unable to adjust margins in combined boxplot & histogram

r,histogram,boxplot
I need to plot a combined boxplot and histogram. While I am able to plot them together I am unable to do print the xlabel abd ylabel in the histogram. Every time I try to adjust the margins I get the error 'figure margins too large'. Here is the code...

C# - Creating a Boxplot in Oxyplot

c#,data-binding,boxplot,oxyplot
I try to get used to Oxyplot to create some charts in my C# application. So I wanted to create a Boxplot diagram with OxyPlot, but I am not able to get any results. I tried the "Getting Started" example with no problems but now I have no clue how...

Highcharts Boxplots How to get five point summary?

javascript,highcharts,boxplot
I want to use HighCharts to create boxplots. As I can see in the docs I need to already provide Highcharts with the required five-point-summary, i.e., min, max, q1, q3, median values for creating the boxplot. Given an arbitrary-length array constisting of numbers, how can I calculate these five numbers...

Java generate random number based on boxplot

java,statistics,boxplot,random-sample
I'm searching for a method or library for java (can be java-8) that is capable of generating a random sample (preferable with a fixed seed for deterministic testing) based on the numbers that make up a boxplot. So imagine having the boxplot: ---------- |-----| | |-----------| ---------- min A avg...

Box-and-Whisker plot grouped by year using R

r,time-series,boxplot
I have timeseries object in R which contains the values of AirPassenger bookings in every month from year 1949-1960. Its easy to plot box plot grouped by month using the command boxplot(AP ~ cycle(AP)). I would like to know how to do box plot if we have to group by...

Box plot using JFreeChart

java,jfreechart,boxplot
First off, I am new to Java and to Stackoverflow. So I hope I can supply enough clarity in my question. My goal is to create a box plot using jfreechart to keep track of measurement values from every day use. I want to do this by storing minimal amount...

How do I put multiple boxplots in the same graph in R?

r,plot,ggplot2,rstudio,boxplot
Sorry I don't have example code for this question. All I want to know is if it is possible to create multiple side-by-side boxplots in R representing different columns/variables within my data frame. Each boxplot would also only represent a single variable--I would like to set the y-scale to a...

Two Boxplots for one X position using gnuplot

graph,gnuplot,boxplot
I have 2 sets of data A and B, each with a y value for x=100, 200, 300. I want to create one graph which shows the difference between these two data sets. As such this means that for each x, there will be two boxplots(one for data A and...

Paired boxplot from data frames R

r,dataframes,boxplot,graphic
I would like to create a graphic with box plot in R. I got the following data frames: > drools_responseTimes_numberOfClients_REST X1 X5 X10 X20 X50 1 816 183 699 154 297 2 366 280 1283 345 291 3 103 946 1609 409 377 4 431 1086 1974 482 479 5...

Displaying values from a character vector as italic labels in boxplot in R

r,boxplot,plotmath
I want to use a character vector for boxplot names, how can I get these to be displayed as italic? # get some data x <- rnorm(1000) # I want to get this: labels <- c(expression(italic("One"), italic("Two"))) labels boxplot(split(x, cut(x,breaks = c(-Inf, 0, Inf))), names = labels) But using a...

Multiple Boxplots in one HighCharts chart

javascript,angularjs,highcharts,boxplot
I am trying to show two different boxplots in one chart. This should be possible as can be seen here: http://jsfiddle.net/maw3rd18/3/ In my actual code I have the exact same code as in the fiddle, however it does not work. The result looks like this. Totally not like a boxplot....

ggplot2: arranging multiple boxplots as a time series

r,ggplot2,time-series,boxplot
I would like to create a multivariate boxplot time series with ggplot2 and I need to have an x axis that positions the boxplots based on their associated dates. I found two posts about this question: one is Time series plot with groups using ggplot2 but the x axis is...

Boxplot with continuous and discrete x variables

r,ggplot2,boxplot
I am trying to make a box plot without faceting. Data look like this: species elevation hbl datae 400 83 datae 300 92 datae 257 92 datae 350 102 datae 500 89 datae 625 100 datae 625 94 datae 632 87 datae 1000 100 datae 940 89 datae 1050 98...

Is it a bug in zingchart ( boxplot legend )

legend,boxplot,zingchart
I am trying to draw a boxplot using zingchart. I need a legend for the chart, but the legend generated is wrong. is it a bug in zingchart? Below is the json passed in: { "type": "boxplot", "vertical-labels": true, "legend":{}, "scale-x": { "labels": [] }, "series": [ { "data-box": [...

create boxplots with first element of first row of multiple dataframes

r,boxplot,lapply
I have a list of dataframes. Each dataframe has 6 rows. I want to create 6 boxplots. The first boxplot should take the values of the first row of the first column. The second boxplot should take the values of the second row of the first column, etc. I want...

R ggplot boxplot: change y-axis limit

r,ggplot2,boxplot
I'm using ggplot to create sevral boxplots from the following data: df<-(structure(list(Effect2 = c("A2", "A2", "A2", "A2", "A2", "A2", "A2", "A2", "A2", "A2", "A2", "A2", "A2", "A2", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A3", "A3", "A3", "A3", "A3", "A3", "A3", "A3", "A3",...