Pro PlotObj, x, y, $ Window=Window, Model=Model, $ Plot_Line=Plot_Line, View=View, $ Left_Yaxis=Left_Yaxis, Right_Yaxis=Right_Yaxis, $ Bottom_Xaxis=Bottom_Xaxis, Top_Xaxis=Top_Xaxis ; Create a view that matches the data ranges with ; additional room for the x and y axis Max_x=Max(x,Min=Min_x) Max_y=Max(y,Min=Min_y) XRange=Max_x-Min_x YRange=Max_y-Min_y Pad_x=XRange*.25 Pad_y=YRange*.25 View = Obj_New('IDLgrView', Viewplane_Rect=$ [Min_x-Pad_x,Min_y-Pad_y, $ XRange+2.0*Pad_x, YRange+2.0*Pad_y], $ Color=[0,0,0]) ; Create a model Model = Obj_New('IDLgrModel') ; Create a plot line object using the passed X and Y variables Plot_Line = Obj_New('IDLgrPlot', x, y, Color=[255,255,255]) ; Add the plot line to the model Model -> Add, Plot_Line ; Create a Window Window = Obj_New('IDLgrWindow',Retain=2) ; Create a top and bottom X axis and place it in the ; model XTickLen = 0.02 * (Max_y - Min_y) Bottom_XAxis = Obj_New('IDLgrAxis',0,loc=[Min_x,Min_y], $ Range=[Min_x,Max_x],$ Color=[255,255,255],$ TickLen=XTickLen);,/Extend) Top_XAxis = Obj_New('IDLgrAxis',0,loc=[Max_x,Max_y], $ Range=[Min_x,Max_x],$ Color=[255,255,255],$ TickLen=XTickLen, $ TickDir=1,/NoText);,/Extend) Model->Add,Bottom_Xaxis Model->Add,Top_Xaxis ; Create a left and right Y axis and place it in the ; model YTickLen = 0.02 * (Max_x - Min_x) Left_Yaxis = Obj_New('IDLgrAxis',1,loc=[Min_x,Min_y], $ Range=[Min_y,Max_y],$ Color=[255,255,255],$ TickLen=YTickLen);,/Extend ) Right_Yaxis = Obj_New('IDLgrAxis',1,loc=[Max_x,Max_y], $ Range=[Min_y,Max_y],$ Color=[255,255,255],$ TickLen=YTickLen, $ TickDir=1,/NoText);,/Extend) Model->Add,Left_Yaxis Model->Add,Right_Yaxis ;Add the model to the view object. View -> Add, Model ;Render the contents of the view in the window. Window -> Draw, View end