How to use pyplot broken_barh using dates? Because I want to plot a Gantt chart

Asked

Viewed 51 times

0

    import matplotlib.pyplot as plt
    from math import floor
    
    def tamanho(lista):
        return floor(len(lista)/2)
    
    rangex = [[(0,1.5)], [(1.5,3)], [(3,3)]]
    rangey = [(n, -.5) for n in range(tamanho(rangex),-tamanho(rangex) - 1,-1)]
    color = ['red', 'blue', 'yellow']
    
    for charts in range(len(rangex)):
        plt.broken_barh(rangex[charts], rangey[charts], facecolor=color[charts])

From this code, which has an output like:

inserir a descrição da imagem aqui

I wish I could enter dates, someone has an idea how to do that, using the broken_barh?

I ended up not talking, but I plan that the dates are in format %d/%m/%Y

  • I ended up not talking, but I plan that the dates are in format %d/%m/%Y

  • 1

    Have you seen this post?

  • I just saw @Paulomarques, thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.