[R] Multiple Plots using ggplot

stephen sefick ssefick at gmail.com
Mon Mar 30 16:34:09 CEST 2015


Hi Frederic,

Can you provide a minimal reproducible example including either real data
(dput), or simulated data that mimics your situation? This will allow more
people to help.

Stephen

On Mon, Mar 30, 2015 at 8:39 AM, Frederic Ntirenganya <ntfredo at gmail.com>
wrote:

> Dear All,
>
> I want to plot multiple using ggplot function from a data frame of
> many columns. I want to plot only str1, str2 and str3 and I failed to
> make it. What I want is to compare str1, str2 and str3 by plotting
> vertical line. I also need to add points to the plot to be able to
> separate them.
>
>
> Here is how the data look like and how I tried to make it.
>
> Date NumberofRaindays TotalRains str1 str2 str3 1/1/1952 86 1360.5 92 120
> 112 1/1/1953 96 1100 98 100 110
> ...                                           ....
> ....             ...              ....            ....
>
> df1 <-data.frame(data)
> df1
> df2 <- melt(df1 ,  id = 'Date', variable_name = 'start of Rains')
> df2
>
> ggplot(df2, aes(Date,value)) + geom_line(aes(colour ="red"),type = "h")
>
> Kindly any help is welcome. Thanks
>
> Regards,
> Frederic.
>
> Frederic Ntirenganya
> Maseno University,
> African Maths Initiative,
> Kenya.
> Mobile:(+254)718492836
> Email: fredo at aims.ac.za
> https://sites.google.com/a/aims.ac.za/fredo/
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



-- 
Stephen Sefick
**************************************************
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**************************************************
sas0025 at auburn.edu
http://www.auburn.edu/~sas0025
**************************************************

Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

                                -K. Mullis

"A big computer, a complex algorithm and a long time does not equal
science."

                              -Robert Gentleman

	[[alternative HTML version deleted]]



More information about the R-help mailing list