diff --git a/docs/changes.md b/docs/changes.md index d75645d4..cf05c4db 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -13,6 +13,7 @@ - added `basegrid.extract_cells_on_cylinder()` - added `count_vertices()` method - added `copy_data_from()` method to transfer all cell and point data from an object to another. +- fixed `metadata` association --- ### `pointcloud.py` @@ -90,9 +91,7 @@ examples/pyplot/fit_curve.py examples/pyplot/histo_2d_a.py examples/pyplot/histo_2d_b.py examples/other/flag_labels2.py - -------------------------- -### Deleted +examples/volumetric/image_false_colors.py ### Broken examples/simulations/lorenz.py diff --git a/examples/advanced/fitspheres2.py b/examples/advanced/fitspheres2.py index 98f5a966..4363fe16 100644 --- a/examples/advanced/fitspheres2.py +++ b/examples/advanced/fitspheres2.py @@ -7,7 +7,7 @@ plt = Plotter() -msh = Mesh(dataurl+"cow.vtk").alpha(0.3) +msh = Mesh(dataurl+"cow.vtk").c("cyan7") pts1, pts2, vals, cols = [], [], [], [] @@ -29,7 +29,7 @@ plt += msh plt += Points(pts1, c=cols) plt += Lines(pts1, pts2, c="black") -plt += histogram(vals, xtitle='radius', xlim=[0,2]).pos(-1,0.5,-1) +plt += histogram(vals, xtitle='radius', xlim=[0,2]).as2d(pos="bottom-left") plt += __doc__ plt.show().close() diff --git a/examples/other/run_all.sh b/examples/other/run_all.sh index 5eb08228..b8fb0c48 100755 --- a/examples/other/run_all.sh +++ b/examples/other/run_all.sh @@ -10,8 +10,11 @@ echo echo Running clone2d.py python3 clone2d.py -echo Running flag_labels.py -python3 flag_labels.py +echo Running flag_labels1.py +python3 flag_labels1.py + +echo Running flag_labels2.py +python3 flag_labels2.py echo Running icon.py python3 icon.py diff --git a/examples/simulations/pendulum_ode.py b/examples/simulations/pendulum_ode.py index 0235fbd6..57d38f2a 100644 --- a/examples/simulations/pendulum_ode.py +++ b/examples/simulations/pendulum_ode.py @@ -52,7 +52,7 @@ def derivs(state, t): l1 = Line([[0,0], P1[i], P2[i]]).lw(7).c("blue2", 1.0) l2 = Line([[0,0], P1[j], P2[j]]).lw(6).c("blue2", 0.4) l3 = Line([[0,0], P1[k], P2[k]]).lw(5).c("blue2", 0.2) - plt.show(l1, l2, l3, ax, zoom=1.4).clear() + plt.clear().show(l1, l2, l3, ax, zoom=1.4) pb.print() plt.interactive().close() diff --git a/examples/volumetric/numpy2volume2.py b/examples/volumetric/numpy2volume2.py index 6c289a2c..a711a0c3 100644 --- a/examples/volumetric/numpy2volume2.py +++ b/examples/volumetric/numpy2volume2.py @@ -7,7 +7,7 @@ data_matrix[30:50, 30:60, 30:70] = 2 data_matrix[50:69, 60:79, 70:89] = 3 -vol = Volume(data_matrix, c=['white','b','g','r'], mapper='gpu') +vol = Volume(data_matrix, c=['white','b','g','r'], mode=1) vol.add_scalarbar3d() vol.print() diff --git a/vedo/mesh.py b/vedo/mesh.py index 17252fbe..4bee2246 100644 --- a/vedo/mesh.py +++ b/vedo/mesh.py @@ -151,7 +151,7 @@ def __init__( tact = vedo.utils.trimesh2vedo(inputobj) self._data = tact.polydata() - elif "meshio" in inputtype: # meshio-4.0.11 + elif "meshio" in inputtype: if len(inputobj.cells): mcells = [] for cellblock in inputobj.cells: @@ -169,14 +169,16 @@ def __init__( self._data.GetPointData().AddArray(vdata) except AssertionError: print("Could not add meshio point data, skip.") - try: - if len(inputobj.cell_data): - for k in inputobj.cell_data.keys(): - vdata = numpy2vtk(inputobj.cell_data[k]) - vdata.SetName(str(k)) - self._data.GetCellData().AddArray(vdata) - except AssertionError: - print("Could not add meshio cell data, skip.") + # try: + # if len(inputobj.cell_data): + # for k in inputobj.cell_data.keys(): + # #print(inputobj.cell_data) + # exit() + # vdata = numpy2vtk(inputobj.cell_data[k]) + # vdata.SetName(str(k)) + # self._data.GetCellData().AddArray(vdata) + # except AssertionError: + # print("Could not add meshio cell data, skip.") elif "meshlab" in inputtype: self._data = vedo.utils.meshlab2vedo(inputobj) diff --git a/vedo/plotter.py b/vedo/plotter.py index bf240861..046564c1 100644 --- a/vedo/plotter.py +++ b/vedo/plotter.py @@ -3229,7 +3229,7 @@ def add_inset(self, *actors, **options): self.widgets.append(widget) return widget - def clear(self, at=None, render=True, deep=False): + def clear(self, at=None, deep=False, render=False): """Clear the scene from all meshes and volumes.""" if at is not None: renderer = self.renderers[at] diff --git a/vedo/pyplot.py b/vedo/pyplot.py index de83a45f..efd17cf6 100644 --- a/vedo/pyplot.py +++ b/vedo/pyplot.py @@ -650,6 +650,11 @@ def as2d(self, scale=1, pos="center", padding=0.05): """ x0, x1 = self.xbounds() y0, y1 = self.ybounds() + pp = self.pos() + x0 -= pp[0] + x1 -= pp[0] + y0 -= pp[1] + y1 -= pp[1] if not utils.is_sequence(padding): padding = (padding, padding) diff --git a/vedo/version.py b/vedo/version.py index e7bd291d..5fbe8cff 100644 --- a/vedo/version.py +++ b/vedo/version.py @@ -1 +1 @@ -_version='2022.4.1.dev10' +_version='2022.4.2'