In our first example, namely matplotlib_1.py, we will import the dates module besides pyplot. We will use the matplotlib.dates module instead of Python standard library dates module because the way we use the module is how Matplotlib will convert the date value internally into the float that is required.
import matplotlib.pyplot as plt import matplotlib.dates as dates
We will create two empty lists, each representing the x axis and y axis values. Note that on line 12, we used the built-in eval() Python to read the input as a dictionary instead of a default string:
x_time ...