No graph showing on my Matplotlib

by: Alexli, 7 years ago

Last edited: 7 years ago


Hello people

I loaded up my csv file and try to use matplotlib to plot my data  which are the columns 'Date & Time',    ' Voltage', .
I set up my 'Date & Time' as my x-axis and 'voltage' as my y-axis.

The excutive panel does not report any problems  to me. but the maplotlib  just keep giving me a empty figure to me. I am using python 3.5.4

I am a beginner to python, any help will be a great appreciation.


import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')


#use pandas to load the file and trim the tables
dpm=pd.read_csv ('C:/Users/bingyang.li/Desktop/DPM.csv', header=1 ,usecols=['Date & Time',' Voltage'])

#print(dpm)

plt.xlabel('Date & Time')
plt.ylabel(' Voltage')
plt.show()










You must be logged in to post. Please login or register an account.



Try using plt.plot and use your columns are your parameters.
For example: plt.plot([1,2,3,4,5], [1,2,3,4,5]) (This should plot a line.)

Put your plt.plot above plt.show().


-superpower! 7 years ago

You must be logged in to post. Please login or register an account.