Marcus Eger
2002-Jun-05 10:06 UTC
[R] mixing different modes of lty line type specification in legend() ?
Hi List, is sth. like the following possible: legend(x,y,c("A","B","C"), lty=list(1,"42","11")) ? Or: is there a possibility to define a solid line using the "string" mode for lty? Thanks Marcus -- +-------- ><> ------------------------------------------- | E-Mail: eger.m at gmx.de (NEW) | marcus.eger at physik.uni-marburg.de (OLD) | WWW: http://neuro.physik.uni-marburg.de/~eger (NEW) +-------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Ko-Kang Kevin Wang
2002-Jun-05 10:42 UTC
[R] mixing different modes of lty line type specification in legend() ?
Hi, ----- Original Message ----- From: "Marcus Eger" <eger.m at gmx.de> To: "r-help" <r-help at stat.math.ethz.ch> Sent: Wednesday, June 05, 2002 10:06 PM Subject: [R] mixing different modes of lty line type specification in legend() ?> Hi List, > is sth. like the following possible: > > legend(x,y,c("A","B","C"), lty=list(1,"42","11")) ?I am assuming you want to fit the three lines with line type 1, 42, and 11? If this is so you need something like: legend(x,y,c("A","B","C"), lty=c(1,42,11)) Or you can use: legend(x,y,c("A","B","C"), lty=c("solid", "dotted", "dashed")) which draws solid line for A, dotted line for B and dashed line for C. I hope this is what you want :-) Cheers, Ko-Kang Wang --------------------------------------------- Ko-Kang Kevin Wang Post Graduate PGDipSci Student Department of Statistics University of Auckland New Zealand www.stat.auckand.ac.nz/~kwan022 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Uwe Ligges
2002-Jun-05 11:15 UTC
[R] mixing different modes of lty line type specification in legend() ?
Marcus Eger wrote:> > Hi List, > is sth. like the following possible: > > legend(x,y,c("A","B","C"), lty=list(1,"42","11")) ?Well, you have to convert such a list anyway ...> Or: is there a possibility to define a solid line using the "string" mode for lty?What about legend(x, y, c("A","B","C"), lty=c("dashed", "solid", "dotted")) Uwe -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Marcus Eger
2002-Jun-05 13:47 UTC
[R] mixing different modes of lty line type specification in legend() ?
On Wednesday 05 June 2002 12:42, Ko-Kang Kevin Wang wrote:> I am assuming you want to fit the three lines with line type 1, 42, and 11? > If this is so you need something like: > legend(x,y,c("A","B","C"), lty=c(1,42,11))The problem is: lty=42 is not the same as lty="42", e.g., compare plot(1:10,type="l",lwd=3,lty="42") plot(1:10,type="l",lwd=3,lty=42) I would like to use the "string"-mode for lty because thereby I can precisely define the stretch pattern. On Wednesday 05 June 2002 13:15, Uwe Ligges wrote:> What about > ? legend(x, y, c("A","B","C"), lty=c("dashed", "solid", "dotted"))Yes, that is possible, but again, the pattern cannot be specified precisely. As an alternative, one could use: legend(x, y, c("A","B","C"), lty=c("11", "22", "42"),lwd=3) But, unfortunately, solid lines do not seem to supported in "string" mode. Marcus -- +-------- ><> ------------------------------------------- | E-Mail: eger.m at gmx.de (NEW) | marcus.eger at physik.uni-marburg.de (OLD) | WWW: http://neuro.physik.uni-marburg.de/~eger (NEW) +-------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Marcus Eger
2002-Jun-05 15:34 UTC
[R] mixing different modes of lty line type specification in legend() ?
On Wednesday 05 June 2002 16:53, Uwe Ligges wrote:> Marcus Eger wrote: > > legend(x, y, c("A","B","C"), lty=c("11", "22", "42"),lwd=3) > > But, unfortunately, solid lines do not seem to supported in "string" > > mode. > > Was a misunderstanding, sorry ... > > Not really tested: Does "0" the trick?Hhmm. plot(1:10,type="l",lwd=3,lty="0") works, but unfortunately not in legends: legend(x, y, c("A","B","C"), lty=c("0", "22", "42"),lwd=3) It just leaves the first line blank. I think it is because legend simply does not process lty elements less equal zero (not distinguishing between strings and numbers): "legend" <- function( ....... ...... if (do.lines) { seg.len <- 2 ok.l <- if (missing(lty)) { lty <- 1 TRUE } else lty > 0 browser() ....... Browse[1]> ok.l [1] FALSE TRUE TRUE +-------- ><> ------------------------------------------- | E-Mail: eger.m at gmx.de (NEW) | marcus.eger at physik.uni-marburg.de (OLD) | WWW: http://neuro.physik.uni-marburg.de/~eger (NEW) +-------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Marcus Eger
2002-Jun-05 15:55 UTC
[R] mixing different modes of lty line type specification in legend() ?
On Wednesday 05 June 2002 17:43, Uwe Ligges wrote:> > works, but unfortunately not in legends: > > > > legend(x, y, c("A","B","C"), lty=c("0", "22", "42"),lwd=3) > > > > It just leaves the first line blank. > > I think it is because legend simply does not process lty elements less > > equal zero (not distinguishing between strings and numbers): > > legend(x, y, c("A","B","C"), lty=c("10", "22", "42"), lwd=3)This does not work for me (R 1.4.1): legend(x,y, c("A","B","C"), lty=c("10", "22", "42"),lwd=3) does the same as legend(x,y, c("A","B","C"), lty=c("1", "22", "42"),lwd=3) or legend(x,y, c("A","B","C"), lty=c("11", "22", "42"),lwd=3) It just produces a narrow dot pattern. Moreover, the lty="10" produces a ghostscript error when plotted to postscript device: Error: /rangecheck in --setdash-- Operand stack: --nostringval-- 0 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- 2 3 %oparray_pop --nostringval-- --nostringval-- Dictionary stack: --dict:1035/1476(ro)(G)-- --dict:0/20(G)-- --dict:92/200(L)-- Current allocation mode is local GNU Ghostscript 6.53: Unrecoverable error, exit code 1 -- +-------- ><> ------------------------------------------- | E-Mail: eger.m at gmx.de (NEW) | marcus.eger at physik.uni-marburg.de (OLD) | WWW: http://neuro.physik.uni-marburg.de/~eger (NEW) +-------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2002-Jun-05 17:02 UTC
[R] mixing different modes of lty line type specification in legend() ?
Marcus Eger <eger.m at gmx.de> writes:> On Wednesday 05 June 2002 16:11, Peter Dalgaard BSA wrote: > > Marcus Eger <eger.m at gmx.de> writes: > > > legend(x, y, c("A","B","C"), lty=c("11", "22", "42"),lwd=3) > > > But, unfortunately, solid lines do not seem to supported in "string" > > > mode. > > > > Eh? > > With "string" mode, I mean that a line type may be specified by a sequence of > characters. E.g., as R-help says (par.html), > >>lty="3313" specifies three units on followed by three off followed by one > on and finally three off. << > Another example is lty="11" which produces a narrow dot pattern. I wished > that it were possible to also define a solid line by these patterns.Yes, but "solid" is a perfectly valid string and can easily be mixed with the others. The problem with the patterns is that they recycle and thus give alternating on/off values by definition. Curiously, "0" gives a solid line in plot() but not in legend(), whereas "00" works in both places. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._