Economic Data Visualization
2021
第 1 章 Prerequisites
1.1 Packages
install.packages(
c("showtext","extrafont", "remotes")
)remotes::install_github("tpemartin/econDV2", force=T)1.2 Start a project
Start a new project for your ggplot environment:
Project > New Project… > New Directory > New Project
1.3 中文
install.packages(
c("showtext","extrafont")
)sysfonts::font_families()
sysfonts::font_add_google('Noto Sans TC')
sysfonts::font_families()library(ggplot2)
library(showtext)
showtext_auto()
theme_set(
theme(
text=element_text(family = "Noto Sans TC")
)
)你也可以在你的.Rprofile裡加上:
library(ggplot2)
library(showtext)
sysfonts::font_add_google('Noto Sans TC')
showtext_auto()
theme_set(
theme(
text=element_text(family = "Noto Sans TC")
)
)1.4 econDV2
devtools::install_github("tpemartin/econDV2")1.5 .Rprofile
library(ggplot2)
library(showtext)
sysfonts::font_add_google('Noto Sans TC')
showtext_auto()
theme_set(
theme(
text=element_text(family = "Noto Sans TC")
)+
theme_classic()
)
library(econDV2)
gg <- list(
dash = econDV2::ggdash,
geom = econDV2::ggbrowse,
aes = econDV2::ggaes
)1.6 其他
後製軟體: Choose your own image editor, but make sure it support SVG editing. Here I use Boxy SVG.
程式排版:
install.packages("styler")