[英]Latex in Chaco text?
Is it possible to create a chaco plot with latex text? 是否可以用乳胶文字创建查科图? For example, if we wanted latex symbols in the title of this exampe :
例如,如果我们要在此样本的标题中使用乳胶符号:
from traits.api import HasTraits, Instance
from traitsui.api import View, Item
from chaco.api import Plot, ArrayPlotData
from enable.component_editor import ComponentEditor
from numpy import linspace, sin
class LinePlot(HasTraits):
plot = Instance(Plot)
traits_view = View(
Item('plot',editor=ComponentEditor(), show_label=False),
width=500, height=500, resizable=True, title="Chaco Plot")
def __init__(self):
super(LinePlot, self).__init__()
x = linspace(-14, 14, 100)
y = sin(x) * x**3
plotdata = ArrayPlotData(x=x, y=y)
plot = Plot(plotdata)
plot.plot(("x", "y"), type="line", color="blue")
plot.title = "sin(x) * x^3"
self.plot = plot
if __name__ == "__main__":
LinePlot().configure_traits()
I tried replacing title with $sin(x)^3$
to no avail, and wondered if this was possible? 我试图用
$sin(x)^3$
替换title,但无济于事,想知道这是否可能? Screenshot below: 屏幕截图如下:
No, it is not (it is a matplotlib feature). 不,不是(这是matplotlib功能)。 But you could try to use unicode symbols for easy cases.
但是您可以尝试在简单情况下使用unicode符号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.