boxplot

Creating a Multi-Project Timeline Using ggplot2 in R

泄露秘密 提交于 2019-12-06 09:19:56
I'm attempting to create a multi-project timeline that features various stages of the project in order to organize all of our current projects going forward in one easy to visualize place. I initially found the timeline() package and was able to semi-create what I was hoping for. However, it appears that package is not very customizable, so I am hoping to complete my timeline in ggplot2() instead. Here is my fake data: Phase Project StartDate EndDate SD Test1 2015-08-01 2015-08-31 DD Test1 2015-08-31 2015-09-30 CD Test1 2015-09-30 2015-11-14 PC Test1 2015-11-14 2015-12-14 CA Test1 2015-12-14

Grouped boxplots in Matlab: a Generic function

梦想的初衷 提交于 2019-12-06 07:46:50
After seeing this great post in SO: Most efficient way of drawing grouped boxplot matlab I was wondering if it is possible to create a function like that but a bit more generic, as in my application I need to make several analysis of different algorithms in different situations and it would be very tedious to tune the plotting code for each case. I would like something generic for this kind of plots: I coded a Matlab function that does that for you (me). Features: In each boxplot different amount of data supported Any amount of groups and boxplot per group supported Xlabel and boxplotlabel

Multiple boxplots on one plot with ggplot2

倾然丶 夕夏残阳落幕 提交于 2019-12-06 05:50:08
问题 Standard R plotting produces 30 boxplots in one plot when I use this code: boxplot(Abundance[Quartile==1]~Year[Quartile==1],col="LightBlue",main="Quartile1 (Rare)") I would like to produce something similar in ggplot2. So far i'm using this: d1 = data.frame(x=data$Year[Quartile==1],y=data$Abundance[Quartile==1]) a <- ggplot(d1,aes(x,y)) a + geom_boxplot() There are 30 years of data. In each year there are 145 species. In each year the 145 species are categorized into quartiles of 1-4. However

ggplot2 : multiple factors boxplot with scale_x_date axis in R

帅比萌擦擦* 提交于 2019-12-06 05:33:07
问题 I would like to create a multivariate boxplot time serie with ggplot2 and i need to have an x axis with boxplot position function of dates. I created for that an interaction matrix with the combination of the factors Treatment x Date that is plotted against NDVI and with different trial groups: here you can find some minimal data : dat<-"Treatment Trial.group Date NDVI HighN A 14/06/2013 0.27522123 HighN A 14/06/2013 0.259781926 HighN A 14/06/2013 0.175982276 LowN A 14/06/2013 0.193604644

Coloring only the median in the boxplot

坚强是说给别人听的谎言 提交于 2019-12-06 05:08:03
问题 Is there a way to color only the median line of the boxplot and not the whole boxplot. When I try this : boxplot(matrix,col="red") then the whole box gets red colored. I want to color only the median line of the boxplot. Is there a way to do it in R ?? 回答1: Try medcol as in boxplot(matrix(rnorm(100), ncol=2), medcol="red") 来源: https://stackoverflow.com/questions/10071371/coloring-only-the-median-in-the-boxplot

How to make the jitter point centered using ggplot2?

回眸只為那壹抹淺笑 提交于 2019-12-06 04:49:57
I am trying to recreate a multiple dot plot like the figure below. https://www.dropbox.com/s/9jqguesqd5gdm99/jitter%20plot.png Both geom_dotplot and position_jitter in ggplot2 have been tried. But neither of these two commands could make it. The figure created by position_jitter is quite similar, but there are also some differences. The point created by position_jitter seems too scattered, compared to the figure mentioned above. This is the figure I could make so far. https://www.dropbox.com/s/athsgkjjrlwr15k/figure.png?dl=0 e.g. value<-c(141573, 262616, 66773.8, 93032.2, 55528.8, 113125,

How would you plot a box plot and specific points on the same plot?

时光怂恿深爱的人放手 提交于 2019-12-06 04:45:56
问题 We can draw box plot as below: qplot(factor(cyl), mpg, data = mtcars, geom = "boxplot") and point as: qplot(factor(cyl), mpg, data = mtcars, geom = "point") How would you combine both - but just to show a few specific points(say when wt is less than 2) on top of the box? 回答1: Use + geom_point(...) on your qplot (just add a + geom_point() to get all the points plotted). To plot selectively just select those points that you want to plot: n <- nrow(mtcars) # plot every second point idx <- seq(1

plot line over boxplot using pandas DateFrame

放肆的年华 提交于 2019-12-06 03:55:26
问题 I have a pandas DateFrame with 16 columns corresponding years (2000 to 2015) and 12 lines with values for each month. I'm trying plot a boxplot and a line with 2015 values in same fig in order to compare, using this code: import pandas as pd import matplotlib.pyplot as plt df = pd.read_excel('hidro_ne.xlsx') fig, ax = plt.subplots() ax1 = df[2015].plot(ax=ax, linewidth=2, legend='2015',color='red') df.T.plot.box(yticks=range(0, 100, 5), ax=ax1) plt.show() In 2015 column I have data from

Histogram with marginal boxplot in R

夙愿已清 提交于 2019-12-06 02:32:50
问题 How make matching X-axis in histogram with marginal boxplot? data <- rnorm(1000) nf <- layout(mat = matrix(c(1,2),2,1, byrow=TRUE), height = c(1,3)) layout.show(nf) par(mar=c(5.1, 4.1, 1.1, 2.1)) boxplot(data, horizontal=TRUE, outline=FALSE) hist(data) 回答1: One solution would be to set ylim= in boxplot() to the same range as xlim= in hist() . set.seed(123) data <- rnorm(1000) nf <- layout(mat = matrix(c(1,2),2,1, byrow=TRUE), height = c(1,3)) par(mar=c(5.1, 4.1, 1.1, 2.1)) boxplot(data,

Add name to boxplot in R

家住魔仙堡 提交于 2019-12-05 20:16:49
This question is related to: R: how to label the x-axis of a boxplot When more than one column is plotted, names appear. But when only one column is plotted, name does not appear, even when names=.. argument is used: ddf = structure(list(apple = c(1, 2, 3, 4, 5), banana = c(5, 4, 3, 2, 1), watermelon = c(4, 5, 6, 7, 8)), .Names = c("apple", "banana", "watermelon"), row.names = c(NA, -5L), class = "data.frame") ddf apple banana watermelon 1 1 5 4 2 2 4 5 3 3 3 6 4 4 2 7 5 5 1 8 boxplot(ddf[,1:2]) boxplot(ddf[,1]) Following also do not work: boxplot(ddf[,1], names='apple') boxplot(ddf[,1], names