positioning a TV image within plotting region [message #77882] |
Thu, 29 September 2011 06:50  |
Matthew
Messages: 18 Registered: February 2006
|
Junior Member |
|
|
I am writing a program in which I need to display an image within a
set of axes (frequency vs. time with electric field power spectral
density in color). The problem is that, while the position keyword
specifies the lower left corner of the plotting region, the plot
procedure draws the x and y axes on the inside of this space. So, when
I plot my image using the same position that I supplied to the
plotting routine, the image covers the x and y axes -- it is drawn on
starting on the outer corner of the axes, not on the inner corner.
This would be fine if the axes had a fixed width, but they do not. If
I reposition or resize the plot, the axis width changes and the image
does not fit snugly within the axes. Is there a trick to get around
this?
This happens no matter what coordinates I am using (device,
normal, ...). I already know about TVIMAGE and IMDISP, but want to be
able to fix the problem myself.
position = [x0, y0, x1, y1] ;position in normal coordinates
xsize = (position[2] - position[0]) * !d.x_vsize
ysize = (position[3] - position[1]) * !d.y_vsize
xstart = position[0] * !d.x_vsize
ystart = position[1] * !d.y_vsize
loadct, 13
plot, time, freq, position=position, /normal, /nodata, /noerase
tvscl, congrid(alog(transpose(E_pwr_dens)), xsize, ysize), xstart,
ystart
|
|
|