PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Plframe Namespace Reference

Classes

class  Plframe
class  PlXframe

Functions

def _flatten
def plenv
 Now implement the PLplot API.
def pleop
def pllab
def plline
def plpoin
def setup_defaults
 All this stuff is being based heavily on the Pltkwin.tcl thing by Vince, for itcl/itk (which in turn was based heavily on the plwidgets.tcl stuff by Maurice).
def setup_bindings
def set_focus
def build_menu_bar
def create_menu_print
def create_menu_save
def create_menu_orient
def create_menu_zoom
def create_menu_page
def create_menu_options
def create_menu_debug
def key_filter
 Now the commands needed to implement the menus.
def user_mouse
def cmd_print
 flash
def sucky_save
def save_as
def save_again
def save_close
def update_zoom
def zoom_select
def zoom_enter
 s.def_button_cmd = s.plf.bind( "<ButtonPress>" )
def zoom_reset
 
zoom_reset
def update_orient
 global def_button_cmd
def orient
def page_enter
def page_reset
def zoom_start
def zoom_coords
 Restore previous binding, but don't know how to do this in Python/Tk.
def zoom_mouse_draw
def zoom_mouse_end
def view_zoom
 Hmm, view_select is only called by update_view, which isn't called by anything...
def zoom_back
def zoom_forward
def view_scroll
def fixview
def status_msg
 When scrollbars are first created, it may be necessary to unmap then map the plframe widget so that it has a chance to initialize the scrollbars before they are mapped.
def label_reset
def label_set
def plcmap0_edit
def plcmap1_edit
def cmd
 Now do the PLplot API.
def pladv
def plaxes
def plbin
def plbop
def plbox
def plbox3
def plcol0
def plcol1
def plcont
 def plcontxxx( s, z, kx, lx, ky, ly, clev, pltr, xg, yg, wrap ): plsstrm( s.strm ) plcont( z, kx, lx, ky, ly, clev, pltr, xg, yg, wrap )
def plfcont
def plcpstream
def clearpage
def plfill
def plfont
def plfontld
def plhist
def plhls
def pljoin
def plline3
def pllsty
def plmesh
def plmtex
def plot3d
def plplot3d
def plpoin3
def plpoly3
def plprec
def plpsty
def plptex
def plreplot
def plrgb
def plrgb1
def plschr
def plshade
def plssub
 def plshade2( s, z, xmin, xmax, ymin, ymax, sh_min, sh_max, sh_cmap, sh_color, sh_width, min_col, min_wid, max_col, max_wid, rect, pltr, xg, yg, wrap ): "Was unable to fix plshade, must make new plshade2, grrr."
def plssym
def plsvpa
def plsxax
def plsyax
def plsym
def plszax
def plvasp
def plvpas
def plvpor
def plvsta
def plw3d
def plwid
def plwind
def debug

Variables

string CMD = 'cmd'
int variable = 0
 for i in range( len(devnamlst) ): devnam = devnamlst[i] devkey = devkeylst[i]
 dx = x1-x0
 if { $zoomopts($this,1) == 0 } then {
 dy = y1-y0
tuple sign_dx = sign(dx)
 set dx [expr $x1 - $x0] set dy [expr $y1 - $y0]
tuple sign_dy = sign(dy)
 xl = x0
 set sign_dx [expr ($dx > 0) ? 1 : -1] set sign_dy [expr ($dy > 0) ? 1 : -1]
 yl = y0
 xr = xl+dx
 set xl $x0 set yl $y0
 yr = yl+dy
 xscale = xmax-xmin
 yscale = ymax-ymin
 rx = dx/xscale
 ry = dy/yscale
 wxl = xl/Lx
 Optional translation to relative device coordinates.
 wxr = xr/Lx
float wyl = 1.0
float wyr = 1.0
tuple coords = s.zoom_coords( s.wx, s.wy, e.x, e.y, 1 )
 bind [plwin] <B1-ButtonRelease> {} bind [plwin] <B1-Motion> {}
int stdzoom = 5
 Check for double-click (specified zoom region less than a few pixels wide).
int nxl = 5
int nxr = 5
int nyl = 5
int nyr = 5
tuple bounds = split( s.tk.call( s.plf._w, 'view', 'bounds' ) )
 Adjust arguments to be in bounds (in case margins are in effect).
tuple xmin = atof( bounds[0] )
tuple ymin = atof( bounds[1] )
tuple xmax = atof( bounds[2] )
tuple ymax = atof( bounds[3] )
int created_sb = 0
 Create scrollbars if they don't already exist.

Function Documentation

def Plframe._flatten (   tuple)
private

Definition at line 15 of file Plframe.py.

def Plframe.build_menu_bar (   s)

Definition at line 164 of file Plframe.py.

def Plframe.clearpage (   s)

Definition at line 1134 of file Plframe.py.

def Plframe.cmd (   s,
  args 
)

Now do the PLplot API.

Just vector these off to the contained Plframe widget.

Definition at line 1076 of file Plframe.py.

def Plframe.cmd_print (   s)

flash

Definition at line 403 of file Plframe.py.

def Plframe.create_menu_debug (   s,
  pmenu 
)

Definition at line 375 of file Plframe.py.

def Plframe.create_menu_options (   s,
  pmenu 
)

Definition at line 368 of file Plframe.py.

def Plframe.create_menu_orient (   s,
  pmenu 
)

Definition at line 272 of file Plframe.py.

def Plframe.create_menu_page (   s,
  pmenu 
)

Definition at line 356 of file Plframe.py.

def Plframe.create_menu_print (   s,
  m 
)

Definition at line 192 of file Plframe.py.

def Plframe.create_menu_save (   s,
  pmenu 
)
Create the menu which lets us control the whole business of
saving plots to disk.

Definition at line 195 of file Plframe.py.

def Plframe.create_menu_zoom (   s,
  pmenu 
)

Definition at line 298 of file Plframe.py.

def Plframe.debug (   s)

Definition at line 1300 of file Plframe.py.

def Plframe.fixview (   s,
  hscroll,
  vscroll 
)

Definition at line 994 of file Plframe.py.

def Plframe.key_filter (   s,
  e 
)

Now the commands needed to implement the menus.

Process keystroke events, and parcell out to various control
functions.

Definition at line 380 of file Plframe.py.

def Plframe.label_reset (   s)

Definition at line 1061 of file Plframe.py.

def Plframe.label_set (   s,
  msg 
)

Definition at line 1064 of file Plframe.py.

def Plframe.orient (   s,
  n 
)
Set the orientation of the plframe, but check to make sure
we only do this if the new orientation is different from the
old one.

Definition at line 513 of file Plframe.py.

def Plframe.page_enter (   s)

Definition at line 526 of file Plframe.py.

def Plframe.page_reset (   s)

Definition at line 529 of file Plframe.py.

def Plframe.pladv (   s,
  page 
)

Definition at line 1080 of file Plframe.py.

def Plframe.plaxes (   s,
  x0,
  y0,
  xopt,
  xtick,
  nxsub,
  yopt,
  ytick,
  nysub 
)

Definition at line 1083 of file Plframe.py.

def Plframe.plbin (   s)

Definition at line 1086 of file Plframe.py.

def Plframe.plbop (   s)

Definition at line 1087 of file Plframe.py.

def Plframe.plbox (   s,
  xopt,
  xtick,
  nxsub,
  yopt,
  ytick,
  nysub 
)

Definition at line 1090 of file Plframe.py.

def Plframe.plbox3 (   s,
  xopt,
  xlabel,
  xtick,
  nsubx,
  yopt,
  ylabel,
  ytick,
  nsuby,
  zopt,
  zlabel,
  ztick,
  nsubz 
)

Definition at line 1095 of file Plframe.py.

def Plframe.plcmap0_edit (   s)

Definition at line 1067 of file Plframe.py.

def Plframe.plcmap1_edit (   s)

Definition at line 1070 of file Plframe.py.

def Plframe.plcol0 (   s,
  col0 
)

Definition at line 1101 of file Plframe.py.

def Plframe.plcol1 (   s,
  col1 
)

Definition at line 1104 of file Plframe.py.

def Plframe.plcont (   s,
  args 
)

def plcontxxx( s, z, kx, lx, ky, ly, clev, pltr, xg, yg, wrap ): plsstrm( s.strm ) plcont( z, kx, lx, ky, ly, clev, pltr, xg, yg, wrap )

Definition at line 1113 of file Plframe.py.

def Plframe.plcpstream (   s)

Definition at line 1118 of file Plframe.py.

def Plframe.plenv (   s,
  xmin,
  xmax,
  ymin,
  ymax,
  i,
  j 
)

Now implement the PLplot API.

For simple functions, can call straight to Tk, which is probably the most straightforward way, in the sense of making the Python/Tk widget look and act most like it's older brother the Tcl version. However, functions which rely on the Numeric extensions cannot work this way, so for those we call straight to the Python compiled interface to the PLplot API.

Definition at line 55 of file Plframe.py.

def Plframe.pleop (   s)

Definition at line 58 of file Plframe.py.

def Plframe.plfcont (   s)

Definition at line 1117 of file Plframe.py.

def Plframe.plfill (   s,
  x,
  y 
)

Definition at line 1137 of file Plframe.py.

def Plframe.plfont (   s,
  ifnt 
)

Definition at line 1141 of file Plframe.py.

def Plframe.plfontld (   s,
  fnt 
)

Definition at line 1144 of file Plframe.py.

def Plframe.plhist (   s,
  data,
  datmin,
  datmax,
  nbin,
  oldwin 
)

Definition at line 1147 of file Plframe.py.

def Plframe.plhls (   s,
  h,
  l,
  sat 
)

Definition at line 1151 of file Plframe.py.

def Plframe.pljoin (   s,
  x1,
  y1,
  x2,
  y2 
)

Definition at line 1154 of file Plframe.py.

def Plframe.pllab (   s,
  xlab,
  ylab,
  tlab 
)

Definition at line 61 of file Plframe.py.

def Plframe.plline (   s,
  x,
  y 
)

Definition at line 64 of file Plframe.py.

def Plframe.plline3 (   s,
  x,
  y,
  z 
)

Definition at line 1164 of file Plframe.py.

def Plframe.pllsty (   s,
  lin 
)

Definition at line 1168 of file Plframe.py.

def Plframe.plmesh (   s,
  x,
  y,
  z,
  opt 
)

Definition at line 1173 of file Plframe.py.

def Plframe.plmtex (   s,
  side,
  disp,
  pos,
  just,
  text 
)

Definition at line 1177 of file Plframe.py.

def Plframe.plot3d (   s,
  x,
  y,
  z,
  opt,
  side 
)

Definition at line 1180 of file Plframe.py.

def Plframe.plplot3d (   s,
  x,
  y,
  z,
  opt,
  side 
)

Definition at line 1184 of file Plframe.py.

def Plframe.plpoin (   s,
  xs,
  ys,
  mark 
)

Definition at line 68 of file Plframe.py.

def Plframe.plpoin3 (   s,
  x,
  y,
  z,
  code 
)

Definition at line 1192 of file Plframe.py.

def Plframe.plpoly3 (   s,
  x,
  y,
  z,
  draw 
)

Definition at line 1196 of file Plframe.py.

def Plframe.plprec (   s,
  setp,
  prec 
)

Definition at line 1200 of file Plframe.py.

def Plframe.plpsty (   s,
  patt 
)

Definition at line 1203 of file Plframe.py.

def Plframe.plptex (   s,
  x,
  y,
  dx,
  dy,
  just,
  text 
)

Definition at line 1206 of file Plframe.py.

def Plframe.plreplot (   s)

Definition at line 1209 of file Plframe.py.

def Plframe.plrgb (   s,
  r,
  g,
  b 
)

Definition at line 1212 of file Plframe.py.

def Plframe.plrgb1 (   s,
  r,
  g,
  b 
)

Definition at line 1215 of file Plframe.py.

def Plframe.plschr (   s,
  dflt,
  scale 
)

Definition at line 1218 of file Plframe.py.

def Plframe.plshade (   s,
  z,
  xmin,
  xmax,
  ymin,
  ymax,
  sh_min,
  sh_max,
  sh_cmap,
  sh_color,
  sh_width,
  min_col,
  min_wid,
  max_col,
  max_wid,
  rect,
  pltr = 'pltr0',
  xg = None,
  yg = None,
  wrap = 0 
)

Definition at line 1224 of file Plframe.py.

def Plframe.plssub (   s,
  nx,
  ny 
)

def plshade2( s, z, xmin, xmax, ymin, ymax, sh_min, sh_max, sh_cmap, sh_color, sh_width, min_col, min_wid, max_col, max_wid, rect, pltr, xg, yg, wrap ): "Was unable to fix plshade, must make new plshade2, grrr."

print "in plshade2" plsstrm( s.strm ); plshade( z, xmin, xmax, ymin, ymax, sh_min, sh_max, sh_cmap, sh_color, sh_width, min_col, min_wid, max_col, max_wid, rect, pltr, xg, yg, wrap )

Definition at line 1250 of file Plframe.py.

def Plframe.plssym (   s,
  dflt,
  scale 
)

Definition at line 1253 of file Plframe.py.

def Plframe.plsvpa (   s,
  xmin,
  xmax,
  ymin,
  ymax 
)

Definition at line 1260 of file Plframe.py.

def Plframe.plsxax (   s,
  digmax,
  digits 
)

Definition at line 1263 of file Plframe.py.

def Plframe.plsyax (   s,
  digmax,
  digits 
)

Definition at line 1266 of file Plframe.py.

def Plframe.plsym (   s,
  x,
  y,
  code 
)

Definition at line 1269 of file Plframe.py.

def Plframe.plszax (   s,
  digmax,
  digits 
)

Definition at line 1273 of file Plframe.py.

def Plframe.plvasp (   s,
  aspect 
)

Definition at line 1276 of file Plframe.py.

def Plframe.plvpas (   s,
  xmin,
  xmax,
  ymin,
  ymax,
  aspect 
)

Definition at line 1279 of file Plframe.py.

def Plframe.plvpor (   s,
  xmin,
  xmax,
  ymin,
  ymax 
)

Definition at line 1282 of file Plframe.py.

def Plframe.plvsta (   s)

Definition at line 1285 of file Plframe.py.

def Plframe.plw3d (   s,
  basex,
  basey,
  height,
  xmin0,
  xmax0,
  ymin0,
  ymax0,
  zmin0,
  zmax0,
  alt,
  az 
)

Definition at line 1289 of file Plframe.py.

def Plframe.plwid (   s,
  width 
)

Definition at line 1294 of file Plframe.py.

def Plframe.plwind (   s,
  xmin,
  xmax,
  ymin,
  ymax 
)

Definition at line 1297 of file Plframe.py.

def Plframe.save_again (   s)

Definition at line 417 of file Plframe.py.

def Plframe.save_as (   s)

Definition at line 416 of file Plframe.py.

def Plframe.save_close (   s)

Definition at line 418 of file Plframe.py.

def Plframe.set_focus (   s,
  e 
)

Definition at line 160 of file Plframe.py.

def Plframe.setup_bindings (   s)

Definition at line 155 of file Plframe.py.

def Plframe.setup_defaults (   s)

All this stuff is being based heavily on the Pltkwin.tcl thing by Vince, for itcl/itk (which in turn was based heavily on the plwidgets.tcl stuff by Maurice).

Definition at line 140 of file Plframe.py.

def Plframe.status_msg (   s,
  msg 
)

When scrollbars are first created, it may be necessary to unmap then map the plframe widget so that it has a chance to initialize the scrollbars before they are mapped.

Map scrollbars if not already mapped. To get packing right, need to unmap then remap plot widget. Otherwise need to do explicit redraw. Hmmm. Actually, "update_view" doesn't seem to be used by anything... def update_view(s): """Updates view. Results in scrollbars being added if they are appropriate. Does nothing if the plot window is unchanged from the default."""

print "in update_view" set coords [[plwin] view]

set xl [lindex "$coords" 0] set yl [lindex "$coords" 1] set xr [lindex "$coords" 2] set yr [lindex "$coords" 3]

view_select $xl $yl $xr $yr

Definition at line 1056 of file Plframe.py.

def Plframe.sucky_save (   s)
A sucky save menu thing.  Needs to be enhanced to work like
the one in Tcl/Itcl.

Definition at line 408 of file Plframe.py.

def Plframe.update_orient (   s,
  m 
)

global def_button_cmd

bind [plwin] <ButtonPress> $def_button_cmd Reset zoom windows list

Definition at line 497 of file Plframe.py.

def Plframe.update_zoom (   s,
  m 
)
Configure zoom menu.

Responsible for making sure zoom menu entries are normal or
disabled as appropriate.  In particular, that 'Back' or 'Forward'
are only displayed if it is possible to traverse the zoom windows
list in that direction.

Definition at line 420 of file Plframe.py.

def Plframe.user_mouse (   s,
  e 
)

Definition at line 398 of file Plframe.py.

def Plframe.view_scroll (   s)

Definition at line 991 of file Plframe.py.

def Plframe.view_zoom (   s,
  x0,
  y0,
  x1,
  y1 
)

Hmm, view_select is only called by update_view, which isn't called by anything...

def view_select( s, x0, y0, x1, y1 ):
    """Handles change of view into plot.
    Given in relative plot window coordinates."""

    print "in view_select"

body Pltkwin::view_select {x0 y0 x1 y1} {

Adjust arguments to be in bounds and properly ordered (xl < xr, etc)

   set     xl [min $x0     $x1]
   set     yl [min $y0     $y1]
   set     xr [max $x0     $x1]
   set     yr [max $y0     $y1]

   xl = min( x0, x1 ); yl = min( y0, y1 )
   xr = max( x0, x1 ); yr = max( y0, y1 )

   set     xmin 0.
   set     ymin 0.
   set     xmax 1.
   set     ymax 1.

   xmin = 0.; ymin = 0.
   xmax = 1.; ymax = 1.

   set     xl [max $xmin [min $xmax $xl]]
   set     yl [max $ymin [min $ymax $yl]]
   set     xr [max $xmin [min $xmax $xr]]
   set     yr [max $ymin [min $ymax $yr]]

   xl = max( xmin, min( xmax, xl ) )
   yl = max( ymin, min( ymax, yl ) )
   xr = max( xmin, min( xmax, xr ) )
   yr = max( ymin, min( ymax, yr ) )

Only create scrollbars if really needed.

   if {($xl ==     $xmin) && ($xr == $xmax)} \
   then {set hscroll 0} else {set hscroll 1}

   if {($yl ==     $xmin) && ($yr == $xmax)} \
   then {set vscroll 0} else {set vscroll 1}

   if { ! ($hscroll ||     $vscroll)} {return}

   if xl == xmin and xr == xmax:
       hscroll = 0
   else:
       hscroll = 1

   if yl == ymin and yr == ymax:
       vscroll = 0
   else:
       vscroll = 1

   if not (hscroll or vscroll):
       return

Select plot region

   [plwin] view select $xl $yl $xr $yr

   s.tk.call( s.plf._w, 'view', 'select', xl, yl, xr, yr )

Fix up view

   fixview $hscroll $vscroll
   s.fixview( hscroll, vscroll ) 

Definition at line 865 of file Plframe.py.

def Plframe.zoom_back (   s)

Definition at line 961 of file Plframe.py.

def Plframe.zoom_coords (   s,
  x0,
  y0,
  x1,
  y1,
  opt 
)

Restore previous binding, but don't know how to do this in Python/Tk.

   s.plf.bind( "<ButtonPress>", s.def_button_cmd )         global def_button_cmd

   bind [plwin] <ButtonPress>      $def_button_cmd  Maybe what I should do for now is just remove the one we instlaled,

but punt on restoring the prexisting binding. Hmpffff. That didn't work... Grrrrrr. -------------------------------------------------------------------------— zoom_coords

Transforms the initial and final mouse coordinates to either:

opt = 0 device coordinates opt = 1 normalized device coordinates

The global variable "zoomopts" is used to determine zoom behavior:

zoomopts($this,0): 0 box follows mouse movements exactly 1 box follows mouse movements so that aspect ratio is preserved (default)

zoomopts($this,1): 0 first and last points specified determine opposite corners of zoom box. 1 box is centered about the first point clicked on, perimeter follows mouse (default)


Definition at line 580 of file Plframe.py.

def Plframe.zoom_enter (   s)

s.def_button_cmd = s.plf.bind( "<ButtonPress>" )

global def_button_cmd zoomopts

set def_button_cmd [bind [plwin] <ButtonPress>]

Definition at line 463 of file Plframe.py.

def Plframe.zoom_forward (   s)

Definition at line 974 of file Plframe.py.

def Plframe.zoom_mouse_draw (   s,
  e 
)

Definition at line 768 of file Plframe.py.

def Plframe.zoom_mouse_end (   s,
  e 
)

Definition at line 776 of file Plframe.py.

def Plframe.zoom_reset (   s)


zoom_reset

Resets after zoom. Note that an explicit redraw is not necessary since the packer

issues a resize after the scrollbars are unmapped.

Definition at line 474 of file Plframe.py.

def Plframe.zoom_select (   s)

Definition at line 444 of file Plframe.py.

def Plframe.zoom_start (   s,
  e 
)

Definition at line 532 of file Plframe.py.

Variable Documentation

tuple Plframe.bounds = split( s.tk.call( s.plf._w, 'view', 'bounds' ) )

Adjust arguments to be in bounds (in case margins are in effect).

Definition at line 906 of file Plframe.py.

string Plframe.CMD = 'cmd'

Definition at line 10 of file Plframe.py.

tuple Plframe.coords = s.zoom_coords( s.wx, s.wy, e.x, e.y, 1 )

bind [plwin] <B1-ButtonRelease> {} bind [plwin] <B1-Motion> {}

Only create scrollbars if really needed.

Select plot region Fix up view Add window to zoom windows list

Definition at line 790 of file Plframe.py.

int Plframe.created_sb = 0

Create scrollbars if they don't already exist.

Definition at line 999 of file Plframe.py.

tuple Plframe.dx = x1-x0

if { $zoomopts($this,1) == 0 } then {

set xr [expr $xl + $dx] set yr [expr $yl + $dy]

zoom from center out, preserving aspect ratio

Definition at line 613 of file Plframe.py.

tuple Plframe.dy = y1-y0

Definition at line 614 of file Plframe.py.

int Plframe.nxl = 5

Definition at line 882 of file Plframe.py.

int Plframe.nxr = 5

Definition at line 883 of file Plframe.py.

int Plframe.nyl = 5

Definition at line 893 of file Plframe.py.

int Plframe.nyr = 5

Definition at line 894 of file Plframe.py.

Plframe.rx = dx/xscale

Definition at line 713 of file Plframe.py.

Plframe.ry = dy/yscale

Definition at line 714 of file Plframe.py.

tuple Plframe.sign_dx = sign(dx)

set dx [expr $x1 - $x0] set dy [expr $y1 - $y0]

Definition at line 618 of file Plframe.py.

tuple Plframe.sign_dy = sign(dy)

Definition at line 619 of file Plframe.py.

int Plframe.stdzoom = 5

Check for double-click (specified zoom region less than a few pixels wide).

In this case, magnification is 2X in each direction, centered at the mouse location. At the boundary, the magnification is determined by the distance to the boundary.

Definition at line 880 of file Plframe.py.

int Plframe.variable = 0

for i in range( len(devnamlst) ): devnam = devnamlst[i] devkey = devkeylst[i]

m.sdev.add( "radio", label=devnam, variable=s.saveopt_dev,
            value=devkey )  ivk = 1

for i in range( len(devnamlst) ): if devkeylst[i] == "psc": ivk = i+1 break

m.sdev.invoke( ivk )

Definition at line 266 of file Plframe.py.

Plframe.wxl = xl/Lx

Optional translation to relative device coordinates.

Definition at line 756 of file Plframe.py.

Plframe.wxr = xr/Lx

Definition at line 757 of file Plframe.py.

Plframe.wyl = 1.0

Definition at line 758 of file Plframe.py.

Plframe.wyr = 1.0

Definition at line 759 of file Plframe.py.

tuple Plframe.xl = x0

set sign_dx [expr ($dx > 0) ? 1 : -1] set sign_dy [expr ($dy > 0) ? 1 : -1]

Adjust arguments to be properly ordered (xl < xr, etc)

Definition at line 623 of file Plframe.py.

tuple Plframe.xmax = atof( bounds[2] )

Definition at line 909 of file Plframe.py.

tuple Plframe.xmin = atof( bounds[0] )

Definition at line 907 of file Plframe.py.

tuple Plframe.xr = xl+dx

set xl $x0 set yl $y0

if { $zoomopts($this,0) == 1 } then {

Scale factors used to maintain plot aspect ratio

    set     xscale [expr $xmax - $xmin]
    set     yscale [expr $ymax - $ymin]

Adjust box size for proper aspect ratio

    set     rx [expr double(abs($dx)) /     $xscale]
    set     ry [expr double(abs($dy)) /     $yscale]

    if { $rx > $ry } then {
            set     dy [expr $yscale * $rx * $sign_dy]
    } else {
            set     dx [expr $xscale * $ry * $sign_dx]
    }

    set     xr [expr $xl + $dx]
    set     yr [expr $yl + $dy]

Now check again to see if in bounds, and adjust if not

    if { $xr < $xmin ||     $xr     > $xmax } then {
            if { $xr < $xmin } then {
                    set     dx [expr $xmin - $x0]
            } else {
                    set     dx [expr $xmax - $x0]
            }
            set     rx [expr double(abs($dx)) /     $xscale]
            set     dy [expr $yscale * $rx * $sign_dy]
    }

    if { $yr < $ymin ||     $yr     > $ymax } then {
            if { $yr < $ymin } then {
                    set     dy [expr $ymin - $y0]
            } else {
                    set     dy [expr $ymax - $y0]
            }
            set     ry [expr double(abs($dy)) /     $yscale]
            set     dx [expr $xscale * $ry * $sign_dx]
    }

}

Definition at line 678 of file Plframe.py.

Plframe.xscale = xmax-xmin

Definition at line 708 of file Plframe.py.

tuple Plframe.yl = y0

Definition at line 624 of file Plframe.py.

tuple Plframe.ymax = atof( bounds[3] )

Definition at line 910 of file Plframe.py.

tuple Plframe.ymin = atof( bounds[1] )

Definition at line 908 of file Plframe.py.

tuple Plframe.yr = yl+dy

Definition at line 679 of file Plframe.py.

Plframe.yscale = ymax-ymin

Definition at line 709 of file Plframe.py.