如何在Python Plotly中设置Y轴的范围?

Plotly支持在X轴和Y轴上设置范围。让我们了解如何在Plotly中设置Y轴的范围。

  • plotly.graph_objects is used to generate figures. It contains a lot of methods to customize charts and render a chart in HTML format.

  • Create a numpy module and generate random ranges for both X and Y axis.

  • 创建Figure()方法,以线条模式绘制X轴和Y轴

  • Create update_layout() method and set the Y-axis range.

按照给定的步骤来设置Plotly中Y轴的范围。

第一步 - 导入plotly

导入 plotly.graph_objs 模块,并将其别名为 go

import plotly.graphs_objs as go登录后复制