To add a legend to the plot, use the legend() method.We define the data coordinates by using the random() function.Then we use the scatter() method to create a scatter plot, and we also pass marker, color, and label as a parameter.In the above example, first, we import matplotlib.pyplot and random library.Here we’ll see an example of scatter plot markers color bt labels.ĭata1 = plt.scatter(random(30), random(30), marker='d',ĭata2 = plt.scatter(random(50), random(50), marker='d',ĭata3 = plt.scatter(random(25), random(25), marker='d',ĭata4 = plt.scatter(random(20), random(20), marker='d',ĭata5 = plt.scatter(random(10), random(10), marker='d', Read: Matplotlib default figure size Matplotlib scatter plot color by label To create a scatter plot, use scatter() function and we also facecolors, s, and alpha as a parameter to set color of marker, size of marker, and transparency of marker respectively.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |