Changeset 563 for branches


Ignore:
Timestamp:
09/18/12 15:04:55 (4 years ago)
Author:
mmckerns
Message:

enable selection of color for datapoints and cone

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UQ/math/legacy/plot_data.py

    r562 r563  
    6767 
    6868#### plotting the cones #### 
    69 def plot_cones(ax, data, slope, bounds): 
     69def plot_cones(ax, data, slope, bounds, color='0.75'): 
    7070  """plot double cones for a given dataset 
    7171 
     
    7474  slope -- slope multiplier for cone on the X,Y,Z axes (for mesh construction) 
    7575  bounds -- list of tuples of bounds for the plot; (lower,upper) for each axis 
     76  color -- string name (or rbg value) of color to use for datapoints 
    7677""" 
    7778  cone = cone_builder(slope, bounds) 
     
    8182    if _cone: 
    8283      X,Z,Y = _cone 
    83       ax.plot_surface(X, Z,Y, rstride=1, cstride=1, color="0.75")  
     84      ax.plot_surface(X, Z,Y, rstride=1, cstride=1, color=color)  
    8485    _cone = cone(datapt, top=False) 
    8586    if _cone: 
    8687      X,Z,Y = _cone 
    87       ax.plot_surface(X, Z,Y, rstride=1, cstride=1, color="0.75") 
     88      ax.plot_surface(X, Z,Y, rstride=1, cstride=1, color=color) 
    8889  return ax 
    8990 
    90 def plot_data(ax, data, bounds): 
     91def plot_data(ax, data, bounds, color='red'): 
    9192  """plot datapoints for a given dataset 
    9293 
     
    9495  data -- list of datapoints, where datapoints are 3-tuples (i.e. x,y,z) 
    9596  bounds -- list of tuples of bounds for the plot; (lower,upper) for each axis 
     97  color -- string name (or rbg value) of color to use for datapoints 
    9698""" 
    9799  strict = True # always respect the bounds 
     
    107109    else: 
    108110      ax.plot([datapt[0]], [datapt[2]], [datapt[1]], \ 
    109               color='r', marker='o', markersize=10) 
     111              color=color, marker='o', markersize=10) 
    110112  return ax 
    111113 
     
    184186    plot_cones(ax, coords, slope, bounds) 
    185187  plot_data(ax, coords, bounds) 
    186   clip_axes(ax, bounds) 
     188 #clip_axes(ax, bounds) 
    187189  plt.show()  
    188190 
Note: See TracChangeset for help on using the changeset viewer.