Tom Dawn Tom Dawn - 1 year ago 167
Python Question

python plot large dimension data

I have a 1800*100000000 matrix, and I want to plot it in python using code below:

import matplotlib.pyplot as plt

The result is disappointing, it looks like a line because of little row number compared to column number:

enter image description here

How can I do it correctly?

Answer Source

spy() accepts a number of keyword arguments, aspect in particular is interesting...

In [1]: import numpy as np
In [2]: import matplotlib.pyplot as plt
In [3]: a = np.random.random((25,250))>0.6
In [4]: %matplotlib
Using matplotlib backend: Qt4Agg
In [5]: plt.spy(a)
Out[5]: <matplotlib.image.AxesImage at 0x7f9ad1a790b8>


In [6]: plt.spy(a, aspect='auto')
Out[6]: <matplotlib.image.AxesImage at 0x7f9ad1139d30>

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download