comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » plotting symbols
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
plotting symbols [message #8169] Wed, 12 February 1997 00:00
haskell is currently offline  haskell
Messages: 3
Registered: January 1997
Junior Member
a couple of weeks ago there was a question posted of how, if possible, to use standard characters as plotting symbols. i do not know if this is what people are looking for but here is a small subroutine that works well for me under appropriate conditions. it uses usersym and xyouts to produce the symbols. i use it on a sun system to produce plots in xwindows and postscript but have not tried it under any other conditions.

i did not write this with distribution in mind so some of my idiosyncrasies may be unpalatable for the rest of the world but i thought i would throw it out here anyway.

i call it symplot and it accepts all (i hope) of the standard arguments that plot accepts plus three additional optional ones: symbol, ssize, and space

example: symplot,x,y,title='test',yr=[0,19], ... ,symbol='m!E3!N',ssize=2,space=4

the symbol keyword specifies any string (including arrays and the 'geek codes') to be used as the plotting symbols.

sizing of the plot/symbol can be done in several ways. using the charsize keyword changes the size of titles but not the symbols, ssize changes the size of the symbols but not the titles, and using !p.charsize changes both.

space can be set to specify the spacing, in data points, of the symbols. example, curves with 1000 data points do not present well if every point is plotted with a symbol, using space allows you to put symbols on every 50th point (or whatever value you specify)

defaults are currently set for ssize=1, space=1 and symbol='*'

because it uses xyouts, it requires both an x an y array.

from this it is easy to create an osymplot to substitute for oplot.

i have not done much in the way of error checking so odds are there is an easy way to make it blow up that i have not come across yet.

it is not professional quality but it works for me. if anyone has anything better or can improve on this i would like to hear about it.

cheers,
eddie

---------------------------------------

pro symplot,x,y,symbol=symbol,ssize=ssize,space=space,_EXTRA=ext ra

if n_elements(symbol) eq 0 then symbol = '*' else symbol = string(symbol)
if n_elements(space) eq 0 then space = 1 else space = space
sz = size(reform(x))
xsteps = ceil(sz(1)/float(space))
xspace = indgen(xsteps)*space
len = max(strlen(symbol(*)))
xb = len/2.+0.5
if n_elements(ssize) ne 0 then sc = ssize else $
if !p.charsize eq 0 then sc = 1.0 else sc = !p.charsize
usersym,[-xb,-xb,xb,xb,-xb]*sc,[-.5,2.4,2.4,-.5,-.5]*sc,/fil ,co=!p.background
plot,x,y,_EXTRA=extra
oplot,x(xspace),y(xspace),psym=8
xyouts,x(xspace),y(xspace),symbol,ali=.5,charsize=sc,noclip= 0
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ps to deskjet 660Cse via ghostview/script on windows95
Next Topic: Internet IDL script

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:39:11 PDT 2025

Total time taken to generate the page: 0.00493 seconds