Reverse Axis Limits of Plot in Base R & ggplot2 (2 Examples) | Change Scale | rev & range Functions

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

y = 1:5)

plot(data$x, data$y) # Plot with default axes

plot(data$x, data$y, # Reversed y-axis
ylim = rev(range(data$y)))

library("ggplot2")

ggp <- ggplot(data, aes(x, y)) + # ggplot2 Plot with default axes
geom_point()
ggp # ggplot2 Plot with default axes

ggp + # Reversed y-axis
scale_y_reverse()

Follow me on Social Media:

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

These are great little videos. I know this isn't a main theme of your content, but do you think you would ever do a series on spatial analysis/visualization? I just updated a lot of my work to use the 'sf' package, and I'm fairly new to ggplot and all things tidyverse.

douglaspage
visit shbcf.ru