<phob...@geosyntec.com> wrote:

> ...maybe dividing the markers up into 2, 3, or 4 sections would be  
> useful too.
> ...

There's a gallery example doing that in general, making pie-charts out  
of the markers:

http://matplotlib.sourceforge.net/examples/api/scatter_piecharts.html

although I think my demo of it shows off its data-representation better:

# Piechart markers from matplotlib gallery, thanks to Manuel Metz for  
the original example
# CPHLewis, 2010.

import math
import numpy as np
import matplotlib.pyplot as plt

def payoff(x,y):
     return x*y*400

def outcome_xwins(x,y):
     return x/(x+y)

def outcome_ywins(x,y):
     return y/(x+y)

x_cases = [ .25, .5, .75]
y_cases = [ .33, .5, .66]
outcomes = [('x wins', outcome_xwins, 'blue'),
             ('y wins', outcome_ywins, 'green')] #the name,  
calculation, and plotting color for categories of outcome

fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('Small multiples: pie charts calculated based on (x,y)')
legend_once = True
#At each point in the plot we calculate everything about the outcomes.
for x in x_cases:
     for y in y_cases:
         size = payoff(x,y)
         start_at = 0
         for result in outcomes:
             result_share = result[1](x,y)
             xpt = [0] + np.cos(np.linspace(2*math.pi*start_at,  
2*math.pi*(result_share+start_at), 10)).tolist()
             ypt = [0] + np.sin(np.linspace(2*math.pi*start_at,  
2*math.pi*(result_share+start_at), 10)).tolist()
             xypt = zip(xpt, ypt)
             ax.scatter([x],[y], marker = (xypt, 0), s = size,  
facecolor = result[2], label=result[0])
             start_at = start_at + result_share
         if legend_once: ax.legend() #don't know why this isn't  
picking up the labels.
         legend_once = False
plt.show()






------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to