Changeset 2321 in lmdz_wrf


Ignore:
Timestamp:
Feb 6, 2019, 1:12:04 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `figureMap_size': Function to determine the real size of a figure adjusted to the ratio of the maps
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing_tools.py

    r2258 r2321  
    125125# check_colorBar: Check if the given colorbar exists in matplotlib
    126126# colorbar_vals: Function to provide the colorbar values for a figure
     127# figureMap_size: Function to determine the real size of a figure adjusted to the
     128#   ratio of the maps
    127129# format_axes: Function to provide the format for the ticks of the axes in a figure
    128130# graphic_range: Function to provide the ranges of a figure following different options
     
    30763078    return axisv, newaxist, newaxisL
    30773079
     3080def figureMap_size(lonlatb, figwidth=8, Ncol=1, Nrow=1, dpi=100)
     3081    """ Function to determine the real size of a figure adjusted to the ratio of the
     3082      maps
     3083      [lonlatb]: lonlat box with the coordinates [lonSW, latSW, lonNE, latNE] of the
     3084        extreme of the map
     3085      [figwidth]: width of the figure in inches
     3086      [Ncol]: Number of columns of panels
     3087      [Nrow]: Number of rows of panels
     3088      [dpi]: density of pixels by inch
     3089      * To be used as
     3090      fig, axmat = plt.subplots(Nrow,Ncol,figsize=figsizev)
     3091    """
     3092    fname = 'figureMap_size'
     3093
     3094    fwidth = zonev[3]-zonev[1]
     3095    fheight = zonev[4]-zonev[2]
     3096
     3097    figwidth = 8.
     3098    figheight = figwidth*1.1*Nrow*fheight/(Ncol*fwidth)
     3099    figsizev = (figwidth, figheight)
     3100
     3101    # Height of a line of text as fraction of the figure height
     3102    txtlineh = 16./(figheight*fig.dpi)
     3103
     3104    return figsizev, txtlineh
     3105
    30783106####### ###### ##### #### ### ## # END of GENERIC functions
    30793107
Note: See TracChangeset for help on using the changeset viewer.