imshow demonstration


In [1]:
%pylab inline
from biokit.viz import Imshow


Populating the interactive namespace from numpy and matplotlib

Imshow

  • we overwrite the pylab.imshow to change the default behaviour (no interpolation, hot cmap)
  • input can be a dataframe, in which case, X and Y ticks are filled automatically

In [2]:
data = numpy.random.randn(10,10)

In [3]:
imshow(data) # this is the default behaviour in matplotlib


Out[3]:
<matplotlib.image.AxesImage at 0x7ff1d60f5da0>

In [4]:
im = Imshow(data)
im.plot(cmap='jet')



In [5]:
import pandas as pd
df = pd.DataFrame({'A':[1,2], 'B':[3,4]}, index=['X','Y'])
df


Out[5]:
A B
X 1 3
Y 2 4

In [6]:
# by default xticks are rotated by 90 degrees since names could be long 
# but in this example names are short, so we reset the rotation.
Imshow(df).plot(rotation_x=0)



In [ ]: