boxplot

How to manually increase spacing between two specific boxes within a grouped box plot in R?

為{幸葍}努か 提交于 2021-01-28 05:33:29
问题 Is there a way to increase the spacing between the yellow and red boxes within this box plot? set.seed(40) df <- data.frame( Outcome = runif(60), Fruit = rep(1:3, each = 10), Freshness = rep(c(0, 0.5), each = 30), Farm = factor(rep(c("A", "B"), each = 5)) ) %>% transform( Outcome = Outcome*Fruit+Freshness, Fruit = as.factor(Fruit), Freshness = as.factor(Freshness) ) ggplot(data = df, aes(Farm, Outcome, col = Freshness, fill = Fruit)) + geom_boxplot() + scale_color_manual(values = c(

How to add labels to a boxplot figure (pylab)

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 06:26:01
问题 This is a pretty basic question I'm sure but I cannot seem to find the right code. There is my code for the boxplot I am creating. I would like to label the axes and have a title. from pylab import * import numpy raw_data = list(numpy.genfromtxt(filename, delimiter=',')) print raw_data figure() boxplot(raw_data,1) savefig('testfigure.pdf') I have tried pylab.xlabel('x') and plt.xlable('x') but those do not work...? Do they not work for boxplots or have I just got it wrong about those lines

How to add labels to a boxplot figure (pylab)

只谈情不闲聊 提交于 2021-01-27 06:25:29
问题 This is a pretty basic question I'm sure but I cannot seem to find the right code. There is my code for the boxplot I am creating. I would like to label the axes and have a title. from pylab import * import numpy raw_data = list(numpy.genfromtxt(filename, delimiter=',')) print raw_data figure() boxplot(raw_data,1) savefig('testfigure.pdf') I have tried pylab.xlabel('x') and plt.xlable('x') but those do not work...? Do they not work for boxplots or have I just got it wrong about those lines

Getting an error that ggplot2_3.2.0 can't draw more than one boxplot per group

你。 提交于 2021-01-27 06:19:08
问题 I have xy data that I'd like to plot using R 's ggplot : library(dplyr) library(ggplot2) set.seed(1) df <- data.frame(group = unlist(lapply(LETTERS[1:5],function(l) rep(l,5))), x = rep(1:5,5), y = rnorm(25,2,1), y.se = runif(25,0,0.1)) %>% dplyr::mutate(y.min = y-3*y.se, y.low = y-y.se, y.high = y+y.se, y.max = y+3*y.se) As you can see, while df$x is a point ( integer ), df$y has an associated error, which I would like to include using a box plot. So my purpose is to plot each row in df by

ggplot2: Add p-value to grouped box plots

人盡茶涼 提交于 2021-01-20 09:55:06
问题 I am trying to add p_values to my graph using "stat_signif" function. The problem is that my boxplots are grouped box plots where I want to compare every 2 box plots of the same category and stat_signif function requires the x-axis values for comparing. This is my code: p <- ggplot(plot.data, aes(x = Element, y = Value, fill = Group)) + #Define the elements for plotting - group by "strandness". geom_boxplot(outlier.shape = NA, colour = "black") + scale_fill_manual(values = c("goldenrod",

R: for the same code, labels (q1, median) appear on one computer but don't appear on another computer

两盒软妹~` 提交于 2021-01-10 03:44:30
问题 I am using the R programming language. I made a simple box plot using the "plotly" library: library(plotly) library(ggplot2) var_1<-rnorm(100,10,5) var_2 <- sample( LETTERS[1:4], 100, replace=TRUE, prob=c(0.1, 0.2, 0.65, 0.05) ) df = data.frame(var_1, var_2) df$var_2 = as.factor(df$var_2) p5 <- plot_ly(df, y = ~var_1, color = ~var_2, type = "box") %>% layout(title = "Income by career stage", xaxis = list(title = "Stage", zeroline = FALSE), yaxis = list(title = "Income", zeroline = FALSE)) p5

R: for the same code, labels (q1, median) appear on one computer but don't appear on another computer

て烟熏妆下的殇ゞ 提交于 2021-01-10 03:36:21
问题 I am using the R programming language. I made a simple box plot using the "plotly" library: library(plotly) library(ggplot2) var_1<-rnorm(100,10,5) var_2 <- sample( LETTERS[1:4], 100, replace=TRUE, prob=c(0.1, 0.2, 0.65, 0.05) ) df = data.frame(var_1, var_2) df$var_2 = as.factor(df$var_2) p5 <- plot_ly(df, y = ~var_1, color = ~var_2, type = "box") %>% layout(title = "Income by career stage", xaxis = list(title = "Stage", zeroline = FALSE), yaxis = list(title = "Income", zeroline = FALSE)) p5

R: for the same code, labels (q1, median) appear on one computer but don't appear on another computer

浪子不回头ぞ 提交于 2021-01-10 03:29:23
问题 I am using the R programming language. I made a simple box plot using the "plotly" library: library(plotly) library(ggplot2) var_1<-rnorm(100,10,5) var_2 <- sample( LETTERS[1:4], 100, replace=TRUE, prob=c(0.1, 0.2, 0.65, 0.05) ) df = data.frame(var_1, var_2) df$var_2 = as.factor(df$var_2) p5 <- plot_ly(df, y = ~var_1, color = ~var_2, type = "box") %>% layout(title = "Income by career stage", xaxis = list(title = "Stage", zeroline = FALSE), yaxis = list(title = "Income", zeroline = FALSE)) p5

Grouped boxplot with 2 y axes, 2 plotted variables per x tick

旧街凉风 提交于 2021-01-05 12:14:04
问题 I am trying to make a boxplot of an 18 year record of monthly rainfall and flood frequency. i.e. each x tick is the month, and each x tick is associated with two boxplots, one of the rainfall and one of the flood frequency. So far I have managed to plot these using seaborn (see following code and image), however I do not know how to create the boxplot with two y axes, which I need because the scales for each variable differ. The data looks like this (largest value of flood_freq in the dataset

Grouped boxplot with 2 y axes, 2 plotted variables per x tick

假装没事ソ 提交于 2021-01-05 12:07:46
问题 I am trying to make a boxplot of an 18 year record of monthly rainfall and flood frequency. i.e. each x tick is the month, and each x tick is associated with two boxplots, one of the rainfall and one of the flood frequency. So far I have managed to plot these using seaborn (see following code and image), however I do not know how to create the boxplot with two y axes, which I need because the scales for each variable differ. The data looks like this (largest value of flood_freq in the dataset