ScatterPlot Visualization
n_scatter( data, x, y, entry_info = NULL, group = NULL, group_info = NULL, render = c("svg", "canvas"), ..., width = NULL, height = NULL, element_id = NULL )
data | data set in data.frame. |
---|---|
x, y | column names of x, y and z (if any, for size) value. |
entry_info | column names of additional information for entries (point). Used to set the label or the size of the point, etc. |
group | column name of group. |
group_info | column names of additional information for groups (serie). |
render | "svg" (responsive) or "canvas". "canvas" is well suited for large data sets as it does not impact DOM tree depth, however you'll lose the isomorphic rendering ability. |
... | additional arguments. |
width, height | Must be a valid CSS unit (like |
element_id | element id of widgets. |
a nivo ScatterPlot component
library(nivor) # the simplest use n_scatter( data = iris, x = "Sepal.Width", y = "Sepal.Length", group = "Species" ) # an example of a slightly more complex setup n_scatter( data = iris, x = "Sepal.Width", y = "Sepal.Length", group = "Species", margin = list(top = 60, right = 140, bottom = 70, left = 90), xFormat = htmlwidgets::JS('function(e){return e+" cm"}'), yFormat = htmlwidgets::JS('function(e){return e+" cm"}'), axisBottom = list( orient = "bottom", tickSize = 5, tickPadding = 5, tickRotation = 0, legend = "Sepal.Width", legendPosition = "middle", legendOffset = 46 ), blendMode = "multiply", legends = list( list( anchor = "bottom-right", direction = "column", justify = FALSE, translateX = 130, translateY = 0, itemWidth = 100, itemHeight = 12, itemsSpacing = 5, itemDirection = "left-to-right", symbolSize = 12, symbolShape = "circle", effects = list( list( on = "hover", style = list( itemBackground = "rgba(0, 0, 0, .03)", itemOpacity = 1 ) ) ) ) ) ) # Set additional information as size for each point n_scatter( data = iris, y = "Sepal.Width", x = "Sepal.Length", entry_info = "Petal.Length", group = "Species", nodeSize = list( key = "Petal.Length", values = list(0, 4), sizes = list(9, 32) ) )