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

rgb parameter for add_composite not working #6012

Open
user27182 opened this issue May 1, 2024 · 0 comments
Open

rgb parameter for add_composite not working #6012

user27182 opened this issue May 1, 2024 · 0 comments
Assignees
Labels
bug Uh-oh! Something isn't working as expected.

Comments

@user27182
Copy link
Contributor

user27182 commented May 1, 2024

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

If I plot a point cloud with the rgb option like this:

import pyvista as pv
import numpy as np

BLACK = [0.0, 0.0, 0.0]
WHITE = [1.0, 1.0, 1.0]
RED = [1.0, 0.0, 0.0]
GREEN = [0.0, 1.0, 0.0]
BLUE = [0.0, 0.0, 1.0]

rng = np.random.default_rng(seed=1)
points = rng.random((5, 3))

point_cloud = pv.PointSet(points)
point_cloud['colors'] = [WHITE, BLACK, RED, GREEN, BLUE]
point_cloud.plot(render_points_as_spheres = True, point_size = 100, rgb = True)

I get this result:
image

But if I try to plot each point as a multiblock like this:

white_point = pv.PointSet(points[0])
white_point['colors'] = [WHITE]
black_point = pv.PointSet(points[1])
black_point['colors'] = [BLACK]
red_point = pv.PointSet(points[2])
red_point['colors'] = [RED]
green_point = pv.PointSet(points[3])
green_point['colors'] = [GREEN]
blue_point = pv.PointSet(points[4])
blue_point['colors'] = [BLUE]

multiblock = pv.MultiBlock([white_point,black_point,red_point,green_point,blue_point])
multiblock.plot(render_points_as_spheres = True, point_size = 100, rgb = True)

I get this result:
image

I expected the second image to match the first. Not sure why they're colored red and blue.

The scalars in the multiblock seem to be ok

print(multiblock.combine()['colors'])

pyvista_ndarray([[0., 0., 0.],
                 [1., 1., 1.],
                 [1., 0., 0.],
                 [0., 1., 0.],
                 [0., 0., 1.]])

For reference, setting rgb=False with the multiblock produces this result:

image

Steps to reproduce the bug.

See above.

System Information

OS : Darwin
            CPU(s) : 8
           Machine : arm64
      Architecture : 64bit
               RAM : 16.0 GiB
       Environment : IPython
       File system : apfs
        GPU Vendor : Apple
      GPU Renderer : Apple M2
       GPU Version : 4.1 Metal - 88
  MathText Support : True
  Python 3.12.2 (v3.12.2:6abddd9f6a, Feb  6 2024, 17:02:06) [Clang 13.0.0
  (clang-1300.0.29.30)]
           pyvista : 0.44.dev0
               vtk : 9.3.0
             numpy : 1.26.4
        matplotlib : 3.8.2
            scooby : 0.9.2
             pooch : 1.8.0
            pillow : 10.2.0
           imageio : 2.34.0
           IPython : 8.21.0
          colorcet : 3.1.0
           cmocean : 3.1.3
        ipywidgets : 8.1.2
             scipy : 1.12.0
              tqdm : 4.66.2
            meshio : 5.3.5
        jupyterlab : 4.1.4
    pytest_pyvista : 0.1.8
             trame : 3.5.3
      trame_client : 2.16.1
      trame_server : 2.17.2
         trame_vtk : 2.8.5
     trame_vuetify : 2.4.3
      nest_asyncio : 1.6.0
--------------------------------------------------------------------------------

Screenshots

No response

@user27182 user27182 added the bug Uh-oh! Something isn't working as expected. label May 1, 2024
@tkoyama010 tkoyama010 self-assigned this May 10, 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