Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize R preset color matching system and custom color swatch in r language

Shulou Source: shulou.com Published: 2022-06-01 10:49:29 10月26日 Update

This article is about how to implement R preset color matching system and custom color swatches in r language. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The content mainly consists of two parts:

R preset color system swatches

R language custom color call

In fact, in the R language color system, there are two types of color systems, one is the preset color palette, through the color palette, you can get any number of color combinations.

There are five default palettes for the R language:

Rainbow

Heat.colors

Terrain.colors

Topo.colors

Cm.colors

These five color palettes are like a large dye vat, arranged with countless color combinations. Color selection is also very simple, that is, you can use the preset color disk name + color data:

Rainbow (10)

[1] "# FF0000FF"# FF9900FF"# CCFF00FF"# 33FF00FF"# 00FF66FF"# 00FFFFFF"

[7] "# 0066FFFF"# 3300FFFF"# CC00FFFF"# FF0099FF"

Since the above is a group of 10 colors obtained by name + quantity, we can also view the specific color effect through the show_col function in the scales package:

Library (scales)

Show_col (rainbow (10), labels=T) # labels controls whether color value information in HEX format is displayed.

Next, I use a layout matrix to display all five color plates:

Par (mfrow=c (1), mar=c (0.5), xaxs= "I", yaxs= "I")

N

Tags: Color system function language color swatch name theme can be passed through quantity combination drawing information content effect and then parameters that is mode scheme Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Apple Huawei Shulou Information vpn