how to plot two very large lists in python
Question: I've two lists:

    
    
    time_str = ['06:03' '06:03' '06:04' ..., '19:58' '19:59' '19:59']
    value = ['3.25' '3.09' '2.63' ..., '2.47' '2.57' '2.40']
    

I tried below code but got error:

    
    
        plt.plot(time_str,value)
        plt.xlabel('Time')
        plt.show()
    

> ValueError: invalid literal for float(): 06:00

How can I plot time_str on x_axis and value on y axis. time_str has values for
every minute and maybe we can show for every 15 minutes ticks on x axis.I
tried in several ways but I couldn't get the line plot properly. Can anyone
suggest

Edit: After some trials, I have this code yet I don't have appropriate labels
on the axis (It appears as though python just tried to scratch something):

    
    
       fig = plt.figure()
        ax = fig.add_subplot(1,1,1)  
        ax.xaxis.set_major_locator(md.MinuteLocator(interval=15))
        ax.xaxis.set_major_formatter(md.DateFormatter('%H:%M')) 
        plt.plot(y)
        plt.xticks(range(len(x)), x)
        plt.show()
    

[![enter image description
here](http://i.stack.imgur.com/Edpsz.png)](http://i.stack.imgur.com/Edpsz.png)


Answer: You can plot every ith value using numpy's array slicing and indexing
(<http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#basic-
slicing-and-indexing>)

    
    
    #only plot every 15th value
    plt.plot(time_str[::15], value[::15]) 
    

**In response to question update**  
The value error is not associated with the size of the list. You need to cast
your string as a datetime object. Something like:

    
    
    from datetime import datetime
    times = [datetime.strptime(time, '%I:%M') for time in  time_str]
    

**In response to comment**  
You will have to adjust this to your needs, but using masks would be the
simpliest way to get every 15 mins

    
    
    import matplotlib.pyplot as plt
    from datetime import datetime
    import numpy as np
    
    time_str = ['06:03', '06:18', '06:28', '19:33', '19:03', '19:59']
    value = np.array(['3.25', '3.09', '2.63', '2.47', '2.57', '2.40'])
    
    times = np.array([datetime.strptime(time, '%H:%M') for time in  time_str])
    time_deltas = np.array([(time - times[0]).total_seconds()/60. for time in times])
    
    plt_times = times[time_deltas%15==0]
    plt_values = value[time_deltas%15==0]
    
    plt.plot_date(plt_times, plt_values)
    plt.show()
    

