Skip to content

Plot Many Data to same plot

4 messages · Alaios, R. Michael Weylandt, PIKAL Petr +1 more

#
What do you want to change about the lines? pch (different characters)
might give the desired variety.

Michael
On Tue, Feb 21, 2012 at 7:56 AM, Alaios <alaios at yahoo.com> wrote:
#
Hi


If you want to have more than 6 line types you had either to use colours 
or to follow last part of lty advice from par and go to section "Line 
types". In that case you can not sim?ply use lty 1,2,...,n but you have to 
prespecify line types in some character vector and choose from that 
vector.

Quote
Line types can either be specified by giving an index into a small 
built-in table of line types (1 = solid, 2 = dashed, etc, see lty above) 
or directly as the lengths of on/off stretches of line. This is done with 
a string of an even number (up to eight) of characters, namely non-zero 
(hexadecimal) digits which give the lengths in consecutive positions in 
the string. For example, the string "33" specifies three units on followed 
by three off and "3313" specifies three units on followed by three off 
followed by one on and finally three off. The ?units? here are (on most 
devices) proportional to lwd, and with lwd = 1 are in pixels or points or 
1/96 inch. 

However with more than 6 lines in one colour the picture will probably 
resemble mad spider net.
Regards
Petr


r-help-bounces at r-project.org napsal dne 21.02.2012 13:56:53:
same plot
type="l")
{
{
$dataset)
}
datalist[[i]]$dataset$
differentline type.
(in
keep
(like
especially
http://www.R-project.org/posting-guide.html
#
On 02/21/2012 11:56 PM, Alaios wrote:
Hi Alex,
The easiest way is to define a vector of more line types and then step 
through that vector. Here is one with the default five broken lines and 
five more that are reasonably distinguishable:

mylinetypes=c("44", "13", "1343", "73", 
"2262","7272","5331","3366","2714","6224")
plot(1:10,type="n")
for(i in 1:10) abline(h=i,lty=mylinetypes[i])

Work out a way to generate different line types automatically? You might 
be able to do this by some tricky algorithm that applied a sequence like 
(+3,-2,+1,-1) to your index and then rotating the sequence on each 
iteration, BUT, your plot would still probably look like a mess with 
more than ten lines.

Jim