2

I am using ipython notebook with pylab --inline

import matplotlib.pyplot as plt
import pandas as pd
......
plt.figsize(14,8)
ax1=plt.subplot(311)
#data is a pandas data frame with timeseries stock data
# this plots the data
data.plot(ax=ax1)

This shows a plot of the stock data but its all displayed at once. I would like to display just subrange of dates and have a scrollbar to control what range How do I do it such that it works with the inline display of plots.

2 Answers 2

3

You can't. Inline display is a static PNG.

If you want something like that you will have to use a Javascript plotting library for now. None that I know of will work out of the box with panda.

Sign up to request clarification or add additional context in comments.

Comments

3

You can't manipulate plots in inline-mode after they have been drawn. However, you can scale,zoom and resize plots in the interactive mode. Just start your notebook without the inline-option and all plots will be generated in an extra window with the functionality you asked for:

ipython notebook --pylab

3 Comments

This popped a new window and displayed the same thing that I saw inline. It does have a list of buttons at the bottom of the window, one of which seems to be zoom/pan. I seem to be able to pan the plot in all the 4 directions and the axis shifts. But I can't seem to figure out how to zoom in/out of it to seem a smaller range of either axis.
To zoom you have to choose the double-array-button and right-click on the plot. But I guess you figured that out by yourself in the meantime.
I don't think this works if the notebook is run on a distant server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.