clearplot.plot_functions module

plot(filename, x, y, labels=[None], x_label=None, y_label=None, **kwargs)

Plot the x and y data as 2D curves.

Parameters:
  • filename (string) – File name for the plot output file. A file extension supported by matplotlib, such as ‘.png’, can be appended to the file name to override the default file type. To skip creating an output file, input ‘’ for filename.
  • x (list of numpy arrays) – x coordinates of the data to be plotted. Each list element should be a 1-D numpy array.
  • y (list of numpy arrays) – y coordinates of the data to be plotted. Same structure as the x input.
  • labels (list, optional) – Specifies LaTeX strings to label the curves. The list should be 1xQ, where Q is the number of curves.
  • x_label (list of strings, optional) – x-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • y_label (list of strings, optional) – y-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • x_lim (1x2 list, optional) – x-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • y_lim (list, optional) – y-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • x_tick (float or int, optional) – Tick mark spacing for the x-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • y_tick (list, optional) – Tick mark spacing for the y-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • x_scale ([ 'linear' | 'log' ], optional) – x-axis scaling. The default is ‘linear’.
  • y_scale ([ 'linear' | 'log' ], optional) – y-axis scaling. The default is ‘linear’.
  • legend (bool, optional) – Specifies whether to display a legend for the curves.
  • legend_loc (1x2 list or string, optional) – Legend location. For the proper syntax, see the matplotlib documentation for the legend ‘loc’ keyword argument.
  • legend_outside_ax (bool, optional) – Specifies whether to place the legend outside of the data axes. If True then the legend_loc sets the legend position within the axes. If False, then legend_loc sets the legend postion outside the axes.
  • legend_kwargs (dict, optional) – Keyword arguments to customize the legend appearance. This is passed directly into the matplotlib legend function. See the matplotlib documentation further details.
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Other Parameters:
 

See parameters in Axes.plot()

Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • curves (list) – Curve objects

See also

plot_functions.plot_markers()

plot_3d_scatter(filename, x, y, z, x_label='x', y_label='y', z_label='z', x_lim=[None, None], y_lim=[None, None], z_lim=[None, None], x_tick=None, y_tick=None, z_tick=None, light_alt_angle=0.0, light_azm_angle=90.0, title='None')

Plots a 3D scatter plot. In development…

plot_bars(filename, x, y, labels=[None], x_label=None, y_label=None, **kwargs)

Plot the x and y data as a series of vertical bars

Parameters:
  • filename (string) – File name for the plot output file. A file extension supported by matplotlib, such as ‘.jpg’, can be appended to the file name to override the default file type. To skip creating an output file, input ‘’ for filename.
  • x (1xN list of numpy arrays) – x coordinates of bars
  • y (1xN list of numpy arrays) – Height of bars
  • labels (list, optional) – Specifies LaTeX strings to label the curves. The list should be 1xQ, where Q is the number of curves.
  • x_label (list of strings, optional) – x-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • y_label (list of strings, optional) – y-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • x_lim (1x2 list, optional) – x-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • y_lim (list, optional) – y-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • x_tick (float or int, optional) – Tick mark spacing for the x-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • y_tick (list, optional) – Tick mark spacing for the y-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • x_scale ([ 'linear' | 'log' ], optional) – x-axis scaling. The default is ‘linear’.
  • y_scale ([ 'linear' | 'log' ], optional) – y-axis scaling. The default is ‘linear’.
  • legend (bool, optional) – Specifies whether to display a legend for the bars.
  • legend_loc (1x2 list or string, optional) – Legend location. For the proper syntax, see the matplotlib documentation for the legend ‘loc’ keyword argument.
  • legend_outside_ax (bool, optional) – Specifies whether to place the legend outside of the data axes. If True then the legend_loc sets the legend position within the axes. If False, then legend_loc sets the legend postion outside the axes.
  • legend_kwargs (dict, optional) – Keyword arguments to customize the legend appearance. This is passed directly into the matplotlib legend function. See the matplotlib documentation further details.
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Other Parameters:
 

See parameters in Axes.plot_bars()

Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • bars (list) – Bar objects

plot_box_and_whiskers(filename, x, y, x_label=None, y_label=None, **kwargs)

Make a box and whisker plot from the x and y data

Parameters:
  • filename (string) – File name for the plot output file. A file extension supported by matplotlib, such as ‘.jpg’, can be appended to the file name to override the default file type. To skip creating an output file, input ‘’ for filename.
  • x (1xN list of numpy arrays) – x coordinates of boxes
  • y (1xN list of numpy arrays) – Distributions of data
  • x_label (list of strings, optional) – x-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • y_label (list of strings, optional) – y-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • x_lim (1x2 list, optional) – x-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • y_lim (list, optional) – y-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • x_tick (float or int, optional) – Tick mark spacing for the x-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • y_tick (list, optional) – Tick mark spacing for the y-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • x_scale ([ 'linear' | 'log' ], optional) – x-axis scaling. The default is ‘linear’.
  • y_scale ([ 'linear' | 'log' ], optional) – y-axis scaling. The default is ‘linear’.
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Other Parameters:
 

See parameters in Axes.plot_box_and_whiskers()

Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • boxes (list) – Box objects

plot_contours(filename, x, y, z, x_label=None, y_label=None, **kwargs)

Create a contour plot from the x, y, and z data.

Parameters:
  • filename (string) – File name for the plot output file. A file extension supported by matplotlib, such as ‘.jpg’, can be appended to the file name to override the default file type. To skip creating an output file, input ‘’ for filename.
  • x (2-D numpy array) – x coordinates of the data to be plotted.
  • y (2-D numpy array) – y coordinates of the data to be plotted. y must have the same shape as x.
  • z (2-D numpy array) – z coordinates of the data to be plotted. z must have the same shape as x.
  • x_label (list of strings, optional) – x-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • y_label (list of strings, optional) – y-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • x_lim (1x2 list, optional) – x-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • y_lim (list, optional) – y-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • x_tick (float or int, optional) – Tick mark spacing for the x-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • y_tick (list, optional) – Tick mark spacing for the y-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • c_bar (boolean, optional) – Specifies whether or not to place a color bar in the figure window.
  • c_map (matplotlib colormap object, optional) – If “im” array is MxN, then the array values are mapped to a certain color (or gray value) using the supplied colormap.
  • c_lim (1x2 list, optional) – Colormap limits. The first element should be the lower limit, while the second element should be the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • c_tick (float, optional) – Tick mark spacing for the color bar. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • c_orient (the string 'h' or 'v', optional) – Orientation of the color bar. The default is a vertical orientation.
  • c_label (list, optional) – Color bar label. The first list element is the color bar variable being plotted, while the second element is the color bar units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • c_scale ([ 'linear' | 'log' ], optional) – Color bar scaling. The default is ‘linear’.
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Other Parameters:
 

See parameters in Axes.plot_contours()

Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • bg (contour background) – Background of contour plot
  • cl (contour lines) – Contour lines

plot_intensity_map(filename, x, y, z, x_label=None, y_label=None, **kwargs)

Plots a intensity map (heat map) as an image.

Parameters:
  • filename (string) – File name for the plot output file. A file extension supported by matplotlib, such as ‘.jpg’, can be appended to the file name to override the default file type. To skip creating an output file, input ‘’ for filename.
  • x (1x2 or MxN numpy array) – Matrix x position.
  • y (1x2 or MxN numpy array) – Matrix y position.
  • z (MxN numpy array) – Matrix to be plotted
  • x_label (list of strings, optional) – x-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • y_label (list of strings, optional) – y-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • x_lim (1x2 list, optional) – x-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • y_lim (list, optional) – y-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • x_tick (float or int, optional) – Tick mark spacing for the x-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • y_tick (list, optional) – Tick mark spacing for the y-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • c_bar (boolean, optional) – Specifies whether or not to place a color bar in the figure window.
  • c_map (matplotlib colormap object, optional) – If “im” array is MxN, then the array values are mapped to a certain color (or gray value) using the supplied colormap.
  • c_lim (1x2 list, optional) – Colormap limits. The first element should be the lower limit, while the second element should be the upper limit. Alternatively, either element may None to have the algorithm automatically select the limits.
  • c_tick (float, optional) – Tick mark spacing for the color bar. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • c_orient (the string 'h' or 'v', optional) – Orientation of the color bar. The default is a vertical orientation.
  • c_label (list, optional) – Color bar label. The first list element is the color bar variable being plotted, while the second element is the color bar units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • c_scale ([ 'linear' | 'log' ], optional) – Color bar scaling. The default is ‘linear’.
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Other Parameters:
 

See parameters in Axes.plot_matrix()

Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • im (image object) – Matrix plotted as an image

plot_markers(filename, x, y, labels=[None], x_label=None, y_label=None, **kwargs)

Plot the x and y data as markers (a scatterplot).

Parameters:
  • filename (string) – File name for the plot output file. A file extension supported by matplotlib, such as ‘.png’, can be appended to the file name to override the default file type. To skip creating an output file, input ‘’ for filename.
  • x (list of numpy arrays) – x coordinates of the data to be plotted. Each list element should be a 1-D numpy array.
  • y (list of numpy arrays) – y coordinates of the data to be plotted. Same structure as the x input
  • labels (list, optional) – Specifies LaTeX strings to label the marker. The list should be 1xQ, where Q is the number of curves.
  • x_label (list of strings, optional) – x-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • y_label (list of strings, optional) – y-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • x_lim (1x2 list, optional) – x-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • y_lim (list, optional) – y-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • x_tick (float or int, optional) – Tick mark spacing for the x-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • y_tick (list, optional) – Tick mark spacing for the y-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • x_scale ([ 'linear' | 'log' ], optional) – x-axis scaling. The default is ‘linear’.
  • y_scale ([ 'linear' | 'log' ], optional) – y-axis scaling. The default is ‘linear’.
  • legend (bool, optional) – Specifies whether to display a legend for the curves.
  • legend_loc (1x2 list or string, optional) – Legend location. For the proper syntax, see the matplotlib documentation for the legend ‘loc’ keyword argument.
  • legend_outside_ax (bool, optional) – Specifies whether to place the legend outside of the data axes. If True then the legend_loc sets the legend position within the axes. If False, then legend_loc sets the legend postion outside the axes.
  • legend_kwargs (dict, optional) – Keyword arguments to customize the legend appearance. This is passed directly into the matplotlib legend function. See the matplotlib documentation further details.
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Other Parameters:
 

See parameters in Axes.plot_markers()

Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • markers (list) – Marker objects

See also

plot_functions.plot()

plot_surface(filename, x, y, z, x_label='x', y_label='y', z_label='z', x_lim=[None, None], y_lim=[None, None], z_lim=[None, None], x_tick=None, y_tick=None, z_tick=None, light_alt_angle=0.0, light_azm_angle=90.0, title='None', c_map=<matplotlib.colors.ListedColormap object>)

Plots a 3D surface. In development…

plot_violins(filename, x, y, x_label=None, y_label=None, **kwargs)

Make a violin plot from the x and y data

Parameters:
  • x (1xN list of numpy arrays) – x coordinates of violins
  • y (1xN list of numpy arrays) – Distributions of data
  • x_label (list of strings, optional) – x-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • y_label (list of strings, optional) – y-axis label. The first list element is the axis variable being plotted, while the second element is the axis units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • x_lim (1x2 list, optional) – x-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • y_lim (list, optional) – y-axis limits. The first list element is the lower limit, while the second element is the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • x_tick (float or int, optional) – Tick mark spacing for the x-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • y_tick (list, optional) – Tick mark spacing for the y-axis. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • x_scale ([ 'linear' | 'log' ], optional) – x-axis scaling. The default is ‘linear’.
  • y_scale ([ 'linear' | 'log' ], optional) – y-axis scaling. The default is ‘linear’.
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Other Parameters:
 

See parameters in Axes.plot_violins()

Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • violins (list) – Violin objects

show_im(filename, im_seq, **kwargs)

Displays an image or a sequence of images.

Parameters:
  • filename (string) – File name for the plot output file. A file extension supported by matplotlib, such as ‘.jpg’, can be appended to the file name to override the default file type. To skip creating an output file, input ‘’ for filename.
  • im_seq (list of lists containing MxN or MxNx3 arrays) – A list of images sequences. The list should be 1xA, where A is the number of image sequences. Each image sequence is a 1xC list, where C is the number of images in the sequence. (Images within a sequence are displayed side by side, while sequences have a small space between them.) Each element in the image sequence list should be a MxN or MxNx3 array. If image shapes are MxN, the array values are interpreted as intensities that are mapped using the specified color map. If the shapes are MxNx3, then the array values are treated as RGB values.
  • scale_im (float, optional) – Scales the images, holding the aspect ratio fixed. If left unspecified the algorithm will attempt to pick the proper value. If the image sequence is smaller than the screen resolution, then images will be displayed at full scale. Otherwise, the images will be scaled down to fit within the screen resolution.
  • scale_gap (float, optional) – Scales the size of the gap between continuous image sequences
  • im_origin (string, optional) – Origin for the image indices. If ‘upper left’ is input, then the [0,0] index is the upper left of the image, with positive y being downwards. If ‘lower left’ is input, then the [0,0] index is the lower left of the image, with positive y being upwards.
  • im_interp (string, optional) – Image interpolation method. See matplotlib documentation for acceptable values.
  • c_bar (boolean, optional) – Specifies whether or not to place a color bar in the figure window.
  • c_map (matplotlib colormap object, optional) – If “im” array is MxN, then the array values are mapped to a certain color (or gray value) using the supplied colormap.
  • c_lim (1x2 list, optional) – Colormap limits. The first element should be the lower limit, while the second element should be the upper limit. Alternatively, either element may be None to have the algorithm automatically select the limits.
  • c_tick (float, optional) – Tick mark spacing for the color bar. Alternatively, input None to have the algorithm automatically select the tick mark spacing.
  • c_orient (the string 'h' or 'v', optional) – Orientation of the color bar. The default is a vertical orientation.
  • c_label (list, optional) – Color bar label. The first list element is the color bar variable being plotted, while the second element is the color bar units. Both strings should be in LaTeX syntax. The units get automatically wrapped in parentheses. Input a 1x1 list to supply a variable without any units.
  • b_labels (bool, optional) – Specifies whether or not to label images with circled numbers (balloons)
  • scale_plot (float, optional) – Changes the size of the entire plot, but leaves the font sizes the same.
  • font_size (float, optional) – Font size (in points) of the text in the plot.
  • fig (figure object, optional) – Figure window to place the plot in. The default behavior is to place the plot in a new, dedicated, figure window.
  • ax_pos (1x2 list of floats, optional) – Position (in mm) of the lower left corner of the data axes, relative to the lower left corner of the figure window. (For reference, the default distance between tick marks is 20 mm.)
Returns:

  • fig (figure object) – Figure object containing the plot.
  • ax (axes object) – Axes object containing the data.
  • im_obj (image object) – Image object containing the image data

See also

Axes.add_image()