Skip to content

Is there a way to set_zticks in a customized way ? #14980

Closed
@bhuvanshukla

Description

@bhuvanshukla

Bug report

Bug summary
I'm unable to find anywhere that we can set the ztick like xtick and ytick or is there a way ?

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
import math
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
ax = fig.add_subplot(111)
x= np.linspace(-math.pi,math.pi,30)
y= np.linspace(-math.pi,math.pi,30)
xx,yy = np.meshgrid(x,y)

X_grid, Y_grid = np.meshgrid(x,y)
print("X_grid shape: ",X_grid.shape)
zz =-2*(np.cos(xx) + np.cos(yy))

#ax = plt.axes(projection='3d')
ax = Axes3D(fig)
ax.plot_surface(xx,yy,zz)

plt.xticks([x[0],x[int(len(s)/2)], x[-1]], [r'$-\pi$',  r'$0$', r'$-\pi$' ])
plt.yticks([y[0],y[int(len(s)/2)], y[-1]], [r'$-\pi$',  r'$0$', r'$-\pi$' ])
plt.xlabel("kx")
plt.ylabel("ky")

Actual outcome
Please see this.

Expected outcome
In output z-axis should have the values like x and y axis ( [-math.pi,0,math.pi] ).

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: '2.2.2'
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: Python 3.6.5

Working on Spyder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions