-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in centimeters keyword and arguments to TV in Postscript device? #850
Comments
Hi thanks for your appreciations, and for the bug report. |
Thanks for the info on the problem. Here's some more which may help. First, a little context. Years ago, not long after starting with IDL, I decided to design all my graphical output (combinations of images and line plots, often overlaid) using cm coordinates. The ultimate aim was (precisely arranged) HQ EPS output for publications/presentations, but using X-windows for development. I worked up a handful of procedures, or rather 'wrappers' to the standard DEVICE and TV commands. Say the EPS graphic has dimensions 16 x 10cm. With device set to 'X', a window of size (very nearly) 16 x 10cm is generated. All the plots/graphics are specified first in cm coords, and converted to normal for the commands. The wrapper to TV invariably needs to CONGRID all images to fit in the plot space on the X window. But in postscript the image is left unaltered. In short, a sort of WYSIWYG between X-windows and postscript. And very easy to produce neatly arranged graphics containing several plot and/or image types. For the TV command in postscript I did settle on using the centimeters keyword (which works perfectly in IDL). However, no compelling need, and switching to /Normal for postscript works equally well. And now in GDL, whilst the overall dimensions and positioning are incorrect, plots and images are now precisely aligned when specified in Normal coords (see example). Further testing shows some rather odd behaviour. For both of the graphics (dashed-line boxes) in the attached PDF, the same command was used in postscript: DEVICE, Encaps=2, Filename='test01', Xsize=14.0, Ysize=10.0 The plot (line & image) should of size 10x8cm, with the origin at 2.0cm,1.0cm, i.e. centre in graphic. The upper graphic shows only the line plot -- not centre, and not the specified dimensions. The graphic below has the image and plot perfectly aligned. Pretty much dead centre, but the dimensions still quite different from what was specified. Back to the line plot shown above, the TV command was commented out -- that was the only change. Yet it somehow changes the overall graphic size even though it appears, of course, after the DEVICE command. For the graphic with the image, the order is not important, placing the TV command either before or after the PLOT command gives the same. Note, the line plot size is the same in both graphics. The various dimensions are as reported by Omigraffle (and should be reliable). I've included on the PDF page (shrunken) grabs of the X-windows showing expected behaviour. I hope this somehow helps. |
this is definitely something we have to work on. |
PR #1022 may be the solution. |
Try now that #1022 is merged. |
Yay! Looks perfect. Many thanks indeed. |
Placement of graphics using the TV command with the centimeters keyword and arguments appears to have a bug: graphics appear, but with the wrong size and in the wrong position, e.g:
TV, byt_data, 0, 0, Xsize=16.0, Ysize=10.0, /Centimeters, Order=order, True=true
A graphic that should (in IDL) have an (X) size of 16cm appears in the GDL postscript with an X size of ~10.1cm. The aspect ratio is correct.
Additionally, origin placement is slightly off: my graphic should appear in the bottom corner of the postscript file (TV position arguments 0,0). Instead, there is a small shift in the Y position of just ~0.14 cm (the X position seems correct, i.e. at the left edge of the postscript file).
A graphic that should appear at centimeters position (17.5, 0.5), instead shows at (~11.1, ~0.45). So, there appears to be a scaling factor of ~0.63 being applied somewhere to the cm coordinates of the TV command in postscript (plus a little offset in the Y position).
Although a longstanding user of IDL, this is my first try out with GDL. Notwithstanding the above, very impressed! BTW, couldn't get GDL work first few attempts due to problems with PLplot. However, the 'minimum_script4gdl.sh' worked a charm.
macOS 10.14.6
The text was updated successfully, but these errors were encountered: