Learn R Programming

SveltePlots (version 0.1.0)

add_xy: Add XY Data to Chart

Description

This function adds XY (scatter or line) data to a SveltePlot chart. It supports customization of aesthetics such as color, size, opacity, and more. It is used to overlay data points, lines, or other XY elements onto the chart.

Usage

add_xy(
  sp,
  current_data,
  group_name,
  color_mapping,
  size,
  alpha,
  facet,
  tooltip,
  type,
  second_axis,
  include_legend
)

Arguments

sp

A SveltePlot htmlwidget object to which the data will be added.

current_data

A list of data frames representing the XY data series.

group_name

A character vector of group names corresponding to each data series.

color_mapping

A named list mapping group names to colors.

size

A numeric value specifying the size of the points or line thickness.

alpha

A numeric value between 0 and 1 specifying the opacity of the series.

facet

A list of facets, specifying how the data should be split across multiple panels.

tooltip

A logical value indicating whether tooltips should be displayed on hover.

type

A character string specifying the chart type ('line', 'points', etc.).

second_axis

A logical value indicating if the series should be plotted on a secondary y-axis.

include_legend

A logical value indicating whether to include the series in the chart legend.