Scatter Plots
This is an instance of our custom ScatterPlot React widget lightly wrapped in htmlwidgets and rendered in an R Markdown document.
The width Integer indicates the pixel width of the entire chart (inc legend).
The height Integer indicates the pixel height of the entire chart.
The legendWidth Integer indicates the pixel width of the column for legend.
The legendTitle String (optional) is the title that should appear at the top of the legend.
The backgroundColor String (optional) is a CSS color for an SVG created for background of entire chart.
The tooltipBackground String (optional) is a CSS color for the background color of the tooltip.
The tooltipTextColor String (optional) is a CSS color for the color of the tooltip text.
The axes List describes the x and y axes; each of which contain a list containing:
- The title String, a textual label to display on that axis.
- The min Number, the minimum value on that axis.
- The max Number, the maximum value on that axis.
- The marks list (optional), which contains a set of demarcations to display along this axis, containing:
- The position Number, the numeric position along this axis to show the demarcation.
- The hoverLabel String, the label to display on hover tooltip.
- The axisLabel String (optional), the label to display on the chart for this mark.
- The color String (optional), the CSS color to use on this demarcation.
The data list contains the set of layers to render. Each layer contains the following items:
- The title String is the name of the layer (displayed in the legend).
- The color String (optional) is the CSS color for the layer.
- The polyPts Number (optional) is the number of sides of polygon that represent points on this layer (default 8).
- The polySize Number (optional) is the size of the polygons for this layer.
- The points list is the set of points to display on the layer. Each point has a list containing:
- The x Number.
- The y Number.
- The text String (optional to display as tooltip text.
- The line list (optional) is the set of points for the fitted line; a list of:
- The x Number coordinate.
- The y Number coordinate.
axes <- list(
x = list(
title = "Interval", min = 0, max = 200, marks = list(list(position = 66, hoverLabel = 'Some Marker'))
),
y = list(
title = "Proportion", min = 0, max = 100
)
)
scatterData <- list(
list(
title = "Any MM Treatment 1",
polyPts = 3,
polySize = 4,
points = list(
list(x=10, y=10, text='Item Label'),
list(x=35, y=15),
list(x=110, y=78),
list(x=150, y=92)
)
),
list(
title = "Proteasome Inhibitors",
polyPts = 4,
polySize = 4,
points = list(
list(x=25, y=21, text='Another Item Label'),
list(x=45, y=33),
list(x=65, y=44),
list(x=72, y=61)
),
line = list(list(x=28, y=24), list(x=50, y=40), list(x=70, y=59))
)
)
tableData <- list(
columns = list(
list(key="col1", label="X", align="left"),
list(key="col2", label="Y", align="left"),
list(key="col3", label="Z", align="left")
),
rows = list(
list(columns=list(list(value="R1C1"), list(value="R1C2"), list(value="R1C3"))),
list(columns=list(list(value="R2C1"), list(value="R2C2"), list(value="R2C3"))),
list(columns=list(list(value="R3C1"), list(value="R3C2"), list(value="R3C3"))),
list(columns=list(list(value="R4C1"), list(value="R4C2"), list(value="R4C3"))),
list(columns=list(list(value="R5C1"), list(value="R5C2"), list(value="R5C3"))),
list(columns=list(list(value="R6C1"), list(value="R6C2"), list(value="R6C3"))),
list(columns=list(list(value="R7C1"), list(value="R7C2"), list(value="R7C3"))),
list(columns=list(list(value="R8C1"), list(value="R8C2"), list(value="R8C3")))
)
)
nswidgets::create_scatter_plot(width = 700, height = 400, legendWidth = 150, legendTitle = 'Treatment Types', axes = axes,
data = scatterData, table = tableData)