PySimpleGUI - Line Graphs (with MatPlotLib)

Поділитися
Вставка
  • Опубліковано 5 жов 2024
  • In this video, we use the MatPlotLib Python library to display line graphs inside a Python application.
    Link to Code:
    github.com/ami...
    #python #pysimplegui #coding
    Links to Tutorials Used:
    trinket.io/pyg...
    datatofish.com...
    Sign up for my programming-related newsletter here 🍦→ csclassroom.gu...
    Join the Discord for help and fun: / discord
  • Наука та технологія

КОМЕНТАРІ • 15

  • @oceanedlfg7531
    @oceanedlfg7531 2 роки тому +1

    hello, very good video. I just want to ask a little question. Imagine a GUI where you put a button "plot", and you want to plot different plot each time you click on this button, but remplacing the previous plot by the new one each time. I've been trying to do that since yesterday

    • @oceanedlfg7531
      @oceanedlfg7531 2 роки тому

      like for example the first plot is x**1, the seconde x**2, then x**3 ...

    • @TheCSClassroom
      @TheCSClassroom  2 роки тому

      @@oceanedlfg7531 Whenever the button is clicked, I would generate new plot with the create_plot functions and then run the draw_figure function again, which should refresh the Canvas element with the new plot. This should happen in the event loop, when the event corresponding to the "plot" button is fired.

    • @oceanedlfg7531
      @oceanedlfg7531 2 роки тому

      @@TheCSClassroom in my case, it plots the new under the previous one

    • @TheCSClassroom
      @TheCSClassroom  2 роки тому

      @@oceanedlfg7531 stackoverflow.com/questions/64433446/how-to-clear-a-matplotlib-subplot-canvas-figure-when-a-new-radio-button-is-click

    • @TheCSClassroom
      @TheCSClassroom  2 роки тому

      This should help your solution will probably have to make use of this.

  • @Noktadee
    @Noktadee 2 роки тому +1

    Hello again, I have a graph made by matplot by excel entries, how can i make it show in a window element ? I tried to rearrange my code with the logic from this video but couldnt make it work ? What would you recommend ? Have a nice day.

    • @TheCSClassroom
      @TheCSClassroom  2 роки тому +1

      Basically what you need to do is take your matplotlib graph and place it inside a PySimpleGUI Canvas element. The key to this is the "draw_figure" function, which puts both of those together (in the code linked in the description).

  • @stevetownley1
    @stevetownley1 2 роки тому

    Really nice tutorial, thank you. Got me up to speed really quickly. Any plans to do that live update version?

    • @TheCSClassroom
      @TheCSClassroom  2 роки тому

      I'll add it to the list, probably in 2 weeks :)

    • @ericmoulton4309
      @ericmoulton4309 2 роки тому

      @@TheCSClassroom Nice video indeed. Did you happen to get around to making the live update version?

    • @TheCSClassroom
      @TheCSClassroom  2 роки тому

      @@ericmoulton4309 Not yet, unfortunately, the last few months have been quite busy, but I'll comment here when I do knock it out.

  • @taryana8190
    @taryana8190 Рік тому

    Amazing information, but can this tutorial develop to Realtime chart? thanks before

    • @TheCSClassroom
      @TheCSClassroom  Рік тому

      You can, but you have to use the Graph Element instead of MatPlotLib. It's not the easiest thing to do in PysimpleGUI.

  • @rodrigo100kk
    @rodrigo100kk 2 роки тому

    Jses, it took like a 190803980219 lines of code to do it. =/