tags:

views:

90

answers:

3
+3  Q: 

Point symbols in R

There are 25 symbols defined by 'pch' paramter in the points function.

How can I draw more than these 25 symbols

Thanks

+1  A: 

You just can't... only this set is implemented. Some option is to use character vectors (eg. pch=c('a','b','c')) to get points marked by as, bs, ... -- this extends the set to about 60 (with numbers), but does not look too well.

mbq
+2  A: 

You can use the basic plotting and drawing functions to devise your own symbols. Use 'lines' or 'segments' for drawing lines and 'polygon' for filled areas. So you might have a function called 'littleHouse' that takes x,y for the centre and w and h for width and height, then you would do something like:

for(i in 1:nrows(data)){
 di = data[i,]
 littleHouse(di$x,di$y,di$w,di$h)
}

Being any more specific is probably a waste of time unless you've got anything specific in mind. You can't do it via the pch parameter.

Spacedman
+3  A: 

You can see all the options for a given font using code like:

plot( 0:15, 0:15, type='n' )
points( (0:255)%% 16, (0:255) %/% 16, pch=0:255, font=5 )

Change the font= to different numbers for different options. There are a couple more options using the symbols function. If you want even more then check out the my.symbols function in the TeachingDemos package. There are several symbols available already and it gives an option for creating your own custom symbols, so there really is no limit.

Greg Snow