How combine line plot and mesh plot? #18
-
I am trying to combine two plots in a single plot window. Basically, the line plot will appear inside the bounds of the mesh, if plotted together correctly. Here is the relevant snippet:
I keep getting only the second mesh plot without the first line plot. To get both, I have to plot them separately in two windows. However, that's not what I want. This module has no attribute "hold" so unable to use something of that sort too. Any help is greatly appreciated. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Are you sure that your axons aren't just much much smaller than your mesh or possibly inside your mesh? That would make them look like they've disappeared when they haven't. Everything you plot goes into the same figure - it's not reset until you call import vtkplotlib as vpl
from stl.mesh import Mesh
import numpy as np
axons = np.random.uniform(-100, 100, (3, 5, 3))
for i in axons:
vpl.plot(i, color ="dark red")
# Read the STL using numpy-stl
path = vpl.data.get_rabbit_stl()
mesh = Mesh.from_file(path)
# Plot the mesh
vpl.mesh_plot(mesh)
# Show the figure
vpl.show() ... gives me the image below: |
Beta Was this translation helpful? Give feedback.
Are you sure that your axons aren't just much much smaller than your mesh or possibly inside your mesh? That would make them look like they've disappeared when they haven't.
Everything you plot goes into the same figure - it's not reset until you call
vpl.show()
orvpl.figure()
- so it should be doing exactly what you want it to do. For example if I add definitions to youraxons
andpath
variables so that I can run your example...