I feel like I’m missing something very obvious here, but I can’t get a scatter plot in pylab to print in black and white. Any and all help would be greatly appreciated. Here’s my code:
from pylab import *
from random import random
ioff()
r = range(10)
x = [3 + i + random() for i in r]
y = [50*i + random() for i in r]
x2 = [5 + i + random() for i in r]
y2 = [5*i + random() for i in r]
scatter(x,y, marker = 'o', hold = True, label = 'collected underwear',cmap=cm.Greys)
scatter(x2,y2, marker = 's', hold = True, label = 'Profit!',cmap=cm.Greys)
legend(loc='upper left')
show()
Thanks,
Adam
if you simply want to specify the color arbitrarily, do
for black, and do
for greyscale,
xcould be any number as long as 0.x is between 0 and 1.But if you want the marker color be determined by another array
z, doso for
you will have