Economic Data Visualization
2021
第 1 章 Prerequisites
1.1 Packages
install.packages(
c("showtext","extrafont", "remotes")
)
::install_github("tpemartin/econDV2", force=T) remotes
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")
)
::font_families()
sysfonts::font_add_google('Noto Sans TC')
sysfonts::font_families() sysfonts
library(ggplot2)
library(showtext)
showtext_auto()
theme_set(
theme(
text=element_text(family = "Noto Sans TC")
) )
你也可以在你的.Rprofile
裡加上:
library(ggplot2)
library(showtext)
::font_add_google('Noto Sans TC')
sysfontsshowtext_auto()
theme_set(
theme(
text=element_text(family = "Noto Sans TC")
) )
1.4 econDV2
::install_github("tpemartin/econDV2") devtools
1.5 .Rprofile
library(ggplot2)
library(showtext)
::font_add_google('Noto Sans TC')
sysfontsshowtext_auto()
theme_set(
theme(
text=element_text(family = "Noto Sans TC")
+
)theme_classic()
)library(econDV2)
<- list(
gg 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")