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

Bert Gunter bgunter@4567 @ending from gm@il@com
Tue Nov 20 20:13:17 CET 2018


You need to do some studying! ggplot is built on the grid graphics system,
which is separate from the base graphics system. The par() function is part
of the *base* graphics system and so ignored by ggplot.

Others may offer you solutions using the "faceting" functionality of
ggplot. But you really should reading up on this on your own. There are
many good tutorials on ggplot2 that are available on the web.

-- Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Nov 20, 2018 at 10:19 AM Subhamitra Patra <
subhamitra.patra using gmail.com> wrote:

> Dear R users,
>
> I have one excel file with 5 sheets. The no. of columns vary for each
> sheet. The 1st sheet consists of 38 columns. So, I want to plot 38 separate
> line charts and arrange them in par(mfrow = c(4, 10)) order. Please suggest
> me how to do this. I have tried with the following code by running a loop
> inside of a sheet, but it is not working. Further, I want to run loops for
> each sheet.
>
> par(mfrow = c(4, 10))
> loop.vector <- 1:38
> for (i in loop.vector)
> x <- JJ[,i]
> library(ggplot2)
>   library(cowplot)
>   plot.mpg <- ggplot(mpg, aes(x,
>                               main = paste ("country", i),
>                               xlab = "Scores",
>                               xlim = c(1,500)
>                               y = colnames[i,], colour = factor(cyl))) +
>   geom_line(size=2.5)
> save_plot("mpg.png", plot.mpg,
>           base_aspect_ratio = 1.3)
>
> I want to give my X axis name as scores of (1,500) and Y axis as the
> particular column names for all graphs.
>
> Please suggest.
>
> Thanks in advance.
>
> --
> *Best Regards,*
> *Subhamitra Patra*
> *Phd. Research Scholar*
> *Department of Humanities and Social Sciences*
> *Indian Institute of Technology, Kharagpur*
> *INDIA*
>
>
>
>
>
>
>
>
> [image: Mailtrack]
> <
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&
> >
> Sender
> notified by
> Mailtrack
> <
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&
> >
> 11/20/18,
> 11:49:42 PM
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list