[R] as.Date and Legend in a plot

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Fri Jun 22 22:33:38 CEST 2018


> On Jun 22, 2018, at 12:12 PM, Ogbos Okike <giftedlife2014 using gmail.com> wrote:
> 
> Dear Contributors,
> 
> I am surprised that I cannot add legend to a certain plot. Although the
> x-axis indicates years, the actual data was in year, month and day format.
> I then used as.Date to play around and get what I am looking for. I am,
> however, worried that I cannot add legend to the plot no matter how I
> tried. Looking at the axis, I tried:
> legend(1998,3, c("Climax", "Thule", "Sopo"), lty = 1, col =
> c("black","red","blue")). I also tried:
> 
> legend(as.Date(1998-02-10),

I don't think you understand the difference between character values and numeric values. Thr using 

as.Date("1998-02-10")


> 3, c("Climax", "Thule", "Sopo"), lty = 1, col =
> c("black","red","blue"))
> but no result and no error.
> 
> I have attached the plot in case it will assist in your suggestions.
> 
> Many thanks for your time.
> 
> Ogbos
> ______________________________________________
> 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law




More information about the R-help mailing list