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

Home » Public Forums » archive » Map Projected Contour plot - function graphics - how to change the contoured data....
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
Map Projected Contour plot - function graphics - how to change the contoured data.... [message #92366] Tue, 01 December 2015 14:03 Go to next message
Geo is currently offline  Geo
Messages: 8
Registered: December 2015
Junior Member
Hi there,

OK so I have set up a map-projected contour plot by doing this:

mp1 = map('Equirectangular', CENTER_LONGITUDE=0, $
POSITION=[0.1,0.1,0.90,0.75], $
LABEL_POSITION = 0, /BOX_AXES, $
/box_antialias, $
GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
/CURRENT, ASPECT_RATIO=0, LIMIT=[-89.99, -180, 89.99, 180])

etc., etc.

and then the contour plot....

cn = contour(data1, lon, lat, overplot = overplot, name='the_contour_plot',$ GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, RGB_INDICES=Indgen(nlevels), $
C_VALUE=levels, /FILL)

So I'm contour plotting 'data1' on a standard equirectangular map. So far, fine.

Now I want to change the contour plot to the show the next dataset in the sequence (lets call it data2 - it has the same dimensions as data1)

This looks to be simple:

cn.setdata, data2

But this doesn't work - I get:
% Not supported for MAPPROJECTION graphics.
So obviously, when the contour plot is 'map projected' it won't do an update
to the contour plot data itself.

Any idea how I can get around this? In general I am wanting to do lots of contour plotting with different map projections - but I need to be able to change the data (like when you go from time T to time T+1).

Thanks for any help,

Geo
Re: Map Projected Contour plot - function graphics - how to change the contoured data.... [message #92369 is a reply to message #92366] Wed, 02 December 2015 11:24 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Tuesday, December 1, 2015 at 3:03:56 PM UTC-7, Geo wrote:
> Hi there,
>
> OK so I have set up a map-projected contour plot by doing this:
>
> mp1 = map('Equirectangular', CENTER_LONGITUDE=0, $
> POSITION=[0.1,0.1,0.90,0.75], $
> LABEL_POSITION = 0, /BOX_AXES, $
> /box_antialias, $
> GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
> /CURRENT, ASPECT_RATIO=0, LIMIT=[-89.99, -180, 89.99, 180])
>
> etc., etc.
>
> and then the contour plot....
>
> cn = contour(data1, lon, lat, overplot = overplot, name='the_contour_plot',$ GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
> RGB_TABLE=rgb, /CURRENT, RGB_INDICES=Indgen(nlevels), $
> C_VALUE=levels, /FILL)
>
> So I'm contour plotting 'data1' on a standard equirectangular map. So far, fine.
>
> Now I want to change the contour plot to the show the next dataset in the sequence (lets call it data2 - it has the same dimensions as data1)
>
> This looks to be simple:
>
> cn.setdata, data2
>
> But this doesn't work - I get:
> % Not supported for MAPPROJECTION graphics.
> So obviously, when the contour plot is 'map projected' it won't do an update
> to the contour plot data itself.
>
> Any idea how I can get around this? In general I am wanting to do lots of contour plotting with different map projections - but I need to be able to change the data (like when you go from time T to time T+1).
>
> Thanks for any help,
>
> Geo

Hi Geo,

I just found & fixed a bug in the graphics code, where it was giving the same "name" to both the contour plot and the map projection. So the "cn" reference that was being returned was actually the map projection instead of the contour.

As a workaround, you can simply remove 'name="the_contour_plot"' and the problem should go away.

Cheers,
Chris
p.s. here's a simple reproduce:

mp1 = map('Equirectangular', CENTER_LONGITUDE=0, /DEBUG, $
POSITION=[0.1,0.1,0.90,0.75], $
LABEL_POSITION = 0, /BOX_AXES, $
/box_antialias, $
GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
/CURRENT, ASPECT_RATIO=0, LIMIT=[-89.99, -180, 89.99, 180])
data1 = dist(50)
lon = findgen(50)*3
lat = findgen(50)*2 - 50
cn = contour(data1, lon, lat, overplot = 1,$
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=33, /CURRENT, /FILL)
help, cn
cn.setdata, 35*hanning(50,50)
Re: Map Projected Contour plot - function graphics - how to change the contoured data.... [message #92370 is a reply to message #92369] Wed, 02 December 2015 11:34 Go to previous messageGo to next message
Geo is currently offline  Geo
Messages: 8
Registered: December 2015
Junior Member
Chris,

Thanks for replying. Yes, I was wondering why the object reference for cn was that is was a 'map projection' rather than a contour plot.

When you say "fixed a bug in the graphics code" - are you talking about a bug in my code snippet - or in IDL ?

Cheers

George.




On Wednesday, December 2, 2015 at 12:24:55 PM UTC-7, Chris Torrence wrote:
> On Tuesday, December 1, 2015 at 3:03:56 PM UTC-7, Geo wrote:
>> Hi there,
>>
>> OK so I have set up a map-projected contour plot by doing this:
>>
>> mp1 = map('Equirectangular', CENTER_LONGITUDE=0, $
>> POSITION=[0.1,0.1,0.90,0.75], $
>> LABEL_POSITION = 0, /BOX_AXES, $
>> /box_antialias, $
>> GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
>> /CURRENT, ASPECT_RATIO=0, LIMIT=[-89.99, -180, 89.99, 180])
>>
>> etc., etc.
>>
>> and then the contour plot....
>>
>> cn = contour(data1, lon, lat, overplot = overplot, name='the_contour_plot',$ GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
>> RGB_TABLE=rgb, /CURRENT, RGB_INDICES=Indgen(nlevels), $
>> C_VALUE=levels, /FILL)
>>
>> So I'm contour plotting 'data1' on a standard equirectangular map. So far, fine.
>>
>> Now I want to change the contour plot to the show the next dataset in the sequence (lets call it data2 - it has the same dimensions as data1)
>>
>> This looks to be simple:
>>
>> cn.setdata, data2
>>
>> But this doesn't work - I get:
>> % Not supported for MAPPROJECTION graphics.
>> So obviously, when the contour plot is 'map projected' it won't do an update
>> to the contour plot data itself.
>>
>> Any idea how I can get around this? In general I am wanting to do lots of contour plotting with different map projections - but I need to be able to change the data (like when you go from time T to time T+1).
>>
>> Thanks for any help,
>>
>> Geo
>
> Hi Geo,
>
> I just found & fixed a bug in the graphics code, where it was giving the same "name" to both the contour plot and the map projection. So the "cn" reference that was being returned was actually the map projection instead of the contour.
>
> As a workaround, you can simply remove 'name="the_contour_plot"' and the problem should go away.
>
> Cheers,
> Chris
> p.s. here's a simple reproduce:
>
> mp1 = map('Equirectangular', CENTER_LONGITUDE=0, /DEBUG, $
> POSITION=[0.1,0.1,0.90,0.75], $
> LABEL_POSITION = 0, /BOX_AXES, $
> /box_antialias, $
> GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
> /CURRENT, ASPECT_RATIO=0, LIMIT=[-89.99, -180, 89.99, 180])
> data1 = dist(50)
> lon = findgen(50)*3
> lat = findgen(50)*2 - 50
> cn = contour(data1, lon, lat, overplot = 1,$
> GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
> RGB_TABLE=33, /CURRENT, /FILL)
> help, cn
> cn.setdata, 35*hanning(50,50)
Re: Map Projected Contour plot - function graphics - how to change the contoured data.... [message #92371 is a reply to message #92370] Wed, 02 December 2015 11:41 Go to previous messageGo to next message
Geo is currently offline  Geo
Messages: 8
Registered: December 2015
Junior Member
Incidentally

The reason I was using name="the_contour_plot" was because the contour data update I was wanting happens within a widget event.
So, here's my widget event code. I'm pulling back the reference to cn by using it's name. If I get rid of the name field - how else can I reference cn?

wDraw = WIDGET_INFO(event.top, FIND_BY_UNAME = 'DRAW')
WIDGET_CONTROL, wDraw, GET_VALUE = graphicWin
cn = graphicWin['the_contour_plot']
cn.setdata, data2

Cheers

George.
Re: Map Projected Contour plot - function graphics - how to change the contoured data.... [message #92414 is a reply to message #92371] Fri, 11 December 2015 08:47 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, December 2, 2015 at 12:41:15 PM UTC-7, Geo wrote:
> Incidentally
>
> The reason I was using name="the_contour_plot" was because the contour data update I was wanting happens within a widget event.
> So, here's my widget event code. I'm pulling back the reference to cn by using it's name. If I get rid of the name field - how else can I reference cn?
>
> wDraw = WIDGET_INFO(event.top, FIND_BY_UNAME = 'DRAW')
> WIDGET_CONTROL, wDraw, GET_VALUE = graphicWin
> cn = graphicWin['the_contour_plot']
> cn.setdata, data2
>
> Cheers
>
> George.

Hi George,

I fixed a bug in the IDL code.

If you want to use the name, then the other way to workaround the problem is to not specify the map projection when you create the contour. You actually don't need to specify the map projection - as long as you say that the grid units are in degrees then contour will automatically use the current map projection.

Cheers,
Chris
Re: Map Projected Contour plot - function graphics - how to change the contoured data.... [message #92444 is a reply to message #92414] Thu, 17 December 2015 09:36 Go to previous message
Geo is currently offline  Geo
Messages: 8
Registered: December 2015
Junior Member
On Friday, December 11, 2015 at 9:47:33 AM UTC-7, Chris Torrence wrote:
> On Wednesday, December 2, 2015 at 12:41:15 PM UTC-7, Geo wrote:
>> Incidentally
>>
>> The reason I was using name="the_contour_plot" was because the contour data update I was wanting happens within a widget event.
>> So, here's my widget event code. I'm pulling back the reference to cn by using it's name. If I get rid of the name field - how else can I reference cn?
>>
>> wDraw = WIDGET_INFO(event.top, FIND_BY_UNAME = 'DRAW')
>> WIDGET_CONTROL, wDraw, GET_VALUE = graphicWin
>> cn = graphicWin['the_contour_plot']
>> cn.setdata, data2
>>
>> Cheers
>>
>> George.
>
> Hi George,
>
> I fixed a bug in the IDL code.
>
> If you want to use the name, then the other way to workaround the problem is to not specify the map projection when you create the contour. You actually don't need to specify the map projection - as long as you say that the grid units are in degrees then contour will automatically use the current map projection.
>
> Cheers,
> Chris

Thanks Chris

I have it working now (by not using the 'name' feature)

Cheers

George.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: chrome browser update
Next Topic: Globe ('satellite') map projection in New Graphics....

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

Current Time: Wed Oct 08 09:17:51 PDT 2025

Total time taken to generate the page: 0.00323 seconds