python - Draw a plot of glyphs in Matplotlib -


i using matplotlib plot scientific visualizations heat map plots (as 1 below) sufficient. code written in python too.

enter image description here

however, need present more "elaborated" plot, consists of glyphs. following image (the second one) shows example:

enter image description here

in image, each point of plot glyph represents probability of vector field orientation. glyph draw circle main direction , standard deviation direction.

i similar. idea draw polar histogram @ each position , have plot comprised polar charts. however, don't think possible matplotlib; @ least don't have idea how can done. whole code written in python, wondering if somehow can stand matplotlib, or if should study how opengl or api/libraty.

thank you.

perhaps whole lot of this:

enter image description here

import matplotlib.pyplot plt import numpy np matplotlib.collections import patchcollection matplotlib.patches import wedge, circle math import degrees, pi  fig, ax = plt.subplots() wedges = [] circles = []  x in np.arange(0, 3.3, .3):     y in np.arange(0, 3.3, .3):         theta, phi = np.random.random(2)  # functions of (x,y) in reality         v in (0, pi):             wedges.append(wedge((x, y),                             .15,                             degrees(v - phi - theta/2),                             degrees(v - phi + theta/2),                             edgecolor='none'),                             )         circles.append(circle((x, y),                              .15,                              edgecolor='none'))   colors = np.linspace(0, 1, len(circles))  # function of (x,y) in reality collection = patchcollection(circles, cmap=plt.cm.jet, alpha=0.2) collection.set_array(np.array(colors)) collection.set_edgecolor('none') ax.add_collection(collection)  #wedgecolors = list(chain.from_iterable(repeat(i,2) in colors)) wedgecolors = np.array([colors, colors]).flatten('f') # no itertools collection = patchcollection(wedges, cmap=plt.cm.jet, alpha=1) collection.set_array(np.array(wedgecolors)) collection.set_edgecolor('none') ax.add_collection(collection)  ax.set_xlim(0,3) ax.set_ylim(0,3) ax.set_aspect('equal') plt.show() 

(setting edgecolor has done (redone?) after collection.set_array call, apparently.)


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -