Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Dynamic graph matplotlib
I draw a lot of data in matplotlib. So I want to make a widget that adjusts the scale horizontally with automatic adjustment vertically.
And after adjusting the zoom use the scroll bar to view the entire graph. Is it possible to do this in matplotlib?
C# is much more complicated than Python, but I was able to do it with it. But in Python I can not do it, I have to study several libraries(Tkinter, PyQt, matplotlib). And it is not clear whether I'm on the right path?
Asked questions on "stackoverflow" and received nothing intelligible as the answer.

from tkinter import *
from matplotlib.backends.backend_tkagg import (
    FigureCanvasTkAgg, NavigationToolbar2Tk)
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

x = pd.read_csv('file.txt',index_col='DATE',parse_dates=True,infer_datetime_format=True)
z = x.iloc[:, 3].values
N = len(z)
ind = np.arange(N)
fig, ax = plt.subplots()
ax.plot(ind, z)

root = Tk()
canvas = FigureCanvasTkAgg(fig, master=root)
canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=1)

toolbar = NavigationToolbar2Tk(canvas, root)

scrollbar = tkinter.Scrollbar(master=root, orient=HORIZONTAL)

scrollbar["command"] = canvas.get_tk_widget().xview


And it's not the first time I come across in Python that no one knows the answer)

If you need something non-standard, then in Python it is difficult to do....
I was able to program the Slider as in the link.Slider
I posted a GIF how it turned out İmage

But still want to do so in tkinter.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] how to remove black area around the graph in tkinter ? NEL 1 93 Aug-03-2019, 01:48 PM
Last Post: NEL
  Axis lim and Plotting a graph in Tkinter KEDivergente 0 167 May-21-2019, 08:10 PM
Last Post: KEDivergente
  [matplotlib]Heatmap with Sliders punksnotdead 1 204 May-19-2019, 10:48 PM
Last Post: punksnotdead
  Tkinter - Make changes to graph and update it adriancovaci 0 359 Apr-08-2019, 09:02 AM
Last Post: adriancovaci
  How to show graph as a slideshow in PyQt5 using matplotlib binsha 0 638 Mar-08-2019, 03:58 AM
Last Post: binsha
  Plotting Matplotlib Grid Lines gehrenfeld 12 828 Feb-23-2019, 12:37 AM
Last Post: gehrenfeld
  [PyQt] PyQt4 dynamic QComboBox littleGreenDude 4 677 Jan-02-2019, 07:22 PM
Last Post: littleGreenDude
  Show a plot from matplotlib in a webpage cliquot22 2 458 Dec-28-2018, 05:03 AM
Last Post: cliquot22
  [PyQt] PyQt4 handle dynamic checkbox click littleGreenDude 1 872 Dec-27-2018, 09:17 PM
Last Post: littleGreenDude
  Making a Matplotlib in Tkinter using a slider Jemeronimo 1 730 Dec-05-2018, 08:06 AM
Last Post: Gribouillis

Forum Jump:

Users browsing this thread: 1 Guest(s)