From: Pascal H. <Pas...@un...> - 2010-11-29 08:29:25
|
Hi everybody, I'm trying to insert polar axes into another axis. I need to place many windrose-like plots (bar plots in a polar axis) inside an xy plot. I need them to move while panning the xy plot. To do so, I tried with inset_axes, but I cannot force the new axis to be polar. Or is there a better way to to it ? Here is the code: ---- #!/usr/bin/python import matplotlib.pyplot as plt import numpy as np import mpl_toolkits.axes_grid1.inset_locator as iloc angleStart = 0.75 angleEnd = 2.5 ringOutterLimit = 0.95 ringWidth = 0.4 lineWidth = 1 values = np.array([0., 0.3, 0.95, 0.5, 0.1]) # Figure and main axis fig = plt.figure(figsize=(5,5)) ax1 = fig.add_subplot(111) ax1.plot([0,1], [0,1]) ax1.set_aspect(1.) # Second axis ax2 = iloc.inset_axes(ax1, width="100%", height="100%", loc=3, bbox_to_anchor=(0.3, 0.5, 0.1, 0.1), bbox_transform=ax1.transData) bars = ax2.bar([np.pi/2., np.pi], [0.5, 0.2], width=.1*np.pi) # Third axis ax3 = iloc.inset_axes(ax1, width="100%", height="100%", loc=3, bbox_to_anchor=(0.5, 0.7, 0.1, 0.1), bbox_transform=ax1.transData) bars = ax3.bar([np.pi/2., np.pi/4.], [0.1, 0.4], width=.1*np.pi) plt.show() ---- Thanks a lot, Pascal |