Untitled

 avatar
unknown
plain_text
a year ago
859 B
5
Indexable
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime
tasks = ['Kursi i gjuhes gjermane','Kursi i Python','Intership','Pushimet verore']
start_dates=['2024-06-01','2024-06-20','2024-06-30','2024-07-15']
end_dates=['2024-06-17','2024-07-10','2024-07-18','2024-07-23']
start_dates=[datetime.strptime(date,'%Y-%m-%d') for date in start_dates]
end_dates=[datetime.strptime(date,'%Y-%m-%d') for date in end_dates]
fig,ax=plt.subplots()
for tasks,start,end in zip(tasks,start_dates,end_dates):
     ax.barh(tasks,end-start,left=start,height=0.5,align='center',edgecolor='black')
ax.xaxis_date()
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
ax.set_xlabel('Datat e aktiviteteve')
ax.set_ylabel('Emri i aktivitetit')
ax.set_title('Grafiku Gantt i aktiviteteve')
plt.tight_layout()
plt.show()
Editor is loading...
Leave a Comment