Ryan, I should clarify my color issue. Your code is smart enough to generate however many colors are needed but I want to make sure the colors are all unique. Thanks again!
Mike Mike, sorry to send this twice... I should have sent it to the list as well... _______________________________ Mike, If your locations were integers or floats rather than strings, you could just change the scatter call to the following: ax.scatter(dates,IDs,c= locations,marker='d') I don't know about a legend... I don't know if that is possible with a scatter plot (?). Because scatter plots get their colors based off of a color map, you could generate a color bar for your data. You may need to capture the collection object returned from the scatter plot function call, though. Here's your code with these modifications: # Of course, you need to change your locations list to integers rather than strings. fig = plt.figure() ax = fig.add_subplot(111) sc = ax.scatter(dates,IDs,c=locations,marker='d') ax.xaxis_date() fig.autofmt_xdate() plt.colorbar(sc) plt.grid(True) plt.show() If you really need a legend, then you could do a loop of plot commands for each set of unique locations. Using some fancy Numpy masking makes the process easier... import numpy as np import matplotlib.pyplot as plt IDs = np.array([47, 33, 47, 12, 50, 50, 27, 27, 16, 27]) locations = np.array(['201', '207', '207', '205', '204', '201', '209', '209', \ '207','207']) dates = np.array([ 733315.83240741, 733315.83521991, 733315.83681713, 733315.83788194, 733336.54554398, 733336.54731481, 733337.99842593, 733337.99943287, 733338.00070602, 733338.00252315]) fig = plt.figure() ax = fig.add_subplot(111) cs = ['r', 'b', 'g', 'k', 'c'] for n, i in enumerate(np.unique(locations)): ax.plot(dates[locations==i],IDs[locations==i],'d', c=cs[n%len(cs)], label=i) ax.xaxis_date() fig.autofmt_xdate() plt.legend(numpoints=1) plt.grid(True) plt.show() Not sure if this is exactly what you wanted, but I hope it helps a little. Ryan -- View this message in context: http://old.nabble.com/color-problems-in-scatter-plot-tp32584727p32592799.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users