Skip to content

Instantly share code, notes, and snippets.

@kylefritz
Created November 12, 2017 03:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefritz/ce7ba26d24aeb79ac348cf3654c1067a to your computer and use it in GitHub Desktop.
Save kylefritz/ce7ba26d24aeb79ac348cf3654c1067a to your computer and use it in GitHub Desktop.
Basic Plotting on jupyter notebook
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
x = np.linspace(0, 10, 100)
y = np.cos(x)
plt.plot(x,y)
grid = np.zeros((20,20))
grid[5,5] = 100
grid[2,8] = 50
grid[19,1] = 50
grid[10,10] = 30
# math uses origin bottom left but images use top left. transpose & set origin to get that behavior
plt.imshow(np.transpose(grid), cmap='GnBu',interpolation='none', origin='lower')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment