1

So far I got this code, and I would like the 3D plot but without the axes and printed in eps vectorial format.

#!/usr/local/bin/python
# coding: latin-1
import os, sys

from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = Axes3D(fig, azim = -128, elev = 43)

s = .05
X = np.arange(-2, 2.+s, s)
Y = np.arange(-1, 3.+s, s)
X, Y = np.meshgrid(X, Y)
Z = (1.-X)**2 + 100.*(Y-X*X)**2
ax.plot_surface(X, Y, Z, rstride = 1, cstride = 1, norm = LogNorm(), cmap = cm.jet,linewidth=0)

plt.xlabel("x")
plt.ylabel("y")

plt.savefig("Rosenbrock function.svg")

plt.show()
tcassanelli
  • 175
  • 8

1 Answers1

1

Your question about turning off the axes is answered here. To summarize, you want to add the line

ax.set_axis_off()

if you have a newer version of Matplotlib. If that doesn't work, you can try

ax._axis3don = False

or just upgrade your Matplotlib.

Community
  • 1
  • 1
hunse
  • 3,175
  • 20
  • 25