[Matplotlib-users] plotting multiple plots with string for x label

Jason Snyder jmssnyder at ucdavis.edu
Tue Jan 24 20:11:34 EST 2017


I am trying to plot multiple plots where for the labels of the x axis I use
strings.  I the below script in which I am attempting to do this.


       data = np.loadtxt(sys.argv[1], dtype='str',delimiter=',',
skiprows=1,  usecols=(0,1,2,3,4,5))
       x = data[:,0]
       date = data[:,1]
       value1 = data[:,2]
       value2 = data[:,3]

       my_xticks = data[:,1]
       plt.xticks(x.astype(float), my_xticks)

       fig, (ax1,ax2) = plt.subplots(nrows=2)
       my_xticks = data[:,1]
       ax1.set_xticks(x.astype(float), my_xticks)
       ax1=plt.plot(x, value1)
       plt.tick_params(axis='both',which='major', labelsize=7)
       plt.title('Value1',fontsize=10)
       plt.grid()

      ax2=plt.plot(x, value2)
      plt.tick_params(axis='both',which='major', labelsize=7)
      plt.title('Value2',fontsize=10)
      plt.grid()

What can I do to tweak this program to get desired results?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170125/9bd231b3/attachment.html>


More information about the Matplotlib-users mailing list