<tfoot id='8LkAP'></tfoot>

    1. <i id='8LkAP'><tr id='8LkAP'><dt id='8LkAP'><q id='8LkAP'><span id='8LkAP'><b id='8LkAP'><form id='8LkAP'><ins id='8LkAP'></ins><ul id='8LkAP'></ul><sub id='8LkAP'></sub></form><legend id='8LkAP'></legend><bdo id='8LkAP'><pre id='8LkAP'><center id='8LkAP'></center></pre></bdo></b><th id='8LkAP'></th></span></q></dt></tr></i><div id='8LkAP'><tfoot id='8LkAP'></tfoot><dl id='8LkAP'><fieldset id='8LkAP'></fieldset></dl></div>

      <legend id='8LkAP'><style id='8LkAP'><dir id='8LkAP'><q id='8LkAP'></q></dir></style></legend>

        <small id='8LkAP'></small><noframes id='8LkAP'>

        • <bdo id='8LkAP'></bdo><ul id='8LkAP'></ul>

      1. matplotlib 3d 坐标轴刻度、标签和 LaTeX

        matplotlib 3d axes ticks, labels, and LaTeX(matplotlib 3d 坐标轴刻度、标签和 LaTeX)

        <tfoot id='ohnrD'></tfoot>

        <small id='ohnrD'></small><noframes id='ohnrD'>

        <i id='ohnrD'><tr id='ohnrD'><dt id='ohnrD'><q id='ohnrD'><span id='ohnrD'><b id='ohnrD'><form id='ohnrD'><ins id='ohnrD'></ins><ul id='ohnrD'></ul><sub id='ohnrD'></sub></form><legend id='ohnrD'></legend><bdo id='ohnrD'><pre id='ohnrD'><center id='ohnrD'></center></pre></bdo></b><th id='ohnrD'></th></span></q></dt></tr></i><div id='ohnrD'><tfoot id='ohnrD'></tfoot><dl id='ohnrD'><fieldset id='ohnrD'></fieldset></dl></div>
          <tbody id='ohnrD'></tbody>
          <bdo id='ohnrD'></bdo><ul id='ohnrD'></ul>

                <legend id='ohnrD'><style id='ohnrD'><dir id='ohnrD'><q id='ohnrD'></q></dir></style></legend>

                • 本文介绍了matplotlib 3d 坐标轴刻度、标签和 LaTeX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在运行

                  为什么我想用这个脚本做的 x 轴标签扭曲,而不是 z 轴标签 (gamma)?这根本不符合逻辑.我需要用希腊字母标记的这个轴.我该如何解决这个问题?

                  解决方案

                  如何将轴刻度调整为我选择的刻度?即,如何我将 z 轴仅标记为 2、0 和 -2,并且字体大小为我想?我知道如何在 2D 中做到这一点,但不是 3D.

                  您必须更改 zticks 的属性.

                  <块引用>

                  为什么x轴标签会扭曲,我想用这个来做脚本,但不是 z 轴标签(伽玛)?这根本不符合逻辑.一世需要用希腊字母标记这个轴.我该如何解决这个问题?

                  您必须禁用 z 轴标签的自动旋转.看下面的代码:

                  将 matplotlib 导入为 mpl从 mpl_toolkits.mplot3d 导入 Axes3D将 numpy 导入为 np将 matplotlib.pyplot 导入为 pltmpl.rcParams['legend.fontsize'] = 10无花果 = plt.figure()ax = fig.gca(投影='3d')theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)z = np.linspace(-2, 2, 100)r = z**2 + 1x = r * np.sin(θ)y = r * np.cos(theta)ax.plot(x, y, z, label='参数曲线')斧头传奇()ax.set_xlabel('$X$', fontsize=20)ax.set_ylabel('$Y$')ax.yaxis._axinfo['label']['space_factor'] = 3.0# 设置 z 刻度和标签ax.set_zticks([-2, 0, 2])# 更改字体大小对于 ax.zaxis.get_major_ticks() 中的 t:t.label.set_fontsize(10)# 禁用自动旋转ax.zaxis.set_rotate_label(False)ax.set_zlabel('$gamma$', fontsize=30, 旋转 = 0)plt.show()

                  I am running this sample script, with the following modifications:

                  import matplotlib as mpl
                  from mpl_toolkits.mplot3d import Axes3D
                  import numpy as np
                  import matplotlib.pyplot as plt
                  
                  mpl.rcParams['legend.fontsize'] = 10
                  
                  fig = plt.figure()
                  ax = fig.gca(projection='3d')
                  theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
                  z = np.linspace(-2, 2, 100)
                  r = z**2 + 1
                  x = r * np.sin(theta)
                  y = r * np.cos(theta)
                  ax.plot(x, y, z, label='parametric curve')
                  ax.legend()
                  
                  ax.set_xlabel('$X$', fontsize=20, rotation=150)
                  ax.set_ylabel('$Y$')
                  ax.set_zlabel(r'$gamma$', fontsize=30, rotation=60)
                  ax.yaxis._axinfo['label']['space_factor'] = 3.0
                  
                  plt.show()
                  

                  1. How do I adjust the axis ticks to that of my choosing? I.e., how would I get the z-axis to only label 2, 0, and -2, and in the font size that I want? I know how to do this in 2D but not 3D.

                  2. The script above produces the following:

                  Why is the x-axis label distorted, which I wanted to do with this script, but not the z-axis label (gamma)? This does not make sense. I need this axis labeled in the Greek letter. How do I fix this?

                  解决方案

                  How do I adjust the axis ticks to that of my choosing? I.e., how would I get the z-axis to only label 2, 0, and -2, and in the font size that I want? I know how to do this in 2D but not 3D.

                  You have to change properties of zticks.

                  Why is the x-axis label distorted, which I wanted to do with this script, but not the z-axis label (gamma)? This does not make sense. I need this axis labeled in the Greek letter. How do I fix this?

                  You have to disable autorotation for z axis labels. Look at the code below:

                  import matplotlib as mpl
                  from mpl_toolkits.mplot3d import Axes3D
                  import numpy as np
                  import matplotlib.pyplot as plt
                  
                  mpl.rcParams['legend.fontsize'] = 10
                  
                  fig = plt.figure()
                  ax = fig.gca(projection='3d')
                  theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
                  z = np.linspace(-2, 2, 100)
                  r = z**2 + 1
                  x = r * np.sin(theta)
                  y = r * np.cos(theta)
                  ax.plot(x, y, z, label='parametric curve')
                  ax.legend()
                  
                  ax.set_xlabel('$X$', fontsize=20)
                  ax.set_ylabel('$Y$')
                  ax.yaxis._axinfo['label']['space_factor'] = 3.0
                  # set z ticks and labels
                  ax.set_zticks([-2, 0, 2])
                  # change fontsize
                  for t in ax.zaxis.get_major_ticks(): t.label.set_fontsize(10)
                  # disable auto rotation
                  ax.zaxis.set_rotate_label(False) 
                  ax.set_zlabel('$gamma$', fontsize=30, rotation = 0)
                  plt.show()
                  

                  这篇关于matplotlib 3d 坐标轴刻度、标签和 LaTeX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Running .jl file from R or Python(从 R 或 Python 运行 .jl 文件)
                  Running Julia .jl file in python(在 python 中运行 Julia .jl 文件)
                  Using PIP in a Azure WebApp(在 Azure WebApp 中使用 PIP)
                  How to run python3.7 based flask web api on azure(如何在 azure 上运行基于 python3.7 的烧瓶 web api)
                  Azure Python Web App Internal Server Error(Azure Python Web 应用程序内部服务器错误)
                  Run python dlib library on azure app service(在 azure app 服务上运行 python dlib 库)
                  1. <tfoot id='Pymjc'></tfoot>
                    1. <legend id='Pymjc'><style id='Pymjc'><dir id='Pymjc'><q id='Pymjc'></q></dir></style></legend>
                      • <small id='Pymjc'></small><noframes id='Pymjc'>

                            <tbody id='Pymjc'></tbody>

                            <bdo id='Pymjc'></bdo><ul id='Pymjc'></ul>

                            <i id='Pymjc'><tr id='Pymjc'><dt id='Pymjc'><q id='Pymjc'><span id='Pymjc'><b id='Pymjc'><form id='Pymjc'><ins id='Pymjc'></ins><ul id='Pymjc'></ul><sub id='Pymjc'></sub></form><legend id='Pymjc'></legend><bdo id='Pymjc'><pre id='Pymjc'><center id='Pymjc'></center></pre></bdo></b><th id='Pymjc'></th></span></q></dt></tr></i><div id='Pymjc'><tfoot id='Pymjc'></tfoot><dl id='Pymjc'><fieldset id='Pymjc'></fieldset></dl></div>