col.persp3d: Continous color schemes for 3D plots

Description Usage Arguments Note See Also Examples

Description

col.persp3d is a continuous Color Scheme Generator for persp3d.

col.persp is a continuous Color Scheme Generator for persp.

These functions are used to produce a continuous color mapping for 3D plots. They look almost identical, but indeed use slightly different schemes due to the difference between persp3d and persp.

Usage

1
2
3
4
5
col.persp3d(z, colfun, ncol = 12, colcoe = 1, 
    colrange = range(z, na.rm = T), ...)

col.persp(z, colfun, ncol = 12, colcoe = 1, 
    colrange = range(z, na.rm = T), ...)

Arguments

z

The data matrix you used to draw 3d interactive plot by persp3d()

colfun

The color function which produces a continuous color scheme. Candidates are topo.colors(), terrian.colors(), cm.colors(), ..., or brewer.pal() in the RColorBrewer package

ncol

The total number of distinct colors you want to produce. The default is 12. It is based on the idea that people typically can not distinguish more than 12 different colors.

colcoe

The "expanding" coefficient of the color scheme. The default is 1, which means you will use the full spectrum of the colors in your color function(such as topo.colors). If you set some values greater than 1, like 1.4, then you basically expanded the sprectrum from ratio 1 to 1.4, and you take all the 1 portion of the tail part

colrange

The data range you color scheme is mapped. By default it will mapped to the full range of z. But sometimes you need a predefined mapping range for comparison reasons.

...

Any other arguments to feed the color function, such as other functions in the brewer.pal()

Note

This can't be used as the color scheme for persp() function in the R base. The two color scheme are similar and transformable, but they are not identical.

See Also

objects to See Also as topo.colors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require(rgl)
require(RColorBrewer)

#col.persp
persp(x=60:300, y=1:100, z=data3d,
      xlab="STBS Length", ylab="Minute", zlab="Purity",
      ticktype="detailed", box=TRUE, border=NA,
      theta=190, phi=30, expand=1,ltheta=180,lphi=0,shade = 0.5,
      col=col.persp(data3d, colfun=topo.colors, 50))

persp(x=60:300, y=1:100, z=data3d,
      xlab="STBS Length", ylab="Minute", zlab="Purity",
      ticktype="detailed", box=TRUE, border=NA,
      theta=190, phi=30, expand=1,ltheta=180,lphi=0,shade = 0.5,
      col=col.persp(data3d, colfun=brewer.pal, ncol=6, name="Set1"))

#col.persp3d
zlim=0:1

persp3d(x=60:300, y=1:100, z=data3d, 
        col=col.persp3d(data3d, colfun=cm.colors, 8),
        xlab="STBS Length", ylab="100 Quantiles in 0-1", zlab="Purity", 
        zlim=zlim,
        main="Purity in 3D 1-5 hour length in 100 quantile")

persp3d(x=60:300, y=1:100, z=data3d, 
        col=col.persp3d(data3d, colfun=brewer.pal, ncol=9, name="Blues"),
        xlab="STBS Length", ylab="100 Quantiles in 0-1", zlab="Purity", 
        zlim=zlim,
        main="Purity in 3D 1-5 hour length in 100 quantile")

persp3d(x=60:300, y=1:100, z=data3d, 
        col=col.persp3d(data3d, colfun=brewer.pal, ncol=9, name="Set1"),
        xlab="STBS Length", ylab="100 Quantiles in 0-1", zlab="Purity",
        zlim=zlim,
        main="Purity in 3D 1-5 hour length in 100 quantile")

fzwaeustc/pcrfn documentation built on May 16, 2019, 4:06 p.m.