简体   繁体   中英

R Language: How to Set ylim?

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.

-60:10生成一个从-6010的序列,您需要的是ylim是一个最小值和最大值(使用语法c(min, max) )而不是一个序列,请尝试以下操作:

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM