comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Adding straight lines to a plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Adding straight lines to a plot [message #73557 is a reply to message #73472] Fri, 12 November 2010 06:32 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
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
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL_IDLBridge limited to 4?
Next Topic: Adding straight lines to a plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:33:00 PDT 2025

Total time taken to generate the page: 0.24126 seconds