R client for the lightning-viz server API http://lightning-viz.org/
To use this package you have to setup your own lightning server. The package by itself will not create/display any visualisations. Instructions on how to deploy your own lightning server are available at http://lightning-viz.org/documentation/#server
Clone the repository and build your package using RStudio, or download the newest binary:
Then run command
install.packages(<path to file>, repos = NULL)
Run command
install.packages("LightningR")
To create your first visualisation, you need to create an object of a Lightning class, installed with this package.
library(LightningR)
vizserver <- Lightning$new("http://my-lightning.herokuapp.com/")
Then you need to create your first session on the server.
vizserver$createsession("optional_session_name")
After that you are free to create your first visualisation! Lets start with a simple line plot:
vizserver$line(c(1,2,3,4,5,6,7,8))
You can open created visualization with
vizserver$openviz()
vizserver$openviz(vizid)
Your visualizations can be automatically opened in your browser. You can enable/disable that option with functions:
vizserver$enableautoopening()
vizserver$disableautoopening()
parameters in [] brackets are optional
createsession([sessionname]) - creates a new lightning session
usesession(sessionid) - sets current session to session with given id
sethost(serveraddress) - sets new server address
enableautoopening() - enables auto opening of created plots
disableautoopening() - disables auto opening of created plots
Creates a line visualization for vector/matrix with each row representing a line, given in series}
line(series, [index, color, label, size, xaxis, yaxis, logScaleX, logScaleY])
Parameters: series - vector or matrix of data for plot, each row of the matrix is plotted as another line. If lines are of different size, put NaN in empty fields
index - vector specyfying x-axis of the plot
color - vector of RGB values for each line
label - vector of labels for lines, sets color according to label
size - vector of line thickness values
xaxis - label for xaxis
yaxis - label for yaxis
logScaleX - logical, sets X axis to logarythmic scale
logScaleY - logical, sets Y axis to logarythmic scale
Creates a scatterplot for points with coordinates given in vectors x and y.
scatter(x, y, [color, label, size, alpha, xaxis, yaxis])
Parameters: x - vector of x coordinates for points
y - vector of y coordinates for points
color - vector of RGB values for each point
label - vector of labels for points, sets color according to label
size - vector of point size values
alpha - vector of opacity values for each point
xaxis - label for xaxis
yaxis - label for yaxis
Creates a plot of multiple lines given in matrix series, with an ability to hide and show every one of them.
linestacked(series, [color, label, size])
Parameters: series - matrix of data for lines, where each row represents a single line
color - vector of RGB values for each line
label - vector of labels for lines, sets color according to label
size - vector of line thickness values
Creates a force plot for matrix given in matrix.
force(matrix, [color, label, size])
Parameters: matrix - connectivity matrix, binary or weighted
color - vector of RGB values for each point
label - vector of labels for points, sets color according to label
size - vector of point size values
Creates a graph of points with coordinates given in x and y vectors, with connection given in matrix connectivity matrix.
graph(x, y, matrix, [color, label, size])
Parameters: x - vector of x coordinates for points
y - vector of y coordinates for points
matrix - connectivity matrix, binary or weighted
color - vector of RGB values for each point
label - vector of labels for points, sets color according to label
size - vector of point size values
Creates a bundled graph of points with coordinates given in x and y vectors, with connection given in matrix connectivity matrix. Lines on this graph are stacked a bit more than in the graph function.
graphbundled(x, y, matrix, [color, label, size])
Parameters: x - vector of x coordinates for points
y - vector of x coordinates for points
matrix - connectivity matrix, binary or weighted
color - vector of RGB values for each point
label - vector of labels for points, sets color according to label
size - vector of point size values
Creates a world (or USA) map, marking regions given as a vector of abbreviations (3-char for countries, 2-char for states) in regions with weights given in weights vector and with colormap color (string from colorbrewer).
map(regions, weights, colormap)
Parameters: regions - vector or region abbreviations (3-chars for countries, 2-chars for states in USA)
weights - vector of weights for each region
colormap - colorbrewer string for type of map coloring
Creates a visualization of matrix given in matrix parameter, with its contents used as weights for the colormap given in colormap (string from colorbrewer).
matrix(matrix, colormap)
Parameters: matrix - matrix to visualise as a heat map
colormap - colorbrewer string for type of map coloring
Creates a visualization for adjacency matrix given in matrix parameter.
adjacency(matrix, [label])
Parameters: matrix - adjacency matrix data
label - labels for each pixel
Creates a scatterplot for coordinates in vectors x and y and assignes a line plot to every point on that plot. Each line is given as a row in t matrix.
scatterline(x, y, t, [color, label, size])
Parameters: x - vector of x coordinates for points
y - vector of y coordinates for points
t - matrix of of line data, each row represents a line for given point / label
color - vector of RGB values for each point
label - vector of labels for points, sets color according to label
size - vector of point size values
Creates a 3D scatterplot for coordinates given in vectors x, y and z.
scatter3(x, y, z, [color, label, size, alpha])
Parameters: x - vector of x coordinates for points
y - vector of y coordinates for points
z - vector of z coordinates for points
color - vector of RGB values for each point
label - vector of labels for points, sets color according to label
size - vector of point size values
alpha - vector of opacity values for each point