I am learning to draw scatter using matplotlib. However, there is a bug and it seems related with the color argument. Could anyone explain me the mistake? I googled but no answer found. Thanks in advance.
xActA = range(10)
yActA = np.random.randn(10)
xActQ = range(10)
yActQ = np.random.randn(10)
xRa = np.random.randn(10)
yRa = np.random.randn(10)
f1 = figure(1)
scatter(xActA, yActA, c ='b', marker = 'o', facecolors = True, label = 'Answers')
scatter(xActQ, yActQ, c ='r', marker = 'o', facecolors = True, label = 'Questions')
xscale('log')
yscale('log')
title('User activity')
xlabel('Number of posts')
ylabel('Number of users')
legend()
f1.show()
f1.savefig('figure7_test.png')
You are giving facecolors a boolean.
The parameter is defined as:
Just make
facecolor = Noneand it will work. You probably dont want this because you get the same color for the two plots. If you eliminate the parameter you will get automatic colors. If still you need custom colors the easiest way is to indicate them as matplotlib colors (‘yellow, ‘red’, etc)