overplotting contours on tvimage.... [message #94393] |
Mon, 08 May 2017 12:50  |
astroboy.20000
Messages: 39 Registered: August 2012
|
Member |
|
|
Hello,
I'm trying to overplot contour lines on an image made with David Fanning's TVIMAGE command.
I'm doing something like this:
data=world() ;360x360 array, ranges from 0 to 254
tvimage,data,position=[.5,.5,.6,.6] ; I need to do multiple plots
contour,/overplot,data,levels =[ 100,150,200]
No contours show up.
I've thought about doing a congrid command something like this:
data2 = congrid(data,x_panel_size, y_panel_size)
contour,data2,/overplot,levels =[100,150,200]
but I can't figure out how to get the size of the current plot, that is, the image I plotted at position= [.5,.5,.6,.6].
Any suggestions would be welcome. I've been banging my head against the wall for a couple of days now.
Mark
|
|
|
Re: overplotting contours on tvimage.... [message #94397 is a reply to message #94393] |
Tue, 09 May 2017 04:40   |
Nikola
Messages: 53 Registered: November 2009
|
Member |
|
|
On Monday, May 8, 2017 at 8:50:18 PM UTC+1, M Q wrote:
> Hello,
>
> I'm trying to overplot contour lines on an image made with David Fanning's TVIMAGE command.
>
> I'm doing something like this:
>
>
> data=world() ;360x360 array, ranges from 0 to 254
> tvimage,data,position=[.5,.5,.6,.6] ; I need to do multiple plots
>
> contour,/overplot,data,levels =[ 100,150,200]
>
> No contours show up.
>
> I've thought about doing a congrid command something like this:
>
> data2 = congrid(data,x_panel_size, y_panel_size)
> contour,data2,/overplot,levels =[100,150,200]
>
> but I can't figure out how to get the size of the current plot, that is, the image I plotted at position= [.5,.5,.6,.6].
>
>
> Any suggestions would be welcome. I've been banging my head against the wall for a couple of days now.
>
> Mark
I guess that the problem is that you have to set the axes when using TVIMAGE (in the latest version, set the keyword AXES). Then you have to use the same axes (same range in X and Y) when you overplot the contour.
I can't quickly test it now as I don't use the latest Coyote's library, but this may give you a hint where the problem is.
|
|
|
Re: overplotting contours on tvimage.... [message #94398 is a reply to message #94393] |
Tue, 09 May 2017 04:44  |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
On 05/08/2017 09:50 PM, M Q wrote:
> I'm trying to overplot contour lines on an image made with David Fanning's TVIMAGE command.
>
> I'm doing something like this:
>
>
> data=world() ;360x360 array, ranges from 0 to 254
> tvimage,data,position=[.5,.5,.6,.6] ; I need to do multiple plots
>
> contour,/overplot,data,levels =[ 100,150,200]
>
> No contours show up.
>
> I've thought about doing a congrid command something like this:
>
> data2 = congrid(data,x_panel_size, y_panel_size)
> contour,data2,/overplot,levels =[100,150,200]
>
> but I can't figure out how to get the size of the current plot, that is, the image I plotted at position= [.5,.5,.6,.6].
>
>
> Any suggestions would be welcome. I've been banging my head against the wall for a couple of days now.
Use
contour,data, path_info=info, path_xy=lines, /path_data_coord, $
levels=[100,150,200]
print, info, /implied
print, lines
to check, whether the contours are as you expect.
I'm not familiar with the tvimage command, but to properly align the
contours and the image, consider manually setting the window size then
using device coordinates to draw the contours.
xwsize=1200
ywsize=1200
imagePos=[.5,.5,.6,.6]
window, xs=xwsize, ys=ywsize
tvimage, data, position=imagePos
foreach ii,info do plots, $
imagePos[0]*xwsize +lines[0,ii.offset+lindgen(ii.n)]* $
((imagePos[2]-imagePos[0])/360*xwsize), $
imagePos[1]*ywsize +lines[1,ii.offset+lindgen(ii.n)]* $
((imagePos[3]-imagePos[1])/360*xwsize), $
/device
I hope this helps, Markus
|
|
|