# Retrieving the range of the x-axis of a zoomed in plot

**URL:** <https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335>\
**Category:** 📊 Plotly Python\
**Created:** [June 17, 2016, 3:42pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335 "2016-06-17T15:42:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheThaoTranLP](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@TheThaoTranLP](https://community.plotly.com/u/TheThaoTranLP)\
**Post date:** [June 17, 2016, 3:42pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335/1 "2016-06-17T15:42:54Z")

</div>

I’m trying to retrieve the range of the x-axis when you zoom in a plotly scatter plot, but when I tried to access it using:

```
figure['layout']['xaxis']['range'] 

```

it just returns ‘None’.  
This is the code that I am using to create the graph:

```
# 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)

```

I’m using cufflinks to create the plot from a pandas DataFrame so I don’t explicitly set the layout.xaxis.range to anything. Also I’m using a Jupyter Notebook to display the graph, if that helps at all. So is there any way of getting the range of the x-axis of the current view window of the plot? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![yankev](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/yankev/32/410_2.png) [@yankev](https://community.plotly.com/u/yankev)\
**Post date:** [July 12, 2016, 9:27pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335/2 "2016-07-12T21:27:01Z")

</div>

Graph parameters don’t dynamically change with chart actions. However, as you zoom, the plot does emit data regarding the new x-axis range, you’re unable to to access this information directly in Python. Instead you’d have to use javascript: [https://plot.ly/javascript/zoom-events/](https://plot.ly/javascript/zoom-events/)

---

<div class="post-metadata">

**Author:** ![davzup89](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@davzup89](https://community.plotly.com/u/davzup89)\
**Post date:** [February 6, 2023, 6:56pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335/3 "2023-02-06T18:56:10Z")

</div>

Is this still up-to-date information, is it possible to access x-axis range within python (maybe though some interpreter of JS)?

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [February 6, 2023, 7:56pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335/4 "2023-02-06T19:56:46Z")

</div>

Hi @davzup89, there is a way to do this in python, it’s not recommended though:

> <https://github.com/AIMPED/plotly_dash/blob/master/plotlyDash_show_zoom_area.py#L47-L51>

---

<div class="post-metadata">

**Author:** ![davzup89](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@davzup89](https://community.plotly.com/u/davzup89)\
**Post date:** [February 7, 2023, 1:54pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335/5 "2023-02-07T13:54:13Z")

</div>

Thanks. Just being curious, for which reasons it is not recommended? Overload due to user activity?

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [February 7, 2023, 2:44pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335/6 "2023-02-07T14:44:43Z")

</div>

@davzup89 I actually don’t know, that’s just the warning message you get while using it. 🤣

Might be interesting to know, though. @adamschroeder

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [February 7, 2023, 4:57pm UTC](https://community.plotly.com/t/retrieving-the-range-of-the-x-axis-of-a-zoomed-in-plot/1335/7 "2023-02-07T16:57:35Z")

</div>

hey @davzup89 hi @AIMPED

The issue with `full_figure_for_development()` is that it spins up Kaleido from Python; basically it’s running a whole browser on the server to render the figure, which is very resource-hungry in terms of RAM, CPU, boot-time, etc.

So it’s very much not recommended for production, hence the name `for_development`. in the comment, the figure is already being rendered in a browser in a Dash app, so you can use the client’s browser and a client-side callback to grab the relevant info if you like. It much cheaper, resource-wise.
