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.

Use discrete colorbars for contours and polygons

See original GitHub issue

If I take the simple contour example from the docs and add a filled=True option, the %%opts seem to have no effect. I can no longer change the cmap or add a colorbar:

%%opts Contours [show_legend=False colorbar=True width=325] (cmap='fire')
x,y = np.mgrid[-50:51, -50:51] * 0.05
img = hv.Image(np.sin(x**2+y**3))
z0, z1 = img.range('z')
hv.operation.contours(img, levels=np.linspace(z0, z1, 5), overlaid=False, filled=True)

image

Holoviews version is 1.8.3-x-ga66181c36 via conda-forge.

Possibly related to #1558

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
philippjfrcommented, Mar 29, 2018

We now support a color_levels argument for discrete color mapping.

1reaction
rabernatcommented, Sep 15, 2017

Great work!

My only comment would be that, with contour plots with discrete levels, we like to see discrete colorbars. This helps to read the precise values from the plot.

In matplotlib it looks like this: contours

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use discrete colorbars for contours and polygons · Issue #1856
My only comment would be that, with contour plots with discrete levels, we like to see discrete colorbars. This helps to read the...
Read more >
mayavi mapping a discrete colorbar on a surface
I have found my answer by using a scipy nearest-neighbour interpolation and using one color by cell of my object. from mayavi import...
Read more >
Colorbars - L3HarrisGeospatial.com
You can display a colorbar that matches discrete contour levels. ... 'Discrete Colorbar Example') ; Display the second function using the original color...
Read more >
Change interval of color bar in contour scatter plot - MathWorks
If you only want n discrete colors you can use any of the colormap functions and specify the number of levels. Theme.
Read more >
Contourf Demo — Matplotlib 3.6.2 documentation
We are using automatic selection of contour levels; this is usually not such a good idea, because they don't occur on nice boundaries,...
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