Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scale parameter in screenshot breaks add_point_labels #5748

Open
chapochn opened this issue Mar 8, 2024 · 0 comments
Open

scale parameter in screenshot breaks add_point_labels #5748

chapochn opened this issue Mar 8, 2024 · 0 comments
Assignees
Labels
bug Uh-oh! Something isn't working as expected.

Comments

@chapochn
Copy link

chapochn commented Mar 8, 2024

Describe the bug, what's wrong, and what you expected.

When putting the scale parameter in screenshot function to some integer different from 1, the labels generated by add_point_labels are not shown properly.

Steps to reproduce the bug.

This works fine (see first screenshot):

import pyvista as pv
import numpy as np
import matplotlib.pyplot as plt

pl = pv.Plotter()

n = 1
points = np.random.randn(n, 3)
labels = [str(i) for i in range(n)]
pl.add_point_labels(points ,labels, point_color='k', point_size=10)

pl.render()
pl.show()

img = pl.screenshot(return_img=True, scale=1)
plt.figure()
plt.imshow(img)
plt.show()

Changing the end to the follow, breaks the label (see second screenshot):

img = pl.screenshot(return_img=True, scale=2)
plt.figure()
plt.imshow(img)
plt.xlim(1000, 1100)
plt.ylim(700, 800)
plt.show()

System Information

--------------------------------------------------------------------------------
  Date: Fri Mar 08 12:45:25 2024 EST

                OS : Darwin
            CPU(s) : 12
           Machine : arm64
      Architecture : 64bit
               RAM : 32.0 GiB
       Environment : Jupyter
       File system : apfs
        GPU Vendor : Apple
      GPU Renderer : Apple M2 Pro
       GPU Version : 4.1 Metal - 88
  MathText Support : True

  Python 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:35:25)
  [Clang 16.0.6 ]

           pyvista : 0.43.3
               vtk : 9.2.6
             numpy : 1.26.4
        matplotlib : 3.8.3
            scooby : 0.9.2
             pooch : 1.8.1
            pillow : 10.2.0
           imageio : 2.34.0
         pyvistaqt : 0.11.0
             PyQt5 : 5.15.9
           IPython : 8.22.1
        ipywidgets : 8.1.2
             scipy : 1.12.0
              tqdm : 4.66.2
        jupyterlab : 4.1.2
             trame : 3.5.2
      trame_client : 2.16.0
      trame_server : 2.17.2
         trame_vtk : 2.8.5
     trame_vuetify : 2.4.2
      nest_asyncio : 1.6.0

Screenshots

Screenshot 2024-03-08 at 12 43 31 PM
Screenshot 2024-03-08 at 12 44 07 PM

@chapochn chapochn added the bug Uh-oh! Something isn't working as expected. label Mar 8, 2024
@tkoyama010 tkoyama010 self-assigned this Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh-oh! Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

2 participants