plotting multiple plots with string for x label

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>

It's going to be really hard to know what your desired output is without a
runnable script. Rather than reading from a file that only you have, it's
better to hardcode some representative values for your arrays.

It looks like your trying to plot a time series. Matplotlib handles that
pretty well without having to resort to using strings:
http://matplotlib.org/examples/pylab_examples/date_demo_convert.html

···

On Tue, Jan 24, 2017 at 5:11 PM, Jason Snyder <jmssnyder at ucdavis.edu> wrote:

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?

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170124/31dc909b/attachment.html&gt;