Matplotlib Tutorial : Matplotlib Full Course

Поделиться
HTML-код
  • Опубликовано: 3 фев 2025

Комментарии • 214

  • @derekbanas
    @derekbanas  4 года назад +15

    TABLE OF CONTENTS
    00:00 Intro
    00:32 Importing
    02:38 Simple Plotting
    04:52 Multiple Plots
    06:08 Using Figure Objects
    12:32 Subplots
    15:03 Appearance Options
    21:28 Saving Plots
    22:09 Working with Pandas Dataframe
    29:01 TeX Markup (Math Symbols)
    36:41 Histograms
    40:57 Bar Charts
    48:19 Pie Charts
    53:50 Timeseries
    59:31 Tables
    1:08:21 Scatterplots
    1:12:59 3D Surfaces
    1:21:38 Matplotlib Finance
    1:26:23 Heatmaps
    Probability in One Video : ruclips.net/video/sEte4hXEgJ8/видео.html
    Statistics in One Video : ruclips.net/video/tcusIOfI_GM/видео.html
    NumPy in One Video : ruclips.net/video/8Y0qQEh7dJg/видео.html
    Pandas in One Video : ruclips.net/video/PcvsOaixUh8/видео.html

    • @thunderbirdizations
      @thunderbirdizations 3 года назад

      1:33:45
      Stayed til the end.
      Have an enormous project with a crazy learning curve ahead. I don’t plan on using matplotlib but I wanted to learn it before PlotLy to get a second perspective.

  • @m.aurelien2872
    @m.aurelien2872 4 года назад +26

    I was just finishing an implementation of a deep learning paper and needed to plot some stuff, great timing!

    • @derekbanas
      @derekbanas  4 года назад +2

      That's great! I'm happy I could help :)

  • @arturowatson
    @arturowatson 3 года назад +4

    The college professor you wished you had! To say Derek knows his stuff is just a bit understated. Video moves rapidly covering many visualization possibilities using Jupyter notebook. One of the hurdles I've had with Matplotlib is that there are actually too many possibilities with disjointed specifics. The pace, logical progression and scope of this video is perfect, leaving the viewer with functioning code examples to run, modify and explore on their own. Bravo!

    • @derekbanas
      @derekbanas  3 года назад +2

      Thank you for the nice compliment :) I do this stuff for a living so I’m happy to hear that I was able to make it understandable.

  • @elijahkalii5290
    @elijahkalii5290 3 года назад +1

    You are the only guy I have found who can really teach me data analysis. You are really good at this Derek. Thank you. Elijah Kalii. Nairobi, Kenya

  • @TheVerbalAxiom
    @TheVerbalAxiom 3 года назад +5

    I just realized I needed to learn matplotlib in DEPTH and of course it WOULD be Derek to help me, gotta love this freakin genius.

  • @punkbuster2004
    @punkbuster2004 8 месяцев назад +2

    WOW , that was a really through class!!! I know that you din't dive too deep on every module, but it actually is not neeeded . anyone wanting to learn Python will find he's way, all we need is this headstart!!

  • @digigoliath
    @digigoliath 4 года назад +11

    OMG!! Everything I need in 1 video. Derek, you are my superhero!!! SMASHING the LIKE Button!!

    • @derekbanas
      @derekbanas  4 года назад +2

      Thank you very much :) I appreciate that!!!

  • @MikkoHaavisto1
    @MikkoHaavisto1 3 года назад +5

    Thank you and keep making these! I've watched hundreds of Python videos here in RUclips, but yours might be the best.

  • @CKPSchoolOfPhysics
    @CKPSchoolOfPhysics 2 года назад +3

    Really powerful introduction of Matplotlib from basic to really advanced level. This has helped me tremendously in my ML plotting.

  • @vedachintha
    @vedachintha 2 года назад +2

    This is a fantastic tutorial. Even though I have a lot of experience in plotting using Excel and PowerBI, for reasons unknown, I've always felt intimidated by the idea of plotting using python. From your video, I've gained a lot of knowledge and confidence, thank you so much for your effort. Also, many thanks for the ipynb file, much appreciated. Next stop - Seaborn Tutorial :-)

    • @derekbanas
      @derekbanas  2 года назад +1

      Thanks for taking the time to tell me it helped :) Enjoy Seaborn

  • @GabrieleIuzzolino
    @GabrieleIuzzolino 11 месяцев назад

    Ty, the way you talk is really easy to understand for non-native English speakers like me

  • @andreapaps
    @andreapaps 2 года назад

    This is great, the info comes at you so fast... Basically you see what is possible then when you need to actually use it you come back and pause the video and copy the code :D

  • @GloomyElder
    @GloomyElder 4 года назад +1

    I just watched your Plotly and matplotlib tutorials, they are awesome, I' heading to watch the seaborn , numpy and and the other cool videos you have! Keep the great work, greetings from Mexico

    • @derekbanas
      @derekbanas  4 года назад

      Thank you very much :) I love Mexico!

  • @liapeterson1051
    @liapeterson1051 2 года назад

    By 12 minutes in, my mind was absolutely blown. Thank you for making these!

    • @derekbanas
      @derekbanas  2 года назад

      Thank you :) I'm very happy that I could help

  • @davidcrossey
    @davidcrossey 4 года назад

    This series has come up at a fantastic time in the Data Science / Machine Learning space. As a software engineer myself with weaker background in mathematics, trying to prepare for the future in this field has always been daunting. These video tutorials, along with the statistics series are extremely valuable to making this area more accessible & fun to learn - thank you @Derek Banas !

    • @derekbanas
      @derekbanas  4 года назад +1

      Thank you :) I’m doing my best to create a step-by-step course while also trying to present everything in new ways. I’ve been using data science for work for quite some time so I have my core toolset. I will however try to cover everything to the best of my ability. For example I mainly use PyTorch, but I’ll cover Tensorflow as well.

  • @debjyotiarr
    @debjyotiarr 4 года назад

    Commenting after watching the whole video and also following along on a Jupyter notebook of my own. Sincere gratitude to you!

    • @derekbanas
      @derekbanas  4 года назад +1

      Thank you for taking the time to say I helped :) I greatly appreciate it

  • @sshashi67
    @sshashi67 5 месяцев назад

    Great video for starting off various charts...then do deep dive into specifics as needed using documentation. (Watched to the end!)

  • @Naeem2460
    @Naeem2460 Год назад

    I just found your channel, and it has everything that i need, Thank you very much

    • @derekbanas
      @derekbanas  Год назад

      Thank you :) I’m happy I could help

  • @ericzheng4815
    @ericzheng4815 2 года назад

    This video is invaluable. It is so well-prepared and every plot is explained very clearly.

    • @derekbanas
      @derekbanas  2 года назад

      Thank you for the nice compliment :) I'm happy you found it useful!

  • @maziarghorbani
    @maziarghorbani 3 года назад +1

    I watched the whole video but in two goes. As usual, very informative and professional. Thank you 🙂

  • @odraudenoel
    @odraudenoel 3 года назад

    Thanks so much for your tutorials, I am a big fan! Always watch all the way to the end!

  • @stacysanders7735
    @stacysanders7735 Год назад

    Thank you for a great video. I did watch until the end and appreciate the great pacing.

  • @gavyn3258
    @gavyn3258 4 года назад

    Watched the whole video and followed along on Jupyter. Excellent content that deserves a like and subscribe

    • @derekbanas
      @derekbanas  4 года назад

      Thank you very much :) I'm very happy that you enjoyed it

  • @MohammadYousofi-ho9bh
    @MohammadYousofi-ho9bh 9 месяцев назад

    Your teaching method is just great! I love the way you are teaching Sir. I recently purchased a Data Science course in Udemy from Jose Portilla, but his teaching method is not interesting to me at least. And I wanted to say that I rarely comment on videos on RUclips, and those are the ones I liked a lot like this video! Bravo!!!

    • @derekbanas
      @derekbanas  9 месяцев назад

      Thank you very much :) I'm glad that I could help.

  • @umairsalim9442
    @umairsalim9442 Год назад

    Just completed the whole video, above everything else just loved the way you say 'anndddddd' 😅

  • @olejir
    @olejir 2 года назад

    It's such an amazing course, thank u a lot. I'm so glad that I've found ur channel!

    • @derekbanas
      @derekbanas  2 года назад

      Thank you :) I'm very happy you found it useful!

  • @chriscoyne2881
    @chriscoyne2881 3 года назад

    stayed until the end and am now going to watch all of your other videos

    • @derekbanas
      @derekbanas  3 года назад

      Thank you very much :) There are a lot of them!

  • @RahulKumar-fc8cf
    @RahulKumar-fc8cf Год назад

    Great Content and very concise one. Really enjoyed learning plotting with Matplotlib. Keep up the good work.

  • @i-eto-projdjot
    @i-eto-projdjot 2 года назад

    Thanks for nice tutorial! Some shorthand for rounding in Tabels section:
    df.iloc[:, 1:6] = round(df.iloc[:, 1:6], 2)
    This line of code would round all values in all price columns

  • @gabrielgirodo
    @gabrielgirodo 3 года назад

    Tks for the video! You made it very easy and the cheat sheet will come in handy. Now I will move to the seaborn tutorial. Have a great day!

    • @derekbanas
      @derekbanas  3 года назад +1

      I'm happy I could help :)

  • @eythoreinarsson6260
    @eythoreinarsson6260 4 года назад

    Watched the whole video, although I skipped some details since I am quite familiar with matplotlib. I liked slower pace of the video, it made it easy to casually watch the video without my full attention.
    I am looking forward to seaborn, which i have not used it yet, so you will have my full attention. Thank you very much for your videos, the amount and breadth of topics you are able to cover is amazing.

    • @derekbanas
      @derekbanas  4 года назад +1

      Thank you for the input. Yes I just slightly slowed the video to see if anyone noticed. I appreciate both that you watched the video and that you said you preferred the slower speed I'll keep doing it. Yes Seaborn is next. It should be up in less than 6 days.

  • @manavt2000
    @manavt2000 Год назад

    Thank you very much for this amazing tutorial! Love from Germany

    • @derekbanas
      @derekbanas  Год назад +1

      I'm very happy you found it useful :)

  • @sameerreddy7514
    @sameerreddy7514 7 месяцев назад

    Amazing tutorial. was easy to follow. thanks Derek.

  • @younesmakhchan2010
    @younesmakhchan2010 3 года назад +1

    dude , 3D Surfaces are amazing

  • @praleen_
    @praleen_ 4 года назад +3

    My first line of code worked at first try! \o/

  • @alwin5995
    @alwin5995 2 года назад

    completed the whole thing amazing

  • @olevam1
    @olevam1 3 года назад

    Thanks to this video I finally understood how to modify axes properly (I need to create them in a figure first!) week of figuring it out paid off!

    • @derekbanas
      @derekbanas  3 года назад

      I'm happy I could help :)

    • @olevam1
      @olevam1 3 года назад

      @@derekbanas One questions, I have struggled to save the file, as it does not show the axes (and I noticed it does not show it in your video either) any thoughts on how to get the axes to show on the saved file?

  • @dinoscheidt
    @dinoscheidt 3 года назад

    Super useful. Incredible preparation and delivery. Love from Berlin ❤️

    • @derekbanas
      @derekbanas  3 года назад

      Thank you for the nice compliment :)

  • @gerrywilson2035
    @gerrywilson2035 4 года назад

    God will bless you for giving free education... Keep it up... ✌️♥️

    • @gerrywilson2035
      @gerrywilson2035 4 года назад +1

      If possible try to cover keras and tensorflow

    • @derekbanas
      @derekbanas  4 года назад

      Thank you for the nice message 😁 I tend to use PyTorch most often but I will definitely cover tensorflow and keras as well

    • @gerrywilson2035
      @gerrywilson2035 4 года назад

      @@derekbanas Thanks😊

  • @mgr1282
    @mgr1282 4 года назад +8

    Great series: numpy, pandas, matplotlib. what's next? tensorflow? pytorch? scikitlearn?

    • @derekbanas
      @derekbanas  4 года назад +6

      Thank you 😁 Yes I'll cover all of the above and more. Seaborn is next

    • @digigoliath
      @digigoliath 4 года назад

      @@derekbanas Wow!!

  • @gesuchter
    @gesuchter 4 года назад +1

    I am very ready for this one, thank you!

    • @derekbanas
      @derekbanas  4 года назад +1

      Thank you for following my series :)

  • @kennethstephani692
    @kennethstephani692 Год назад

    Great video, Derek!!

  • @yashjadhav3974
    @yashjadhav3974 3 года назад

    love your content man.......much support to you!!!

  • @Pattypatpat7122
    @Pattypatpat7122 Год назад

    Great content! I learnt a lot

  • @markkennedy9767
    @markkennedy9767 Год назад +2

    At 23:50, why do we need to convert the pandas dataframe to a numpy array. Isn't pandas based on numpy.
    Also, many stackexchange posts suggest that .values (is this an attribute?) is not recommended to do this.
    They suggest using the function Dataframe to numpy() instead.
    At 38:10, why are you choosing stacked=True if there is only one data set for the histogram. Isn't this redundant (and kinda confusing)?
    At 48:10, surely you need to change the tick labels back form the index to the school types again using xticks(ticks, labels) etc?

  • @markkennedy9767
    @markkennedy9767 Год назад

    The syntax for subplotting is incredibly confusing. There are various functions e.g. subplot(), subplots(), add_subplot() or the axes() functions, all used in a variety of ways e.g. some as part of the module plt in plt.subplots() or plt.subplot() here and some as a method acting on the figure e.g. fig.add_subplots. Then there's the various and confusing indices for the arguments.
    For example, around 5:15, couldn't you first just assign plt.subplot() with its arguments to a variable e.g. ax1 and then on the next line have ax1.plot() with it's arguments.
    The reason I say this is that I can't understand how plt.plot() with its arguments knows how to work on the specific axis plt.subplot() etc on the line above it.
    I suspect fig.add_subplots is the best way to create subplots, but every video seems to do it differently.
    Surely at 11:50, the arguments for positioning the text for axes2 are based not on the centre of the figure being (0,0) as you say, but on the origin of axis 2 being (0,0). If you see where the text ends up, this is clear (around (0,40) relative to the axis 2 origin).

  • @deondoure1075
    @deondoure1075 2 года назад

    Good video thanks.
    I will watch it again.

  • @ebbandari
    @ebbandari 2 года назад

    Fantastic tutorial. Thank you.

  • @pavanim6258
    @pavanim6258 4 года назад

    Excellent content and very useful stuff..all in one video..thx a lot for sharing Derek

    • @derekbanas
      @derekbanas  4 года назад

      Thank you very much :) Happy I could help

  • @markkennedy9767
    @markkennedy9767 Год назад

    Thank you for this.
    At 12:20, is there any good reason why the add_axes() method takes a list as argument, yet the text() method takes a tuple. It seems totally arbitrary since the arguments are both related to location etc.

  • @burner918
    @burner918 3 года назад

    Loved this video. Thank you so much.

  • @JackQuark
    @JackQuark 3 года назад

    Great tutorial, thanks.

  • @abhin.v4981
    @abhin.v4981 2 года назад

    That was an excellent tutorial. I did not understand why you used list comprehension at 41:18 instead of directly passing t_type as an argument?

  • @cvryn7
    @cvryn7 3 года назад

    Just finished it. thanks

  • @upgraduate
    @upgraduate 3 года назад

    😊 very nice tutorial

  • @shreyasmd21
    @shreyasmd21 3 года назад

    thank you for making this video, it really helped me a lot!

    • @derekbanas
      @derekbanas  3 года назад

      I'm very happy that I could help :)

  • @bhavinmoriya9216
    @bhavinmoriya9216 3 года назад

    Thank you very much for the wonderful vide0 :)

    • @derekbanas
      @derekbanas  3 года назад +1

      Thank you :) I'm very happy you enjoyed it

  • @TheLegalLens1
    @TheLegalLens1 Год назад

    At 7:20 , I can't get this code to run: `fig1 = plt.figure(figsize(5,4),dpi =100)`
    Error: NameError Traceback (most recent call last)
    Input In [7], in ()
    ----> 1 fig1 = plt.figure(figsize(5,4),dpi =100)
    Any idea what I have wrong here?

    • @TheLegalLens1
      @TheLegalLens1 Год назад

      Chatgpt solved it: fig1 = plt.figure(figsize=(5,4),dpi=100) Explanation below ->
      'The issue with your code is that you have specified the figsize argument incorrectly. The figsize argument expects a tuple of width and height values, but in your code, you have specified it as two separate values. To fix this issue, you can modify your code as follows:
      import matplotlib.pyplot as plt
      fig1 = plt.figure(figsize=(5,4), dpi=100)
      axes_1 = fig1.add_axes([0.1, 0.1, 0.9, 0.9])
      axes_1.set_xlabel("x-axis label")
      plt.show()
      Thanks chatpgt

    • @TheLegalLens1
      @TheLegalLens1 Год назад

      Also just saw you correct the error @ 9:30 lol.....

  • @mahmoudabdelaziz7994
    @mahmoudabdelaziz7994 2 года назад +1

    8:44 will anyone please tell me how you wrote the small 2 like that

  • @joaovaz3473
    @joaovaz3473 4 года назад +1

    Great video, as always! Btw, first.

  • @m.h.7121
    @m.h.7121 4 года назад

    top-notch tutorial as always. Thank you so much, man. You are my motivation that keeps me productive every day. BTW, I just noticed that your typing speed is getting slow. But I still like your content tho.

    • @derekbanas
      @derekbanas  4 года назад

      Thank you very much :) I have been messing with the tutorial speed to see if people like videos that are slightly slower.

    • @m.h.7121
      @m.h.7121 4 года назад

      @@derekbanas Alright. I can see some data science projects over there...(I just travelled into the future).LOL

  • @jacquesfrancois4275
    @jacquesfrancois4275 2 года назад

    5:15, Hi what does 1,2,1 refer to exactly in this instance?

  • @josefkurk1492
    @josefkurk1492 4 года назад

    fajtastic review!!
    super easy to undestend:)

    • @derekbanas
      @derekbanas  4 года назад

      Thank you very much 😁

  • @jamesjohnathan4424
    @jamesjohnathan4424 3 года назад

    Thanks for the valuable piece of information. Appreciate that :)

  • @maxqin29
    @maxqin29 3 года назад +3

    Hi Derek, good job. How did you input x^2 in your Jupyter notebook at 8:43?

    • @daviaires2219
      @daviaires2219 2 года назад +1

      You mean how to input the "²"? ctrl + alt + 2 (not the 2 on the numpad, the other one)

  • @igniculus_
    @igniculus_ 4 года назад

    Wow, thank you so much for this!

    • @derekbanas
      @derekbanas  4 года назад +1

      Thank you for following my videos :)

  • @qtrix06
    @qtrix06 4 года назад +1

    Make a video on OpenCV please!

  • @sankalpchenna3355
    @sankalpchenna3355 4 года назад

    Hey Derek you are amazing I have learnt a lot from your machine series if possible can make a video on sikit learn
    And machine learning algorithms in python with real-time examples that would be great!!
    Again, thanks a lot for your effort it really makes a difference load of love from india..

    • @derekbanas
      @derekbanas  4 года назад +1

      Thank you very much :) Yes I plan to do both and a whole lot more. Seaborn is next

  • @carlypetracco1107
    @carlypetracco1107 4 года назад

    Thank you, this was great!

    • @derekbanas
      @derekbanas  4 года назад

      Thank you for taking the time to say it helped :)

  • @ogadit
    @ogadit 4 года назад +3

    WAITING FOR THIS FOR SOO LONG

    • @derekbanas
      @derekbanas  4 года назад +1

      I hope you find it useful :)

  • @JasonOngVlog
    @JasonOngVlog 2 года назад

    Can anyone help me in adding labels for the scatterplot sample? I'm trying but it keeps getting errors.. the scatterplot is in 1:12:00

  • @vanshshah6418
    @vanshshah6418 3 года назад

    plt.scatter()
    plt.plot()
    plt.title()
    plt.xlabel()
    plt.ylabel()
    plt.show()
    plt is a module and all these scatter,plot,show are functions than how are they connected like where is the information from one function being stored so that another function can use it??
    please answer me

  • @didierleprince6106
    @didierleprince6106 4 года назад

    A ton of mercis

    • @derekbanas
      @derekbanas  4 года назад

      je suis très heureux d'aider

  • @garvsadh9983
    @garvsadh9983 Год назад

    in the timeseries section it shows the error that ValueError: x and y must have same first dimension, but have shapes (64,) and (251,)
    even after copying your code it does not seem to work What do you think might be the issue here im kinda stuck thanks

  • @vishwad9372
    @vishwad9372 4 года назад

    Hi derek, I learned alot from you. (Thank you ) **1000

    • @derekbanas
      @derekbanas  4 года назад

      Thank you for taking the time to tell me that :) I appreciate it

  • @sudarshankshirsagar4568
    @sudarshankshirsagar4568 4 года назад

    I have favour to ask you bro ,
    Will Go deep into Descriptive Analytics along with Supervised Machine Learning?
    I don't get anything which My Teacher teaches and they don't put much effort in teaching us(that's sorry to say but it's true).
    And one thing I really like your "Machine Learning and Data Science " series and I know that there are more things to come in that series .
    So best of luck and i really hope that you will go as deeper as possible in this series .Best wishes with you Bro . Keep it up 👍👍💪

    • @derekbanas
      @derekbanas  4 года назад

      Thank you for the nice message :) Yes I have promised I will dedicate myself to data science, machine learning and the related maths for the rest of the year. My goal to to provide a complete learning path all at one location in order.

  • @cl32
    @cl32 4 года назад

    Would you ever consider doing a Dafny tutorial? I've have a very short introduction to it in one of my uni classes and thought it was interesting, and I'm sure it would help some people!

    • @derekbanas
      @derekbanas  4 года назад +1

      I'll see what I can do. I have looked at it and it is very verbose indeed

    • @cl32
      @cl32 4 года назад

      @@derekbanas Thanks! I really appreciate your work :)

  • @EcExplorer
    @EcExplorer 4 года назад

    It would be great if you take some time and explain the installation procedure and troubleshooting at the beginning. I am using pip install, matplotlib is installed but it is showing error in import.

    • @derekbanas
      @derekbanas  4 года назад

      In the description I have installation videos for Windows and MacOS. What error are you seeing?

  • @alexandern8671
    @alexandern8671 4 года назад

    Thanks for another great video.
    It's probably me but I could not find the link to jupiter notebook you used in the video to run the examples. Could you please point me in the right direction if it is possible?

    • @derekbanas
      @derekbanas  4 года назад

      Thank you :) I show how to install everything for Windows here : ruclips.net/video/a7Ylbn1ikF0/видео.html and for Mac here which is basically the same for Linux ruclips.net/video/2JeoNlCcLOM/видео.html and at the end of my Pandas tutorial I talk about setting up virtual environments and installing libraries ruclips.net/video/PcvsOaixUh8/видео.html
      Sorry everything is all over the place. That is sort of the problem with trying to create a big course, while also making these learn in one videos.

    • @alexandern8671
      @alexandern8671 4 года назад

      @@derekbanas Thanks Derek for getting back to me. The video that you mentioned has a link to the Python codes that you used for the stats tutorial, but no codes for Matplotlib video that I am after. I found these on your web site www. newthinktank. com/2020/08/learn-matplotlib-one-video/ (remove spaces) where there was a link to your Github. Thanks again

  • @rtr195807
    @rtr195807 4 года назад

    many thanks

  • @KevinTempelx
    @KevinTempelx 4 года назад

    Thank you!

    • @derekbanas
      @derekbanas  4 года назад

      I'm happy you found it useful :)

  • @4getme2getme
    @4getme2getme 10 месяцев назад

    sir, How do you wrote a supersript x**2 casually in jupyter notebbok in code mode?! :O

  • @amirnajafi206
    @amirnajafi206 4 года назад

    Please do the Digital humanities introduction video(s).

    • @derekbanas
      @derekbanas  4 года назад

      I'll look into it. Thank you for the request

  • @emifo6018
    @emifo6018 4 года назад

    How did you I will come to your page to find machine learning tutorials these days to upload these?! Thanks, I have never come back from your channel with absence.

    • @derekbanas
      @derekbanas  4 года назад

      Thank you 😁 I hope you find them useful

  • @patricknelson7914
    @patricknelson7914 4 года назад

    Thanks man!

  • @Emma-mu7kj
    @Emma-mu7kj 3 года назад

    Thanks again for this great course! Could you show me your solution on Subplout IN[12] with a for loop?

  • @elliem9548
    @elliem9548 4 года назад +1

    Hey, thanks for the video, it's so well explained. For the Time Series section, I downloaded data from 21 Aug 2019 - 21 Aug 2020. I've done all the same code but when I put in plt.plot (date_arr_np, goog_cp) I get an error and this message: 'x and y must have same first dimension, but have shapes (64,) and (253,)'. Do you know what's gone wrong or how I can fix this?

    • @derekbanas
      @derekbanas  4 года назад

      Thank you :) It is hard to say. I have all the code and the csv file here github.com/derekbanas/matplotlib Try it and make sure you don't get an error

    • @jaroslavkrbec582
      @jaroslavkrbec582 2 года назад

      @@derekbanas Same problem here, I managed to fix this example with your data, but in case of data I downloaded, it didn't work. Did you swith some other options on yahoo or something else? Anyway, thank you for your great work!

    • @jaroslavkrbec582
      @jaroslavkrbec582 2 года назад

      So I figured it out! Almost kids' joy here :) My solution was to extract the same amount of rows from downloaded material a then use it. It may not be the most elegant sulution, but it worked.
      goog_data = pd.read_csv('GOOG.csv')
      goog_data
      goog_data_np = goog_data.to_numpy()
      goog_cp = goog_data_np[:, 4]
      data = pd.DataFrame(goog_cp)
      rows = data.head(43).to_numpy()
      #odstranit svátky
      holidays = [datetime.datetime(2022, 11, 17), datetime.datetime(2022, 10, 28)]
      date_arr = pd.bdate_range(start='10/1/2022', end='12/4/22', freq='C', holidays=holidays)
      date_arr_np = date_arr.to_numpy()
      fig_7 = plt.figure(figsize=(8,5))
      axes_7 = fig_7.add_axes([0.1, 0.1, 0.9, 0.9])
      plt.plot(date_arr_np, rows)

  • @taricov4662
    @taricov4662 4 года назад

    thanx Derek

    • @derekbanas
      @derekbanas  4 года назад

      Thank you very much :) Happy I could help

  • @bennguyen1313
    @bennguyen1313 4 года назад

    Why is pandas, sometimes, but not always used in conjunction with matplotlib?
    Any suggestions on how to read/parse/plot a string from the (py)serial port, such that no data is dropped? The transmitter sends lines like "1.23, 3.3, 87.1
    " every 500ms for approximately 2 minutes..
    yet in the code below, the update to the plot seems to take too much time, because the data starts to get dropped (or gets backed up into a queue?), and does not get plotted nor csv saved . Is there more efficient way of plotting (animation) or using threads
    import serial
    import time
    import csv
    import threading
    import numpy as np
    import matplotlib
    matplotlib.use("tkAgg")
    import matplotlib.pyplot as plt
    #TODO : Use threads for Plot and Serial.. like ComPlotter or felipengeletrica /PyDatalogger
    ser = serial.Serial('/dev/ttyACM0')
    ser.flushInput()
    plot_window = 20
    y_var = np.array(np.zeros([plot_window]))
    plt.ion()
    fig, ax = plt.subplots()
    line, = ax.plot(y_var)
    while True:
    try:
    ser_bytes = ser.readline()
    try:
    decoded_bytes = float(ser_bytes[0:len(ser_bytes)-2].decode("utf-8"))
    print(decoded_bytes)
    except:
    continue
    with open("test_data.csv","a") as f:
    writer = csv.writer(f,delimiter=",")
    writer.writerow([time.time(),decoded_bytes])
    y_var = np.append(y_var,decoded_bytes)
    y_var = y_var[1:plot_window+1]
    line.set_ydata(y_var)
    ax.relim()
    ax.autoscale_view()
    fig.canvas.draw()
    fig.canvas.flush_events()
    except:
    print("Keyboard Interrupt")
    break
    ##################################
    ##################################
    ##################################
    def Main():
    ser = None # serial.Serial(3, 11520)
    t1 = threading.Thread(target = Task1, args=[ser])
    t2 = threading.Thread(target = Task2, args=[ser])
    Report("Starting Thread 1")
    t1.start()
    time.sleep(3)
    Report("Starting Thread 2")
    t2.start()
    if __name__ == '__main__':
    Main()
    ##################################
    ##################################
    ##################################
    import serial
    import wx
    import numpy
    import matplotlib
    matplotlib.use('WXAgg')
    from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
    from matplotlib.figure import Figure
    import matplotlib.pyplot as plt
    class DataLoggerWindow(wx.Frame):
    def __init__(self):
    wx.Frame.__init__(self, None, -1, "ComPlotter", (100,100), (640,480))
    self.SetBackgroundColour('#ece9d8')
    # Flag variables
    self.isLogging = False
    # Create data buffers
    self.N = 100
    self.n = range(self.N)
    self.M = 3
    self.x = []
    for m in range(self.M):
    self.x.append(0 * numpy.ones(self.N, numpy.int))
    # Create plot area and axes
    self.fig = Figure(facecolor='#ece9d8')
    self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
    self.canvas.SetPosition((0,0))
    self.canvas.SetSize((640,320))
    self.ax = self.fig.add_axes([0.08,0.1,0.86,0.8])
    self.ax.autoscale(False)
    self.ax.set_xlim(0, 99)
    self.ax.set_ylim(-100, 1100)
    for m in range(self.M):
    self.ax.plot(self.n,self.x[m])
    # Create text box for event logging
    self.log_text = wx.TextCtrl(
    self, -1, pos=(140,320), size=(465,100),
    style=wx.TE_MULTILINE)
    self.log_text.SetFont(
    wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False))
    # Create timer to read incoming data and scroll plot
    self.timer = wx.Timer(self)
    self.Bind(wx.EVT_TIMER, self.GetSample, self.timer)
    # Create start/stop button
    self.start_stop_button = wx.Button(
    self, label="Start", pos=(25,320), size=(100,100))
    self.start_stop_button.SetFont(
    wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False))
    self.start_stop_button.Bind(
    wx.EVT_BUTTON, self.onStartStopButton)
    def GetSample(self, event=None):
    # Get a line of text from the serial port
    sample_string = self.ser.readline()
    # Add the line to the log text box
    self.log_text.AppendText(sample_string)
    # If the line is the right length, parse it
    if len(sample_string) == 15:
    sample_string = sample_string[0:-1]
    sample_values = sample_string.split()
    for m in range(self.M):
    # get one value from sample
    value = int(sample_values[m])
    self.x[m][0:99] = self.x[m][1:]
    self.x[m][99] = value
    # Update plot
    self.ax.cla()
    self.ax.autoscale(False)
    self.ax.set_xlim(0, self.N - 1)
    self.ax.set_ylim(-100, 1100)
    for m in range(self.M):
    self.ax.plot(self.n, self.x[m])
    self.canvas.draw()
    def onStartStopButton(self, event):
    if not self.isLogging:
    self.isLogging = True
    self.ser = serial.Serial()
    self.ser.baudrate = 38400
    self.ser.timeout=0.25
    # Try serial ports one by one starting
    # with COM30 and working downwards
    for m in range(29, 0, -1):
    self.ser.port = m
    try:
    # Try this port number
    self.ser.open()
    # We only get to here if port opened
    self.log_text.AppendText(
    'Opened COM' + str(m+1) + '...
    ')
    break
    except:
    # We end up here if this port number
    # failed to open
    pass
    if self.ser.isOpen():
    # We successfully opened a port, so start
    # a timer to read incoming data
    self.timer.Start(100)
    self.start_stop_button.SetLabel("Stop")
    else:
    self.timer.Stop()
    self.ser.close()
    self.isLogging = False
    self.start_stop_button.SetLabel("Start")
    if __name__ == '__main__':
    app = wx.PySimpleApp()
    window = DataLoggerWindow()
    window.Show()
    app.MainLoop()

  • @cutieFAIZANHASSAN
    @cutieFAIZANHASSAN 3 года назад

    How did he put superscript (square) in string? Please somebody tell me.

  • @cruelladkvods
    @cruelladkvods 9 месяцев назад

    Thanks :)

  • @motiongraphic5145
    @motiongraphic5145 3 года назад

    What is the benefit of np.arrange i did not get it.😭

  • @huizhao3589
    @huizhao3589 4 года назад

    where is the x, y_axis when saving the figure to a file?

    • @derekbanas
      @derekbanas  4 года назад +1

      Increase the figure size and both will show in the file

  • @hosenmdaltaf
    @hosenmdaltaf 4 года назад

    Can you give the serial, where to start this series from pandas/numpy/statistics. That will be very helpful for me.

    • @derekbanas
      @derekbanas  4 года назад +1

      Here is my Data Science & Machine Learning Playlist in order ruclips.net/p/PLGLfVvz_LVvQy4mkmEvtFwZGg1S38MUmn

  • @yanco6
    @yanco6 4 года назад

    Very good tutorial
    How about tutorial on geogabra py api
    geogabra is the best

    • @derekbanas
      @derekbanas  4 года назад

      Thank you :) That is funny. I was looking at how I could use GeoGebra in my math courses just the other day. I'll definitely be using it soon.

    • @yanco6
      @yanco6 4 года назад

      @@derekbanas it has it's own script language and api for other languages, also he has gui buttons and other staff.
      Classic is the full package including 3d 2d statistic and other staff.

  • @sarmadali3338
    @sarmadali3338 4 года назад

    Hi Derek sir do you know any online compiler for machine learning if you Know then tell me

    • @derekbanas
      @derekbanas  4 года назад

      Sorry, but machine learning requires a pretty powerful computer. I used to use AWS which is pretty cheap up to a point.

    • @sarmadali3338
      @sarmadali3338 4 года назад

      @@derekbanas ok thanks

  • @ThirumaleshHS1
    @ThirumaleshHS1 4 года назад

    Nice tutorial, next video on PyQtGraph please ?

    • @derekbanas
      @derekbanas  4 года назад +1

      I'll see what I can do. Seaborn is next because I'm already working on it. I have to schedule out way in advance to make videos every day.

    • @ThirumaleshHS1
      @ThirumaleshHS1 4 года назад

      Derek Banas thanks. Looking forward for the next videos. I found PyQtGraph visualisation to be faster than matplotlib especially for real time data/signals and at the same time, PyQtGraph is difficult to understand(for me :P)

    • @derekbanas
      @derekbanas  4 года назад +1

      I'll definitely check it out 😁 Thank you for the request

  • @arpitagec9
    @arpitagec9 4 года назад

    Can you please cover a series on PyQt5 with Designer (Qt)?

    • @derekbanas
      @derekbanas  4 года назад +1

      I'll see what I can do

    • @arpitagec9
      @arpitagec9 4 года назад

      @@derekbanas Hope to see a detailed series!🤞

  • @sadeghsadeghy6563
    @sadeghsadeghy6563 4 года назад

    @Derek Banas hey derek ive watched your java tutorial and i wanna be java backend programmer what should i learn after that i mean what concept should i learn first on java ee and actually u promise me to create Spring tutorial ?

    • @derekbanas
      @derekbanas  4 года назад

      Basically everything listed in the certification is required education.oracle.com/oracle-certified-professional-java-ee-7-application-developer/trackp_900

    • @sadeghsadeghy6563
      @sadeghsadeghy6563 4 года назад

      @@derekbanas i saw that but its little a bit counfusing u know could u cover it next tutorial i know u already created a java ee but its not enough i gues can u cover java ee i really need this and o already asked u to cover Spring too if u cover these topics your gonna change my life Thanks bro

  • @liamhoward2208
    @liamhoward2208 4 года назад

    How did you produce the superscript while typing x/x^2 for the legend?

    • @derekbanas
      @derekbanas  4 года назад +1

      Look for the TeX part of this tutorial