I am trying to plot data with maximum 9.70 and minimum -58.9.
I coded:
plot(BriannaJan[,3,i], type = "line", col="black",
main = "Brianna January Trend", xlab = "days", ylab="Temperature",
ylim = -60:10)
But I get error:
Error in plot.window(...) : invalid 'ylim' value
How can I set ylim? y value range has to be from -60 to 10.
ylim: Convenience function to set the limits of the y axis.
The xlim() function with the provided parameters as the range of the x-axis in vectors is used to set the x-axis without dropping any data of the given plot or an object accordingly. Parameters: …: if numeric, will create a continuous scale, if factor or character, will create a discrete scale.
Use the title() function title() can be also used to add titles to a graph. A simplified format is : title(main = NULL, sub = NULL, xlab = NULL, ylab = NULL, ...)
-60:10
generates a sequence from -60
to 10
, what you need as the ylim is a min and max value (with syntax c(min, max)
) instead of a sequence, try this:
ylim=c(-60,10)
You need to change it to
ylim=c(-60,10)
so the whole thing would be:
plot(BriannaJan[,3,i], type = "line", col="black", main ="Brianna January Trend",
xlab = "days", ylab="Temperature", ylim=c(-60,10))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With