Re: symsize in data units [message #66292] |
Mon, 04 May 2009 19:29 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On May 4, 5:31 pm, pyoac...@gmail.com wrote:
> > I think it's impossible to do with PSYM or SYMSIZE.
>
>
>
>> On the other hand, it's simple enough to write a small procedure that
>> OPLOT's what you want, in the units you want. For example, a circle
>> could be done like this,
>
>> pro plot_circle, xcent, ycent, symsize=radius, _EXTRA=extra
>> th = 2*!dpi/100*dindgen(101)
>> if n_elements(radius) EQ 0 then r = 1 else r = radius(0)
>> x = r*cos(th) & y = r*sin(th)
>> for i = 0, n_elements(xcent)-1 do $
>> oplot, xcent(i)+x, ycent(i)+y, _EXTRA=extra
>> end
>
>> Then you can call PLOT_CIRCLE, x, y, symsize=4.5
>
> Thanks Craig, that works great. I replaced your oplot with a polyfill
> so I could get solid points. I was also surprised that I can get this
> to make smaller postscript files than using the plotsym procedure. I
> thought for sure your routine would make giant output.
Heh, if you want a bigger postscript file, you could change the 100
above to 1000 :-)
It's strange you say PLOTSYM makes bigger files, since it seems to use
only 50 points instead of 100 to construct a circle.
Craig
|
|
|
Re: symsize in data units [message #66297 is a reply to message #66292] |
Mon, 04 May 2009 14:31  |
pyoachim
Messages: 2 Registered: January 2009
|
Junior Member |
|
|
> I think it's impossible to do with PSYM or SYMSIZE.
>
> On the other hand, it's simple enough to write a small procedure that
> OPLOT's what you want, in the units you want. For example, a circle
> could be done like this,
>
> pro plot_circle, xcent, ycent, symsize=radius, _EXTRA=extra
> th = 2*!dpi/100*dindgen(101)
> if n_elements(radius) EQ 0 then r = 1 else r = radius(0)
> x = r*cos(th) & y = r*sin(th)
> for i = 0, n_elements(xcent)-1 do $
> oplot, xcent(i)+x, ycent(i)+y, _EXTRA=extra
> end
>
> Then you can call PLOT_CIRCLE, x, y, symsize=4.5
Thanks Craig, that works great. I replaced your oplot with a polyfill
so I could get solid points. I was also surprised that I can get this
to make smaller postscript files than using the plotsym procedure. I
thought for sure your routine would make giant output.
|
|
|
Re: symsize in data units [message #66307 is a reply to message #66297] |
Sun, 03 May 2009 18:21  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On May 1, 5:42 pm, ianpaul.free...@gmail.com wrote:
> Does anyone know a way to set the plotting symbol size in terms of
> data units? In particular, I'd like to make the plotting symbol a
> circle with diameter 4.3 data units. Then I'd like to do it both on-
> screen and output to postscript.
I think it's impossible to do with PSYM or SYMSIZE.
On the other hand, it's simple enough to write a small procedure that
OPLOT's what you want, in the units you want. For example, a circle
could be done like this,
pro plot_circle, xcent, ycent, symsize=radius, _EXTRA=extra
th = 2*!dpi/100*dindgen(101)
if n_elements(radius) EQ 0 then r = 1 else r = radius(0)
x = r*cos(th) & y = r*sin(th)
for i = 0, n_elements(xcent)-1 do $
oplot, xcent(i)+x, ycent(i)+y, _EXTRA=extra
end
Then you can call PLOT_CIRCLE, x, y, symsize=4.5
|
|
|