Setting tick colors of matplotlib 3D plot

前端 未结 2 1049
野性不改
野性不改 2021-01-18 15:44

If I have a 3D matplotlib plot (Axes3D object), how do I change the color of the tick marks? I figured out how to change the color of the axis line, the tick la

2条回答
  •  醉话见心
    2021-01-18 16:31

    A straightforward way to achieve the expected result is as follows:

    from mpl_toolkits.mplot3d import Axes3D
    from matplotlib import rcParams
    from matplotlib import pyplot as plt
    
    rcParams['xtick.color'] = 'red'
    rcParams['ytick.color'] = 'red'
    rcParams['axes.labelcolor'] = 'red'
    rcParams['axes.edgecolor'] = 'red'
    
    fig = plt.figure()
    ax = Axes3D(fig)
    
    ax.scatter((0, 0, 1), (0, 1, 0), (1, 0, 0))
    plt.show()
    

    The output display is:

提交回复
热议问题