Two Different Y-axis for same X-axis is same plot

Help
2014-08-04
2014-08-06
  • Soumyaranjan Dash

    Hii

    I want to plot a graphics in left-y axis and x axis. In the same plot i want to add another plot which will be plotted in right-y axis and same x axis scale in the same window. I will define the range of both y-axis independently.
    How to do that ??
    I have tried

    t=findgen(5000)
    a=sin(t)
    a2=cos(t)
    window,2
    set_plot,' ps'
    plot,t,a,ytitle='Yasis-1'
    axis,yaxis=1,ytitle='Y-axis-2',yrange=[0,0.00002] ;/save
    oplot,2,color=20

    But this is not working.
    save is not working.
    plotting is not there for right-y.
    right-y axis is there but ranges are overlapped. Two scales are plotted in right-Y axis.
    How to fix that ?
    Please helpp...

     
  • Alain C.

    Alain C. - 2014-08-06

    After checking in the CVS, the /save keyword for AXIS is already available, but in the CVS version.

    GDL> #axis
    Internal PROCEDURE : AXIS,[3 Args],CHARSIZE,CHARTHICK,COLOR,DATA,DEVICE,FONT,NODATA,NOERASE,NORMAL,SUBTITLE,T3D,TICKLEN,SAVE,XAXIS,YAXIS,XLOG,YLOG,XTYPE,YTYPE,YNOZERO,THICK,XCHARSIZE,YCHARSIZE,XGRIDSTYLE,YGRIDSTYLE,XMARGIN,YMARGIN,XMINOR,YMINOR,XRANGE,YRANGE,XSTYLE,YSTYLE,XTHICK,YTHICK,XTICK_GET,YTICK_GET,XTICKFORMAT,YTICKFORMAT,XTICKINTERVAL,YTICKINTERVAL,XTICKLAYOUT,YTICKLAYOUT,XTICKLEN,YTICKLEN,XTICKNAME,YTICKNAME,XTICKS,YTICKS,XTICKUNITS,YTICKUNITS,XTICKV,YTICKV,XTITLE,YTITLE,ZAXIS,ZLOG,ZVALUE,ZCHARSIZE,ZGRIDSTYLE,ZMARGIN,ZMINOR,ZRANGE,ZSTYLE,ZTHICK,ZTICK_GET,ZTICKFORMAT,ZTICKINTERVAL,ZTICKLAYOUT,ZTICKLEN,ZTICKNAME,ZTICKS,ZTICKUNITS,ZTICKV,ZTITLE

    but I tested you code
    t=findgen(5000)
    a=sin(t)
    a2=cos(t)
    plot,t,a,ytitle='Yasis-1', xmargin=[10,10]
    axis,yaxis=1,ytitle='Y-axis-2',yrange=[0,0.00002],/save
    oplot,a2,color=20

    and:
    1/ yes AXIS working
    2/ yes /SAVE working
    3/ yes !Y modified as expected
    4/ but I see we have a trouble with the way the top range of right axis is plotted
    (ok if range is, e.g., yrange=[0,0.002] or yrange=[0,0.2] but not for 2e-5 :(

     

Log in to post a comment.