How can I change the fill color in boxplot

DXL

I want to change the fill color in boxplot with the follwing code, but the code color only change the color of the border.

p = ggplot(data=concentration,aes(factor(status), con), ylim=c(0,0.15),cex.axis=1.5,cex.lab=15) + 
stat_summary(fun.data=f, geom="boxplot", position="dodge",color='blue') + 
ylab(expression(paste("Formaldehyde concentration"," (",mu,"g/",m^3,")"))) +
xlab("") + 
ylim(0,200) #+ 
geom_boxplot(aes(fill = Condition))

How can I change the fill color?

Michael Harper

You can see all the ways to edit the aesthetics of a ggplot boxplot here: http://ggplot2.tidyverse.org/reference/geom_boxplot.html

  • alpha
  • colour
  • fill
  • group
  • linetype
  • shape
  • size
  • weight

In your case you want to change the fill:

set.seed(123)
concentration <- data.frame(status = c("Yes", "No"), con = rnorm(n = 30) + 10)

ggplot(data=concentration, aes(factor(status), con)) + 
geom_boxplot(fill = "blue")

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Can I manually change boxplot color with ggMarginal?

GoJS: How can I change Node fill color?

Change fill color of dotplot_geom but retain fill color of boxplot

How can I change the color of the mean marker in plt.boxplot's showmeans?

How can I fill color the tile leaflet?

How can I fill and color based on a variable

How can i fill part of image with color?

How can I change the color based on my grouping value instead of fill value in ggplot in R?

How can I change the fill color or hide other continent which is not selected onRegionClick in jvectormap

How can I change Fill color of Ellipse when mouse is over another Ellipse?

I can't change the fill color of a SVG Sprite

How can i change the order of the fill area?

How can I change the group titles in a pandas grouped-by boxplot?

How to change the color of outliers of certain category in boxplot()?

How can I change the color of the counter on a button?

How can I change the tree's color?

How I can change the color of a themed box?

How can I change UIButton title color?

how can i change the color of titlebar in JFrame?

How can I change background color of PageViewController?

How can I change the color of a QGraphicsItem object?

How can I change the text color with jQuery?

How can I change the color of an 'svg' element?

How can I change the color of label with * in text

How can I change the button color

How can I change background color for the desktop?

How can I change the color of a label in css?

How can I change the color of icons?

How can i setState for color change