Comments (1)
Setting the data does not automatically adjust the limits of the color normalization. When you do the first draw with all 0 select the min/max of the data set as the vmin/vmax for the visualization. As both are 0, you end up with a degenerate colormaping.
You can either explicitly set the vmin/vmax when you call imshow
or use im.set_clim
to adjust it everytime through the loop.
The following works for me (with stock Arch packages):
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
fig, ax = plt.subplots()
data = np.random.rand(10, 10)
data.fill(0.0)
im = ax.imshow(data, cmap='viridis', vmin=0, vmax=1)
for _ in range(50):
data = np.random.rand(10, 10)
im.set_data(data)
ax.set_title(f'frame {_}')
plt.draw()
plt.pause(0.1)
plt.ioff()
plt.show()
%history
I am going to close this because I do not think there is a bug in Matplotlib and this is behaving as expected.
from matplotlib.
Related Issues (20)
- [MNT]: scale of the quiver does not print the actually value till after the figure pop up. HOT 1
- [Bug]: "fill_between" not showing on some PDF readers when using "alpha" HOT 1
- [Bug]: 'TimedAnimation' object has no attribute '_framedata' HOT 1
- [ENH]: matplotlib.widgets.PolygonSelector widget initial cursor position at data rather than (0,0) HOT 1
- [Doc]: drawedges attribute described twice in matplotlib.colorbar documentation HOT 5
- [ENH]: Add TypedDict (like) type hints to rcParams HOT 3
- [Bug]: Inconsistent Visualization of Intervals in ax.barh for Different Duration Widths HOT 2
- [Bug]: `set_text` does not work when accessed from `axis.get_xticklabels` HOT 2
- [ENH]: More accurate type stub for `plt.subplots` like VSCode did before. HOT 1
- [ENH]: Band and Sankey Diagramm HOT 2
- [Bug]: constant valued line plot has strange/unexpected y-axis HOT 13
- [Bug]: mpltype custom role breaks sphinx build for third-party projects that have intersphinx links to matplotlib HOT 8
- [Bug]: ImportError: /home/travis/miniconda/envs/env/lib/python3.11/lib-dynload/pyexpat.cpython-311-x86_64-linux-gnu.so: undefined symbol: XML_SetReparseDeferralEnabled HOT 6
- [Doc]: Gallery example showing 3D slice planes HOT 5
- Mathplt HOT 1
- [ENH]: Color along line by a value HOT 8
- [ENH]: Request for linestyle='.' and linestyle='.-' in plt.plot HOT 1
- [Doc]: Tutorial how to write custom wrapper functions HOT 2
- font finding in OSX produces 200+ lines of warnings HOT 5
- [Doc]: Sphinx gallery links mispointed for Axes3D methods HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matplotlib.