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

Home » Public Forums » archive » legend() with symbols
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
legend() with symbols [message #88767] Tue, 17 June 2014 09:33 Go to next message
Gordon Farquharson is currently offline  Gordon Farquharson
Messages: 48
Registered: December 2010
Member
Hi All

Is there any way to change the behaviour of legend() when using symbols in a plot? For example, the following code produces a legend, but the legend text is preceded by three '+' symbols, instead of the more traditional single '+'. While the output is not incorrect, it does look a little odd.

lp1 = plot(findgen(10), NAME='Test', LINESTYLE='None', SYMBOL='+')
lg1 = legend(TARGET=lp1, POSITION=[0.1,0.9], HORIZONTAL_ALIGNMENT='LEFT', $
/RELATIVE)

Gordon
Re: legend() with symbols [message #88768 is a reply to message #88767] Tue, 17 June 2014 09:58 Go to previous messageGo to next message
Starbuck is currently offline  Starbuck
Messages: 11
Registered: June 2012
Junior Member
On Tuesday, June 17, 2014 10:33:41 AM UTC-6, Gordon Farquharson wrote:
> Hi All
>
>
>
> Is there any way to change the behaviour of legend() when using symbols in a plot? For example, the following code produces a legend, but the legend text is preceded by three '+' symbols, instead of the more traditional single '+'. While the output is not incorrect, it does look a little odd.
>
>
>
> lp1 = plot(findgen(10), NAME='Test', LINESTYLE='None', SYMBOL='+')
>
> lg1 = legend(TARGET=lp1, POSITION=[0.1,0.9], HORIZONTAL_ALIGNMENT='LEFT', $
>
> /RELATIVE)
>
>
>
> Gordon

I don't think there is a way to do this by default. I wrote the following blog post that provides a possible workaround:

http://www.exelisvis.com/Company/PressRoom/Blogs/IDLDataPoin tDetail/TabId/902/ArtMID/2926/ArticleID/13952/Customizing-Mo use-Handler-for-IDL-8-Graphics-Windows.aspx
Re: legend() with symbols [message #88769 is a reply to message #88768] Tue, 17 June 2014 10:11 Go to previous messageGo to next message
Gordon Farquharson is currently offline  Gordon Farquharson
Messages: 48
Registered: December 2010
Member
On Tuesday, June 17, 2014 9:58:38 AM UTC-7, Starbuck wrote:
> I don't think there is a way to do this by default. I wrote the following blog post that provides a possible workaround:
>
> http://www.exelisvis.com/Company/PressRoom/Blogs/IDLDataPoin tDetail/TabId/902/ArtMID/2926/ArticleID/13952/Customizing-Mo use-Handler-for-IDL-8-Graphics-Windows.aspx

Thanks very much! Very helpful.

Gordon
Re: legend() with symbols [message #91988 is a reply to message #88769] Thu, 24 September 2015 15:03 Go to previous messageGo to next message
laura.hike is currently offline  laura.hike
Messages: 87
Registered: September 2013
Member
This may be an instance that no one thought of, but what if I want to make a legend for a plot that contains both lines ("plot" function) and filled circles ("scatterplot" function, although I'd be happy if it worked with "symbol" instead)? If you use the sample_width=0 workaround to get just one filled circle in the legend, no lines show up.

Thanks in advance,

Laura
Re: legend() with symbols [message #91989 is a reply to message #91988] Fri, 25 September 2015 01:32 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le vendredi 25 septembre 2015 00:03:16 UTC+2, laura...@gmail.com a écrit :
> This may be an instance that no one thought of, but what if I want to make a legend for a plot that contains both lines ("plot" function) and filled circles ("scatterplot" function, although I'd be happy if it worked with "symbol" instead)? If you use the sample_width=0 workaround to get just one filled circle in the legend, no lines show up.
>
> Thanks in advance,
>
> Laura

I guess that this code:
pl = plot(/TEST)
pl.getdata, x, y
pl1 = scatterplot(x,y,/OVER)
l = legend(TARGET=[pl,pl1])
is doing what you want.
alx.
Re: legend() with symbols [message #91990 is a reply to message #91988] Fri, 25 September 2015 01:35 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le vendredi 25 septembre 2015 00:03:16 UTC+2, laura...@gmail.com a écrit :
> This may be an instance that no one thought of, but what if I want to make a legend for a plot that contains both lines ("plot" function) and filled circles ("scatterplot" function, although I'd be happy if it worked with "symbol" instead)? If you use the sample_width=0 workaround to get just one filled circle in the legend, no lines show up.
>
> Thanks in advance,
>
> Laura


I guess that this code:
pl = plot(/TEST)
pl.getdata, x, y
pl1 = scatterplot(x,y,/OVER, /SYM_FILLED)
l = legend(TARGET=[pl,pl1])
is doing what you want.
alx.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: HISTOGRAM
Next Topic: MONTHS IN PLOT

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

Current Time: Wed Oct 08 15:13:25 PDT 2025

Total time taken to generate the page: 0.00457 seconds