Skip to content
Back to formatted view

Raw Message

Message-ID: <6161763.1241463741791.JavaMail.root@mswamui-blood.atl.sa.earthlink.net>
Date: 2009-05-04T19:02:21Z
From: Peter Flom
Subject: Producing a legend successfullly

Steve Murray <smurray444 at hotmail.com> wrote
>
>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)
>

You've got mismatched parentheses here, with two ( and only one ).

I suspect you added one at the end, making r look at lty= and col = as part of the legend text.

You want

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

HTH

Peter

Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT com