Data overlapping the x-axis of the graph

1

I need to put a series of dates (timestamp) that are stored in a bd on the x-axis of a chart, the problem is that the dates overlap and an efficient analysis is impossible. Follow the code:

# -*- coding: utf-8 -*-
import MySQLdb as mdb
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as dates

con = mdb.connect('localhost', 'testuser', '*******', 'testdb')
with con:
    f = []
    cur = con.cursor()
    conversor = dates.strpdate2num('%Y-%m-%d %H:%M:%S')
    a = cur.execute("SELECT Ping FROM Pings WHERE Enderecos ='186.209.34.78'")
    a = cur.fetchall()    
    row = cur.execute("SELECT Timestamp FROM Pings WHERE Enderecos = '186.209.34.78'")
    for i in range(cur.rowcount):   
        row= cur.fetchone()[0]   
        f.append(conversor(row))
    plt.xlabel("Timestamp")
    plt.ylabel("Ping")
    plt.plot_date(f,a)
    plt.title("186.209.34.78")
    plt.show() 

Withzoom:

    
asked by anonymous 06.06.2017 / 21:48

1 answer

1

I believe you can rotate this text, using:

plt.xticks(rotation=20)

Result:

    
08.06.2017 / 03:12