#!/usr/bin/python from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt plt.rcParams['legend.fontsize'] = 10 fig = plt.figure () ax = fig.gca (projection='3d') # the z-axis is vertical in matplotlib x = np.linspace (-2, 2, 5000) y = np.sin (np.pi * x) z = np.cos (np.pi * x) ax.plot (x, y, z, label='$y=(-1)^{x}$') ax.legend () ax.set_xlabel ('x', labelpad=7) ax.set_xticks ([-2, -1, 0, 1, 2]) ax.xaxis.set_rotate_label (False) ax.set_ylabel ('$y_{im}$', labelpad=7) ax.set_yticks ([1, 0.5, 0, -0.5, -1]) ax.invert_yaxis () ax.yaxis.set_rotate_label (False) ax.set_zlabel ('$y_{re}$', labelpad=7) ax.set_zticks ([-1, -0.5, 0, 0.5, 1]) ax.zaxis.set_rotate_label (False) plt.show ()