You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have a question and hope that you can help me. I put together a small MCVE.
When you click the button for the first time,
you can see that the 3d (add_mesh, add_points) and 2d (chart.scatter) show up.
If you click it again only the 3d stuff shows up.
Do you have any ideas why?
import sys
import os
os.environ["QT_API"] = "pyqt5"
from qtpy import QtWidgets
import numpy as np
from pyvista import Chart2D
import pyvista as pv
from pyvistaqt import QtInteractor, MainWindow
class MyMainWindow(MainWindow):
def __init__(self, parent=None, show=True):
QtWidgets.QMainWindow.__init__(self, parent)
self.frame = QtWidgets.QFrame()
vlayout = QtWidgets.QVBoxLayout()
self.plotter = QtInteractor(self.frame)
btn1 = QtWidgets.QPushButton("Button 1", self)
vlayout.addWidget(btn1)
btn1.clicked.connect(self.buttonClicked)
vlayout.addWidget(self.plotter)
self.frame.setLayout(vlayout)
self.setCentralWidget(self.frame)
self.show()
def buttonClicked(self):
self.plotter.clear()
data = np.random.standard_normal(size=(100, 3))
actor = self.plotter.add_points(data)
chart = Chart2D()
_x = np.random.standard_normal(100)
_y = np.random.standard_normal(100)
chart.scatter(_x, _y, color="tab:blue", style="d", label="Scores")
self.plotter.add_chart(chart)
self.plotter.add_mesh(pv.Sphere())
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
window = MyMainWindow()
sys.exit(app.exec_())
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a question and hope that you can help me. I put together a small MCVE.
When you click the button for the first time,
you can see that the 3d (add_mesh, add_points) and 2d (chart.scatter) show up.
If you click it again only the 3d stuff shows up.
Do you have any ideas why?
Beta Was this translation helpful? Give feedback.
All reactions