gradient: gradient

Description Usage Arguments Examples

View source: R/gradient.R

Description

Generates a kml including the heading

Usage

1
2
3
gradient(x, y, colors, len = c(0.1, 0.2), pos = NULL, dist = c(0.1,
  0.1), place = "upperright", bars = 5, tdist = 0.04, labels = c(0,
  1), title = NULL, tdisttitle = 0.04, font = 1, tcol = "white")

Arguments

x

= x axis values

y

= y axis values

colors

= vector of colors

len

= width of the bar given as a proportion of x and y axis

pos

= maximum x and y coordinate

dist

= the distance from the border

place

= placement of the bar in the plot window (upperright, lowerleft, upperleft, lowerright)

bars

= number of bars to distinguish in the gradient

tdist

= distance of text from gradient bar

labels

= vector with min and max value

tcol

text color of labels and title

if

pos is null dist and place can be used to set the position of the

If

pos is null than dist (distance from border) and place (upperright, lowerleft, upperleft, lowerright) is used to determine the position

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
EXAMPLE 1 
x <- 1:100
y <- (1:100)/5
colors <- colorRampPalette(c('grey90','grey20'))(100)
plot(x,y, col=colors)
gradient(x,y, col=colors)
EXAMPLE 2 
If there are less than 20 colors no bars are plotted 
colors <- colorRampPalette(c('grey90','grey20'))(10)
plot(x,y, col=colors)
gradient(x,y, col=colors)
EXAMPLE 3  
x <- 1:100
y <- (1:100)/5
colors <- colorRampPalette(c('grey90','grey20'))(100)
plot(x,y, col=colors)
Add gradient using pos (values of x and y axis) or using dist (distance from border) and place (upperright, upperleft,...)
gradient(x,y, col=colors, pos=c(21,18)) # using pos 
gradient(x,y, col=colors, dist=c(0.1,0.1), place = 'upperleft') # using dist and place 

jedgroev/makekml documentation built on Nov. 4, 2019, 2:36 p.m.