Astrid
Astrid

Reputation: 1936

How to make this plot.ly heatmap-esque plot in "pure" python?

Is there an equivalent plotting function and/or a simple way to make this plot.ly plot in python in "pure" python using e.g. matplotlib?

enter image description here

from here.

Just wondering if there is an equivalent function or similar. Cannot find any, or am not searching for the right thing. "heatmap python" only comes up with square plots, and changing their shape seems cumbersome.

Upvotes: 0

Views: 286

Answers (2)

Reblochon Masque
Reblochon Masque

Reputation: 36732

Building on Hun answer, if you don't want your eyes to hurt too much, you can use an alternate color map. Here viridis

import matplotlib.pyplot as plt
import numpy as np
Z = np.random.rand(6, 100)
c = plt.pcolor(Z, cmap='viridis')
plt.show()

enter image description here

and remember: pyplot & numpy will keep your namespace tidy...

Upvotes: 1

Hun
Hun

Reputation: 3857

To give you a simple example, the following will generate the attached plot.

from pylab import *
Z = rand(6, 100) # tried to make it look similar to your plot
c = pcolor(Z)
show()

enter image description here

Upvotes: 1

Related Questions