> > Is it fairly easy to put something like this together using all the > offsetbox tools and fancy arrows?
I tried to cook up something similar to what you described. See the attached file. Well, I would not say it is fairly easy, but not that difficult either I hope. The demo requires svn r8227 to work correctly. I think the demo is rather self-explanatory. But let me know if there is anything that are not clear. Regards, -JJ > > Thanks, > JDH > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
<<attachment: image.png>>
import matplotlib.pyplot as plt
from matplotlib.offsetbox import HPacker, VPacker, TextArea, AnnotationBbox
from matplotlib.transforms import IdentityTransform
from matplotlib.text import Annotation
textprops=dict(bbox=dict(boxstyle="round", fc="w"))
t1 = TextArea("Python", textprops=textprops)
t2a = TextArea("IPython", textprops=textprops)
t2b = TextArea("Numpy", textprops=textprops)
t3a = TextArea("Matplotlib", textprops, textprops)
t3b = TextArea("Scipy", textprops, textprops)
hp1 = HPacker(pad=0, sep=50, children=[t1])
hp2 = HPacker(pad=0, sep=30, children=[t2a, t2b])
hp3 = HPacker(pad=0, sep=50, children=[t3a, t3b])
vp1 = VPacker(pad=0, sep=50, children=[hp1, hp2, hp3], align="center")
ab1 = AnnotationBbox(vp1, xy=(0.5, 0.5), xycoords="data",
box_alignment=(.5, .5))
ab1.patch.set_visible(False)
plt.clf()
ax = plt.subplot(111)
ax.add_artist(ab1)
def myannot(txt1, txt2, arrowprops):
arrowprops = arrowprops.copy()
p1 = txt1._text._bbox_patch
p2 = txt2._text._bbox_patch
if "patchA" not in arrowprops:
arrowprops["patchA"] = p1
if "patchB" not in arrowprops:
arrowprops["patchB"] = p2
# if given coordinate (xycoords or textcoords) is an instance of
# Artist, xy or xytext is interpreted as a normalized coordinate
# of the artist's bbox.
arr = Annotation("", xy=(0.5, 0.5), xytext=(0.5, 0.5), xycoords=p2,
textcoords=p1,
arrowprops=arrowprops,
transform=IdentityTransform())
return arr
arrstyle1 = dict(arrowstyle="->",
connectionstyle="arc3,rad=0.3")
arrstyle2 = dict(arrowstyle="->",
connectionstyle="arc3,rad=-0.3")
arr1 = myannot(t1, t2a, arrstyle1)
ax.add_artist(arr1)
arr2 = myannot(t1, t2b, arrstyle2)
ax.add_artist(arr2)
arr3 = myannot(t2a, t3a, arrstyle1)
ax.add_artist(arr3)
arr4 = myannot(t2b, t3a, arrstyle1)
ax.add_artist(arr4)
arr5 = myannot(t2b, t3b, arrstyle2)
ax.add_artist(arr5)
plt.show()
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
