[R] Detailed legend in mathplot ...

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Mar 21 13:10:52 CET 2007



Petar Milin wrote:
> You are absolutely right, and I apologize. Here is the data.frame:
> no day concentrated distributed
> 1 4 7 6.8
> 2 5 3 6
> 3 6 2.3 5.65
> 4 7 1.6 5.30
> 9 8 0.9 4.95
> 
> And then, if DAT = data.frame, mathplot() should do the job.


So what is the problem with creating the legend? Is the help page for 
?legend not clear enough? I'd just do straightforward

legend(1, 1, legend = names(DAT)[3:4], lty = c("dashed", "solid"))

Otherwise, I do not understand your question.

Best,
Uwe Ligges



> Thank you in advance,
> Petar
> 
> 
> On Wed, 2007-03-21 at 09:37 +0100, Uwe Ligges wrote:
>> Petar Milin wrote:
>>> Hello,
>>> Recently, I have asked for a help with building graphs, and I got few
>>> great advices. Now, my appetite is growing :) and I wander how to add
>>> legend for two (or more) lines in following example:
>>>
>>> matplot(DAT[, c(3,4)], type="b", ylim=c(0,8), xaxt="n", yaxt="n",
>>>  + pch=c(21,22), col="black", lty=c("dashed","solid"), xlab="", ylab="")
>>> title(ylab="% correct", xlab="Trial", cex.lab=1.5)
>>> axis(1, at=1:4, labels=as.character(DAT$Trial), cex.axis=1.5)
>>> axis(2, cex.axis=1.5)
>>>
>> We do not have DAT, why don't you make it easier for us to help by 
>> specifying a very tiny data.frame that fits to your code?
>>
>> Best,
>> Uwe Ligges
>>
>>
>>> Sincerely,
>>> Petar
>>>
>>> ______________________________________________
>>> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list