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.

Disable `DiscreteNorm` by default for `imshow` plots?

See original GitHub issue

Description

In all the examples available for this package and in my tests, the colorbar maximum number of bins is fixed to 10. There is doesn’t seem to by any to changing this

Steps to reproduce

A “Minimal, Complete and Verifiable Example” will make it much easier for maintainers to help you.

fig, ax = proplot.subplots()
pc = plt.imshow(p.image, extent=[file.bounds[0], file.bounds[1], file.bounds[2], file.bounds[3]], cmap=my_cmap, vmin=0.5, vmax=1.5)
plt.colorbar(pc, ax=ax)
ax.set_xlim([0, 1])
ax.set_ylim([0, 1])
ax.set_xlabel(r"$x/R$")
ax.set_ylabel(r"$y/R$")
plt.show()

Actual behavior: [What actually happened] image

Equivalent steps in matplotlib

Please make sure this bug is related to a specific proplot feature. If you’re not sure, try to replicate it with the native matplotlib API. Matplotlib bugs belong on the matplotlib github page.

fig, ax = plt.subplots()
pc = plt.imshow(p.image, extent=[file.bounds[0], file.bounds[1], file.bounds[2], file.bounds[3]], cmap=my_cmap, vmin=0.5, vmax=1.5)
plt.colorbar(pc, ax=ax)
ax.set_xlim([0, 1])
ax.set_ylim([0, 1])
ax.set_xlabel(r"$x/R$")
ax.set_ylabel(r"$y/R$")
plt.show()

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lukelbdcommented, Aug 20, 2021

This is now fixed! See #233. You can use discrete=False or discrete=True to enable or disable application of DiscreteNorm for different plots, and it is diabled by default for most commands: imshow, matshow, scatter, barbs, quiver, streamplot, hexbin.

1reaction
pratiman-91commented, Mar 23, 2021

This might be help: Default is rc[‘image.levels’] = 11. You can change here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable the output of matplotlib pyplot - python - Stack Overflow
I have an array A of shape (1000, 2000). I use matplotlib.pyplot to plot ...
Read more >
2D plotting commands — ProPlot documentation
By default, proplot uses DiscreteNorm to “discretize” the possible colormap colors for contour and pseudocolor PlotAxes commands (e.g., contourf , pcolor ).
Read more >
matplotlib.pyplot.imshow — Matplotlib 3.6.2 documentation
By default, the colormap covers the complete value range of the supplied data. It is an error to use vmin/vmax when a norm...
Read more >
proplot/2dplots.py at master - GitHub
By default, proplot automatically adjusts the width of. # `~proplot.axes. ... To disable this feature, pass ``inbounds=False`` to the plotting command or.
Read more >
How to change the scale of imshow in matplotlib without ...
This will prevent stretching of the image. By default, imshow sets the aspect of the plot to 1. To display the figure, use...
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