修改X,Y,Z轴的刻度值
from matplotlib.ticker import MultipleLocator,FuncFormatter
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib import colors
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
import matplotlib.ticker as ticker
def fun(x):
if x >= 1:
return 1
return x
def to_percent(temp, position):
return '%1.0f'%(100*temp)
x = np.arange(0, 0.5, 0.001)
y = np.arange(0, 0.05, 0.001)
x, y = np.meshgrid(x, y)
z = (3*x+y-x*x-np.sqrt(2*x*x*x-3*x*x*x*x+x*x+22*x*x*y-22*x*y-12*x*x*x*y-8*x*x*y*y+12*x*y*y-7*y*y))/(2*x+2*y)
for row in range(len(z)):
for col in range(len(z[0])):
z[row][col] = fun(z[row][col])
fig = plt.figure()
ax = fig.gca(projection='