question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Coloring by scalar not working in 0.33.3

See original GitHub issue

I updated to Pyvista 0.33.3 today, from 0.31.3. I still use the same VTK build.

I have the following small plotting script:

pv.set_plot_theme("document")
plotter = pv.Plotter(window_size=[1920, 1200])

plotter.add_mesh(grid, scalars='array', style="points", categories=True)
_ = plotter.add_axes(line_width=5)

plotter.camera_position = 'iso'
plotter.show(screenshot='probes.png', auto_close=False)

plotter.close()

that previously (0.31.3) produced this plot: probes-0 31 3

With 0.33.3 the result is: probes-0 33 3

I.e. the coloring by the scalar ‘array’ does not work. The colorbar is scaled correctly, though. I attach a complete input file and plot script here: pyvista-probes.tar.gz

System Information:

0.31.3:

--------------------------------------------------------------------------------
  Date: Wed Mar 16 14:22:42 2022 UTC

                OS : Linux
            CPU(s) : 16
           Machine : x86_64
      Architecture : 64bit
               RAM : 62.6 GiB
       Environment : Python
        GPU Vendor : Mesa/X.org
      GPU Renderer : llvmpipe (LLVM 12.0.1, 256 bits)
       GPU Version : 4.5 (Core Profile) Mesa 21.3.0

  Python 3.8.11 (default, Sep  1 2021, 12:33:46)  [GCC 9.3.1 20200408 (Red Hat
  9.3.1-2)]

           pyvista : 0.31.3
               vtk : 9.1.20211118
             numpy : 1.21.4
           imageio : 2.13.3
           appdirs : 1.4.4
            scooby : 0.5.9
            meshio : 4.4.6
        matplotlib : 3.4.3
          colorcet : 3.0.0
             scipy : 1.7.3
--------------------------------------------------------------------------------

0.33.3:

--------------------------------------------------------------------------------
  Date: Wed Mar 16 14:22:23 2022 UTC

                OS : Linux
            CPU(s) : 16
           Machine : x86_64
      Architecture : 64bit
               RAM : 62.6 GiB
       Environment : Python
        GPU Vendor : Mesa/X.org
      GPU Renderer : llvmpipe (LLVM 12.0.1, 256 bits)
       GPU Version : 4.5 (Core Profile) Mesa 21.3.0

  Python 3.8.11 (default, Sep  1 2021, 12:33:46)  [GCC 9.3.1 20200408 (Red Hat
  9.3.1-2)]

           pyvista : 0.33.3
               vtk : 9.1.20211118
             numpy : 1.22.3
           imageio : 2.16.1
           appdirs : 1.4.4
            scooby : 0.5.12
        matplotlib : 3.4.3
          colorcet : 3.0.0
             scipy : 1.8.0
--------------------------------------------------------------------------------

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
akaszynskicommented, Aug 1, 2022

You’re right. When you load it it’s indeed not in grid.point_data:

pyvista DataSetAttributes
Association     : POINT
Active Scalars  : None
Active Vectors  : None
Active Texture  : None
Active Normals  : None
Contains arrays : None

Looks like it’s added by the plotter, because it indeed shows up after adding it with add_mesh

pyvista DataSetAttributes
Association     : POINT
Active Scalars  : None
Active Vectors  : None
Active Texture  : None
Active Normals  : None
Contains arrays :
    index                   int32      (5928,)
    array                   int32      (5928,)

This is why I would have prefered to have copy_mesh=True, these sorts of weird edge cases that crop up.

This is still a weird bug, and I think it has to do with the fact that n_cells == n_points and we have some bad logic somewhere in there.

1reaction
hakostracommented, Apr 19, 2022

Ok, further update: The first commit to introduce the bug is https://github.com/pyvista/pyvista/commit/d8a8873d84c41a44f3e08d7468233e9b73f61122

Huge commit so it’s not trivial to spot the issue…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases · pyvista/pyvista - GitHub
... Resolve issues with scalars in cell_data_to_point_data API docs by @RobPasMue in #3011 ... Unified Color class and color_like type. by @dcbr in...
Read more >
color_by scalars not working - Web Support - ParaView
I have added two scalars to this data and they can be seen in Glance. The question is why I don't see the...
Read more >
Shape-Out 2 Documentation
Shape-Out 2 can be installed via multiple channels. 1. Windows installer: Download the latest version for your architecture (i.e..
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found