I'm plotting a CSV file of weather data, and I got it to import just fine in my code, but i'm trying to plot it. Here's a sample of the CSV data:
12:00am,171,6,7,52,76,77.1,63.7,28.74,0.00,0.00,0.0,0,63.7,78.1,67.4,56.0,29.96
12:01am,192,4,6,52,76,77.1,63.7,28.74,0.00,0.00,0.0,0,63.7,78.1,67.4,56.0,29.96
12:02am,197,3,6,52,76,77.1,63.7,28.74,0.00,0.00,0.0,0,63.7,78.1,67.4,56.0,29.96
12:03am,175,3,6,52,76,77.1,63.7,28.73,0.00,0.00,0.0,0,63.7,78.1,67.4,56.0,29.96
12:04am,194,4,6,52,76,77.1,63.7,28.73,0.00,0.00,0.0,0,63.7,78.1,67.4,56.0,29.96
12:05am,148,5,6,52,76,77.1,63.7,28.73,0.00,0.00,0.0,0,63.7,78.1,67.4,56.0,29.96
Anyway, I'd like the time to be on the X axis, but I can't get it to plot using matplotlib. I tried a method using xticks, and it plotted my y values, but that was it. It just gave me a thick solid line on my X axis.
import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from matplotlib.dates import date2num
import datetime as DT
import re
data = np.genfromtxt('FILE.csv', delimiter=',', dtype=None, skip_header=3)
length = len(data)
x = data['f0']
y = data['f7']
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.set_title("Temperature")
ax1.set_xlabel('Time')
ax1.set_ylabel('Degrees')
#plt.plot_date(x, y)
plt.show()
leg = ax1.legend()
plt.show()
I'm missing a few crucial parts because I honestly don't know where to go from here. I checked the data type of my numpy array, and it kept saying numpy.ndarray, and I can't find a way to convert it to a string or an int value to plot. It's a 24 hour CSV file, and I would like tick marks every 30 minutes or so. Any ideas?