![]() allows for passing to c= an array that corresponds to groups, which will then color the points based on those groups. Optionally one can include argument to both the linestyle and marker parameters. To specify the markerstyle you can include this as a positional argument in the method call, as seen in the example below. To plot a scatter in 3D, use the plot method, as the legend does not support Patch3DCollection as is returned by the scatter method of an Axes3D instance. Ho = plt.scatter(random(10), random(10), marker='x', color=colors) ![]() Hh = plt.scatter(random(10), random(10), marker='o', color=colors) H = plt.scatter(random(10), random(10), marker='o', color=colors) L = plt.scatter(random(10), random(10), marker='o', color=colors)Ī = plt.scatter(random(10), random(10), marker='o', color=colors) Ll = plt.scatter(random(10), random(10), marker='o', color=colors) Lo = plt.scatter(random(10), random(10), marker='x', color=colors) In the code below I've used random values rather than plotting the same range over and over, making all the plots visible (i.e. Also, if you are using scatter plots, use scatterpoints=1 rather than numpoints=1 in the legend call to have only one point for each legend entry. Using the scatter method of the matplotlib.pyplot module should work (at least with matplotlib 1.2.1 with Python 2.7.5), as in the example code below. When I run this, the legend no longer exists, it is a small white box in the corner with nothing in it. Plt.legend((lo,ll,l,a, h, hh, ho),('Low Outlier', 'LoLo','Lo', 'Average', 'Hi', 'HiHi', 'High Outlier'),scatterpoints=1, loc='lower left', ncol=3, fontsize=8) Ho = plt.scatter(xHOutlier, yHOutlier, zHOutlier, marker='x', color=colors) Hh = plt.scatter(xHiHi, yHiHi, zHiHi, marker='o',color=colors) H = plt.scatter(xHi, yHi, zHi, marker='o',color=colors) L = plt.scatter(xLo, yLo, zLo, marker='o',color=colors)Ī = plt.scatter(xAverage, yAverage, zAverage, marker='o',color=colors) Ll = plt.scatter(xLoLo, yLoLo, zLoLo, marker='o', color=colors) lo = plt.scatter(xLOutlier, yLOutlier, zLOutlier, marker='x', color=colors) Each list contains either the x, y, or z variable. With scatter, I changed the range(10) to the lists containing the data points. ![]() Scatter returned an error and scatter changed the graph and returned an error. I tried changing Line2D to Scatter and scatter. Plt.legend((lo,ll,l,a, h, hh, ho),('Low Outlier', 'LoLo','Lo', 'Average', 'Hi', 'HiHi', 'High Outlier'),numpoints=1, loc='lower left', ncol=3, fontsize=8) When I create the legend, the legend shows the correct symbol and color but adds a line through it. I created a 4D scatter plot graph to represent different temperatures in a specific area.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |