Plotting Matrix using Python
I have recently started to sharpen my machine learning skills and exploring couple of new interesting problems. In my college, I was quite good in mathematics but really haven't seen so far its implementation but machine learning is place where I find out its true use case.
Let me start with something very basic and going forward in couple of blogs share my experience of machine learning - Shift from Data Engineering to Machine Leaning Engineering.
Today I used Python and Matlab API to plot a 2-D matrix. Its quite exciting and good to see something colorful. Specially for a person like me who has always spend his most of time in back-white screen(linux terminal).
Pre-requisite : I have installed Jupyter notebook (most popular in data scientist) using Anaconda.
Source Code :
Let me start with something very basic and going forward in couple of blogs share my experience of machine learning - Shift from Data Engineering to Machine Leaning Engineering.
Today I used Python and Matlab API to plot a 2-D matrix. Its quite exciting and good to see something colorful. Specially for a person like me who has always spend his most of time in back-white screen(linux terminal).
Pre-requisite : I have installed Jupyter notebook (most popular in data scientist) using Anaconda.
Now I am going to create a matrix using numpy followed by matlab to plot.
Source Code :
import numpy as np import matplotlib.pyplot as matrixPlot #Create a matrix A=np.matrix('1,2,3;9,4,7;-1,9,6') #plot matrix matrixPlot.ion() #Turns interactive mode on matrixPlot.imshow(A, interpolation='none')
pyplot() function take multiple properties and one of them is interpolation property. You can explore by changing it someother values to checkout magic.
Lets set interpolation to 'kaiser'
import numpy as np import matplotlib.pyplot as matrixPlot #Create a matrix A=np.matrix('1,2,3;9,4,7;-1,9,6') #plot matrix matrixPlot.ion() #Turns interactive mode on matrixPlot.imshow(A, interpolation='kaiser')
Reference : https://matplotlib.org/api/pyplot_api.html
Happy Coding..!!!
Comments
Post a Comment