|
From: Benjamin R. <ben...@ou...> - 2014-12-05 16:49:11
|
I am a bit confused. Your variable is "TRI", but you keep saying rectangles. You are also referring to unstructured rectangles, which makes zero sense to me. Do you mean triangles? If you, matplotlib has the "tri-" family of functions and a whole module devoted to triangulation-related tasks: http://matplotlib.org/api/tri_api.html http://matplotlib.org/examples/pylab_examples/tricontour_demo.html Even the mplot3d toolkit has (limited) support: http://matplotlib.org/examples/mplot3d/trisurf3d_demo.html I hope that helps! Ben Root On Fri, Dec 5, 2014 at 11:38 AM, Sappy85 <rob...@gm...> wrote: > Hi diedro, > > try something like this: > > import matplotlib.patches as patches > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > verts = [0.2,0.8], [0.1,0.5], [0.7,0.1] > poly = patches.Polygon(verts, ec='r', fc='g') > > ax.add_patch(poly) > plt.show() > > <http://matplotlib.1069221.n5.nabble.com/file/n44560/help3.png> > > or this: > > import numpy as np > import matplotlib > matplotlib.use('Agg') > > from matplotlib.patches import Polygon > from matplotlib.collections import PatchCollection > import matplotlib.pyplot as plt > > fig, ax = plt.subplots() > > patches = [] > x = np.random.rand(3) > y = np.random.rand(3) > > for i in range(3): > polygon = Polygon(np.random.rand(3,2), True) > patches.append(polygon) > > > colors = 100*np.random.rand(len(patches)) > p = PatchCollection(patches, cmap=matplotlib.cm.jet, alpha=0.4) > p.set_array(np.array(colors)) > ax.add_collection(p) > plt.colorbar(p) > plt.grid() > plt.savefig('/var/www/img/help2.png', bbox_inches='tight',pad_inches=0.05) > > <http://matplotlib.1069221.n5.nabble.com/file/n44560/help2.png> > > Regards, > Sappy85 > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Patch-facecolors-tp44558p44560.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |