Skip to content

Instantly share code, notes, and snippets.

@kovid-rathee
Created January 25, 2017 20:11
Show Gist options
  • Save kovid-rathee/65cc085c13567a82f52a3907910f113f to your computer and use it in GitHub Desktop.
Save kovid-rathee/65cc085c13567a82f52a3907910f113f to your computer and use it in GitHub Desktop.
Create a basic scatter plot using matplotlib on random data set generated by NumPy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# if you want a list of integers as your random data set
df = pd.DataFrame(np.random.randint(0,20,size=(20, 2)), columns=list('PQ'))
# if you want a list of random decimal numbers as your random data set
df = pd.DataFrame(np.random.randn(20,2), columns=list('PQ'))
# plot the data
plt.scatter(df.P,df.Q, alpha=0.5)
# plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment