# [R] Help on multi-line plot

Kwesi A. Quagraine starskykwesi at gmail.com
Fri Mar 16 18:55:01 CET 2018

```Thanks! I have been able to solve this!

Kwesi

On 16 March 2018 at 14:49:01, Kwesi Quagraine (starskykwesi at gmail.com) wrote:

Hello R-Users

I am struggling with this line plot, it might be simple but I am missing something here.

First of all I want to make multiple line plots across seasons (DJF,MAM,JJA,SON) for 12 variables (here, called nodes) and fill them with the node.

So that season=x-axis, node=line col and freq=y-axis.

My plot currently links all DJFs, MAMs, JJAs and SONs, however I will like them to be linked across seasons, so that for node 1, I should have a line plot of DJF, MAM,JJA and SON with a particular color as a fill etc.

Any help will be much appreciated. Thanks in advance.

Below is my current code;

library(ggplot2)

​kay​  <- data.frame(
season = factor(c("DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON",             "DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON","DJF","MAM","JJA","SON"), levels=c("DJF","MAM","JJA","SON")),
node = factor(c("1","2","3","4","5","6","7","8","9","10","11","12")),
freq = c(1.075, 5.371, 16.944, 8.953,2.607, 7.257, 14.482, 8.856,5.637, 6.010, 9.239, 11.409,16.096, 6.074, 1.822, 7.498,
1.597, 5.531, 14.290, 9.114,6.647, 6.394, 9.143, 9.761,10.003, 7.289, 3.964, 9.890,18.768, 7.960, 0.863, 4.590,
3.943, 11.125, 15.633, 11.345,7.625, 12.500, 8.184, 9.890,12.414, 14.035, 4.508, 6.173,13.587, 10.454, 0.927, 2.521)
)

​kay​

# Map sex to different point shape, and use larger points
ggplot(data= ​kay​ , aes(x=season, y=freq, group=node, colour=node)) +
geom_line() +
geom_point()

--
Try not to become a man of success but rather a man of value-Albert Einstein

University of Cape Coast | College of Agriculture and Natural Sciences | Department of Physics |
Team Leader | Recycle Up! Ghana|Technology Without Borders |
Other emails: kwesi.quagraine at ucc.edu.gh | kwesi.quagraine at teog.de |
Mobile: +233266173582
Skype: quagraine_cwasi

------------
Try not to become a man of success but rather a man of value- Albert Einstein

Kwesi A. Quagraine
Department of Physics
School of Physical Sciences
College of Agriculture and Natural Sciences
University of Cape Coast
Cape Coast, Ghana

Alt. Email: kwesi at csag.uct.ac.za
Web: http://www.recycleupghana.org/
Office: +27 21 650 3164
Skype: quagraine_cwasi
[[alternative HTML version deleted]]

```