#Import needed libraries | |
import numpy as np | |
from plotnine import * | |
from plotnine.data import * | |
#Add this if you're using Jupyter Notebook | |
%matplotlib inline | |
#Generate data | |
N = 50 | |
x = np.random.rand(N) | |
y = np.random.rand(N) | |
colors = np.random.rand(N) | |
area = (30 * np.random.rand(N))**2 # 0 to 15 point radii | |
#Plot scatter plot | |
p = ggplot(aes(x=x, y=y)) | |
p + geom_point(aes(color=colors)) |