So I am new to R and I am trying to use the ylim()
function in order to zoom into the part of the graph that actually have data.
For example, when I say ylim(10,30)
because my temperature points ranged from 10 to 30 degrees, it also uses the same 10,30 limit for salinity but that was not what I wanted since salinity has points from only 20 to 40 and chlorophyll level ranges from 0 to 10.
Therefore, I would like to use ylim(10,30)
for temperature but ylim(20,40)
for salinity and ylim(0,10)
for chlorophyll but I am unsure how to do so. If this can be done through a geom_point()
graph that would be ok as well. Because I'm new to R, could you tell me how to edit my current code to fix this or to add something to the code with the + symbol?
Thank you very much for the help.
ggplot(data = Factors,
mapping = aes(x = as.Date(Date,"%m/%d/%Y"), y =Variable, group = 1)) +
geom_line(group = 1) +
facet_grid(rows=vars(Group)) +
labs(x = "Date", y = "Variable")
scale_x_date(date_breaks = "week", date_labels = "%b %d") + ylim(10,30).