简体   繁体   中英

Plot in R a Chart Line

I am new in R and Iam looking how to plot a simple Line Chart.

cars <- c(27.91, 28.13, 28.23, 28.41, 28.58, 28.61, 28.78, 28.89)

plot(cars, type="o" , xlab="Taille de séquences",
    ylab="Nombre de séquences", names.arg=c("10","20","50","100","150", "200", "250"), 
    border="blue")

My problem is in the Y axis i cannot find these numbers : "10","20","50","100","150", "200", "250

Any idea please?

Check the warnings() and you'll see that there are no names.arg for plot (unlike barplot ). You can accomplish that with:

plot(cars, type="o" , xlab="Taille de séquences", ylab="Nombre de séquences", yaxt="n")
axis(2, cars, c("10","20","50","100","150", "200", "250", NA)) #You did not specify one argument, I used NA.

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