I have a set csv file that looks like this:
tau,rh,temp,
00,100,23,
03,85,25,
06,98,26,
09,100,15,
Now I am know how to plot graphs from a csv file. I have the script below:
import matplotlib.pyplot as plt
import numpy as np
import csv
import sys
file=sys.argv[1]
fname = open(file,'rt')
plt.plotfile(fname, ('tau', 'rh', 'tmp'), subplots=False)
plt.show()
and this seems to work fine. However, I want to be able to put the plot the tmp on a separate set of y axes than the rh. I know when to plot multiple plots on multiple axes you have to do the following:
t = np.arange(1, 25.0, 5)
s1 = [1,2,3,4,5]
ax1.plot(t, s1, 'b-')
ax1.set_xlabel('time (s)')
# Make the y-axis label, ticks and tick labels match the line color.
ax1.set_ylabel('rh', color='b')
ax1.tick_params('y', colors='b')
ax2 = ax1.twinx()
s2 = [1,2,4,9]
ax2.plot(t, s2, 'r.')
ax2.set_ylabel('tmp', color='r')
ax2.tick_params('y', colors='r')
and you get two plots. What I want to do is have s1 set to the csv values for rh and s2 set to the csv values for tmp in the above example based on reading the csv file. How do I go about doing this?