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

Home » Public Forums » archive » Re: positioning a TV image within plotting region
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: positioning a TV image within plotting region [message #77876 is a reply to message #77868] Thu, 29 September 2011 12:19 Go to previous messageGo to previous message
Matthew is currently offline  Matthew
Messages: 18
Registered: February 2006
Junior Member
> When I do this, I plot the image first and then the axes.

This just draws the axes on top of the image and hides the fact that
the image is in the wrong spot.


> One more thing - I would use device coordinates for the plot instead of normal, because you can't size your image in normal coordinates. Otherwise, you might sometimes get a 1-pixel mismatch at the edges.

Thanks! You made me realize that I was positioning the plot with
fractions of a pixel, which does not work too well. I still have the
same problem, but now it is a fixed offset, not a varying one. It
seems as though the PLOT procedure draws the bottom and left axes
within the plotting window (defined by !x.window and !y.window),
whereas the top and right axes are outside the plotting window.

In the code below, I used the floor function to truncate any partial
pixels from the plot position, reduce the x- and y-size of the image
by 1-pixel (the apparent width of the axes), and shifted it up and to
the right by 1 pixel. This works for the display window and for all
plot sizes that I have tried so far. Now to try postscripts...


position = [x0, y0, x1, y1] ;position in normal
coordinates
position[0] = floor(position[0] * !d.x_vsize)
position[1] = floor(position[1] * !d.y_vsize)
position[2] = floor(position[2] * !d.x_vsize)
position[3] = floor(position[3] * !d.y_vsize)
xsize = (position[2] - position[0]) - 1
ysize = (position[3] - position[1]) - 1
xstart = position[0] + 1
ystart = position[1] + 1

loadct, 13
plot, time, freq, position=position, /device, /nodata, /noerase
tvscl, congrid(alog(transpose(E_pwr_dens)), xsize, ysize), xstart,
ystart
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Modern IDL Comments
Next Topic: positioning a TV image within plotting region

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

Current Time: Sun Oct 12 07:04:08 PDT 2025

Total time taken to generate the page: 0.96301 seconds