Python with Arduino LESSON 10: Installing Drawnow to Allow Live Plotting with Matplotlib

Our objective with this series of lessons is to plot live data coming from arduino using Python and Matplotlib. We have taken a few lessons to get familiar with Matplotlib, and we have built a circuit to stream live data from arduino to python. We need to install one more library to enable Matplotlib to plot live sensor data in real time. The magic library is called drawnow. The bad news is that this library is hard to install on windows. The good news it that PIP installs it very easy. So, if you have not done so already, you need to go to Python with Arduino LESSON 6 and install PIP. PIP makes it very easy to install drawnow.

7 thoughts on “Python with Arduino LESSON 10: Installing Drawnow to Allow Live Plotting with Matplotlib”

  1. Sir
    Your tutorials are beautiful!! These are really informative and have motivated me even more to delve deeper into python. This will open up a new world of possibilities for my future projects. Thank you very much for sharing your knowledge. Its one thing to have knowledge but its completely different to share it patiently with others. I’ll be watching all the tutorials on your blog.

  2. This process no longer works. I get the following error. Do you have an updated method?

    C:\Users\wja2c>pip install drawnow
    Collecting drawnow
    c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see
    c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see
    Using cached drawnow-0.71.2.tar.gz
    Could not import setuptools which is required to install from a source distribution.
    Traceback (most recent call last):
    File “c:\python27\lib\site-packages\pip\req\”, line 387, in setup_py
    import setuptools # noqa
    File “c:\python27\lib\site-packages\setuptools\”, line 12, in
    import setuptools.version
    File “c:\python27\lib\site-packages\setuptools\”, line 1, in
    import pkg_resources
    File “c:\python27\lib\site-packages\pkg_resources\”, line 49, in
    from six.moves import urllib, map, filter
    ImportError: cannot import name urllib

  3. I encountered the same problem as Bill with drawnow.
    When I try to execute command “PIP install drawnow”
    PIP keeps complaining about a missing “urllib”-File. Seems that drawnow meanwhile has been updated to an incompatible version. Tried to manually install drawnow version 0.54 instead but got the same error messages. The previous installation of matplotlib delivered some (non-fatal) warnings, but I could produce the static graphs of lesson 9 nonetheless.

  4. Hi Paul – I’ve been on a holiday in Thailand and went through all your vids on arduino and now python – they are really great.Thank you.

    I guess the computing world is changing all the time,and I also found I could not get drawnow to install.I have tried all sorts of methods but to no avail.

    I guess the only alternative is to upload all the latest files from python down,so they work.But there must be other streaming methods which can be used.What is the best action to take now – update to recent python version and update all the other files – numpy,matplotlib,vidle etc? or try an alternative method – thanks,Peter

  5. As a 70 year old, I have grown up with everything from the Sinclair Spectrum in the UK through DOS and all the windows iterations and with these lessons, almost wish I was able to start an engineering course. Brilliant!
    Pip is already installed in current versions of Python.
    I initially had some problems getting drawnow installed but this is what I did:
    From the cmd prompt
    c:\users\mypc>c:\Python27\Scripts\pip.exe install drawnow
    Everything went like clockwork

  6. Hi paul,
    I had a problem in this course and the problem is the split function give me an error :
    /////File “”, line 13, in
    dataArray = ArduinoString.split(“,”)
    TypeError: a bytes-like object is required, not ‘str’/////

    and just incase I did the other codes exactly like what you did.

    Thanks for helping

  7. I saw that several people had trouble downloading drawnow.

    The command “pip install drawnow” didn’t work for me,
    so here is a workaround that did.

    Download from:

    Unzip the zip file into a folder (or anywhere you can find it); for example:


    Change directory to that folder, and verify that there is a file in it:

    cd c:\downloads\python-drawnow

    Install drawnow by launching the right version of Python (2.7).
    Let’s assume it is in the folder c:\python27

    c:\python27\python install

    Hope this helps!

Comments are closed.