在ggplot2中,我们可以选择按名称或十六进制代码设置颜色。有没有办法以相同的方式使用rgb值?我搜索了文档,但快速回答似乎是'不'。 (我想使用rgb的原因是我有一些颜色,我将用于一些情节,我有他们所有的RGB格式。我可以从像here这样的地方得到十六进制,但它会很好,如果我可以只输入值直入ggplot()
rgb()with ggplot2 in R
6
A
回答
8
您可以使用函数RGB到分数RGB值转换为十六进制
rgb(0.1,0.2,0.3)
[1] "#1A334D"
+3
太好了,我用这个目录ectly在plot函数中,但是如果你没有你的RGB颜色的分数,它需要'maxColorValue'参数:'scale_colour_manual(values = c(rgb(207,31,46,maxColorValue = 255)),“#ffda85 “))' – RobertMc
相关问题
- 1. pch in plot with R
- 2. R load CSV with#in headers
- 3. grid.arrange with filled.contour in R Studio
- 4. ggplot2-geom_linerange with stat_smooth
- 5. ggplot2 coord_flip()with geom_text
- 6. ggplot2:geom_text()with facet_grid()?
- 7. RGB to VIBGYOR in python
- 8. tkplot in html with knitr
- 9. 的R - GGPLOT2:coord_radar不
- 10. ”with“macro in C
- 11. WITH&UNNEST in BigQuery
- 12. Upsert with $ in
- 13. Cartogram + choropleth map in R
- 14. igraph in R:error with get.shortest.paths but not with shortest.paths
- 15. R ggplot2:列不堆积
- 16. pushViewController with tableViewController in viewController
- 17. SQL SELECT IN with like
- 18. sed with&in变量
- 19. isMouseOver in Canvas with Path
- 20. PayPal with Braintree Drop-In
- 21. ORMLite with Dagger in Android
- 22. SetInterval with javascript in javascript
- 23. blit in FigureCanvasTkAgg with matplotlib
- 24. Legend with Radarchart in loop
- 25. Netbeans:JCombobox in Jframe with subindex
- 26. mongoDb $ in with aggregate query
- 27. Weirdness with Javascript in date
- 28. Javascript:Window.Open with#sign in URL?
- 29. mysql select with multiple“in”
- 30. NDSredicate with IN for NSDate
什么功能['rgb'(HTTPS://统计。 ethz.ch/R-manual/R-devel/library/grDevices/html/rgb.html)? – bouncyball
'qplot(x = 1,fill = I(rgb(0.1,0.8,0.5)))' – Axeman
好!不知道这个功能,谢谢,Axeman&bouncyball。 – RobertMc