On 5 April 2013 03:54, Sudheer Joseph <sudheer.jos...@yahoo.com> wrote:
> Some how I am not getting the trick of the
> rect = [0.1, 0.1, 0.8, 0.8]
>
> I tried
> rect1= [0.1,0.1,.4,.4]
> and rect2=[.4,.4,.8,.8]
> but did not work

You don't say exactly what you did, and how it didn't work...

If you read 
http://matplotlib.org/api/figure_api.html?highlight=add_axes#matplotlib.figure.Figure.add_axes
it says "Add an axes at position rect [left, bottom, width,
height]...". So you need to specify sensible values in rect1 and
rect2.

The following works fine for me:

import matplotlib.pyplot as plt
fig = plt.figure()
rect1 = [0.1, 0.1, 0.4, 0.4]
rect2 = [0.55, 0.1, 0.4, 0.4]
ax1 = fig.add_axes(rect1)
ax2 = fig.add_axes(rect2)
ax1.plot(range(3))
ax2.plot(range(4, 8))
plt.show()

So I would expect that you can adapt your original code to something
like the following (untested):

from windrose import WindroseAxes
from matplotlib import pyplot as plt
from numpy.random import random

def new_axes(fig, rect):
    ax = WindroseAxes(fig, rect, axisbg='w')
    fig.add_axes(ax)
    return ax

def set_legend(ax):
    l = ax.legend(axespad=-0.10)
    plt.setp(l.get_texts(), fontsize=8)

#Create wind speed and direction variables
ws = random(500)*6
wd = random(500)*360
ws1 = random(500)*6
wd1 = random(500)*360

rect1 = [0.1, 0.1, 0.4, 0.4]
rect2 = [0.55, 0.1, 0.4, 0.4]

fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w')

ax1 = new_axes(fig, rect1)
ax2 = new_axes(fig, rect2)

#windrose like a stacked histogram with normed (displayed in percent) results
ax1.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')
set_legend(ax1)

#windrose like a stacked histogram with normed (displayed in percent) results
ax2.bar(wd1, ws1, normed=True, opening=0.8, edgecolor='white')
set_legend(ax2)

plt.show()

Cheers,
Scott

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to