[ncl-talk] PDF plot to big and rotated in 90 degrees.
Adam Phillips
asphilli at ucar.edu
Sat Aug 8 08:43:24 MDT 2015
Hi Sebastián,
You need to delete the workstation before you call convert otherwise you will get an error message:
do it=0,1
wks = gsn_open_wks(wks_type,"animate"+sprinti("%03i",it))
..........
plot = ..........
delete(wks)
system("convert -trim"animate"+sprinti("%03i",it)+".png" "animate"+sprinti("%03i",it)+".png")
end do
Hope that helps.. If not let ncl-talk know.
Adam
> On Aug 8, 2015, at 6:58 AM, Sebastian Otarola-Bustos <Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:
>
> Thank you very much, that was really helpful! I think that my trouble is solved. By the way, and only for curiosity, you know if you can use the trim option inside a loop, to get a gif with all images without those blank spaces. Cause I tried something like this inside a loop, but it didn't work:
>
> wks = gsn_open_wks(wks_type,"animate"+sprinti("%03i",it))
>
> system("convert -trim"animate"+sprinti("%03i",it)+".png" "animate"+sprinti("%03i",it)+".png")
>
>
> All the best,
>
> Thank you a lot.
>
>
>
>> On Thu, Aug 6, 2015 at 2:42 PM, Mary Haley <haley at ucar.edu> wrote:
>> I didn't notice this before, but you can't use the wkWidth and wkHeight resources with PS or PDF. These width and height are for pixel sizes, which apply to the X11 and PNG workstations only.
>>
>> If you want an image to be a specific pixel size, then you need to use "PNG" as the output. With PNG as the output, the image will not be rotated automatically, so you don't need to set gsnPaperOrientation.
>>
>> However, NCL always draws its images to a square, so your image is going to be the smaller of the two sizes you specified: 1536 x 1536.
>>
>> My suggestion is to set the size to 1700 x 1700, and then use ImageMagick's "convert" to trim the image.
>>
>> I've attached a sample script.
>>
>> --Mary
>>
>>
>>
>>> On Wed, Aug 5, 2015 at 1:46 PM, Sebastian Otarola-Bustos <Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:
>>> Hi,
>>>
>>> Thank you very much, but it seems that doesn't works. The plot it's too big I think.
>>>
>>>
>>> All the best,
>>> Sebastián.
>>>
>>>> On Wed, Aug 5, 2015 at 11:19 AM, Mary Haley <haley at ucar.edu> wrote:
>>>> Try setting gsnPaperOrientation with the "mpres" resources and not the workstation resources.
>>>>
>>>> I know this doesn't make a lot of sense, but it's when the plot is being created that it needs to know that the paper is oriented one way or another.
>>>>
>>>> --Mary
>>>>
>>>>
>>>>> On Tue, Aug 4, 2015 at 12:34 AM, Sebastian Otarola-Bustos <Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:
>>>>> Hi All, I was doing a gif animation in .png format, and I was able to set the width and the height, so my plots were ok. But now I'm trying to do the same with .ps format or .pdf, and I'm having some troubles. It's rotated, and the command, wks_type at gsnPaperOrientation = "portrait" is not recognized. Any suggestion?
>>>>> Any help would be really appreciated, below you can see what I mentioned to you from my code.
>>>>>
>>>>> wks_type = "ps"
>>>>> ;wks_type at wkWidth = 1700
>>>>> ;wks_type at wkHeight = 1536
>>>>> wks_type at gsnPaperOrientation = "portrait"
>>>>>
>>>>> wks = gsn_open_wks(wks_type,"animate"+sprinti("%03i",it))
>>>>>
>>>>> mpid = gsn_csm_map(wks,mpres)
>>>>> hnid = gsn_csm_contour(wks,hgt300(:,:),hres)
>>>>> T_300 = gsn_csm_contour(wks,T300,Tres)
>>>>> V_300 =gsn_csm_vector(wks,U300,V300,Vres)
>>>>>
>>>>> ;Overlaps maps in order
>>>>> overlay(mpid,hnid)
>>>>> overlay(mpid,T_300)
>>>>>
>>>>> All the best,
>>>>> Sebastián.
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150808/af9abeda/attachment.html
More information about the ncl-talk
mailing list