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

Home » Public Forums » archive » PLOTS versus POLYLINE
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
PLOTS versus POLYLINE [message #82107] Tue, 20 November 2012 11:33 Go to next message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
I have admittedly not tinkered around much yet with IDL's snazzy new graphics capabilities (map, text, polygon, etc), but was going to give it a try and convert a fairly simple program to the new format. In my example, a map is drawn, then various annotations are added, and lots of lines are added to the map (storm tracks). The tracks are in lat/lon coordinates of course, but must be treated carefully (I don't want to just throw the entire vector of coordinates at it at once). Previously, I accomplished this with PLOTS (and /CONTINUE), and looped over the points, treating them as necessary.

I can't find a function in the new graphics environment to do something similar, but am probably just missing something obvious. POLYLINE seemed like the correct avenue, but it's not cooperating.

Any guidance would be much appreciated!
Re: PLOTS versus POLYLINE [message #82161 is a reply to message #82107] Wed, 21 November 2012 11:38 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> You can see the comparisons here:
>
> http://www.idlcoyote.com/cg_tips/conpcont.php

Whoops! Try this instead:

http://www.idlcoyote.com/cg_tips/compcont.php

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: PLOTS versus POLYLINE [message #82162 is a reply to message #82107] Wed, 21 November 2012 11:37 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 11/21/12 12:19 PM, David Fanning wrote:
> You can see the comparisons here:
>
> http://www.idlcoyote.com/cg_tips/conpcont.php

I think that URL should be:

http://www.idlcoyote.com/cg_tips/compcont.php

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
Re: PLOTS versus POLYLINE [message #82163 is a reply to message #82107] Wed, 21 November 2012 11:19 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Brian McNoldy writes:

> Well, this may not be the ideal solution, but that bug seems to come about because of the poles. If you add LIMIT=[-89,0,89,360] to the MAP call, it gets rid of the extraneous labels. ???

Ah, thanks! :-)

While I was updating the code that compares contour plots
on map projections with Brian's suggestions, I noticed
a couple of other things I was doing wrong (still had
map projections in the two contour plot commands that I
didn't need anymore).

Fixing all of that made the function graphics contour
plot even faster than before. The same plot in IDL 8
rendered in about 6 seconds. The current plot renders
in a little less than 2 seconds. This is a significant
speed-up!

You can see the comparisons here:

http://www.idlcoyote.com/cg_tips/conpcont.php

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: PLOTS versus POLYLINE [message #82164 is a reply to message #82107] Wed, 21 November 2012 11:01 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 11/21/12 10:15, Mark Piper wrote:
> P.S. (and totally OT) Brian, I saw a few of your recent posts on the
> Capital Weather Gang blog. Cool! My friend Greg Postel used to blog
> there, but he recently took a job with The Weather Channel.

Greg Postel! Crikey. Shades of axes.... :oD

I need to start reading the WP more regularly....
Re: PLOTS versus POLYLINE [message #82165 is a reply to message #82107] Wed, 21 November 2012 10:39 Go to previous message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
On Wednesday, November 21, 2012 1:24:54 PM UTC-5, David Fanning wrote:
> Brian McNoldy writes:
>
>
>
>> Hmm, I don't know. Are you specifically setting the grid spacing (e.g., m.mapgrid.grid_latitude=30 and m.mapgrid.grid_latitude=30)?
>
>>
>
>> I've only started playing with this, so there are probably others who are far more qualified than myself to troubleshoot it. :)
>
>
>
> No, not really. We have had trouble finding experts. :-)
>
>
>
> Here is what I am talking about. You can see the extra
>
> labels getting in the way at 45 degrees East and West:
>
>
>
> mp = map('Equirectangular', CENTER_LONGITUDE=180, $
>
> POSITION=[0.1,0.1,0.90,0.80], $
>
> LABEL_POSITION = 0, BOX_AXES=1, $
>
> GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
>
> /CURRENT, ASPECT_RATIO=0)
>
> mp['Longitudes'].LABEL_ANGLE = 0
>
> mp['Latitudes'].LABEL_ANGLE = 90
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Well, this may not be the ideal solution, but that bug seems to come about because of the poles. If you add LIMIT=[-89,0,89,360] to the MAP call, it gets rid of the extraneous labels. ???
Re: PLOTS versus POLYLINE [message #82166 is a reply to message #82107] Wed, 21 November 2012 10:24 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Brian McNoldy writes:

> Hmm, I don't know. Are you specifically setting the grid spacing (e.g., m.mapgrid.grid_latitude=30 and m.mapgrid.grid_latitude=30)?
>
> I've only started playing with this, so there are probably others who are far more qualified than myself to troubleshoot it. :)

No, not really. We have had trouble finding experts. :-)

Here is what I am talking about. You can see the extra
labels getting in the way at 45 degrees East and West:

mp = map('Equirectangular', CENTER_LONGITUDE=180, $
POSITION=[0.1,0.1,0.90,0.80], $
LABEL_POSITION = 0, BOX_AXES=1, $
GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
/CURRENT, ASPECT_RATIO=0)
mp['Longitudes'].LABEL_ANGLE = 0
mp['Latitudes'].LABEL_ANGLE = 90

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: PLOTS versus POLYLINE [message #82167 is a reply to message #82107] Wed, 21 November 2012 10:18 Go to previous message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
On Wednesday, November 21, 2012 1:06:59 PM UTC-5, David Fanning wrote:
> Brian McNoldy writes:
>
>
>
>> The laying flat part can be accomplished with:
>
>> m['Latitudes'].label_angle=90
>
>> m['Longitudes'].label_angle=0
>
>
>
> OK, much better.
>
>
>
> When I put box axes around a full-global map,
>
> centered at 180 degrees East, I get "extra" longitudinal
>
> labels at 45 degrees East and 45 degrees West. Oddly
>
> both extra labels are "0". Do you see these, or do know
>
> how to get rid of them? The 45 degree labels write over
>
> the top of these "extra" labels.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Hmm, I don't know. Are you specifically setting the grid spacing (e.g., m.mapgrid.grid_latitude=30 and m.mapgrid.grid_latitude=30)?

I've only started playing with this, so there are probably others who are far more qualified than myself to troubleshoot it. :)
Re: PLOTS versus POLYLINE [message #82168 is a reply to message #82107] Wed, 21 November 2012 10:06 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Brian McNoldy writes:

> The laying flat part can be accomplished with:
> m['Latitudes'].label_angle=90
> m['Longitudes'].label_angle=0

OK, much better.

When I put box axes around a full-global map,
centered at 180 degrees East, I get "extra" longitudinal
labels at 45 degrees East and 45 degrees West. Oddly
both extra labels are "0". Do you see these, or do know
how to get rid of them? The 45 degree labels write over
the top of these "extra" labels.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: PLOTS versus POLYLINE [message #82170 is a reply to message #82107] Wed, 21 November 2012 09:44 Go to previous message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
On Wednesday, November 21, 2012 12:42:12 PM UTC-5, David Fanning wrote:
> Brian McNoldy writes:
>
>
>
>> Yes, I did get the box axes working (though not on all four sides of the plot like the original). Adding the /box_axes to the MAP function does the trick. In this example, something like:
>
>>
>
>> m=MAP('cylindrical',/box_axes,limit=limit,title=title,positi on=position,center_longitude=300)
>
>>
>
>> worked pretty well. But, if you're referring to getting the labels to show up on all four sides, I'm afraid I don't have the key to that.
>
>
>
> Yes, I'm trying to get the labels on all four sides, and
>
> laying flat like I expect them to. I haven't found a key,
>
> either. :-)
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

The laying flat part can be accomplished with:
m['Latitudes'].label_angle=90
m['Longitudes'].label_angle=0
Re: PLOTS versus POLYLINE [message #82171 is a reply to message #82107] Wed, 21 November 2012 09:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Brian McNoldy writes:

> Yes, I did get the box axes working (though not on all four sides of the plot like the original). Adding the /box_axes to the MAP function does the trick. In this example, something like:
>
> m=MAP('cylindrical',/box_axes,limit=limit,title=title,positi on=position,center_longitude=300)
>
> worked pretty well. But, if you're referring to getting the labels to show up on all four sides, I'm afraid I don't have the key to that.

Yes, I'm trying to get the labels on all four sides, and
laying flat like I expect them to. I haven't found a key,
either. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: PLOTS versus POLYLINE [message #82172 is a reply to message #82107] Wed, 21 November 2012 09:37 Go to previous message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
On Wednesday, November 21, 2012 12:24:08 PM UTC-5, David Fanning wrote:
> Brian McNoldy writes:
>
>
>
>> The image that I'm trying to reproduce within the new graphics environment is one that shows hurricane tracks (in the example here, it's for the full season, but I also have a version that is real-time and updated hourly). The example plot can be found at http://andrew.rsmas.miami.edu/bmcnoldy/tropics/atcf/test/lat estATL.png, and all of the real-time plots can be found at http://andrew.rsmas.miami.edu/bmcnoldy/tropics/atcf/
>
>
>
> Oh, oh! Hurricane tracks may not be the end of it.
>
> Have you worked out how to create box axes yet?
>
> If so, could you share your expertise? I've had
>
> no joy here with function graphics.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Hi David,
Yes, I did get the box axes working (though not on all four sides of the plot like the original). Adding the /box_axes to the MAP function does the trick. In this example, something like:

m=MAP('cylindrical',/box_axes,limit=limit,title=title,positi on=position,center_longitude=300)

worked pretty well. But, if you're referring to getting the labels to show up on all four sides, I'm afraid I don't have the key to that.

Brian
Re: PLOTS versus POLYLINE [message #82173 is a reply to message #82107] Wed, 21 November 2012 09:24 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Brian McNoldy writes:

> The image that I'm trying to reproduce within the new graphics environment is one that shows hurricane tracks (in the example here, it's for the full season, but I also have a version that is real-time and updated hourly). The example plot can be found at http://andrew.rsmas.miami.edu/bmcnoldy/tropics/atcf/test/lat estATL.png, and all of the real-time plots can be found at http://andrew.rsmas.miami.edu/bmcnoldy/tropics/atcf/

Oh, oh! Hurricane tracks may not be the end of it.
Have you worked out how to create box axes yet?
If so, could you share your expertise? I've had
no joy here with function graphics.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: PLOTS versus POLYLINE [message #82175 is a reply to message #82107] Wed, 21 November 2012 09:15 Go to previous message
Brian McNoldy is currently offline  Brian McNoldy
Messages: 35
Registered: July 2000
Member
On Wednesday, November 21, 2012 10:15:34 AM UTC-5, Mark Piper wrote:
> On Wednesday, November 21, 2012 3:22:14 AM UTC-7, alx wrote:
>
>> Le mardi 20 novembre 2012 20:33:14 UTC+1, Brian McNoldy a écrit :
>
>>
>
>>> I have admittedly not tinkered around much yet with IDL's snazzy new graphics capabilities (map, text, polygon, etc), but was going to give it a try and convert a fairly simple program to the new format. In my example, a map is drawn, then various annotations are added, and lots of lines are added to the map (storm tracks). The tracks are in lat/lon coordinates of course, but must be treated carefully (I don't want to just throw the entire vector of coordinates at it at once). Previously, I accomplished this with PLOTS (and /CONTINUE), and looped over the points, treating them as necessary.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I can't find a function in the new graphics environment to do something similar, but am probably just missing something obvious. POLYLINE seemed like the correct avenue, but it's not cooperating.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Any guidance would be much appreciated!
>
>>
>
>>
>
>>
>
>> I am not fully experienced in using POLYLINE function. But I guess that you can do what you want by using its GETDATA/SETDATA and CONVERTCOORD methods, as well as the CONNECTIVITY keyword.
>
>>
>
>> Adding, modifying and retrieving graphic components is the power of IDL object graphics.
>
>>
>
>> alx.
>
>
>
> Thank you, Alain -- I agree, SetData is the key:
>
>
>
> http://www.exelisvis.com/docs/SetData_Method.html
>
>
>
> Brian, if you'd be interested, maybe we could work together to make an example that could be included in the Help?
>
>
>
> mp
>
>
>
> P.S. (and totally OT) Brian, I saw a few of your recent posts on the Capital Weather Gang blog. Cool! My friend Greg Postel used to blog there, but he recently took a job with The Weather Channel.

Thanks for the feedback.

The image that I'm trying to reproduce within the new graphics environment is one that shows hurricane tracks (in the example here, it's for the full season, but I also have a version that is real-time and updated hourly). The example plot can be found at http://andrew.rsmas.miami.edu/bmcnoldy/tropics/atcf/test/lat estATL.png, and all of the real-time plots can be found at http://andrew.rsmas.miami.edu/bmcnoldy/tropics/atcf/

I'm making them completely with the traditional graphics, which I'm quite familiar with. You can clearly see how each track requires special attention based on the storm's classification and intensity (lots and lots of IF statements!). Definitely not as simple as just plotting a vector of lat/lon pairs.

As far as GetData, SetData, etc, I have never used those. I was hoping there was something similar to the ease of PLOTS. This might be a tricky example to try learning the new graphics environment!

[Mark, that's really neat that you came across my CWG blog posts... small world! As Greg was getting ready to head for TWC, they started looking for a new hurricane blogger, and asked me if I'd be interested. I've been doing it personally for 16 years, so it was an easy adaptation! Incidentally, this map of the 2012 hurricane season tracks will be making an appearance in one of next week's posts!]
Re: PLOTS versus POLYLINE [message #82178 is a reply to message #82107] Wed, 21 November 2012 07:15 Go to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On Wednesday, November 21, 2012 3:22:14 AM UTC-7, alx wrote:
> Le mardi 20 novembre 2012 20:33:14 UTC+1, Brian McNoldy a écrit :
>
>> I have admittedly not tinkered around much yet with IDL's snazzy new graphics capabilities (map, text, polygon, etc), but was going to give it a try and convert a fairly simple program to the new format. In my example, a map is drawn, then various annotations are added, and lots of lines are added to the map (storm tracks). The tracks are in lat/lon coordinates of course, but must be treated carefully (I don't want to just throw the entire vector of coordinates at it at once). Previously, I accomplished this with PLOTS (and /CONTINUE), and looped over the points, treating them as necessary.
>
>>
>
>>
>
>>
>
>> I can't find a function in the new graphics environment to do something similar, but am probably just missing something obvious. POLYLINE seemed like the correct avenue, but it's not cooperating.
>
>>
>
>>
>
>>
>
>> Any guidance would be much appreciated!
>
>
>
> I am not fully experienced in using POLYLINE function. But I guess that you can do what you want by using its GETDATA/SETDATA and CONVERTCOORD methods, as well as the CONNECTIVITY keyword.
>
> Adding, modifying and retrieving graphic components is the power of IDL object graphics.
>
> alx.

Thank you, Alain -- I agree, SetData is the key:

http://www.exelisvis.com/docs/SetData_Method.html

Brian, if you'd be interested, maybe we could work together to make an example that could be included in the Help?

mp

P.S. (and totally OT) Brian, I saw a few of your recent posts on the Capital Weather Gang blog. Cool! My friend Greg Postel used to blog there, but he recently took a job with The Weather Channel.
Re: PLOTS versus POLYLINE [message #82186 is a reply to message #82107] Wed, 21 November 2012 02:22 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le mardi 20 novembre 2012 20:33:14 UTC+1, Brian McNoldy a écrit :
> I have admittedly not tinkered around much yet with IDL's snazzy new graphics capabilities (map, text, polygon, etc), but was going to give it a try and convert a fairly simple program to the new format. In my example, a map is drawn, then various annotations are added, and lots of lines are added to the map (storm tracks). The tracks are in lat/lon coordinates of course, but must be treated carefully (I don't want to just throw the entire vector of coordinates at it at once). Previously, I accomplished this with PLOTS (and /CONTINUE), and looped over the points, treating them as necessary.
>
>
>
> I can't find a function in the new graphics environment to do something similar, but am probably just missing something obvious. POLYLINE seemed like the correct avenue, but it's not cooperating.
>
>
>
> Any guidance would be much appreciated!

I am not fully experienced in using POLYLINE function. But I guess that you can do what you want by using its GETDATA/SETDATA and CONVERTCOORD methods, as well as the CONNECTIVITY keyword.
Adding, modifying and retrieving graphic components is the power of IDL object graphics.
alx.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: SMOOTH or TS_SMOOTH
Next Topic: picking an option with radio buttons

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

Current Time: Wed Oct 08 13:57:16 PDT 2025

Total time taken to generate the page: 0.00649 seconds