Untitled

mail@pastecode.io avatar
unknown
plain_text
18 days ago
859 B
2
Indexable
Never
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()
Leave a Comment