-
Notifications
You must be signed in to change notification settings - Fork 24
Workng update #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Workng update #101
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
|
|
||
| import os | ||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
|
|
||
|
|
||
| __all__ = ['plot_points', 'plot_points_2d', 'plot_points_3d'] | ||
|
|
@@ -71,6 +72,39 @@ def plot_points_2d(coordinates, axis=None, colour='red', size=15, title=None, | |
|
|
||
|
|
||
| def plot_points_3d(coordinates, axis=None, colour='red', size=15, title=None, **kwargs): | ||
| """ | ||
| Utility function to plot 3D scattered points using matplotlib. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| coordinates : 2-dimensional array | ||
| Coordinates of the points to be plotted, shape should be (n_points, 3). | ||
| axis : MayaVi axis, optional | ||
| Axis in which to make the plotting, defaults to new empty one. | ||
| colour : str | ||
| Colour to apply to the points, defaults to red. | ||
| size : float | ||
| Size of the plotted points, defaults to 15. | ||
| title : str, optional | ||
| Figure title, defaults to empty title. | ||
| """ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check other matplotlib functions to add display test at top |
||
| fig = plt.figure(figsize=(10, 8)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check how other matplotlib functions are written, where we let the user provide some external figure/axes and, if not, we create create ones |
||
| ax = fig.add_subplot(111, projection='3d') | ||
| ax.set_title('3D View: Tangent Points with Out-of-Plane Displacement') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. title should be provided externally as parameter, as done in other functions like this |
||
|
|
||
| ax.plot(coordinates[:, 0], coordinates[:, 1], coordinates[:, 2], 'o') | ||
|
|
||
| ax.set_xlabel('X (mm)') | ||
| ax.set_ylabel('Y (mm)') | ||
| ax.set_zlabel('Z (mm)') | ||
| ax.legend() | ||
| ax.grid(True) | ||
| ax.set_box_aspect([1, 1, 0.5]) | ||
| plt.tight_layout() | ||
| plt.show() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in all of these functions, we return the axis instead of plotting inside the function - remove these last two lines and change to |
||
|
|
||
|
|
||
| def plot_points_3d_mayavi(coordinates, axis=None, colour='red', size=15, title=None, **kwargs): | ||
| """ | ||
| Utility function to plot 3D scattered points using MayaVi. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you change the name to
plot_points_3d_matplotlib?