Visualise¶
Functions for plotting knots, supporting different toolkits and types of plot.
pyknotid primarily supports Vispy as the plotting mechanism. Mayavi is semi-supported but may not always work.
Many of these functions can be called in a more convenient way via
methods of the space curve classes
(e.g. Knot
).
API documentation¶
-
pyknotid.visualise.
plot_line
(points, mode='auto', clf=True, **kwargs)[source]¶ Plots the given line, using the toolkit given by mode.
kwargs are passed to the toolkit specific function, except for:
Parameters: - points (ndarray) – The nx3 array to plot.
- mode (str) – The toolkit to draw with. Defaults to ‘auto’, which will automatically pick the first available toolkit from [‘mayavi’, ‘matplotlib’, ‘vispy’], or raise an exception if none can be imported.
- clf (bool) – Whether the existing figure should be cleared before drawing the new one.
-
pyknotid.visualise.
plot_projection
(points, crossings=None, mark_start=False, fig_ax=None, show=True, mark_points=False)[source]¶ Plot the 2d projection of the given points, with optional markers for where the crossings are.
Parameters: - points (array-like) – The nxm array of points in the line, with m >= 2.
- crossings (array-like or None) – The nx2 array of crossing positions. If None, crossings are not plotted. Defaults to None.
-
pyknotid.visualise.
plot_shell_vispy
(func, points, number_of_samples=10, radius=None, zero_centroid=False, sphere_radius_factor=2.0, opacity=0.5, cmap='hsv', **kwargs)[source]¶ func must be a function returning values at angles and points, like OpenKnot._alexander_map_values.
-
pyknotid.visualise.
plot_sphere_lambert_sharp_vispy
(func, circle_points=50, depth=2, output_size=500, edge_color=None, cmap='brg', smooth=0, mesh='circles', **kwargs)[source]¶ func must be a function of sphere angles theta, phi
-
pyknotid.visualise.
plot_sphere_lambert_vispy
(func, circle_points=50, depth=2, edge_color=None, cmap='hsv', smooth=0, mesh='circles', **kwargs)[source]¶ func must be a function of sphere angles theta, phi
-
pyknotid.visualise.
plot_sphere_mollweide_vispy
(func, circle_points=50, depth=2, edge_color=None, cmap='hsv', smooth=0, mesh='circles', **kwargs)[source]¶ func must be a function of sphere angles theta, phi
-
pyknotid.visualise.
plot_sphere_shell_vispy
(func, rows=100, cols=100, radius=1.0, opacity=1.0, translation=(0.0, 0.0, 0.0), method='latitude', edge_color=None, cmap='hsv', smooth=0, cutoff=0.4, cutoff_max=0.8, transparent_side=True, **kwargs)[source]¶ func must be a function of sphere angles theta, phi