Re: [R] Error in colouring by group in core plot R

2020-04-24 Thread Rui Barradas
Hello, This is probably off-topic since you have chosen base graphics but this is much easier with ggplot. library(ggplot2) ggplot(df, aes(Index, Incidence, colour = Country)) + geom_line() + scale_colour_manual(values = c("red", "black", "blue")) + theme_minimal() Hope this helps,

Re: [R] Error in colouring by group in core plot R

2020-04-24 Thread Jim Lemon
Hi Luigi, This is pretty easy using "plot" and "lines": # assume your example data plot(g1,col ="red",type = "l", lwd = 2, xlab = "Days since start", ylab = "Count of infections", main = "Daily cases of COVID-19") lines(g2,col="black", lwd = 2) lines(g3,col="blue", lwd = 2) text(c(15,80,

Re: [R] Error in colouring by group in core plot R

2020-04-24 Thread Eric Berger
Hi Luigi, the problem is not the first graph vs the second graph. The first graph would also show the same effect if you added type='l' to the plot command. There are various ways to approach this. A quick search turned up the following which gives you different options. https://stackoverflow.com/q

[R] Error in colouring by group in core plot R

2020-04-24 Thread Luigi Marongiu
Hello, I am trying to make an epidemic plot of the COVID pandemic using the core plot function. I am looking at three countries and the countries are as factors. The idea is to colour the entry by country, following this scheme: ``` df = data.frame(index = 1:10, value = c(rnorm(10),