Hi All, 
I'm trying to create a set of strip charts so that I can see the relationships 
between a large number of time series.  I'd like to label the y-axis with a 
name on the left side and a value/percentile on the right hand side.  I can get 
the names on the left axis, and it looks very nice (yay Matplotlib!).  When I 
try to the code below I don't get the output I'd like.  None of the explicit 
tick labels that I'm setting make it to the display, and also the 3 charts on 
the page aren't kept separate (left tick labels from chart 132 hit the right 
tick labels from chart 131).  Any suggestions very appreciated. 

import numpy as np
import matplotlib.pyplot as plt

nameN = 25
obsN = 50

names = ["foo%d" % x for x in range(nameN)]
vols = np.random.uniform(0.2, 0.45, nameN)


labels = ['ValA', 'ValB', 'ValC']
d1 = np.random.normal(0,1, obsN*nameN).reshape(obsN, -1)*vols
d2 = np.random.normal(0,1, obsN*nameN).reshape(obsN, -1)*vols
d3 = np.random.normal(0,1, obsN*nameN).reshape(obsN, -1)*vols


f = 0.45
fig = plt.figure()
for label, dset, ax_id in zip(labels, (d1, d2, d3), (131, 132, 133)):
    
    ax = fig.add_subplot(ax_id)

    for i in range(len(names)):
        
        mx = np.max(dset[:,i])
        mn = np.min(dset[:,i])
        y = i + dset[:,i]*2*f/(mx - mn) - f*(mx + mn)/(mx - mn) + 1
        y_last = y[-1]*np.ones_like(y)
        x = np.arange(obsN)
        ax.fill_between(x, y_last, y)

    ax.set_ylim((0, nameN + 1))
    ax.set_yticks(range(1, nameN + 1))
    ax.set_title(label, fontsize=10)

    for tk, nm in zip(ax.yaxis.get_major_ticks(), list(reversed(names))):
        tk.tick1On = False
        tk.tick2On = False
        tk.label1On = True
        tk.label2On = True
        tk.set_label1(nm)
        tk.set_label2("%.1f\n(%.1f tile)" % (36.2, 98.6))
    
    #ytickNames = ax.set_yticklabels(list(reversed(names)), rotation = 45, 
fontsize = 8)
    
    
plt.show()

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to