Да, у вас это есть в ggthemes
(расширение ggplot2) с theme_economist
и theme_economist_white
.
. Для гистограммы вам нужно будет играть с geom_bar
и coord_flip
( здесь )
Примеры из ggthemes делают c ( здесь )
library("ggplot2")
library("ggthemes")
p <- ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg, colour = factor(gear))) +
facet_wrap(~am) +
# Economist puts x-axis labels on the right-hand side
scale_y_continuous(position = "right")
## Standard
p + theme_economist() +
scale_colour_economist()
![enter image description here](https://i.stack.imgur.com/1cD4i.png)
## White
p + theme_economist_white() +
scale_colour_economist()
![enter image description here](https://i.stack.imgur.com/MBQwr.png)
Как воспроизвести график, приведенный в примере
Поскольку я не могу установить пакет SciencesPo
на свой компьютер, я предлагаю Вы подход ggplot + ggthemes.
Хорошей отправной точкой может быть следующий подход. В качестве примера я использую набор данных diamond
.
library(dplyr)
library(ggplot2)
library(ggthemes)
df <- diamonds %>%
group_by(cut) %>%
summarise(mean = mean(price), sigma = sd(price),
n = n())
df <- df %>%
mutate(int_minus = mean - 1.96*sigma/sqrt(n),
int_plus = mean + 1.96*sigma/sqrt(n))
А потом сюжет
ggplot(df) +
geom_segment(aes(x = int_minus, xend = int_plus, y = factor(cut), yend = factor(cut)), size = 2L, alpha = 0.4) +
geom_point(aes(x = mean, y = factor(cut)), shape = 15, color = "blue", size = 4L) +
theme_economist_white()
![enter image description here](https://i.stack.imgur.com/tiGF6.png)