Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/protovis.marks.R
Add a bar to the visualization.
1 |
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 |
pv.bar
Adds a bar plot to the visualization
A wv object.
Shane Conway shane.conway@gmail.com
http://vis.stanford.edu/protovis/
pv.chart
that creates the webvis object.
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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.