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
|