Commit cf351c7b authored by Max Wiebicke's avatar Max Wiebicke
Browse files

change the coloring of the surface of the fabric tensor

parent e2acbf24
...@@ -610,6 +610,8 @@ def distributionDensity( F, step = 50, lim = None, color = None, title = None, s ...@@ -610,6 +610,8 @@ def distributionDensity( F, step = 50, lim = None, color = None, title = None, s
Y = R * numpy.sin(PHI) * numpy.sin(THETA) Y = R * numpy.sin(PHI) * numpy.sin(THETA)
Z = R * numpy.cos(PHI) Z = R * numpy.cos(PHI)
#Create figure #Create figure
import matplotlib
matplotlib.rcParams.update({'font.size': 10})
fig = matplotlib.pyplot.figure() fig = matplotlib.pyplot.figure()
ax = fig.add_subplot( 111, projection = '3d' ) ax = fig.add_subplot( 111, projection = '3d' )
#Set limits #Set limits
...@@ -623,11 +625,13 @@ def distributionDensity( F, step = 50, lim = None, color = None, title = None, s ...@@ -623,11 +625,13 @@ def distributionDensity( F, step = 50, lim = None, color = None, title = None, s
ax.set_yticks((-lim, 0, lim)) ax.set_yticks((-lim, 0, lim))
ax.set_zticks((-lim, 0, lim)) ax.set_zticks((-lim, 0, lim))
ax.set_aspect('equal', 'box') ax.set_aspect('equal', 'box')
# set axis titles
ax.set_xlabel('X axis')
ax.set_ylabel('Y axis')
ax.set_zlabel('Z axis')
#Title #Title
if title is None: if title is not None:
ax.set_title('Distribution Density' + "\n" ) ax.set_title( str(title) + "\n" )
else:
ax.set_title('Distribution Density of '+ str(title) + "\n" )
#Colormap #Colormap
if color == None: if color == None:
cmap = matplotlib.pyplot.get_cmap(matplotlib.pyplot.cm.Reds) cmap = matplotlib.pyplot.get_cmap(matplotlib.pyplot.cm.Reds)
...@@ -636,7 +640,9 @@ def distributionDensity( F, step = 50, lim = None, color = None, title = None, s ...@@ -636,7 +640,9 @@ def distributionDensity( F, step = 50, lim = None, color = None, title = None, s
norm = mcolors.Normalize(vmin=0, vmax=Z.max()) norm = mcolors.Normalize(vmin=0, vmax=Z.max())
#Plot #Plot
ax.plot_surface(X, Y, Z, rstride = 1, cstride = 1, ax.plot_surface(X, Y, Z, rstride = 1, cstride = 1,
facecolors = cmap(norm(numpy.abs(Z))), #facecolors = cmap(norm(numpy.abs(Z))),
#coloring by max extension
facecolors = cmap((R-numpy.amin(R))/numpy.amax(R-numpy.amin(R))),
linewidth = 0, antialiased = True, linewidth = 0, antialiased = True,
alpha = 1) alpha = 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment