visualizer

Simple plotter for your linkages

Created on Mon Jun 14 12:13:58 2021.

@author: HugoFara

This module makes visualisation of linkages easy using matplotlib.

pylinkage.visualizer._get_color(joint)

Search in COLOR_SWITCHER for the corresponding color.

pylinkage.visualizer.movement_bounding_bow(loci)

Return the general bounding box of a group of loci.

pylinkage.visualizer.plot_kinematic_linkage(linkage, fig, axis, loci, frames=100, interval=40)

Plot a linkage with an animation.

linkagepylinkage.linkage.Linkage

DESCRIPTION.

figmatplotlib.figure.Figure

Figure to support the axes.

axismatplotlib.axes._subplots.AxesSubplot

The subplot to draw on.

locilist

list of list of coordinates.

framesint, optional

Number of frames to draw the linkage on. The default is 100.

intervalfloat, optional

Delay between frames in milliseconds. The default is 40 (24 fps).

None.

pylinkage.visualizer.plot_static_linkage(linkage, axis, loci, locus_highlights=None, show_legend=False)

Plot a linkage without movement.

linkageLinkage

The linkage you want to see.

axisArtist

The graph we should draw on.

locisequence

List of list of coordinates. They will be plotted.

locus_highlightslist, optional

If a list, shoud be a list of list of coordinates you want to see highlighted. The default is None.

show_legendbool, optional

To add an automatic legend to the graph. The default is False.

None.

pylinkage.visualizer.show_linkage(linkage, save=False, prev=None, loci=None, points=100, iteration_factor=1, title='0', duration=5, fps=24)

Display results as an animated drawing.

linkagepylinkage.linkage.Linkage

The Linkage you want to draw.

savebool, optional

To save the animation. The default is False.

prevlist, optional

Previous coordinates to use for linkage. The default is None.

locilist, optional

list of loci. The default is None.

pointsint, optional

Number of point to draw for a crank revolution. Useless when loci is set. The default is 100.

iteration_factorfloat, optional

A simple way to subdivide the movement. The real number of points will be points * iteration_factor. The default is 1.

titlestr, optional

Figure title. The default is str(len(ani)).

durationfloat, optional

Animation duration (in seconds). The default is 5.

fpsfloat, optional

Number of frame per second for the output video. The default is 24.

None.

pylinkage.visualizer.swarm_tiled_repr(linkage, swarm, fig, axes, dimension_func=None, points=12, iteration_factor=1)

Show all the linkages in a swarm in tiled mode.

linkagepylinkage.linkage.Linkage

The original Linkage that will be MODIFIED.

swarmlist

Sequence of 3 elements: agents, interation number and initial positions.

figmatplotlib.figure.Figure

Figure to support the axes.

axesmatplotlib.axes._subplots.AxesSubplot

The subplot to draw on.

pointsint, optional

Number of steps to use for each Linkage. The default is 12.

iteration_factorfloat, optional

A simple way to subdivide the movement. The real number of points will be points * iteration_factor. The default is 1.

dimension_funccallable, optional

If you want a special formatting of dimensions from agents before passing them to the linkage.

None.

pylinkage.visualizer.update_animated_plot(linkage, index, images, loci)

Modify im, instead of recreating it to make the animation run faster.

linkageTYPE

DESCRIPTION.

indexint

Frame index.

imageslist of images Artists

Artist to be modified.

locilist

list of locuses.

imlist of images Artists

Updated version.