Skip to content
Prev 377509 / 398502 Next

[R studio] Plotting of line chart for each columns at 1 page

1. xaxt="n" means "Don't display the X axis". See the help for "par" in the
graphics package

2. axis(1,at=1:nrows,labels=names(MPG3))
This means, "Display the bottom axis (1) with ticks at 1 to the number of
rows in the data frame"
"Use the values of MPG$Year as labels for the ticks". see the help for
"axis" in the graphics package
Note that this should be in the same loop as "plot"

Now I can see that my guess at the structure of the data was wrong. What
you could do is to collapse the daily records into the means for the years.
As I don't know what your spreadsheet looks like, I could only guess a
method for this.

You seem to be saying that you plot all 5655 values, but you want the axis
to show just the years.Rather than tell you to convert your data to a time
series, I'll suggest a quick hack.

axis(1,at=seq(1,5655,by=365),labels=1994:2014)

This _may_ work for you. I offer it because I can see that you do not have
a lot of experience in R and you want to get the job done. If you can't get
it to work, I apologize and you can blamelessly move to something else.

Jim

PS - If you don't know how to start HTML help - help.start()

On Wed, Nov 21, 2018 at 7:26 PM Subhamitra Patra <subhamitra.patra at gmail.com>
wrote: