Introduction to SveltePlots

SveltePlots is an innovative charting library designed to enhance Shiny applications by utilizing the power of Svelte and Javascript. This library is a wrapper for a custom Svelte web component that leverages SVG to create interactive and dynamic charts. SveltePlots includes a limited amount of charts to date which are line and scatter plots, bar charts, density charts, and histograms.


Key Features

Ease of Use

Traditional Approach with Proxy Functions

When using JavaScript-based charting libraries in Shiny:

SveltePlots Approach

SveltePlots takes a different approach due to the advantages provided by Svelte’s reactivity system:

Benefits of SveltePlots

Simplified Code

By leveraging Svelte’s reactivity:

Enhanced Maintainability

Limitations

Installation

install.packages("SveltePlots")

Examples

library(tidyverse)
library(SveltePlots)

data("penguins")
sp(
  data = penguins %>% 
    dplyr::distinct(flipper_length_mm, bill_length_mm, species),
  mapping = spaes(x = flipper_length_mm, y = bill_length_mm, group = species),
  type = "points"
) %>% 
  sp_title("Penguins", font_size = 26)

👉 View the penguins plot