Label mixed-fonts HTML strings
label_mixfonts(asciifont = "Arial", mbytefont = "MS Gothic")
ASCII (Single byte) font family, Default: 'Arial'
Multi byte font family, Default: 'MS Gothic'
Returns mixfonts()
.
This function is supposed to be used with ggtext::element_markdown()
. See vignettees("mixfonts")
if(interactive()){
library(ggplot2)
library(magrittr)
library(ggtext)
library(frabento)
register_all_fonts()
set.seed(30)
data.frame(cpue = c(rnorm(n = 30, mean = 300, sd = 25),
rnorm(n = 30, mean = 500, sd = 35)),
year = rep(seq(1990, length.out = 30, by = 1), times = 2),
age = rep(c("0歳魚", "1歳魚+"), each = 30)) %>%
ggplot(aes(x = year, y = cpue, group = age)) +
geom_path(aes(color = age)) +
scale_color_discrete(labels = label_mixfonts()) +
theme(legend.text = element_markdown(color = "blue"),
legend.position = "right")
}