John,
I'll give this method a try also.
Thanks for the ideas!

Mike


John Ladasky-3 wrote:
> 
> On Mon, 2011-10-03 at 12:49 -0700, Michael Castleton wrote:
>> Hello,
>> I am using Matplotlib 1.0.0 in Python 2.6.
>> I am trying to plot time series data of unique IDs and color the points
>> based on location. Each data point has a unique ID value, a date value,
>> and
>> a location value.
>> The unique IDs and date values are plotting fine but I am unable to
>> control
>> the color and subsequently the legend.
> 
>> I've been trying to figure out how to set color = locations with no
>> success.
>> Any ideas out there?
> 
> Michael, if I were you, I would reorganize and group your data into
> several separate scatter data sets, based on the location parameter.
> Then, color each SET the color that you want.  Here's a start, from the
> data as you provided it:
> 
>>>> points = [(a, b, c) for a, b, c in zip(locations, IDs, dates)]
>>>> for p in points:
>         print p
> 
> ('201', 47, 733315.83240741002)
> ('207', 33, 733315.83521991002)
> ('207', 47, 733315.83681712998)
> ('205', 12, 733315.83788193995)
> ('204', 50, 733336.54554397997)
> ('201', 50, 733336.54731480998)
> ('209', 27, 733337.99842593004)
> ('209', 27, 733337.99943286995)
> ('207', 16, 733338.00070602004)
> ('207', 27, 733338.00252314995)
> 
>>>> def make_dict(lst):
>         d = {}
>         for a, b, c in lst:
>           try:
>                 d[a][0].append(b)
>                 d[a][1].append(c)
>             except KeyError:
>                 d[a] = ([b],[c])
>         return d
> 
>>>> collated = make_dict(points)
>>>> for k in collated:
>         print k, collated[k]
> 
> 201 ([47, 50], [733315.83240741002, 733336.54731480998])
> 209 ([27, 27], [733337.99842593004, 733337.99943286995])
> 205 ([12], [733315.83788193995])
> 204 ([50], [733336.54554397997])
> 207 ([33, 47, 16, 27], [733315.83521991002, 733315.83681712998,
> 733338.00070602004, 733338.00252314995])
> 
>>From collated, you could then plot five scattergrams, each of a
> different color, in the same axes object.
> 
> 
> ------------------------------------------------------------------------------
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/color-problems-in-scatter-plot-tp32584727p32593466.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

Reply via email to