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

Home » Public Forums » archive » extra ticks on log axes
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
extra ticks on log axes [message #29516] Fri, 22 February 2002 13:16
Kevin A. Park is currently offline  Kevin A. Park
Messages: 3
Registered: November 2001
Junior Member
Hi everybody,

I'm responsible for tending to an IDL application that uses object
graphics to make lineplots. I'm running it under IDL 5.4. The
application includes a dialog to set the axes ranges so that only the
desired portion of the plots and axes is displayed. I use the /EXACT
flag when setting the properties of the axes in order to tell IDL to
strictly obey the axis range that I specify. I let IDL pick the number
of major and minor ticks to display, and where these ticks should be
placed. (I.E. the MAJOR flag is not set, the MINOR flag is set to -1,
and TICKVALUES is not set.)

However, when an axis has been set to be logarithmic with the /LOG
flag, IDL sometimes draws a major tick that is outside of the axis range
that I specify. This behavior can even occur when the specified axis
range runs over several decades. I have included a demo program at the
bottom of this message (heavily based on David Fanning's Xplot program)
which illustrates the bad behavior.

Is this behavior a bug in IDL or is there something that I am doing
wrong? Thanks...

Kevin Park

--

Kevin A. Park
Prism Computational Sciences, Inc.
16 N. Carroll St., Suite 950
Madison, WI 53703
Phone: (608) 287-1042
Fax: (608) 280-9390
mailto:kpark@prism-cs.com

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

; logticks_demo.pro
;
; by Kevin A. Park
;
; Based on David Fanning's Xplot program.
;
;----------------------------------------------------------- --------
PRO XPlot_Exit, event
Widget_Control, event.top, /Destroy
END
;----------------------------------------------------------- --------
PRO Xplot_Cleanup, id
Widget_Control, id, Get_UValue=info
IF N_Elements(info) NE 0 THEN Obj_Destroy, info.thisContainer
END
;----------------------------------------------------------- ----------
PRO XPlot_Draw_Widget_Events, event
Widget_Control, event.top, Get_UValue=info, /No_Copy
info.thisWindow->Draw, info.plotView
Widget_Control, event.top, Set_UValue=info, /No_Copy
END
;----------------------------------------------------------- -------------
PRO XPlot_Resize_Events, event
Widget_Control, event.top, Get_UValue=info, /No_Copy
info.thisWindow->SetProperty, Dimension=[event.x, event.y]
info.thisWindow->Draw, info.plotView
Widget_Control, event.top, Set_UValue=info, /No_Copy
END
;----------------------------------------------------------- -------------
PRO logticks_demo, Group_Leader=group

xdatarange = [0.00052316598, 0.073974366]
ydatarange = [0.0026925600 , 4.7218197e+22]

xdatamin = xdatarange[0]
ydatamin=ydatarange[0]

xAxis1 = Obj_New("IDLgrAxis", 0)
yAxis1 = Obj_New("IDLgrAxis", 1)


plotModel = Obj_New('IDLgrModel')
plotModel->Add, xAxis1
plotModel->Add, yAxis1

plotView=obj_new('IDLgrview', PROJECTION=1,
VIEWPLANE_RECT=[-0.5,-0.5,2.0,2.0])
plotView->Add, plotModel

xmin=xdatamin
ymin=ALOG10(ydatamin)

xAxis1->SetProperty, MINOR=-1, LOCATION=[0,ymin,0], /EXACT,
RANGE=xdatarange
yAxis1->SetProperty, MINOR=-1, LOCATION=[xmin,0,0], /EXACT, /LOG,
RANGE=ydatarange

yAxis1->GetProperty, CRANGE=crange
ymin=crange[0]
ymax=crange[1]
ylength=ymax-ymin

xAxis1->GetProperty, CRANGE=crange
xmin=crange[0]
xmax=crange[1]
xlength=xmax-xmin

plotModel->Scale, 1.0/xlength, 1.0/ylength, 1.0
plotModel->Translate, -(xmin/xlength),-(ymin/ylength),0.0

xAxis1->SetProperty, TICKLEN=0.05*ylength
yAxis1->SetProperty, TICKLEN=0.05*xlength

tlb = Widget_Base(Column=1, Title='Ticks on Log Axes Example', $
TLB_Size_Events=1, MBar=menubase)

filer = Widget_Button(menubase, Value='File', /Menu)
b = Widget_Button(filer, /Separator, Value='Exit', $
Event_Pro='XPlot_Exit')

drawID = Widget_Draw(tlb, XSize=400, YSize=400, Color_Model=0, $
Graphics_Level=2, Expose_Events=1, Retain=0, $
Event_Pro='XPlot_Draw_Widget_Events')

Widget_Control, tlb, /Realize
Widget_Control, drawID, Get_Value=thisWindow

thisWindow->Draw, plotView

thisContainer = Obj_New('IDL_Container')
thisContainer->Add, thisWindow
thisContainer->Add, plotView
thisContainer->Add, xaxis1
thisContainer->Add, yaxis1

info = { thisWindow:thisWindow, $
thisContainer:thisContainer, $
plotView:plotView }

Widget_Control, tlb, Set_UValue=info, /No_Copy

XManager, 'xplot', tlb, Cleanup='XPlot_Cleanup', Group_Leader=group, $
Event_Handler='XPlot_Resize_Events', /No_Block

END
;----------------------------------------------------------- -------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: ENVI v 3.1 for Mac
Next Topic: Re: Euler formula with complex numbers

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

Current Time: Wed Oct 08 17:42:47 PDT 2025

Total time taken to generate the page: 0.00681 seconds