comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Adding straight lines to a plot

Re: Adding straight lines to a plot
type: item
description: On Nov 11, 8:28 pm, fgg <fabioguimaraesgoncal...@gmail.com> wrote: > Hi, > > Is there a function in IDL to add a straight line through an existing > plot? Something like the 'abline' function in R, where all you need is > to specify the y-value for a horizontal line (or the x-value for a > vertical line). > > Thanks The easiest way is to overplot a line. That is, overplot two 2-element arrays, one with the initial and final x, the other with the initial and final y.
creator: penteado
date: 2010-11-11T22:38:26-00:00

Re: Adding straight lines to a plot
type: item
description: fgg writes: > > Is there a function in IDL to add a straight line through an existing > plot? Something like the 'abline' function in R, where all you need is > to specify the y-value for a horizontal line (or the x-value for a > vertical line). Here you go. PRO ABLine, value, $ VERTICAL=vertical, $ LINESTYLE=linestyle, $ THICK=thick, $ COLOR=color IF N_Elements(color) EQ 0 THEN color = 'white' IF Keyword_Set(Vertical) THEN BEGIN PLOTS, [value, value], [!Y.CRange[0], !Y.CRange[1]], $ LINESTYLE=linestyle, THICK=thick, $ COLOR=FSC_Color(String(color)) ENDIF ELSE BEGIN PLOTS, [!X.CRange[0], !X.CRange[1]], [value, value], $ LINESTYLE=linestyle, THICK=thick, $ COLOR=FSC_Color(color) ENDELSE END Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
creator: David Fanning
date: 2010-11-11T23:02:35-00:00

Re: Adding straight lines to a plot
type: item
description: Thanks a lot!
creator: fgg
date: 2010-11-11T23:22:46-00:00

Re: Adding straight lines to a plot
type: item
description: David Fanning wrote: > fgg writes: > >> Is there a function in IDL to add a straight line through an existing >> plot? Something like the 'abline' function in R, where all you need is >> to specify the y-value for a horizontal line (or the x-value for a >> vertical line). > > Here you go. > > PRO ABLine, value, $ > VERTICAL=vertical, $ > LINESTYLE=linestyle, $ > THICK=thick, $ > COLOR=color > > IF N_Elements(color) EQ 0 THEN color = 'white' > > IF Keyword_Set(Vertical) THEN BEGIN > PLOTS, [value, value], [!Y.CRange[0], !Y.CRange[1]], $ why not simply PLOTS, [value, value], !Y.CRange, $ > LINESTYLE=linestyle, THICK=thick, $ > COLOR=FSC_Color(String(color)) > ENDIF ELSE BEGIN > PLOTS, [!X.CRange[0], !X.CRange[1]], [value, value], $ and similarly PLOTS, !X.CRange, [value, value], $ ? > LINESTYLE=linestyle, THICK=thick, $ > COLOR=FSC_Color(color) > ENDELSE > > END > > Cheers, > > David > >
creator: Paul Van Delst[1]
date: 2010-11-12T14:32:38-00:00