In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to take color according to rainbow in R language". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
rainbow() to get rainbow swatches
rainbow(n, s = 1, v = 1, start = 0, end = max(1, n - 1)/n, alpha = 1)
For example, 10 colors are obtained based on rainbow color gradient, which are sequentially refined by red, yellow, green, cyan, green, blue, magenta, etc.:
> rainbow(10) [1] "#FF0000FF" "#FF9900FF" "#CCFF00FF" "#33FF00FF" "#00FF66FF" "#00FFFFFF" "#0066FFFF" [8] "#3300FFFF" "#CC00FFFF" "#FF0099FF"
The corresponding colors appear as follows (draw ten incremental columns and fill them with the corresponding colors):
> barplot(1:10,col=rainbow(10))
How do I get a portion of the rainbow ribbon instead of going from red to the end position? It can be set based on the parameters start and end:
With rainbow, the parameters start and end can be used to specify particular subranges of hues. The following values can be used when generating such a subrange: red = 0, yellow = 1/6, green = 2/6, cyan = 3/6, blue = 4/6 and magenta = 5/6.
For example, color from red to blue:
> rainbow(10,start = 0,end=4/6) [1] "#FF0000FF" "#FF7100FF" "#FFE300FF" "#AAFF00FF" "#39FF00FF" "#00FF39FF" "#00FFAAFF" [8] "#00E3FFFF" "#0071FFFF" "#0000FFFF"> barplot(1:10,col=rainbow(10,start=0,end=4/6))
Start=1/6, end=5/6
> barplot(1:10,col=rainbow(10,start=1/6,end=5/6))"How to get color according to rainbow in R language" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.