pv.bar: Add a bar to the visualization.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/protovis.marks.R

Description

Add a bar to the visualization.

Usage

1
pv.bar(height.name="y", left.name="x", height.scale="linear.y.y", left.scale="linear.x.x", bottom=0, width, width.name, xmax, scale.min=0, ...)

Arguments

height.name

The name of the field in the supplied data frame or vector.

left.name

The name of the field in the supplied data frame or vector.

height.scale

The scale of the field in the supplied data frame or vector.

left.scale

The scale of the field in the supplied data frame or vector.

bottom

The bottom of the bar, with respect to the panel.

width

The width of each bar.

width.name

The name of the field in the data for the width.

xmax

The max scale for the x-axis.

scale.min

The minimum y-value for scaling.

...

The parameters from pv.chart

Details

pv.bar Adds a bar plot to the visualization

Value

A wv object.

Author(s)

Shane Conway shane.conway@gmail.com

References

http://vis.stanford.edu/protovis/

See Also

pv.chart that creates the webvis object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
plot.webvis(x=c(1, 2, 1.5, 3, 1.2), type="bar", scale.min=0)
pv.bar(data=c(1, 1.2, 1.7, 1.5, .7, .5, .2), height.name="y", left.name="x", height.scale="linear.y.y", left.scale="linear.x.x", bottom=0, width=25, render=TRUE)

pv.bar(data=c(1, 1.2, 1.7, 1.5, .7, .5, .2), width=20, render=TRUE)
pv.bar(data=data.frame(z=c(1, 1.2, 1.7, 1.5, .7, .5, .2)), height.name="z", height.scale="linear.z.y", width=20, render=TRUE)
pv.bar(data=c(1, 1.2, 1.7, 1.5, .7, .5, .2), height.name="y", left.name="x", height.scale=NULL, left.scale="linear.x.x", render=TRUE)

# bar example 1 
wv <- pv.panel(width=150, height=150)
render.webvis(wv + pv.bar(wv=wv, data=c(1, 1.2, 1.7, 1.5, .7), height.name="y", left.name="x", height.scale="linear.y.y", left.scale="linear.x.x"))

# bar example 2 (doesn't work properly)
d <- data.frame(y=c(1, 1.2, 1.7, 1.5, .7), z=c(0, 0.5, 0.9, 0.2, 0.7))
d <- cbind(d, k=d$y-d$z)
wv <- pv.panel(width=150, height=150)
render.webvis(wv + pv.bar(wv=wv, data=d, height=20, height.name=NULL, bottom=NULL, bottom.name="x", width=NULL, width.name="k", left.name="z", left.scale="linear.z.y", bottom.scale="linear.x.x", width.scale="linear.k.x"))

# bar example 3
wv <- pv.panel(width=150, height=150)
render.webvis(wv + pv.bar(wv=wv, data=c(1, 1.2, 1.7, 1.5, .7), height.name="y", left.name="x", bottom=NULL, top=0, height.scale="linear.y.y", left.scale="linear.x.x"))

webvis documentation built on May 19, 2017, 11:07 p.m.

Search within the webvis package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.