[R] Differentiate values in a plot by colour or symbol

Ismail SEZEN sezenismail at gmail.com
Tue May 30 18:26:10 CEST 2017


> On 30 May 2017, at 19:02, Tobias Christoph <s3tochri at uni-bayreuth.de> wrote:
> 
> Hey Guys,
> 
> I just try to differentiate certain values in my plot by colour or symbol.
> 
> I have panel data with three dimensions (number of stations, revenue, 
> years). To integrate the third dimension (years) in the plot, I want to 
> differentiate the values(number of stations, revenue) by a certain range 
> of years.
> 
> e.g.: 2005-2010: red coloured dots, 2011-2016, blue coloured dots
> 
> For the normal plot I used the following formula:
> 
> *plot(data$stations, data$revenue, xlab="stations", ylab="revenue")*
> 
> I only found a way to mark every single year. So hopefully you can help?
> 
> Cheers,
> 
> Toby
> 


See ?findInterval. Especially, first 3 lines in _Examples_ section. Use result of findInterval as argument to _col_ or _pch_ in plot function.



More information about the R-help mailing list