Changeset 9072 for trunk/anuga_core


Ignore:
Timestamp:
Apr 9, 2014, 8:04:06 PM (11 years ago)
Author:
davies
Message:

Adding option to plotTriangles for use of spatial coordinates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/utilities/plot_utils.py

    r9068 r9072  
    777777    return
    778778
    779 def plot_triangles(p):
     779def plot_triangles(p, adjustLowerLeft=False):
    780780    """ Add mesh triangles to a pyplot plot
    781781    """
    782782    from matplotlib import pyplot as pyplot
     783    #
     784    x0=p.xllcorner
     785    x1=p.yllcorner
     786    #
    783787    for i in range(len(p.vols)):
    784788        k1=p.vols[i][0]
    785789        k2=p.vols[i][1]
    786790        k3=p.vols[i][2]
    787         pyplot.plot([p.x[k1], p.x[k2], p.x[k3], p.x[k1]], [p.y[k1], p.y[k2], p.y[k3], p.y[k1]],'-',color='black')
     791        if(!adjustLowerLeft):
     792            pyplot.plot([p.x[k1], p.x[k2], p.x[k3], p.x[k1]], [p.y[k1], p.y[k2], p.y[k3], p.y[k1]],'-',color='black')
     793        else:
     794            pyplot.plot([p.x[k1]+x0, p.x[k2]+x0, p.x[k3]+x0, p.x[k1]+x0], [p.y[k1]+x1, p.y[k2]+x1, p.y[k3]+x1, p.y[k1]+x1],'-',color='black')
    788795        #pyplot.plot([p.x[k3], p.x[k2]], [p.y[k3], p.y[k2]],'-',color='black')
    789796        #pyplot.plot([p.x[k3], p.x[k1]], [p.y[k3], p.y[k1]],'-',color='black')
Note: See TracChangeset for help on using the changeset viewer.