Change y-Axis Limits of Boxplot (2 Examples) | Base R & ggplot2 Graph | coord_cartesian() Function

preview_player
Показать описание
R code of this video:

groups = letters[1:4])

boxplot(values ~ groups, # Base R boxplot with default axes
data)

boxplot(values ~ groups, # Base R boxplot with manual y-axis
data,
ylim = c(- 4, 7))

library("ggplot2")

ggp <- ggplot(data, # ggplot2 boxplot with default axes
aes(groups,
values)) +
geom_boxplot()
ggp

ggp + # Manual y-axis using ylim()
ylim(- 4, 7)

ggp + # Manual y-axis using coord_cartesian()
coord_cartesian(ylim = c(- 4, 7))

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

Thank you so much for this video! you helped me with my thesis

SofiA-nfos
Автор

There is a vital difference between ylim and coord_cartesian .... you did not show it because you are expanding the limit... but it seems coord_cartesian is the only correct option if you want to zoom in on part of the data, as it will not change the underlying data, unlike ylim... According to the documentation.

Xenoni
Автор

Don't understand why everyone's videos of this stuff are videos of a blurry screen. Can we not focus the thing please.

tahliahockridge-haynes
welcome to shbcf.ru