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
|
|
|
Re: positioning a TV image within plotting region [message #77996 is a reply to message #77882] |
Mon, 10 October 2011 19:23  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matthew Argall writes:
> I am using cgImage to do this and it looks great, but the problem
> keeps bugging me and I keep returning to my own program. In the PS
> file, the plot still covers the axes, which is bad when I am trying to
> find synchronous events between plots... Anyway, I will figure it out
> eventually, but I wanted to ask: Do you find any use for PS anymore?
> Only the high end printers come equipped with PS processing. Until IDL
> added the PDF option, I usually ended up converting my PS files to
> TIFF of PNG to have a file anyone could open.
To be honest, the only use I normally have for PostScript
files is to make some other type of files from them using
ImageMagick or Ghostview. PostScript files are the only
way to get decent fonts from direct graphics routines.
Since this process is almost completely automated now,
I don't really even think about ugly fonts anymore.
I just make nice looking PNG and JPEG files of all my
graphics output through PostScript intermediate files.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|