How to maximize the size of your graphical output in NCL

From: Mary Haley (haley AT XXXXXX)
Date: Mon Mar 12 2001 - 10:07:58 MST

  • Next message: Maurice: "Few Questions"

    There's a new GSUN resource called "gsnMaximize" that makes the size
    of your graphical output as large as possible on whatever workstation
    device (NCGM, X11 window, or PostScript file) you are drawing to.

    This is especially useful for maximizing your PostScript output. In
    the past, to maximize your PostScript output, you had to set the
    resources "wkDeviceLowerX", "wkDeviceLowerY", "wkDeviceUpperX", and
    "wkDeviceUpperY", which usually involved a trial-and-error process to
    get the right values.

    Now, if you set the resource "gsnMaximize" to True before going into a
    gsn_* drawing routine, then the values for these four device
    coordinates will be calculated in such a manner to maximize your
    graphical output, without changing its aspect ratio (a minimum margin
    of 0.5" will be left around the plot). Also, by default, the best
    possible orientation (landscape or portrait) will be selected,
    depending on your plot's shape. You can override this by setting
    "gsnPaperOrientation" to the desired orientation.

    Here's a short example that draws a cylindrical equidistant map plot
    to a PostScript file called "example.ps". In this case, the
    orientation automatically selected will be "landscape":

    --------------------------------------------------

    load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
    load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_csm.ncl"

    begin
      wks = gsn_open_wks("ps","example")

      mpres = True
      mpres@gsnMaximize = True
      map = gsn_csm_map_ce(wks,mpres)
    end

    --------------------------------------------------

    This resource also works with gsn_panel. For more information, see the
    "resizing" section of the CSM Graphics Tutorial at:

       http://www.cgd.ucar.edu/csm/support/CSM_Graphics/resize.shtml

    Caveats:
    -------
    Once you start drawing to a frame, you cannot change the PS device
    coordinates. Thus, if you first draw a text string, and then you call
    a gsn_* routine with gsnMaximize set to True, your output may not be
    maximized in the PostScript file. It will depend on what the device
    coordinates were when you started drawing the text string. To get
    around this problem, you need to call the gsn_* routine first, and
    then draw the text string. The URL above has more information on
    this topic.

    Cheers,

    --Mary Haley



    This archive was generated by hypermail 2b29 : Mon Mar 12 2001 - 10:08:23 MST