sgpykit.util.plot

Functions

check_and_convert_to_fig3d(ax)

Check if the given axis is a 3D axis, and convert it if necessary.

clear()

figure_create([nrows, ncols, figsize, dims])

gcf()

grid([flag])

merge_all_args_to_kwargs(args, kwargs[, ...])

Merge positional and keyword arguments into a single dictionary.

parse_matlab_plot_args(*args, **kwargs)

Parse MATLAB-style plot arguments into a format string and keyword arguments.

plot(ax, x, y, *args, **kwargs)

Plot data on a given axis with optional formatting.

plot_3d(ax, x, y, z, *args, **kwargs)

Create a 3D line plot on a given axis with optional formatting.

plot_scatter_3d(ax, x, y, z, *args, **kwargs)

Create a 3D scatter plot on a given axis with optional formatting.

set_legend(location)

Set the legend location in Matplotlib based on MATLAB's legend location strings.

view(azimuth, elevation)

Set the view angle for a 3D plot in Matplotlib.

Classes

Axes3D(fig[, rect, elev, azim, roll, ...])

3D Axes object.

sgpykit.util.plot.check_and_convert_to_fig3d(ax)[source]

Check if the given axis is a 3D axis, and convert it if necessary.

Parameters:
axmatplotlib.axes.Axes

The axis to check and convert.

Returns:
matplotlib.axes.Axes3D

The 3D axis.

sgpykit.util.plot.clear()[source]
sgpykit.util.plot.figure_create(nrows=1, ncols=1, figsize=(10, 8), dims=2)[source]
sgpykit.util.plot.gcf()[source]
sgpykit.util.plot.grid(flag='on')[source]
sgpykit.util.plot.parse_matlab_plot_args(*args, **kwargs)[source]

Parse MATLAB-style plot arguments into a format string and keyword arguments.

Parameters:
*argstuple

Positional arguments for formatting.

**kwargsdict

Keyword arguments for formatting.

Returns:
tuple

A tuple containing the format string and a dictionary of keyword arguments.

sgpykit.util.plot.plot(ax, x, y, *args, **kwargs)[source]

Plot data on a given axis with optional formatting.

Parameters:
axmatplotlib.axes.Axes

The axis to plot on.

xarray_like

The x-coordinates of the data points.

yarray_like

The y-coordinates of the data points.

*argstuple

Additional positional arguments for formatting.

**kwargsdict

Additional keyword arguments for formatting.

Returns:
list of matplotlib.lines.Line2D

The plotted line objects.

sgpykit.util.plot.plot_3d(ax, x, y, z, *args, **kwargs)[source]

Create a 3D line plot on a given axis with optional formatting.

Parameters:
axmatplotlib.axes.Axes3D

The 3D axis to plot on.

xarray_like

The x-coordinates of the data points.

yarray_like

The y-coordinates of the data points.

zarray_like

The z-coordinates of the data points.

*argstuple

Additional positional arguments for formatting.

**kwargsdict

Additional keyword arguments for formatting.

Returns:
matplotlib.lines.Line2D

The plotted line object.

sgpykit.util.plot.plot_scatter_3d(ax, x, y, z, *args, **kwargs)[source]

Create a 3D scatter plot on a given axis with optional formatting.

Parameters:
axmatplotlib.axes.Axes3D

The 3D axis to plot on.

xarray_like

The x-coordinates of the data points.

yarray_like

The y-coordinates of the data points.

zarray_like

The z-coordinates of the data points.

*argstuple

Additional positional arguments for formatting.

**kwargsdict

Additional keyword arguments for formatting.

Returns:
matplotlib.collections.PathCollection

The scatter plot object.

sgpykit.util.plot.set_legend(location)[source]

Set the legend location in Matplotlib based on MATLAB’s legend location strings.

Parameters:
locationstr

The desired location for the legend. Options include: ‘NorthEast’, ‘NorthWest’, ‘SouthEast’, ‘SouthWest’, ‘North’, ‘South’, ‘East’, ‘West’, ‘Best’, ‘NorthOutside’, ‘SouthOutside’, ‘EastOutside’, ‘WestOutside’.

Raises:
ValueError

If the provided location is not valid.

sgpykit.util.plot.view(azimuth, elevation)[source]

Set the view angle for a 3D plot in Matplotlib.

Parameters:
azimuthfloat

The azimuthal angle in degrees.

elevationfloat

The elevation angle in degrees.