trajoptlib.plot package

Submodules

trajoptlib.plot.common module

common.py

Define global variables being shared across this module

trajoptlib.plot.common.get3dAxis()[source]

Return a fig and an axis that supports 3d plotting

trajoptlib.plot.common.getColorCycle()[source]
trajoptlib.plot.common.getIndAlongAxis(x, axis, ind=0)[source]
trajoptlib.plot.common.setFontSize(SMALL_SIZE=14)[source]

change many font size for better visualization

trajoptlib.plot.compare module

compare.py

Extensively used when I want to compare several samples

trajoptlib.plot.compare.compare(arr, x=None, ax=None, transpose=False, show=False, **kwargs)[source]

Given a matrix or 3d tensor, do some comparison

arr is 3d tensor or list of 2d array x is the x-coordinate for each Cat, so it is a list of 1d nparray trnspose = True make the data be data by sample show = False means not plot immediately TODO: headtail = True means distinguish between 1st and last samples kwargs are allowed configurations, we have to pass in dict

trajoptlib.plot.compare.compareXYZ(arr, ax=None, transpose=False, d3=False, scatter=False, show=False, **kwargs)[source]

hybrid of compare, and plot. Assume we have a cat by N by dim dataset, we want to select a few col/row to plot in 2d/3d

trajoptlib.plot.plot3d module

plot3d.py

trajoptlib.plot.plot3d.addSphere(ax, xc, yc, zc, r, elev=10, color='g', alpha=0.2, **kwargs)[source]
trajoptlib.plot.plot3d.plot(x, y=None, z=None, ax=None, axis=1, noz=False, show=False, scatter=False, **kwargs)[source]

Easy-2-use function for plotting, either line or scatter is supported, 2d and 3d are supported Refer scatter for document

trajoptlib.plot.plot3d.scatter(x, y=None, z=None, ax=None, axis=1, noz=False, show=False, **kwargs)[source]

plot scatter figure. if y and z is None, simply use M, col determines 2d (default) or 3d axis determines column-wise (default) or row-wise plot if y is not None, and M and y are both 1d, plot 2d, otherwise do it for 1st axis if z is not None, do the same for 3d case kwargs might be xaxis, xind, yaxis, yind, zaxis, zind

trajoptlib.plot.plot3d.set_axes_equal(ax)[source]

Make axes of 3D plot have equal scale so that spheres appear as spheres, cubes as cubes, etc.. This is one possible solution to Matplotlib’s ax.set_aspect(‘equal’) and ax.axis(‘equal’) not working for 3D.

Input
ax: a matplotlib axis, e.g., as output from plt.gca().

Module contents

trajoptlib.plot.alignRange(*args)[source]

Given many axes, align the range

trajoptlib.plot.getSizeFont(size=16)[source]
trajoptlib.plot.setTickSize(ax, size=16)[source]
trajoptlib.plot.show(*args, **kwargs)[source]