Skip to contents

Overview

text2map.theme provides color palette functions that work with base R graphics. The solaris_pal() function generates a warm purple-to-gold gradient.

Solar Palette

The solaris palette provides five distinct colors suitable for categorical data:

# Generate palette colors
cols <- solaris_pal(5)
print(cols)
#> [1] "#2A0132" "#215AA9" "#009392" "#72BC5A" "#FFD700"

Base R Plot Examples

Histogram

# Simple histogram with solaris colors
hist(
  mtcars$mpg,
  breaks = 10,
  col = cols[3],
  border = "#fcfaf7",
  main = "Distribution of MPG",
  xlab = "Miles per Gallon"
)

Histogram showing distribution of miles per gallon with teal-colored bars

Bar Plot

# Bar plot using palette
barplot(
  VADeaths[, 1],
  col = cols,
  main = "Virginia Deaths (Rural Male)",
  xlab = "Rate per 1000",
  border = "#fcfaf7"
)

Bar plot showing Virginia death rates by age group with solaris palette colors

Pie Chart

# Pie chart with palette colors
pie(
  rep(1, 5),
  labels = paste0("Group ", LETTERS[1:5]),
  col = cols,
  main = "Solaris Palette"
)

Pie chart showing five equal segments in solaris palette colors

Scatter Plot

# Scatter plot with palette colors
plot(
  mtcars$wt, 
  mtcars$mpg,
  xlab = "Weight (1000 lbs)",
  ylab = "Miles per Gallon",
  main = "Fuel Efficiency vs. Weight",
  pch = 19,
  col = cols[1]
)

Scatter plot of car weight versus miles per gallon with purple points

Grid Helper

Use grid_solaris() to add subtle grid lines to your base R plots:

plot(
  mtcars$wt,
  mtcars$mpg,
  pch = 19,
  col = cols[1]
)
grid_solaris()

Scatter plot with warm-toned grid lines overlaid

Palette Options

All four palettes are available:

viridis_pal(5)
#> function (n) 
#> {
#>     viridisLite::viridis(n, alpha, begin, end, direction, option)
#> }
#> <bytecode: 0x5acc5d609450>
#> <environment: 0x5acc5bfac290>
#> attr(,"class")
#> [1] "pal_discrete" "scales_pal"   "function"    
#> attr(,"type")
#> [1] "colour"
#> attr(,"nlevels")
#> [1] 255
inferno_pal(5)
#> [1] "#000004FF" "#56106EFF" "#BB3754FF" "#F98C0AFF" "#FCFFA4FF"
grayscale_pal(5)
#> [1] "#000000" "#6D6D6D" "#959595" "#B3B3B3" "#CCCCCC"
solaris_pal(5)
#> [1] "#2A0132" "#215AA9" "#009392" "#72BC5A" "#FFD700"