X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 10 Mar 2014 04:30 AM by  anon
PLOT object - can't overplot in multigraphics after changing current index
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
10 Mar 2014 04:30 AM
    HiI have a question regarding PLOT object, specifically the OVERPLOT keyword and how to use it when having mutliple graphics, i.e using INDEX keyword. I want to plot a 2 by 3 2D-plot graphics with three graphs for each plot.The values are collected from an external file and I currently retrieve the data in such a way that I would like to plot one graph in each plot index position before moving on to the next set of six graphs and so forth. The first six graphs are plotted in their specific position using INDEX(2,3,i). This is where it gets tricky. If I want to do an OVERPLOT on the already existing plots I can't use the INDEX since OVERPLOT overrides this keyword. This mean that the plotting will always occur in the "current" index position, in this case INDEX(2,3,6).Is there a way to get around this, by selecting an active index in another way and then plot. I solved this issue in another way (less generic way) so I don't have a code example. But the question kept bugging me so I thought I ask here for input.Best regardsMikael

    Berangere Casson



    New Member


    Posts:61
    New Member


    --
    10 Mar 2014 05:34 AM
    Perhaps the following code example could help you. It uses new graphics in IDL 8.x. sinewave = SIN(2.0*FINDGEN(200)*!PI/25.0)*EXP(-0.02*FINDGEN(200)) cosine = COS(2.0*FINDGEN(200)*!PI/25.0)*EXP(-0.02*FINDGEN(200)) ; create 3 plots myPlot = PLOT(sinewave, '-r',$ POSITION=[.05,.55,.40,.95]) myPlotToo = PLOT(cosine, '-b',$ /CURRENT, POSITION=[.25,.05,.65,.45]) myThirdPlot = PLOT(sinewave, '-r',$ /CURRENT, POSITION=[.50,.55,.90,.95]) ; Overplot a graphic onto the first plot. aPlot = PLOT(cosine, '-b', OVERPLOT=myPlot, TITLE='Combined plots')

    Deleted User



    New Member


    Posts:
    New Member


    --
    10 Mar 2014 05:55 AM
    Thanks for your reply. It could work. But it would make the code less generic. The number of plots that I want is not necessarily 2x3 and I would like to have a general routine for it. And it is so convinent to use the INDEX keyword. ;)

    Deleted User



    New Member


    Posts:
    New Member


    --
    11 Mar 2014 01:45 AM
    Solved the problem by using object array. Pasting the plotting section of my code. Not necessarily the best solution but it works for me. oPlotArr = OBJARR(num_param*num_ang*num_mat) graphProps = {props, color:'blue', linestyle:'dashed', symbol:'triangle', thick:2} PropsArr = REPLICATE({props}, num_mat) PropsArr[0] = {color:'blue', linestyle:'dashed', symbol:'triangle', thick:2} PropsArr[1] = {color:'green', linestyle:'solid_line', symbol:'plus', thick:2} PropsArr[2] = {color:'red', linestyle:'dash dot', symbol:'X', thick:2} Yaxislabel = ['Pen / Geo', 'Sc / Geo'] win = WINDOW() FOR i = 0, num_param-1 DO BEGIN FOREACH AngleEl, Angles, Angle_indx DO BEGIN CurAngleEl = WHERE(AcceptAngle EQ AngleEl) FOREACH MatEl, Materials, Mat_indx DO BEGIN CurMatEl = WHERE(Material EQ MatEl AND AcceptAngle EQ AngleEl) CurIndx = i*num_ang*num_mat+Angle_indx*num_mat+Mat_indx OverPlotIndx = i*num_ang*num_mat+Angle_indx*num_mat IF Mat_indx EQ 0 THEN BEGIN oPlotArr(CurIndx) = PLOT(PinSizes, ResMat(i, CurMatEl), $ LAYOUT = [num_ang,num_param,(i*3+Angle_indx)+1] , /CURRENT, $ _EXTRA = PropsArr(Mat_indx), TITLE = '$\alpha$: ' + STRING(AngleEl, FORMAT='(I2.2)' ), $ YTITLE = Yaxislabel[(i*3+Angle_indx)/num_ang], XTITLE= 'Pinhole Size, mm' ) ENDIF ELSE BEGIN oPlotArr(CurIndx) = PLOT(PinSizes, ResMat(i, CurMatEl), $ LAYOUT = [num_ang,num_param,(i*3+Angle_indx)+1] , OVERPLOT = oPlotArr(OverPlotIndx), $ _EXTRA = PropsArr(Mat_indx) ) ENDELSE ENDFOREACH leg = LEGEND(TARGET=[oPlotArr(CurIndx-mat_indx+1:CurIndx)] ) FOREACH legEl, Materials, leg_indx DO leg(leg_indx).label = Materials(leg_indx) ENDFOREACH ENDFOR
    You are not authorized to post a reply.