Skip to content
Back to formatted view

Raw Message

Message-ID: <C301FB6D-6A6A-4071-896C-88D8BD6786BA@exeter.ac.uk>
Date: 2009-05-04T19:30:25Z
From: Baptiste Auguie
Subject: Producing a legend successfullly
In-Reply-To: <BAY135-W52956038D9CADBC80794C888680@phx.gbl>

your code is missing a closing bracket for the text labels,

  legend(1,4, c("Simulation", "Observation"), lty=1:2, col=2:3)

baptiste

On 4 May 2009, at 20:46, Steve Murray wrote:

>
> Dear all,
>
> I'm attempting to insert a legend into a line graph. I've sorted out  
> the positioning, but I'm unable to display the sample line and  
> associated colour to go within the legend box. Instead, under the  
> variable names, the numbers 1, 2, 2, 3 are displayed in a column  
> (with '2' repeated twice). This is the code I'm using:
>
> legend(80,1150, c("Simulation", "Observation", lty=1:2, col=2:3)
>
> How do I go about displaying a red solid line next to 'Simulation'  
> and a green dashed line next to 'Observation' (and if necessary,  
> remove the numbers that are currently displayed)?
>
> Many thanks for any help offered,
>
> Steve
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

_____________________________

Baptiste Augui?

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag