我试图在放大散点图时检索 x 轴的范围,但是当我尝试使用以下方法访问它时: figure['layout']['xaxis']['range'] 它只是返回'没有任何'。
这是我用来创建图形的代码:
# self.plot contains the dataframe passed to the function to be plotted
self.plot = df
# Creates the plotly plot figure
self.fig = self.plot.iplot(asFigure=True,kind='scatter', xTitle='Date', yTitle='Temperature')
# Displays the plot
iplot(self.fig, show_link=False)
Run Code Online (Sandbox Code Playgroud)
我正在使用袖扣从 Pandas DataFrame 创建绘图,所以我没有明确地将 layout.xaxis.range 设置为任何内容。此外,我正在使用 Jupyter Notebook 来显示图表,如果这有帮助的话。那么有没有办法获得绘图当前视图窗口的x轴范围?提前致谢!