使用Taipy绘制的对数刻度线图

huangapple go评论212阅读模式
英文:

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()

使用Taipy绘制的对数刻度线图

可以在此处找到相同类型的其他选项: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 = {&quot;x&quot;: [0, 1, 2, 3, 4, 5, 6, 7, 8],
        &quot;y&quot;: [8, 7, 6, 5, 4, 3, 2, 1, 0]}

layout = {
  &quot;xaxis&quot;: {
    &quot;type&quot;: &#39;log&#39;,
    &quot;autorange&quot;: True
  },
  &quot;yaxis&quot;: {
    &quot;type&quot;: &#39;log&#39;,
    &quot;autorange&quot;: True
  }
}

Gui(&quot;&lt;|{data}|chart|x=x|y=y|layout={layout}|&gt;&quot;).run()

使用Taipy绘制的对数刻度线图

Other options of the same type can be found here: https://plotly.com/javascript/reference/layout/xaxis/

huangapple
  • 本文由 发表于 2023年4月11日 16:19:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75983802.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定