X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 28 Jul 2009 11:08 AM by  anon
Secondary axis in iPlot
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
28 Jul 2009 11:08 AM
    Is there a way to add a secondary y-axis in iPlot, and if so can I do it programmatically?  Ideally when I use overplot in the call to iPlot, Id like to give that second dataset its own axis. Any Suggestions? Thanks, Matt

    Deleted User



    New Member


    Posts:
    New Member


    --
    31 Jul 2009 02:44 AM
    Hi, I can propose you the following code as an example :    x = 2*!PI*INDGEN(100)/99.    dataset1 = SIN(x)    dataset2 = 5*COS(x)     ; First plot         IPLOT, dataset1, YTITLE = 'Sin(x)'       IdTool = IGETCURRENT(TOOL = oTool)  ; 2nd plot with its own data space (so its own axes)      oCreate = oTool->GetService("CREATE_VISUALIZATION")           oDesc = oTool->GetVisualization("DATA SPACE")     oCommand = oCreate->_Create(oDesc, USER_INTERFACE = 'None')      IPLOT, dataset2, /OVERPLOT, YTITLE = '5 x cos(x)', COLOR = [255,0,0] ; here, a way to hide several axes of the new data space    oWindow    = oTool->GetCurrentWindow()    oView      = oWindow->GetCurrentView()    oLayer     = oView->GetCurrentLayer()    oDataspace = oLayer->GetCurrentDataSpace()           oAxes = oDataspace->GetAxes()       oAxes[2]->SetProperty, /HIDE    oAxes[3]->SetProperty,  NOTEXT = 0, TEXT_COLOR = [255,0,0]       oTool->CommitActions   I hope that it may solve your problem. Patrice.

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Oct 2010 05:12 PM
    Thanks Patrice - this works great. One change I had to make was to hide oAxes[3] on the first plot, prior to creating the second plot. Otherwise I get both sets of the ticks on Axis 3. other interested users see below: ; Create first plot iplot, flux_data[1,*], color=[0,255,0], thick=4.0, ytitle="Flux Data", /insert_legend, $ name = "GPP", view_title=string(site_ids[i]), /NO_SAVEPROMPT ; Hide oAxis 3 on first plot IdTool = IGETCURRENT(TOOL = oTool) oWindow = oTool->GetCurrentWindow() oView = oWindow->GetCurrentView() oLayer = oView->GetCurrentLayer() oDataspace = oLayer->GetCurrentDataSpace() oAxes = oDataspace->GetAxes() oAxes[3]->SetProperty, /HIDE oAxes[2]->SetProperty, NOTEXT = 0, TEXT_COLOR = [0,255,0] oTool->CommitActions ; 2nd plot with its own data space (so its own axes) oCreate = oTool->GetService("CREATE_VISUALIZATION") oDesc = oTool->GetVisualization("DATA SPACE") oCommand = oCreate->_Create(oDesc, USER_INTERFACE = 'None') iplot, vod_data, color=[0,0,0], thick=4.0, /overplot, Ytitle="VOD", /insert_legend, name = "VOD 10GHz", /NO_SAVEPROMPT ;linestyle=2, ; hide oAxes[2] of the new data space oWindow = oTool->GetCurrentWindow() oView = oWindow->GetCurrentView() oLayer = oView->GetCurrentLayer() oDataspace = oLayer->GetCurrentDataSpace() oAxes = oDataspace->GetAxes() oAxes[2]->SetProperty, /HIDE oAxes[3]->SetProperty, NOTEXT = 0;, TEXT_COLOR = [0,0,0] oTool->CommitActions
    You are not authorized to post a reply.