在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