Skip to content

Commit

Permalink
Plot surfaces as well as contours.
Browse files Browse the repository at this point in the history
Switched to python PEP style.
  • Loading branch information
murphyk committed Aug 21, 2017
1 parent 96318f9 commit 62ea2e3
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions examples/gaussPlot2Ddemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,29 @@ def Gpdf(x, y, G):
points = np.linspace(-5, 5, 100)
X, Y = np.meshgrid(points, points)

def MakeGraph(G):
def make_contour_plot(G):
Z = Gpdf(X, Y, G)
fig, ax = plt.subplots()
ax.contour(X, Y, Z)
plt.axis('equal')
plt.title(G)
plt.draw()
plt.savefig('figures/Gaussian2D' + G)
plt.show()
plt.savefig('figures/Gaussian2D' + G+ 'Contour')

for g in Gs:
MakeGraph(g)

# Surface plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
Z = Gpdf(X, Y, "spherical")

ax.plot_surface(X, Y, Z, rstride=2, cstride=2, color='white', edgecolor="black")
plt.savefig('figures/Gaussian2DSurface')

plt.show()
def make_surface_plot(G):
Z = Gpdf(X, Y, G)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, rstride=2, cstride=2, color='white', edgecolor="black")
#ax.axis('equal')
#ax.title(G)f
plt.draw()
plt.show()
plt.savefig('figures/Gaussian2D' + G + 'Surface')

for g in Gs:
make_contour_plot(g)
make_surface_plot(g)

0 comments on commit 62ea2e3

Please sign in to comment.