本文介绍了使用qplot更改直方图的轮廓和填充颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个窗口(使用facet)有两个直方图,我想控制轮廓和填充的颜色。我尝试查找颜色 scales aes(),+ color ,+ 填充,包括颜色并填写 qplot >

我的代码可以在下面找到。 (注意:mussel2有两列浓度(数字列表)和waterbody(列出或参考)。如果需要,我可以提供数据。



基本问题,所以我非常感谢您的时间。

  qplot(data = mussel2,
x = Concentration,
xlim = x_lim,
ylim = y_lim,
xlab = expression(paste(Concentrations of DDE(,mu,g / g)),
ylab =Frequency ,
binwidth = 1.5)+
theme(legend.position =none)+
facet_grid(Waterbody〜。)


解决方案

如果要保留 qplot 格式,请尝试以下操作:

  library(ggplot2)

qplot(diamonds $ carat,
xlab =Carat ,
geom =histogram,
ylab =Count,
binwidth = 0.25,
fill = I(gray),
col = I (black))

I have two histograms in one window (using facet) and I would like control over the color of the outline and the fill. I've tried looking up color scales, aes(), + color, + fill, including color and fill in qplot, all resulting in expected plots!

My code can be found below. (Note: mussel2 has two columns concentration (a list of numbers) and waterbody (listed or reference). I can provide the data if necessary.

I understand this is an elementary question, so I do appreciate your time.

qplot(data=mussel2,
    x = Concentration,
    xlim = x_lim,
    ylim = y_lim,
    xlab = expression(paste("Concentrations of DDE (", mu, "g/g)")),
    ylab = "Frequency",
    binwidth = 1.5)+
    theme(legend.position="none")+
    facet_grid(Waterbody~.)
解决方案

If you want to keep the qplot format, try the following:

library(ggplot2)

qplot(diamonds$carat,
      xlab="Carat",
      geom="histogram",
      ylab="Count",
      binwidth=0.25,
      fill=I("grey"),
      col=I("black"))

这篇关于使用qplot更改直方图的轮廓和填充颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-17 05:53