-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add set_data_3d and get_data_3d to Line3d #10111
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
Changes from 4 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mplot3d Line3D now allows {set,get}_data_3d | ||
------------------------------------------- | ||
|
||
Lines created with the 3d projection in mplot3d can now access the data using | ||
``mplot3d.art3d.Line3D.get_data_3d()`` which returns a tuple of array_likes containing | ||
the (x, y, z) data. The equivalent ``mplot3d.art3d.Line3D.set_data_3d(x, y, z)`` | ||
can be used to modify the data of an existing Line3D. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,39 @@ def set_3d_properties(self, zs=0, zdir='z'): | |
self._verts3d = juggle_axes(xs, ys, zs, zdir) | ||
self.stale = True | ||
|
||
def set_data_3d(self, *args): | ||
""" | ||
Set the x, y and z data | ||
|
||
Parameters | ||
---------- | ||
x : array_like | ||
The x-data to be plotted | ||
y : array_like | ||
The y-data to be plotted | ||
z : array_like | ||
The z-data to be plotted | ||
|
||
Notes | ||
----- | ||
Accepts x, y, z arguments or a single array_like (x, y, z) | ||
""" | ||
if len(args) == 1: | ||
self._verts3d = args[0] | ||
else: | ||
self._verts3d = args | ||
|
||
def get_data_3d(self): | ||
""" | ||
Get the current data | ||
|
||
Returns | ||
------- | ||
verts3d : length-3 tuple or array_likes | ||
The current data as a tuple or array_likes | ||
""" | ||
return self._verts3d | ||
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. Does this need to un-juggle the order of the data? 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. It probably should. We're calling
8000
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. Both should probably get the 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. The juggle axis feature is for converting a 2D object into 3D. It essentially states which dimension is going to be a constant. It is not applicable here. |
||
|
||
@artist.allow_rasterization | ||
def draw(self, renderer): | ||
xs3d, ys3d, zs3d = self._verts3d | ||
|
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.
I think you need to add
self.stale = True
here.