3

我一直在尝试在 3-d 轴的顶部添加额外的轴刻度,以便显示轴的“立方体”,而不是默认的只有 3 个边,但没有成功。有谁知道如何做到这一点?

另一个小问题是如何设置网格的颜色?

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


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d',frame_on=True)  # first try, nothing happened

ax.plot([1,], [1,], [1,], marker='o')

ax_grid_color = (0.9, 0.1, 0.1, 1.0)
ax.grid(color=ax_grid_color)   # doesn't work

ax_pane_color = (1, 1, 1, 1.0)
ax.w_xaxis.set_pane_color(ax_pane_color)
ax.w_yaxis.set_pane_color(ax_pane_color)
ax.w_zaxis.set_pane_color(ax_pane_color)
ax.w_xaxis.set_ticks_position('both')  # 2nd try

plt.show()

在此处输入图像描述

4

0 回答 0