Legend object without border [message #91944] |
Mon, 21 September 2015 16:48  |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Can anyone tell me how to produce a legend without a border using object graphics? I don't see any option, keyword, etc., to control this.
Interestingly, on the man page, there are two examples. One legend has a border and the other does not, but I don't see any reason for this difference:
leg = LEGEND(TARGET=[plot1,plot2], POSITION=[185,0.9], $
/DATA, /AUTO_TEXT_COLOR)
versus
leg = LEGEND(SAMPLE_MAGNITUDE=10, UNITS='$m s^{-1}$', $
POSITION=m.MapForward(-45,61), /DATA, $
VERTICAL_ALIGNMENT='bottom')
As I try to learn new commands and techniques, I'm finding so many oddities or places with poor functionality in IDL that I think it might be time to switch to Python.....
|
|
|
Re: Legend object without border [message #91947 is a reply to message #91944] |
Mon, 21 September 2015 20:05   |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Monday, September 21, 2015 at 7:48:12 PM UTC-4, laura...@gmail.com wrote:
> Can anyone tell me how to produce a legend without a border using object graphics? I don't see any option, keyword, etc., to control this.
One kluge is to set shadow = 0 and color = 'w' (so that the box becomes the same color as the background, and thus invisible).
leg = LEGEND(TARGET=[plot1,plot2], POSITION=[185,0.9], $
/DATA, /AUTO_TEXT_COLOR, SHADOW=0, COLOR='w')
>
> Interestingly, on the man page, there are two examples. One legend has a border and the other does not, but I don't see any reason for this difference:
I suspect there are different defaults for a vector plot and for a line plot.
--Wayne
>
|
|
|
Re: Legend object without border [message #91953 is a reply to message #91944] |
Tue, 22 September 2015 08:29   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
On 09/21/15 19:48, laura.hike@gmail.com wrote:
> Can anyone tell me how to produce a legend without a border using
> object graphics? I don't see any option, keyword, etc., to control
> this.
LINESTYLE=' ' or LINESTYLE='none'
*and*
SHADOW=0
> As I try to learn new commands and techniques, I'm finding so many
> oddities or places with poor functionality in IDL that I think it might
> be time to switch to Python.....
Well, I wouldn't call it poor functionality. Maybe non-intuitive. And
sometimes annoyingly redundant - like your case where it takes two
keywords to do one thing. In my case, setting axes gridlines via TWO
keywords, [XYZ]GRIDSTYLE and [XYZ]TICKLEN, still makes me knock my
forehead on my desk. Grrr argghh! :o)
A portion of the FG interface also suffers from a mish-mash of the old
DG way of doing things. E.g. some FG options for alignment are DG-like
ALIGNMENT=0.5 and VERTICAL_ALIGNMENT=1.0
(where ALIGNMENT == horizontal alignment) and others are more FG-like
(e.g. text-based and slightly more meaningful keywords),
HORIZONTAL_ALIGNMENT='center' and VERTICAL_ALIGNMENT='top'
In the grand scheme of (what I am sure is) an enormous code base these
sorts of things are probably considered trivial in the "fix-it" column.
I remember them because I abhor special cases (more stuff to have to
remember).
Having groused about IDL, I do know if you switch to something else
(python, matlab, ruby, DSL-du-jour) you'll simply be switching one set
of idiosyncrasies for another.
Also, I've found deep slow breaths and couple two three "Om mani padme
hum"'s helps as well. (ha ha)
cheers,
paulv
|
|
|
Re: Legend object without border [message #91956 is a reply to message #91953] |
Tue, 22 September 2015 19:55   |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Both of the suggested techniques work in the sense that you don't see a border when they are used, however, they don't accomplish my goal. The problem I have is that the legend overlaps some of my plotted lines, but wouldn't if there wasn't an actual box (with or without a border). When I use either of these techniques, the white corner of the legend box still overlaps the lines, causing a gap. I tried overplotting the lines again, but the box will not be overwritten, so I'm still at a loss. Is there no way to make the legend without creating a box at all?
I think a large portion of my frustration with IDL is that the documentation is poor. When I try something new, I look at the appropriate Exelis web page, but so many details aren't covered, like why there is a legend outline in one exaple but not the other. And yes, things often aren't intuitive. For example, on the page describing "legend," it does say that "linestyle" is a valid property, but I assumed that this would modify the lines in the legend, not the _outline_ of the legend.
I switched to object graphics because I liked the way I could manipulate them until I get what I want and because there are more built-in functions than for the old graphic routines, but a lot of things are turning out to be difficult. (I used a user-written routine called "legend" previously -- I think it originated at MIT? -- and it seemed more intuitive and included many options.)
|
|
|
Re: Legend object without border [message #91959 is a reply to message #91956] |
Wed, 23 September 2015 07:49   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hello again,
On 09/22/15 22:55, laura.hike@gmail.com wrote:
> Both of the suggested techniques work in the sense that you don't see
> a border when they are used, however, they don't accomplish my goal.
> The problem I have is that the legend overlaps some of my plotted
> lines, but wouldn't if there wasn't an actual box (with or without a
> border). When I use either of these techniques, the white corner of
> the legend box still overlaps the lines, causing a gap. I tried
> overplotting the lines again, but the box will not be overwritten, so
> I'm still at a loss. Is there no way to make the legend without
> creating a box at all?
Ohhhh.... I see.
Well, then, as alx stated, the TRANSPARENCY keyword (set to 100%
transparency) is what you want.
(I also tested the legend ORDER method with /SEND_TO_BACK but that
didn't do what you wanted.)
> I think a large portion of my frustration with IDL is that the
> documentation is poor. When I try something new, I look at the
> appropriate Exelis web page, but so many details aren't covered, like
> why there is a legend outline in one exaple but not the other. And
> yes, things often aren't intuitive. For example, on the page
> describing "legend," it does say that "linestyle" is a valid
> property, but I assumed that this would modify the lines in the
> legend, not the _outline_ of the legend.
I think your question highlighted one of the difficulties of writing
documentation. Stating things clearly is quite hard. I certainly
misunderstood.
With regards to the IDL docs, I think they suffer from not enough
cross-referencing and too few examples. Especially for the more esoteric
uses of FG.
I find myself visiting David Fannings Graphics Gallery
(http://www.idlcoyote.com/gallery) quite often to see if what I want to
do can actually be done (in DG or FG). That gives me the fortitude to
soldier on (and, in some cases, the actual FG code where he has dual DG
and FG examples!).
> I switched to object graphics because I liked the way I could
> manipulate them until I get what I want and because there are more
> built-in functions than for the old graphic routines, but a lot of
> things are turning out to be difficult. (I used a user-written
> routine called "legend" previously -- I think it originated at MIT?
> -- and it seemed more intuitive and included many options.)
No argument here. It's a learning process. An archival search of this
newsgroup will reveal a lot of grousing from me about object graphics
when they first arrived (pre-Function Graphics). I suspect RSI (back in
the day) softened us users up with iTools and Insight and LIVE Tools
(cripes - remember Insight? And LIVE? Argh!). After all that, Object and
Function graphics was the proverbial manna from on high. (ha ha)
But, similar to alx, I have found the capabilities of FG over DG
*vastly* outweigh the frustrations[*]. In my case I had to learn to stop
thinking the DG-way and shift to thinking FG. Of course, it would've
been nice if that process was less orthogonal. :o\
cheers,
paulv
[*] At least until I have to start plotting millions of data points
again...then, unless OG/FG speed has increased several orders of
magnitude in the last few releases, I'll probably have to use DG again.
(insert sad trombone music here)
|
|
|
|
Re: Legend object without border [message #91964 is a reply to message #91962] |
Wed, 23 September 2015 12:47  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Wednesday, September 23, 2015 at 11:55:26 AM UTC-7, laura...@gmail.com wrote:
> It is definitely difficult when the documentation only provides an example. In most cases, there is something I want that isn't shown.
There is one additional source for examples, besides those given with each function, at
http://www.exelisvis.com/docs/visualize.html
I agree it can be difficult to figure out how to do some things from the documentation. As Paul said, it is very difficult to write documentation showing clearly all the possibilities. I find this particularly difficult with visualization, because there are so many different things the users might want to do. It is both hard to imagine all the possibilities, and work-intensive to write examples covering all of them.
Which is why I think this newsgroup is a very positive aspect of IDL. There are a lot of very experienced users and even IDL developers here, and a lot of questions get answered quickly.
|
|
|