Relative Content

Tag Archive for rggplot2

Can’t get legend to appear in ggplot

I am making a plot using ggplot and cannot get the legend to show up. I’ve tried looking through other solutions but still can’t figure it out. It used to work for me, but I think that I may have used some code in the past that messed it up if that makes sense?

ggplot2 change axis limits for each individual facet panel

library(tidyverse) ggplot(mpg, aes(displ, cty)) + geom_point() + facet_grid(rows = vars(drv), scales = “free”) The ggplot code above consists of three panels 4, f, and r. I’d like the y-axis limits to be the following for each panel: Panel y-min y-max breaks —– —– —– —— 4 5 25 5 f 0 40 10 r 10 […]