Time for action – plotting stock volume

Stock volume varies a lot, so let's plot it on a logarithmic scale. First, we need to download historical data from Yahoo Finance, extract the dates and volume, create locators and a date formatter, and create the figure and add it to a subplot. We already went through these steps in the previous Time for action section, so we will skip them here.

Plot the volume using a logarithmic scale:

plt.semilogy(dates, volume)

Now, set the locators and format the x axis as dates. Instructions for these steps can be found in the previous Time for action section as well.

The stock volume using a logarithmic scale for DISH appears as follows:

What just happened?

We plotted stock volume using a logarithmic scale (see logy.py ...

Get NumPy : Beginner's Guide - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.