我可以调整scale_color_brewer的下限吗? [英] Can I adjust the lower limit of scale_color_brewer?

查看:253
本文介绍了我可以调整scale_color_brewer的下限吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经订购了我想使用颜色酿造器的分类数据。但我很难看到非常低的值。有没有办法减少这些较低的值或设置下限值?

I have ordered categorical data that I would like to use color brewer on. But I have a hard time seeing the very light lower values. Is there a way to either trim off those lower values or set the lower limit in the scale?

ggplot(data.frame(x=1:6, y=10:15, w=letters[1:6]), aes(x, y, color=w)) + 
geom_point()+ scale_color_brewer(type="seq", palette=1) + theme_bw()

有没有更好的方法来做到这一点?到目前为止,我看到的定性尺度不是有序或连续尺度,不适用于离散数据。我知道手动缩放,如果这是唯一的路线。

Is there a better way to do this? So far I either see qualitative scales that aren't ordered or continuous scales that don't like being applied to discrete data. I'm aware of manual scales if that's the only route.

推荐答案

你不能只设置一个下限。但是,您可以使用比所需颜色更多的调色板,并将最亮的颜色映射到未使用的级别。下面是一个9级的例子:

You cannot just set a lower limit. But you can use a palette with more colors than needed and map the brightest colors to unused levels. Below is an example with 9 levels:

ggplot(data.frame(x=1:6, y=10:15, w=letters[1:6]), aes(x, y, color=w)) + 
  geom_point() + theme_bw() + 
  scale_color_brewer(type="seq", palette=1, 
                     limits=c(LETTERS[1:3], letters[1:6]), 
                     breaks=letters[1:6])

这篇关于我可以调整scale_color_brewer的下限吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆