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.

4 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.
    Regards
    Manpreet

  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\ssl_.py:318: 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 https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
    SNIMissingWarning
    c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: 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 https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning
    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\req_install.py”, line 387, in setup_py
    import setuptools # noqa
    File “c:\python27\lib\site-packages\setuptools\__init__.py”, line 12, in
    import setuptools.version
    File “c:\python27\lib\site-packages\setuptools\version.py”, line 1, in
    import pkg_resources
    File “c:\python27\lib\site-packages\pkg_resources\__init__.py”, 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

Leave a Reply

Your email address will not be published. Required fields are marked *