Setting different color for each series in scatter plot on matplotlib

Suppose I have three data sets: X = [1,2,3,4] Y1 = [4,8,12,16] Y2 = [1,4,9,16] I can scatter plot this: from matplotlib import pyplot as plt plt.scatter(X,Y1,color=”red”) plt.scatter(X,Y2,color=”blue”) plt.show() How can I do this with 10 sets? I searched for this and could find any reference to what I’m asking. Edit: clarifying (hopefully) my question … Read more

Label axes on Seaborn Barplot

I’m trying to use my own labels for a Seaborn barplot with the following code: import pandas as pd import seaborn as sns fake = pd.DataFrame({‘cat’: [‘red’, ‘green’, ‘blue’], ‘val’: [1, 2, 3]}) fig = sns.barplot(x = ‘val’, y = ‘cat’, data = fake, color=”black”) fig.set_axis_labels(‘Colors’, ‘Values’) However, I get an error that: AttributeError: ‘AxesSubplot’ … Read more

ImportError: No module named matplotlib.pyplot

I am currently practicing matplotlib. This is the first example I practice. #!/usr/bin/python import matplotlib.pyplot as plt radius = [1.0, 2.0, 3.0, 4.0] area = [3.14159, 12.56636, 28.27431, 50.26544] plt.plot(radius, area) plt.show() When I run this script with python ./plot_test.py, it shows plot correctly. However, I run it by itself, ./plot_test.py, it throws the followings: … Read more