plot_curve¶
-
menpo.visualize.
plot_curve
(x_axis, y_axis, figure_id=None, new_figure=True, legend_entries=None, title='', x_label='', y_label='', axes_x_limits=0.0, axes_y_limits=None, axes_x_ticks=None, axes_y_ticks=None, render_lines=True, line_colour=None, line_style='-', line_width=1, render_markers=True, marker_style='o', marker_size=5, marker_face_colour=None, marker_edge_colour='k', marker_edge_width=1.0, render_legend=True, legend_title='', legend_font_name='sans-serif', legend_font_style='normal', legend_font_size=10, legend_font_weight='normal', legend_marker_scale=None, legend_location=2, legend_bbox_to_anchor=(1.05, 1.0), legend_border_axes_pad=None, legend_n_columns=1, legend_horizontal_spacing=None, legend_vertical_spacing=None, legend_border=True, legend_border_padding=None, legend_shadow=False, legend_rounded_corners=False, render_axes=True, axes_font_name='sans-serif', axes_font_size=10, axes_font_style='normal', axes_font_weight='normal', figure_size=(7, 7), render_grid=True, grid_line_style='--', grid_line_width=1)[source]¶ Plot a single or multiple curves on the same figure.
- Parameters
x_axis (list or array) – The values of the horizontal axis. They are common for all curves.
y_axis (list of lists or arrays) – A list with lists or arrays with the values of the vertical axis for each curve.
figure_id (object, optional) – The id of the figure to be used.
new_figure (bool, optional) – If
True
, a new figure is created.legend_entries (list of `str or
None
, optional) – If list of str, it must have the same length as errors list and each str will be used to name each curve. IfNone
, the CED curves will be named as ‘Curve %d’.title (str, optional) – The figure’s title.
x_label (str, optional) – The label of the horizontal axis.
y_label (str, optional) – The label of the vertical axis.
axes_x_limits (float or (float, float) or
None
, optional) – The limits of the x axis. If float, then it sets padding on the right and left of the graph as a percentage of the curves’ width. If tuple or list, then it defines the axis limits. IfNone
, then the limits are set automatically.axes_y_limits (float or (float, float) or
None
, optional) – The limits of the y axis. If float, then it sets padding on the top and bottom of the graph as a percentage of the curves’ height. If tuple or list, then it defines the axis limits. IfNone
, then the limits are set automatically.axes_x_ticks (list or tuple or
None
, optional) – The ticks of the x axis.axes_y_ticks (list or tuple or
None
, optional) – The ticks of the y axis.render_lines (bool or list of bool, optional) – If
True
, the line will be rendered. If bool, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis.line_colour (colour or list of colour or
None
, optional) –The colour of the lines. If not a list, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis. If
None
, the colours will be linearly sampled from jet colormap. Example colour options are{'r', 'g', 'b', 'c', 'm', 'k', 'w'} or (3, ) ndarray
line_style (
{'-', '--', '-.', ':'}
or list of those, optional) – The style of the lines. If not a list, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis.line_width (float or list of float, optional) – The width of the lines. If float, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis.
render_markers (bool or list of bool, optional) – If
True
, the markers will be rendered. If bool, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis.marker_style (marker or list of markers, optional) –
The style of the markers. If not a list, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis. Example marker options
{'.', ',', 'o', 'v', '^', '<', '>', '+', 'x', 'D', 'd', 's', 'p', '*', 'h', 'H', '1', '2', '3', '4', '8'}
marker_size (int or list of int, optional) – The size of the markers in points. If int, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis.
marker_face_colour (colour or list of colour or
None
, optional) –The face (filling) colour of the markers. If not a list, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis. If
None
, the colours will be linearly sampled from jet colormap. Example colour options are{'r', 'g', 'b', 'c', 'm', 'k', 'w'} or (3, ) ndarray
marker_edge_colour (colour or list of colour or
None
, optional) –The edge colour of the markers. If not a list, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis. If
None
, the colours will be linearly sampled from jet colormap. Example colour options are{'r', 'g', 'b', 'c', 'm', 'k', 'w'} or (3, ) ndarray
marker_edge_width (float or list of float, optional) – The width of the markers’ edge. If float, this value will be used for all curves. If list, a value must be specified for each curve, thus it must have the same length as y_axis.
render_legend (bool, optional) – If
True
, the legend will be rendered.legend_title (str, optional) – The title of the legend.
legend_font_name (See below, optional) –
The font of the legend. Example options
{'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
legend_font_style (
{'normal', 'italic', 'oblique'}
, optional) – The font style of the legend.legend_font_size (int, optional) – The font size of the legend.
legend_font_weight (See below, optional) –
The font weight of the legend. Example options
{'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
legend_marker_scale (float, optional) – The relative size of the legend markers with respect to the original
legend_location (int, optional) –
The location of the legend. The predefined values are:
’best’
0
’upper right’
1
’upper left’
2
’lower left’
3
’lower right’
4
’right’
5
’center left’
6
’center right’
7
’lower center’
8
’upper center’
9
’center’
10
legend_bbox_to_anchor ((float, float), optional) – The bbox that the legend will be anchored.
legend_border_axes_pad (float, optional) – The pad between the axes and legend border.
legend_n_columns (int, optional) – The number of the legend’s columns.
legend_horizontal_spacing (float, optional) – The spacing between the columns.
legend_vertical_spacing (float, optional) – The vertical space between the legend entries.
legend_border (bool, optional) – If
True
, a frame will be drawn around the legend.legend_border_padding (float, optional) – The fractional whitespace inside the legend border.
legend_shadow (bool, optional) – If
True
, a shadow will be drawn behind legend.legend_rounded_corners (bool, optional) – If
True
, the frame’s corners will be rounded (fancybox).render_axes (bool, optional) – If
True
, the axes will be rendered.axes_font_name (See below, optional) –
The font of the axes. Example options
{'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
axes_font_size (int, optional) – The font size of the axes.
axes_font_style (
{'normal', 'italic', 'oblique'}
, optional) – The font style of the axes.axes_font_weight (See below, optional) –
The font weight of the axes. Example options
{'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
figure_size ((float, float) or
None
, optional) – The size of the figure in inches.render_grid (bool, optional) – If
True
, the grid will be rendered.grid_line_style (
{'-', '--', '-.', ':'}
, optional) – The style of the grid lines.grid_line_width (float, optional) – The width of the grid lines.
- Raises
ValueError – legend_entries list has different length than y_axis list
- Returns
viewer (
GraphPlotter
) – The viewer object.