0

I want to make few modification based on the x axis values, when the plot is shown its looks (https://i.stack.imgur.com/aXkl3.png) but it changes the x axis value after the plot is zoomed (https://i.stack.imgur.com/TkuJb.png), it's obvious!.

All I want is how to get the present x axis value before and after the plot is zoomed.

Based on the plot selection I want to set the plot title, so I need to know the current x -axis value after the plot is shown.

Thanks in advance...

Java.beginner
  • 871
  • 2
  • 19
  • 37
  • possible duplicate of [Pandas timeseries plot setting x-axis major and minor ticks and labels](http://stackoverflow.com/questions/12945971/pandas-timeseries-plot-setting-x-axis-major-and-minor-ticks-and-labels) – Cory Kramer Jul 11 '14 at 16:11
  • It's not duplicate, I don't want to set the x-ticks rather I want read after the plot is shown for some other modification outside, thanks – Java.beginner Jul 11 '14 at 16:15

1 Answers1

0

You can get the current limits of a plot by calling theaxis()function. The return value is in the form[xmin, xmax, ymin, ymax]. From your question it is not entirely clear what you are trying to do. It may be that you need to use these values in conjunction with the tick values/labels of your plot.

If you need to determine when the plot has been zoomed you can connect a handler function to theDrawEventevent of your figure.

user3419537
  • 4,740
  • 2
  • 24
  • 42
  • Thanks @user3419537, All I want set a plot title based on the what user is selected on the plot, for example if the plot shows a data from 'Jan 2012' to 'July 2014' dynamically want to set the title to 'Years' and if the user selects from 'May 2014' to 'July 2014' then dynamically want to set the title to 'Months' and if the user selects from 'July 2014' to 'July 2104' then dynamically want to set the title to 'Days'. To achieve this I need read the x axis values from the current plot, so if you suggest me how to get the x axis then I will work upon to get the task done. Thanks you so much – Java.beginner Jul 13 '14 at 08:34
  • The first 2 values in the list returned from `axis()` are the visible range of the x-axis. If you need the tick values or labels, you can use `get_xticks()` and `get_xticklabels()` – user3419537 Jul 13 '14 at 11:37
  • Thanks @user3419537, I got the x axis values with your help and have manipulated according to my need. Now I have new problem, how do I set the title after the plot is closed..., I think need to start a new thread... please advise... – Java.beginner Jul 14 '14 at 10:08
  • Yes, please create another question for your new problem – user3419537 Jul 14 '14 at 11:01
  • Thanks @user3419537, will create a new post. – Java.beginner Jul 14 '14 at 11:02