ch_col_transparent {CSHShydRology}R Documentation

Add Transparency to plot colours

Description

Adds transparency to a colour based on an integer between 0 and 255, with 0 being fully transparent and 255 being opaque. Based on function rvn_col_transparent in package RavenR.

Usage

ch_col_transparent(colour, trans)

Arguments

colour

colour that is to be made transparent, or an array of colours

trans

an integer (or array of integers) describing the degree of transparency, 0 to 255. Must be the same length as colour. Values < 10 (very transparent), values > 200 (solid colour).

Value

res

returned updated colour code with transparency

Author(s)

Rob Chlumsky; Paul Whitfield

See Also

See original code on post in Stack Overflow plot points transparent in R

Examples


 # plot randomly distributed data
plot(rnorm(20), col='black')

# create a transparent blue colour for plotting
mycol <- ch_col_transparent('blue', 100)

# plot more random points in transparent blue colour
points(rnorm(20),col = mycol)

 # plot randomly distributed data
plot(rnorm(20), col = 'blue')

# create two transparent colour for plotting
mycol <- ch_col_transparent(c('green',"red"), c(100, 200))

# plot more random points in transparent colours
points(rnorm(20), col = mycol[2])



[Package CSHShydRology version 1.3.0 Index]