Re: Size of viewport

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Feb 25 2010 - 15:43:40 MST

Ivan,

Here's a sample code and the resultant output from maximizing an area
with random plots draw on it. These plots are not truly random,
because they are all the same size. :-)

However, you should be able to adapt this code for your own use.

I created a function "set_device_coords" that sets the PS/PDF device
coordinates, based on the area of the unit square you want to
maximize. Unfortunately, this means you need to know the min/max of
the unit square you're drawing to (there's no way to currently
calculate it).

I need to implement a "get_bounding_box" type of function that allows
you to get the bounding box that encloses a particular plot. This
way, you can easily get the min/max of the area you're drawing to.

For now, I used the ndc_draw_grid procedure to eyeball the area I
wanted to maximize.

You need to call set_device_coords before you start drawing to a
frame, because you'll get unexpected results otherwise.

Let me know if you have any questions about this.

--Mary

On Feb 25, 2010, at 11:11 AM, Ivan Lima wrote:

> Hi Mary,
>
> I'm drawing multiple plots on one page. The individual plots have
> different sizes and shapes so I'm not using Ngl.panel. I use
> Ngl.panel all the time for multiple plots of the same size and
> shape.
>
> OK, how do I maximize the plots in a non-square area? Or how can I
> make the "square" use the full height of the page?
>
> Just one more clarification. So nglPaperMargin, nglPaperWidth,
> nglPaperHeight only work when nglMaximize = True ?
>
> Thanks,
>
> - Ivan
>
> --
> Ivan Lima
> Woods Hole Oceanographic Institution, MC&G MS #25
> 360 Woods Hole Road, Woods Hole, MA 02543-1543 USA
>
>
> On Thu, Feb 25, 2010, Mary Haley wrote:
>
>> Hi Ivan,
>>
>> You said "multi-panel" plot, but then you said "the plot would fit
>> nicely
>> in letter sized paper". Are you drawing multiple plots on one
>> page or
>> a single plot?
>>
>> If you are drawing multiple plots that are the same size, have you
>> tried using Ngl.panel instead of using the vpXXXX resources?
>> This will take care of resizing the plots so that they fit nicely on
>> the page.
>>
>> If you are trying to position the plots yourself, then this is
>> going to
>> be done on an invisible unit square, and afterwards you will have
>> to set some special PostScript resources to resize these plots so
>> they
>> are maximized in a non-square area (this is what "nglMaximize"
>> does for
>> you, but this only works for individual plots, or Ngl.panel).
>>
>> I can help you with the latter part, but first I want to see if
>> Ngl.panel
>> will work for you.
>>
>> --Mary
>>
>> On Feb 25, 2010, at 9:48 AM, Ivan Lima wrote:
>>
>>> I'm trying to create a multi-panel plot using vpXF, vpYF, vpWidthF
>>> and vpHeightF. The plot is taller than it is wide and it would fit
>>> nicely in letter sized paper. nglPaperOrientation is set to
>>> 'portrait', but no matter what I do I can only plot inside a
>>> relatively short rectangular area with big margins at the top and
>>> bottom of the page. I tried changing nglPaperMargin, nglPaperWidth,
>>> nglPaperHeight and wkPaperSize but they don't seem to have any
>>> effect. How do I reduce the top and bottom margins in the plot? Or
>>> for that matter, how do I control the size of the margins so I can
>>> use more area in the page without "clipping" part of my plot?
>>>
>>> Thank you for your help,
>>>
>>> --
>>> Ivan Lima
>>> Woods Hole Oceanographic Institution, MC&G MS #25
>>> 360 Woods Hole Road, Woods Hole, MA 02543-1543 USA
>>>
>>> _______________________________________________
>>> pyngl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>
>

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

Received on Thu Feb 25 15:43:54 2010

This archive was generated by hypermail 2.1.8 : Mon Mar 01 2010 - 09:12:40 MST