pro sample_idlgrplot data=findgen(100) ;create objects myplot=obj_new('IDLgrPlot',data) xaxis=obj_new('IDLgrAxis',0) yaxis=obj_new('IDLgrAxis',1) ; Retrieve the data range from the plot object and set the X and Y ; axis objects' RANGE properly so that the axes will match the data ; when displayed myplot -> GetProperty, XRANGE=xr, YRANGE=yr xaxis -> Setproperty, RANGE=xr yaxis -> SetProperty, RANGE=yr ; By default, major tickmarks are 0.2 data units in length. Since ; the data range in this example is 0 to 99, we set the tick length ; to 2% of the data range instead: xtl = 0.02 * (xr[1] - xr[0]) ytl = 0.02 * (yr[1] - yr[0]) xaxis_text=obj_new('IDLgrText','X Axis') yaxis_text=obj_new('IDLgrText','Y Axis') myfont=obj_new('IDLgrFont','times',size=8) xaxis_text->Setproperty,font=myfont yaxis_text->Setproperty,font=myfont xaxis->SetProperty,TITLE=xaxis_text yaxis->SetProperty,TITLE=yaxis_text yaxis->GetProperty, TICKTEXT=xtick_text xaxis->GetProperty, TICKTEXT=ytick_text xtick_text->SetProperty, font=myfont ytick_text->SetProperty, font=myfont mytitle=obj_new('IDLgrText','My Colorbar') ;create an object of IDLgrText class bardims=[0.5,0.5] redvalues=BINDGEN(256) greenvalues=redvalues bluevalues=reverse(redvalues) mycolorbar=obj_new('IDLgrColorbar',redvalues,greenvalues,bluevalues,$ TITLE=mytitle, DIMENSIONS=barDims,/Show_Axis,/Show_outline) ; Create model and view objects to contain the object tree, and ; a window object to display it: mymodel=Obj_new('IDLgrModel') myview=obj_new('IDLgrView') ;The IDLgrView is the size of the viewing window inside the plotting ;window ; use a viewgroup so that the heap will be cleaned up ; when the window is closed mygroup=obj_new('IDLgrViewgroup') mygroup->add,[myview,xaxis_text,yaxis_text,myfont] mywindow=obj_new('IDLgrWindow',RETAIN=2,GRAPHICS_TREE=mygroup,UNITS=1) mymodel->Add,myplot mymodel->Add,xaxis mymodel->Add,yaxis myview->Add,mymodel mymodel->Add,mycolorbar ; Use the SET_VIEW procedure to add an appropriate viewplane rectangle ; to the view object. SET_VIEW, myview, mywindow ; Now, display the plot: barplustextdims=mycolorbar->ComputeDimensions(mywindow) mymodel->Translate, -bardims[0]+(barplustextdims[0]/.5), $ -bardims[1]+(barplustextdims[1]/2.),0 mywindow -> Draw,myview data1=findgen(20)/5 myplot2=obj_new('IdlgrPlot',data1) mymodel->Add,myplot2 mywindow->draw,myview;,/draw_instance end