python - Projection of 3D convex hull onto xy plane with a colour map -
what i'd @ end smoothed colour map contours plotted on top of it. idea preserve as possible information 3d convex hull.
the problem code developed far doesn't work inputs.
example
if set tricontourf() integer parameter let 8 , provide 10 input files 8 plots ok 2 solid colour. next if change parameter 9 i'll 7 , 3 odd. of ones first step wrong!
ideally i'd have parameter fixed @ ~25 colour map smoothed.
have @ pictures:
this want smoother, int parameter 8
what important me have triangulation based on convex hull.
import matplotlib.pyplot plt import numpy np import sys, os, time, math scipy.spatial import convexhull matplotlib.tri import triangulation import matplotlib.cm cm # covex hull data , save them array cvx = [] datax = [] filename in sys.argv[1:]: x = np.genfromtxt(filename,delimiter="", skip_header=2) datax.append(x) hull = convexhull(x) cvx.append(hull) idx,filename in enumerate(sys.argv[1:]): # start plotting data x, y, z = datax[idx].t # triangulation based on convex hull simpl = cvx[idx].simplices tri = triangulation(x, y, triangles=simpl) # plot lines (triangles) plt.triplot(tri, color='k') # plot contour lines based on convex hull facets plt.tricontour(x, y, z, 5, linewidths=0.5, colors='k', triangles=simpl) # plot colour map plt.tricontourf(x, y, z, 8, cmap=plt.cm.rainbow, triangles=simpl) plt.show()
Comments
Post a Comment