Functions
hrl_lib::matplotlib_util Namespace Reference

Functions

def figure
 calls pylab.figure() and returns the figure other params can be added if required.
def flip_x_axis
 typical usage: ax = pp.gca(); mpu.flip_x_axis(ax)
def flip_y_axis
 typical usage: ax = pp.gca(); mpu.flip_y_axis(ax)
def legend
 legend drawing helper
def plot_circle
 plot circle (or an arc counterclockwise starting from the y-axis)
def plot_ellipse
 plot an ellipse
def plot_ellipse_cov
 plot an ellipse
def plot_histogram
 plot a histogram.
def plot_radii
 plot radii at regular angular intervals.
def plot_rectangle
 plot rectangle
def random_color
 generate a random color.
def reduce_figure_margins
def set_figure_size

Function Documentation

def hrl_lib.matplotlib_util.figure (   fig_num = None,
  dpi = None 
)

calls pylab.figure() and returns the figure other params can be added if required.

Parameters:
dpi- changing this can change the size of the font.

Definition at line 39 of file matplotlib_util.py.

typical usage: ax = pp.gca(); mpu.flip_x_axis(ax)

Definition at line 92 of file matplotlib_util.py.

typical usage: ax = pp.gca(); mpu.flip_y_axis(ax)

Definition at line 96 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.legend (   loc = 'best',
  display_mode = 'normal',
  draw_frame = True,
  handlelength = 0.003 
)

legend drawing helper

Parameters:
loc- 'best', 'upper left' ...
display_mode- 'normal', 'less_space'

Definition at line 46 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.plot_circle (   cx,
  cy,
  rad,
  start_angle,
  end_angle,
  step = math.radians(2),
  color = 'k',
  label = '',
  alpha = 1.0,
  linewidth = 2 
)

plot circle (or an arc counterclockwise starting from the y-axis)

Parameters:
cx- x coord of center of circle.
cy- y coord of center of circle.
rad- radius of the circle
start_angle- starting angle for the arcin RADIANS. (0 is y axis)
end_angle- ending angle for the arcin RADIANS. (0 is y axis)
step- step size for the linear segments.
color- color of the circle.
label- legend label.

circle plotted as bunch of linear segments. back to LOGO days.

Definition at line 135 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.plot_ellipse (   pos,
  angle,
  w1,
  w2,
  edge_color,
  face_color = 'w',
  alpha = 1. 
)

plot an ellipse

Parameters:
mn- center of ellipe. (2x1 np matrix)
angleof the ellipse (RADIANS)

Definition at line 114 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.plot_ellipse_cov (   pos,
  P,
  edge_color,
  face_color = 'w',
  alpha = 1. 
)

plot an ellipse

Parameters:
mn- center of ellipe. (2x1 np matrix)
P- covariance matrix.

Definition at line 103 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.plot_histogram (   left,
  height,
  width = 0.8,
  label = '',
  align = 'center',
  color = 'b',
  alpha = 1. 
)

plot a histogram.

Parameters:
left- left edge of the bin. (array-like)
height- height of each bin (array-like)

Definition at line 232 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.plot_radii (   cx,
  cy,
  rad,
  start_angle,
  end_angle,
  interval = math.radians(15),
  color = 'k',
  label = '',
  alpha = 1.0,
  linewidth = 1. 
)

plot radii at regular angular intervals.

Parameters:
cx- x coord of center of circle.
cy- y coord of center of circle.
rad- radius of the circle
start_angle- starting angle for the arcin RADIANS. (0 is y axis)
end_angle- ending angle for the arcin RADIANS. (0 is y axis)
interval- angular intervals for the radii
color- color of the circle.
label- legend label.

Definition at line 204 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.plot_rectangle (   cx,
  cy,
  slope,
  width,
  length,
  color = 'k',
  label = '',
  alpha = 1.0,
  linewidth = 2 
)

plot rectangle

Parameters:
cx- x coord of center of rectangle.
cy- y coord of center of rectangle.
slope- slope of rectangle. (0 is aligned along x axis)
width- width of the rectangle
length- length of the rectangle
color- color of the circle.
label- legend label.

Definition at line 159 of file matplotlib_util.py.

generate a random color.

Returns:
string of the form #xxxxxx

Definition at line 61 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.reduce_figure_margins (   left = 0.1,
  right = 0.98,
  top = 0.99,
  bottom = 0.15 
)

Definition at line 86 of file matplotlib_util.py.

def hrl_lib.matplotlib_util.set_figure_size (   fig_width,
  fig_height 
)
Parameters:
figurewidth in cm
figureheight in cm

Definition at line 71 of file matplotlib_util.py.



hrl_lib
Author(s): Cressel Anderson, Travis Deyle, Advait Jain, Hai Nguyen, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:34:06