- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 latex 向我的情节添加文本。 Latex 和\frac{}{} 在标题和标签中效果很好,但我无法在 plt.text() 中使用它。我都试过了,使用原始反斜杠或双反斜杠。
import matplotlib.pyplot as plt
plt.axhline(x=30, c='k')
plt.text(0,0,r'$\frac{\Gamma_M}{\Gamma_D}$ = 10')
plt.xlabel(r'$\frac{\Gamma_M}{\Gamma_D}$')
它适用于标签(如果你注释掉文本行)但不适用于文本,给我这个输出:
KeyError: '\\Gamma_M'
最佳答案
它将 {}
解释为 python 格式字符串的一部分,而不是 LaTeX。改用双括号:
plt.text(0,0,r'$\frac{{\Gamma_M}}{{\Gamma_D}}$ = 10')
关于matplotlib -\frac{}{} 在 plt.text 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51093060/
from sympy import * x, alpha = symbols('x alpha') latex(alpha/x) Out[1]: '\\frac{\\alpha}{x}' 这在 lat
我正在我的一个数学应用程序中解析 Latex 公式以转换为自定义格式。我的要求是,当 Latex 公式有一个分数时,即 \frac{a}{b} ,它必须转换为 {a}/{b} 下面是我正在使用的正则表
我正在使用非常好的 jQuery 插件 Fracs但我面临一个问题。 实际上,我有一个包装器,其中包含两个 div,一个用于拇指,另一个用于大图像。可用示例over there . 我的想法是知道哪些
分形几何是一个数学分支,主要应用于作图方面。一般来说,分形经过无数次递归迭代后的结果。比如取一条线段,抹去中间的三分之一,会得到长度是原三分之一长的两条线段,中间隔着相同长度的间隙。然后重复这个
有没有办法转换以这种格式编写的字符串:str = "9+3/3+6/2" 到如下所示的 Latex 字符串:“9 +\frac{3}{3} +\frac{6}{2}” 由于sympy.latex(st
我不太擅长使用 python,尤其是 numpy 和 matplotlib。运行下面的代码(没有 \frac{}{} 部分也能正常工作)会产生错误: Normalized Distance in Ch
当我给 matplotlib 一个注释字符串时,例如 '$\frac{A}{B} = C$' 我指定字体大小为 18,A 和 B 以 12.6 pt 呈现,而 C 以 18 pt 呈现。我希望 A、B
我正在尝试使用 latex 向我的情节添加文本。 Latex 和\frac{}{} 在标题和标签中效果很好,但我无法在 plt.text() 中使用它。我都试过了,使用原始反斜杠或双反斜杠。 impo
我想在 C# 中实现一个 frac 函数(就像这里的 hsl 中的函数 http://msdn.microsoft.com/en-us/library/bb509603%28VS.85%29.aspx
我正在寻找一种与 .NET 中 Delphi 的 System.Frac 等效的方法。 Delphi 函数去掉整个数字,只留下小数点后的值。 我可以编写自己的方法,但我想我会检查一下? 最佳答案 我知
我有一个 .csv 文件,我将其导入到 Python Pandas 数据框中。它开始看起来像这样: ...然后在运行一些 one-hot 编码后,我使用“df.sample(frac=1)”函数来随机
我正在接受一个 8 位十六进制数作为 IEEE 754 位 float 我想打印有关该数字的信息(signbit、expbits、fractbits、标准化,非规范化、无穷大、零、NAN) float
我有一个名为 work3 的数据集,我正在尝试根据“clean_name”列删除重复行。以下是有关work3的信息: work3.info() 输出: Int64Index: 3295520 ent
我是一名优秀的程序员,十分优秀!