Learn R Programming

vrmlgen (version 1.3)

vbar: Create bar plots and height maps in VRML-format

Description

vbar visualizes numerical data as bar charts and terrain plots and parametric functions as 3D-graphs in VRML-files.

Usage

vbar(data, row.labels = rownames(data),
col.labels = colnames(data), metalabels = NULL,
filename = "out.wrl",  space = 0.5,
cols = rainbow(length(as.matrix(data))), rcols = NULL,
ccols = NULL, scalefac = 4, lab.axis = c("X-axis",
"Y-axis", "Z-axis"), col.axis = "white",
showaxis = TRUE, col.lab = "white", col.bg = "black",
cex.lab = 1, cex.rowlab= 1, cex.collab = 1,
navigation = "EXAMINE", fov = 0.785, 
pos = rep(scalefac + 4, 3), dir = c(0.19, 0.45, 0.87, 2.45),
htmlout = NULL, hwidth = 1200, hheight = 800,
showlegend = TRUE)

Arguments

data
a numerical matrix with 3 columns and n rows
row.labels
a vector containing the row labels (strings or numbers)
col.labels
a vector containing the column labels (strings or numbers)
metalabels
optional metalabels for the rows which will appear as popup-text when moving the mouse over a data point in the VRML-visualization (strings or numbers)
filename
filename of the generated VRML output file
space
space between single bars in a bar plot (as a fraction of the average bar width)
cols
a vector of colors to visualize different classes among the data points. The number of colors should be at least as large as the number of different labels (i.e. length(col) >= length(unique(labels))
rcols
specifies the bar colors per row of the input matrix. The number of colors must correspond to the numbers of rows of the data matrix.
ccols
specifies the bar colors per column of the input matrix. The number of colors must correspond to the numbers of columns of the data matrix.
scalefac
a scaling factor for the size of the 3D box in which the data will be visualized
lab.axis
a vector of size 3 containing the axis labels
col.axis
color of the axis
showaxis
if FALSE, the coordinate axes are hidden in the output
col.lab
a vector of colors specifying the axis labels
col.bg
background color
cex.lab
scaling factor for axis label font size
cex.rowlab
scaling factor for matrix row labels font size
cex.collab
scaling factor for matrix column labels font size
navigation
type of mouse navigation in the VRML file, can be "EXAMINE", "WALK", "SLIDE", "FLY" or "PAN"
fov
a scalar defining the field of view angle in the VRML file in radians
pos
a vector of size 3 for the position of the viewpoint in the VRML coordinate system
dir
a vector of size 4 specifying the viewing direction (first 3 components) and the rotation of the camera around the direction vector (last component in radians)
htmlout
a filename for generating an HTML-file to embed the VRML-output
hwidth
width of the embedded VRML-display in the HTML-output
hheight
height of the embedded VRML-display in the HTML-output
showlegend
a logical value indicating whether a legend should be drawn on the plot

Value

  • The function is used for its side-effect (output of a VRML-file in the specified directory) and has no return value. The htmlout-parameter can be used to embed the resulting VRML-object in a HTML-file.

See Also

vcloud, lcloud, lbar

Examples

Run this code
# visualize volcano data height-map
vbar(volcano)

# bar plot for a data matrix with numerical metalabels
mat <- matrix(9:1, nrow=3)
rownames(mat) <- paste('row',1:3)
colnames(mat) <- paste('col',1:3)
vbar(mat, space=1, metalabels=1:9, col.bg="white", col.axis="blue",
col.lab="black")

Run the code above in your browser using DataLab