Giter Site home page Giter Site logo

Comments (3)

GuillaumeFavelier avatar GuillaumeFavelier commented on May 25, 2024 1

Thanks for reporting, I'll take a look later today 👌

I hope to reproduce it at least 😅

from pyvistaqt.

GuillaumeFavelier avatar GuillaumeFavelier commented on May 25, 2024

I can reproduce the inconsistency:

PyVista PyVistaQt
image image
PyVista
import pyvista as pv

from pyvista import examples


def cell_picking(picked_cells):
    reset_camera = None  # change here
    plotter.add_mesh(
        picked_cells,
        color='pink',
        style='wireframe',
        name='picked_cells',
        reset_camera=reset_camera
    )
    plotter.add_point_labels(
        picked_cells.cell_centers(),
        'Spatial Cell Data',
        name='picked_cell_labels',
        reset_camera=reset_camera
    )


grid = examples.load_uniform()

plotter = pv.Plotter(shape=(1, 2))
plotter.subplot(0, 0)
plotter.add_axes()
plotter.add_mesh(grid, color='white', show_edges=True)
plotter.enable_cell_picking(grid, cell_picking)
plotter.subplot(0, 1)
plotter.add_axes()
plotter.show()
PyVistaQt
import sys

from PyQt5.QtWidgets import QApplication, QMainWindow

from pyvista import examples
from pyvistaqt import QtInteractor


class Viewer(QMainWindow):

    def __init__(self):
        super(Viewer, self).__init__()

        grid = examples.load_uniform()

        self.plotter = QtInteractor(self, shape=(1, 2))
        self.plotter.subplot(0, 0)
        self.plotter.add_axes()
        self.plotter.add_mesh(grid, color='white', show_edges=True)
        self.plotter.enable_cell_picking(grid, self.cell_picking)
        self.plotter.subplot(0, 1)
        self.plotter.add_axes()
        self.plotter.show()
        self.setCentralWidget(self.plotter)

    def cell_picking(self, picked_cells):
        reset_camera = None  # change here
        self.plotter.add_mesh(
            picked_cells,
            color='pink',
            style='wireframe',
            name='picked_cells',
            reset_camera=reset_camera
        )
        self.plotter.add_point_labels(
            picked_cells.cell_centers(),
            'Spatial Cell Data',
            name='picked_cell_labels',
            reset_camera=reset_camera
        )


if __name__ == '__main__':
    app = QApplication(sys.argv)
    viewer = Viewer()
    viewer.show()
    viewer.resize(1024, 768)
    sys.exit(app.exec_())

from pyvistaqt.

akaszynski avatar akaszynski commented on May 25, 2024

Issue seems to be related to resetting the camera.

from pyvistaqt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.