Zooming into plots?

Hi there:

Does matplotlib have provide any feature to allow zooming into plot
regions like a waveform viewer does?

regards,
Soumyaroop

Mpl offers full control of the plot display. Maybe if you offer an
example of what you are looking for, we might be able to point you to
a way to do what you want?

Ben Root

···

On Wednesday, January 26, 2011, Soumyaroop Roy <soumyaroop@...287...> wrote:

Hi there:

Does matplotlib have provide any feature to allow zooming into plot
regions like a waveform viewer does?

regards,
Soumyaroop

Hi Ben:

That's encouraging!

I want to be able plot up to N data points (the points are in an
ordered sequence) on a canvas and then zoom into the plot region
enclosed within a subset sequence (e.g., T1 to T2 data points, 0 <= T1
< T2 <=N) by putting two cursors - one on T1 and the other one on T2.

regards,
Soumyaroop

···

On Wed, Jan 26, 2011 at 6:44 PM, Benjamin Root <ben.root@...1304...> wrote:

On Wednesday, January 26, 2011, Soumyaroop Roy <soumyaroop@...287...> wrote:

Hi there:

Does matplotlib have provide any feature to allow zooming into plot
regions like a waveform viewer does?

regards,
Soumyaroop

Mpl offers full control of the plot display. Maybe if you offer an
example of what you are looking for, we might be able to point you to
a way to do what you want?

Ben Root

One way to do that would be to set the x and/or y limits based on the
min/max of the slice of data you want to view. For example:

import numpy as np
Import matplotlib.pyplot as plt

X = np.linspace(0, 5*np.pi, 100)
Y = np.sin(X)
plt.plot(X, Y)

iStart = 50
iEnd = 78

plt.xlim(X[iStart:iEnd].min(), X[iStart, iEnd].max())
plt.ylim(Y[iStart:iEnd].min(), Y[iStart, iEnd].max())

plt.show()

···

On Wednesday, January 26, 2011, Soumyaroop Roy <soumyaroop@...287...> wrote:

Hi Ben:

That's encouraging!

I want to be able plot up to N data points (the points are in an
ordered sequence) on a canvas and then zoom into the plot region
enclosed within a subset sequence (e.g., T1 to T2 data points, 0 <= T1
< T2 <=N) by putting two cursors - one on T1 and the other one on T2.

regards,
Soumyaroop