Overview
This gallery showcases what you can build with myIO. Each example is self-contained and uses built-in R datasets.
Scatter Plot with Trend Line
Overlay raw data with a linear model fit:
myIO() |>
addIoLayer(
type = "point",
color = "#E69F00",
label = "observations",
data = mtcars,
mapping = list(x_var = "wt", y_var = "mpg")
) |>
addIoLayer(
type = "line",
transform = "lm",
color = "#D55E00",
label = "trend",
data = mtcars,
mapping = list(x_var = "wt", y_var = "mpg")
) |>
setAxisFormat(xLabel = "Weight (1000 lbs)", yLabel = "Miles per Gallon") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Multi-Series Line Chart
Track temperature across months using grouped data:
aq <- airquality
aq$Month <- paste0("M", aq$Month)
myIO() |>
addIoLayer(
type = "line",
color = c("#0072B2", "#E69F00", "#009E73", "#D55E00", "#CC79A7"),
label = "Month",
data = aq,
mapping = list(x_var = "Day", y_var = "Temp", group = "Month")
) |>
setAxisFormat(xLabel = "Day of Month", yLabel = "Temperature (F)") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Categorical Bar Chart
Aggregate data across categories with custom formatting:
myIO() |>
addIoLayer(
type = "bar",
color = "#56B4E9",
label = "avg_mpg",
data = mtcars,
mapping = list(x_var = "cyl", y_var = "mpg")
) |>
defineCategoricalAxis(xAxis = TRUE) |>
setAxisFormat(
xAxis = ".0f", yAxis = ".1f",
xLabel = "Cylinders", yLabel = "Miles per Gallon"
) |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Area Chart with Confidence Band
Visualize a range using low and high y values:
aq <- airquality[airquality$Month == 7 & complete.cases(airquality), ]
aq$TempLow <- aq$Temp - 8
aq$TempHigh <- aq$Temp + 8
myIO() |>
addIoLayer(
type = "area",
color = "#56B4E9",
label = "range",
data = aq,
mapping = list(x_var = "Day", low_y = "TempLow", high_y = "TempHigh")
) |>
addIoLayer(
type = "line",
color = "#0072B2",
label = "actual",
data = aq,
mapping = list(x_var = "Day", y_var = "Temp")
) |>
setAxisFormat(xLabel = "Day of Month (July)", yLabel = "Temperature (F)") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Dark Mode Dashboard
Combine theming with custom colors for a dark aesthetic:
myIO() |>
addIoLayer(
type = "point",
color = "#48dbfb",
label = "scatter",
data = mtcars,
mapping = list(x_var = "hp", y_var = "qsec")
) |>
addIoLayer(
type = "line",
transform = "lm",
color = "#ff6b6b",
label = "trend",
data = mtcars,
mapping = list(x_var = "hp", y_var = "qsec")
) |>
setTheme(
text_color = "#b0b0b0",
grid_color = "#2d2d2d",
bg = "#0d1117",
font = "Inter, system-ui, sans-serif"
) |>
setAxisFormat(xLabel = "Horsepower", yLabel = "Quarter Mile Time (s)") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Donut Chart
Summarize proportions with a donut:
donut_data <- aggregate(mpg ~ cyl, data = mtcars, FUN = mean)
myIO() |>
addIoLayer(
type = "donut",
color = c("#E69F00", "#56B4E9", "#009E73"),
label = "cylinders",
data = donut_data,
mapping = list(x_var = "cyl", y_var = "mpg")
)Hexbin Density Plot
Visualize point density in large datasets:
myIO() |>
addIoLayer(
type = "hexbin",
color = "#0072B2",
label = "density",
data = mtcars,
mapping = list(x_var = "wt", y_var = "mpg", radius = 20)
) |>
setAxisFormat(xLabel = "Weight (1000 lbs)", yLabel = "Miles per Gallon") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Histogram with Reference Line
Show a distribution with a mean reference line:
myIO() |>
addIoLayer(
type = "histogram",
color = "#CC79A7",
label = "distribution",
data = mtcars,
mapping = list(value = "mpg")
) |>
setReferenceLines(xRef = mean(mtcars$mpg))Interactive Scatter with Draggable Points
Enable drag interactions for exploratory analysis:
myIO() |>
addIoLayer(
type = "point",
color = "#009E73",
label = "draggable",
data = mtcars[1:10, ],
mapping = list(x_var = "wt", y_var = "mpg")
) |>
dragPoints() |>
setAxisFormat(xLabel = "Weight", yLabel = "MPG") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Treemap
Explore hierarchical data:
myIO() |>
addIoLayer(
type = "treemap",
label = "cars",
data = mtcars,
mapping = list(level_1 = "vs", level_2 = "cyl")
)Heatmap
Visualize a matrix of values with continuous color:
df <- expand.grid(
quarter = c("Q1", "Q2", "Q3", "Q4"),
segment = c("Enterprise", "Mid-Market", "SMB"),
stringsAsFactors = FALSE
)
df$revenue <- c(120, 145, 160, 155, 80, 95, 110, 105, 40, 55, 65, 60)
myIO() |>
addIoLayer(
type = "heatmap",
color = "#4E79A7",
label = "Revenue",
data = df,
mapping = list(x_var = "quarter", y_var = "segment", value = "revenue")
) |>
defineCategoricalAxis(xAxis = TRUE, yAxis = TRUE) |>
setAxisFormat(xLabel = "Quarter", yLabel = "Segment")Candlestick Chart
Show open-high-low-close financial data:
df <- data.frame(
day = 1:8,
open = c(44, 45, 43, 46, 45, 47, 46, 48),
high = c(47, 48, 46, 49, 48, 50, 49, 52),
low = c(43, 44, 42, 45, 44, 46, 45, 47),
close = c(45, 43, 46, 45, 47, 46, 48, 51)
)
myIO() |>
addIoLayer(
type = "candlestick",
label = "Stock",
data = df,
mapping = list(
x_var = "day", open = "open",
high = "high", low = "low", close = "close"
)
) |>
setAxisFormat(xAxis = ".0f", yAxis = "$,.0f",
xLabel = "Trading Day", yLabel = "Price") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Waterfall Chart
Show how values accumulate through sequential steps:
df <- data.frame(
step = c("Revenue", "COGS", "Gross Profit", "OpEx", "Tax", "Net Income"),
value = c(500, -200, NA, -120, -30, NA),
is_total = c(FALSE, FALSE, TRUE, FALSE, FALSE, TRUE)
)
myIO() |>
addIoLayer(
type = "waterfall",
label = "P&L Bridge",
data = df,
mapping = list(x_var = "step", y_var = "value", total = "is_total")
) |>
defineCategoricalAxis(xAxis = TRUE) |>
setAxisFormat(yAxis = "$,.0f", xLabel = "Step", yLabel = "Amount") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Sankey Flow Diagram
Visualize flows between nodes:
df <- data.frame(
source = c("Organic", "Organic", "Paid", "Paid", "Referral"),
target = c("Landing", "Blog", "Landing", "Promo", "Landing"),
value = c(300, 120, 200, 80, 150)
)
myIO() |>
addIoLayer(
type = "sankey",
color = c("#4E79A7", "#F28E2B", "#E15759", "#76B7B2", "#59A14F"),
label = "Traffic Flow",
data = df,
mapping = list(source = "source", target = "target", value = "value")
)Boxplot
Compare distributions across groups:
myIO() |>
addIoLayer(
type = "boxplot",
color = "#4E79A7",
label = "Petal Width",
data = iris,
mapping = list(x_var = "Species", y_var = "Petal.Width")
) |>
setAxisFormat(xLabel = "Species", yLabel = "Petal Width (cm)") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Violin Plot
Show distribution shape alongside summary statistics:
myIO() |>
addIoLayer(
type = "violin",
color = "#59A14F",
label = "Sepal Width",
data = iris,
mapping = list(x_var = "Species", y_var = "Sepal.Width"),
options = list(showBox = TRUE, showMedian = TRUE)
) |>
setAxisFormat(xLabel = "Species", yLabel = "Sepal Width (cm)") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)Ridgeline Plot
Compare distributions across groups with overlapping density curves:
df <- mtcars
df$cyl <- as.character(df$cyl)
myIO() |>
addIoLayer(
type = "ridgeline",
color = c("#4E79A7", "#F28E2B", "#E15759"),
label = "MPG Distribution",
data = df,
mapping = list(x_var = "hp", y_var = "mpg", group = "cyl"),
options = list(overlap = 0.5)
) |>
setAxisFormat(xLabel = "Horsepower", yLabel = "Density") |>
setMargin(top = 20, bottom = 70, left = 60, right = 10)