xlim/ylim options to set visible domain limits indirectly by adjusting camera
See original GitHub issueDescribe what feature you would like added.
Matplotlib 2d plots allow xlim
and ylim
options to set visible axes limits.
In vtk/pyvista, in normal plane views (e.g., camera_position='xy'
), this can be achieved by adjusting camera position, focal points, and elevation angle.
It would be convenient to have xlim
and ylim
options to do this automatically
One possible implementation is to reuse the existing codes that set pre-defined views for special camera_positoin
, e.g., the view_xy
, by using the dimension of a ``virtual’’ plane with the desired bounds.
Of course, we may pass the data to Matplotlib directly for drawing, but this is not always straightforward for unstructured grid.
Currently, my manual solution to set the normal view first (e.g., xy) with proper zooming, then shift the camera_position and focal_point by the same amount.
I apologize if pyvista already has a handy solution for this.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
I’d like to add a
zoom_to_data()
method that might help to this end.A prototype of this method is:
Which can be used like:
This could then be used with a
Plane
to get the desired effect:I can give it a try, but I can’t promise a timeline.
I now think the feature itself might be more clearly defined because we have 3d not 2d.
In normal views (like
view_xy
), it is clear. For an oblique angle view, I’m not sure how to use the three limits. We may guess what the user wants. For example, if xlim and ylim is give, we may set the bounds to a xy plane. If all of xlim, ylim, and zlim are given, the only thing we can reasonably do it to use a box with those limits.