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

Home » Public Forums » archive » IDLgrPLOT and log
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
IDLgrPLOT and log [message #10614] Tue, 06 January 1998 00:00 Go to next message
Bernard Puc is currently offline  Bernard Puc
Messages: 65
Registered: January 1998
Member
Hello,
Can somebody show me an example of plotting on a log/log scale using
ObjectGraphics? I'm trying to learn Object Graphics and I can't seem to
get log plots. Any help appreciated. Thanks.

-Bernard Puc
Re: IDLgrPlot [message #17587 is a reply to message #10614] Tue, 02 November 1999 00:00 Go to previous message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
David,

Try the following. I realized that I had no NANs in the X-vector, that's
why I never saw the warning message you get. However, that warning
message does not stop you from obtaining the right object, just annoys
you. In the example below, you can generate the data with or without
NANs in the X-vector. You get the plot regardless. And, as long as you
have NANs in Y, you will have 0 in data[0,*].

********************
pro test, x, y, win=win, x_finite=x_finite

; Init the data if not passed.
if n_elements(x) eq 0 then begin
y=findgen(100)+1
y[(indgen(20)+10)*2]=!values.f_nan
if keyword_set(x_finite) then x=findgen(100)+1 else x=y
endif

if size(win, /type) eq 11 then begin
if obj_class(win) ne 'IDLGRWINDOW' then goto, init_win
endif else begin
init_win:
win = obj_new('IDLgrWindow')
endelse

x_min = min(x, max=x_max, /nan) & y_min = min(y, max=y_max, /nan)
x_range = [x_min, x_max] & y_range = [y_min, y_max]
; Normalize plot range.
n_xr = normalize(x_range)
n_yr = normalize(y_range)
Plots_symbol = obj_new('IDLgrSymbol', 2, size=[0.006/n_xr[1],
0.008/n_yr[1]], $
color=[0, 0, 200])
Plots_lines = obj_new('IDLgrPlot', x, y, color=[0, 0, 0],
symbol=Plots_symbol, linestyle=6, $
xcoord_conv=n_xr, ycoord_conv=n_yr, xrange=x_range, yrange=y_range)
x_axis = obj_new('IDLgrAxis', 0, ticklen=0.03, name='X_AXIS',
location=[1000, 0, 0], /exact)
y_axis = obj_new('IDLgrAxis', 1, ticklen=0.03, name='Y_AXIS',
location=[0, 1000, 0], /exact)
X_axis -> setProperty, range=x_range, xcoord_conv=n_xr
Y_axis -> setProperty, range=y_range, ycoord_conv=n_yr
Plots_model = obj_new('IDLgrModel')
Plots_view = obj_new('IDLgrView', viewplane_rect=[-0.1, -0.1, 1.12,
1.16], location=[0.0, 0.0])
Plots_model -> add, Plots_lines
Plots_model -> add, x_axis
Plots_model -> add, y_axis
Plots_view -> add, Plots_model
Container = obj_new('IDL_Container')
Container -> add, Plots_view
Container -> add, Plots_model
Container -> add, Plots_symbol

Plots_lines -> getProperty, data=data
print, 'Min of X from IDLgrPlot equals', min(data[0, *], /nan)
print, 'While in the real data it equals', min(x, /nan)

win -> draw, Plots_view

obj_destroy, Container

end

**********************

Cheers,
Pavel

David Fanning wrote:

> I can't seem to get a vector with a NAN into IDLgrPlot.
> How did you do it?
>
> IDL> a=findgen(11)
> IDL> a[5] = !Values.F_Nan
> IDL> b=findgen(11)
> IDL> ploter = Obj_New("idlgrplot", a, b)
> IDL> ploter = Obj_New("idlgrplot", a, b)
> % Program caused arithmetic error: Floating illegal operand
Re: IDLgrPlot [message #17601 is a reply to message #10614] Mon, 01 November 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel Romashkin (promashkin@cmdl.noaa.gov) writes:

> I placed the X and Y vectors into IDLgrPlot. Vectors contain NANs.

I can't seem to get a vector with a NAN into IDLgrPlot.
How did you do it?

IDL> a=findgen(11)
IDL> a[5] = !Values.F_Nan
IDL> b=findgen(11)
IDL> ploter = Obj_New("idlgrplot", a, b)
IDL> ploter = Obj_New("idlgrplot", a, b)
% Program caused arithmetic error: Floating illegal operand

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Prevent color flashing
Next Topic: Re: Prevent color flashing

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

Current Time: Wed Oct 08 14:56:30 PDT 2025

Total time taken to generate the page: 0.00557 seconds