Skip to content

Instantly share code, notes, and snippets.

View krshrimali's full-sized avatar
💻
Sup?

Kushashwa Ravi Shrimali krshrimali

💻
Sup?
View GitHub Profile
@krshrimali
krshrimali / README.md
Created December 20, 2017 12:19 — forked from fasiha/README.md
How to visualize 2D arrays in Matplotlib/Python (like imagesc in Matlab)

Visualizing rectangular 2D arrays in Python and Matplotlib the way you do with Matlab’s imagesc

Say you have a very rectangular 2D array arr, whose columns and rows correspond to very specific sampling locations x and y. That is, the arr[i, j] entry corresponds to some measurement taken at x[j] and y[i].

Matlab’s imagesc shows you this quite meaningfully:

x = linspace(-100, -10, 10);
y = [-8 -3];
data = randn(numel(y), numel(x));