英文:
Line charts in Logarithmic Scale with Taipy
问题
在台北似乎支持在x和y轴上使用线性刻度的折线图。有没有办法绘制对数刻度?谢谢。我知道有一种方法可以制作对数刻度(在Stack的另一个问题中看到),但不知道怎么做。
英文:
It seems that in Taipy the Line charts support the linear Scale on x, y axis.
Is there’s way to plot Logarithmic Scale?
Thanks
I know that there's a way to make Logarithmic Scale (saw it on another question on Stack) but don't know how.
答案1
得分: 1
以下是翻译好的部分:
"可以绘制具有对数刻度的图表。Taipy基于Plotly用于绘制图表。可以通过布局属性访问布局参数。Plotly的其他参数可以通过Taipy进行访问,例如标记参数。请查看文档此处。
这是如何将x轴和y轴设置为对数刻度的快速演示。在这里,布局用于更改x轴和y轴的默认行为。
from taipy.gui import Gui
data = {"x": [0, 1, 2, 3, 4, 5, 6, 7, 8],
"y": [8, 7, 6, 5, 4, 3, 2, 1, 0]}
layout = {
"xaxis": {
"type": 'log',
"autorange": True
},
"yaxis": {
"type": 'log',
"autorange": True
}
}
Gui("<|{data}|chart|x=x|y=y|layout={layout}|>").run()
可以在此处找到相同类型的其他选项:https://plotly.com/javascript/reference/layout/xaxis/
英文:
It is possible to plot a chart with a logarithm scale. Taipy is based on Plotly for charts. Layout parameters are accessible through the layout property. Other parameters of Plotly can be accessed through Taipy like for markers for example. Check the doc here.
Here is a quick demo of how the x and y axes can be of the log scale. Here, the layout is being used to change the default behavior of the x and y-axis.
from taipy.gui import Gui
data = {"x": [0, 1, 2, 3, 4, 5, 6, 7, 8],
"y": [8, 7, 6, 5, 4, 3, 2, 1, 0]}
layout = {
"xaxis": {
"type": 'log',
"autorange": True
},
"yaxis": {
"type": 'log',
"autorange": True
}
}
Gui("<|{data}|chart|x=x|y=y|layout={layout}|>").run()
Other options of the same type can be found here: https://plotly.com/javascript/reference/layout/xaxis/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论