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 data list contains the set of layers to render. Each layer contains the following items:

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(
    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)
    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)