5

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

How can I draw more than these 25 symbols

Thanks

  • this wont answer your question, but if for some reason you need to plot >25 symbols, start coloring them to increase the diversity – Dave Sep 17 '10 at 23:08
  • 4
    If you need more than 25 symbols in a plot you need to rethink your problem. – John Sep 17 '10 at 23:55
  • Obviously, the question was not about adding 25+ symbols, it was "what other custom symbols can I make". Given that the given set of 25 is very, very clunky. I really wish R can improve on the symbol design! – PA6OTA May 31 '19 at 17:08

3 Answers3

9

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 (I am the author of my.symbols and most of 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
  • 48,497
  • 6
  • 83
  • 110
  • authorship disclosure please :p – MichaelChirico Jan 06 '16 at 04:35
  • @MichaelChirico, are you referring to the code with `plot` and `points`? If so, who do you think deserves the authorship credit? I fully admit that I am not the first to come up with the above code, but I don't know who came up with it first or a reference, will be happy to include them if you can point it out. Or do you want me to admit that I am the author of `my.symbols` and the TeachingDemos package? – Greg Snow Jan 06 '16 at 19:07
2

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
  • 92,590
  • 12
  • 140
  • 224
1

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
  • 18,510
  • 6
  • 49
  • 72