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

Feature Request: Add a possibility to use the colormaps in Paraview #125

Closed
PavelMath opened this issue Dec 18, 2024 · 4 comments
Closed

Comments

@PavelMath
Copy link

Problem to solve

Paraview provides great visualization techniques for 2D and 3D data set. It comes also with some colormaps, but choices are limited here and also a common colormap for python plots and paraview is complex to create. Here it would help if one could easly use ColorCet in paraview.

Solution

Paraview provides the option to import new colormaps from a json or xml file (see Paraview Wiki). I have written a basic python script that can create such a json file for a given palette in color cet: colorCet2Paraview.zip
If you want it might be helpful for others if this file goes to the github and/or if the resulting files (for cc.palette_n and cc.palette) would be available via the web page for download. Also feel free do add things to the script or modify it.

@jbednar
Copy link
Member

jbednar commented Dec 19, 2024

Cool! I agree that it would be great to be able to use colorcet maps in ParaView, but to me it seems more natural for ParaView to add support for the colormap formats established by widely used packages like Bokeh and Matplotlib over a decade ago. That way ParaView users can use any colormap available, not just colorcet. Have you tried opening an issue with ParaView asking for it to support Bokeh-format or Matplotlib-format colormaps directly?

@PavelMath
Copy link
Author

Thanks for the fast reply. That seems to be an interesting solution. I have not tried to open an issue for ParaView yet.
However I am not so sure how this would work then exactly. I imagine it like this:

  • Export a colormap from some python library to a file (written with Matplotlib format)
  • Then import this into ParaView

However this is not so much of a difference then what I offered, just that the file format fits better to the python libs.
As an alternative one could ask for a direct way to import colormaps from certain python libs in paraview, without the need to export them to a file. What would you think is the best approach for this?

@jbednar
Copy link
Member

jbednar commented Dec 19, 2024

D'oh! I guess I was mixing up ParaView with VTK (what ParaView is based on). Since ParaView is a GUI frontend where you can't just import colorcet, I guess you do need to export files unless ParaView chooses to natively import colorcet.

I'm ok if you want to stash your script into assets/colorcet_to_paraview.py in colorcet, though it wouldn't be packaged when colorcet is made into pip or conda packages. You'd then suggest that ParaView add instructions to their website indicating that people can grab that script from github and run it to use colorcet colormaps if they wish. Or the script could go on the ParaView website; as you wish! I don't think it would be something to mention in colorcet's docs.

@PavelMath
Copy link
Author

Thanks for your ideas. That sounds good to me. I have created an issue for paraview here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants