On 2013-08-14 00:38:34 +0000, David Fanning said:
> Paul Levine writes:
>
>> I tried adding the WXSize and WYSize (though I used 800 for x and 600
>> for y because I am trying to get landscape output), but I still get the
>> same result, i.e. PNG oriented correctly and PDF rotated 90 degrees.
>>
>> But this brings up a somewhat-related question about PNG output. When
>> I use WXSize=800 and WYSize=600 my PNG file ends up being 752 x 556
>> pixels, and the bottom of my x axis title is chopped off. Should I not
>> be getting 800 x 600 pixels out? And is my truncated title indicative
>> of some mistake on my part? The PDF file shows the entire x axis
>> title, but of course the file itself is 8.5 x 11 inches.
>
> Well, I tested this pretty thoroughly before I posted, but I'm almost
> certainly not using the code you are. Can you send me some example code
> so we are comparing apples with apples?
>
> I'm never surprised to find the Mac acting strangely, but this seems
> reasonable straightforward to me.
>
> Cheers,
>
> David
Hi David,
I made some example code that simulates the plots I'm trying to make
(two data sets, two y axes, each with a title, plotted over time,
x-axis labels are month and year, so x axis title needs to get pushed
down). The example creates both a png and a pdf for each of the
following cases:
1. no resizing
2. resizing to 800 x 800
3. resizing to 800 x 600
4. resizing to 800 x 400
5. resizing to 600 x 800
I tried three different ways of resizing:
1. Calling cgWindow with xwsize and ywsize as the first command,
followed by cgPlot with /addcmd
2. Calling cgPlot with xwsize and ywsize as arguments as the first command
3. Putting xwsize and ywsize as arguments in the new and improved cgControl
All three of these resize methods produced identical results, as I
imagine they should, so I went with the third method
I suspect you might find all sorts of bad in my example code (even
things unrelated to graphic file output); please feel free to point out
anything I am doing wrong.
Also, I should mention, I am using:
Mac OS X 10.8.4
IDL 8.2.3
Coyote Graphics downloaded at 5:30 pm PDT on August 13, 2013
GPL Ghostscript 9.06
ImageMagick 6.8.6-6 (installed via MacPorts, and I included SetEnv,
'PATH=/opt/local/bin:$PATH' as you suggested on your webpage)
Example code:
time = indgen(100)*36 + 2451545 ; creates a vector of julian days from
2000-2009
date_label = label_date(date_format = ['%M!C%Y'])
data1 = (randomu(seed,100)*60)-30
data2 = (randomu(seed,100)*20)-10
cgPlot, time, data1 , thick=4, title = 'Title for Plot', /window, $
yrange=[-50, 50], ytickinterval=10, yminor=1, ytitle = 'Data Value', $
xtickunits = 'months', xtickformat = 'label_date', xticks = 20,
xtickinterval = 12, $
xrange=[julday(1,1,2000),julday(1,1,2009)], xtitle = '!CDate'
cgAxis, Yaxis=1, yrange=[-10,10], ytickinterval=5, yminor=2, ytitle =
'Another Data Value', /window, /save
cgOplot, time, data2, linestyle=2, thick=1, /window
al_legend, ['Data 1', 'Data 2'], linestyle=[0,2], thick=[4,1], /window
cgControl, Output='Resize_none.pdf'
cgControl, Output='Resize_none.png'
cgControl, Resize=800, Output='Resize_800x800.pdf'
cgControl, Resize=800, Output='Resize_800x800.png'
cgControl, Resize=[800,600], Output='Resize_800x600.pdf'
cgControl, Resize=[800,600], Output='Resize_800x600.png'
cgControl, Resize=[800,400], Output='Resize_800x400.pdf'
cgControl, Resize=[800,400], Output='Resize_800x400.png'
cgControl, Resize=[600,800], Output='Resize_600x800.pdf'
cgControl, Resize=[600,800], Output='Resize_600x800.png'
The resulting PDF and PNG files can be seen at
https://www.dropbox.com/sh/3945ubx8b61xyoo/APfJsg-cl
But to summarize what I got:
All PDF files are 8.5 x 11 inches
Resize_none.pdf, Resize_800x600.pdf, and Resize_800x400.pdf are all
rotated 90 degrees (i.e., I would need to rotate the PDF display 90
degrees clockwise to see the graphic correctly), and the graphic is
framed at different sizes within the 8.5 x 11 inch page
Resize_800x800.pdf and Resize_600x800 show the graphic in the correct
orientation; both are framed at different sizes within the 8.5 x 11
inch page.
All PNG files have the correct orientation (no rotation of the graphic)
Resize_none.png is 717 x 573 pixels
Resize_800x800.png is 573 x 573 pixels, and the right side y axis title
is partially cut off
Resize_800x600.png is 742 x 556 pixels, and the x axis title is
partially cut off
Resize_800x400.png is 742 x 371 pixels, the x axis title is completely
cut off, and the x axis labels are partially cut off
Resize_600x800.png is 556 x 742 and the right side y axis title is
partially cut off
Thank you for your help!
Paul
|