0

I have a data frame as:

enter image description here

and I can plot this data as :

enter image description here

how can I make x axis of this plot like the following plot:

enter image description here

fig, ax1 = plt.subplots(figsize=(15, 5))
ax1.set(xlabel='hours in a week', ylabel='occupancy ratio(0-1)')
ax1.plot(HoursOfWeek.values, color='g')
plt.show()
Nima
  • 45
  • 1
  • 6

1 Answers1

0

After plotting the graph, you can edit the x-ticks. Documentation: plt.xticks()

For the markers,

plt.xticks(np.r_[0:15]*7, ['00','12']*7+['00'])

For the x-axis labels, plt.xlabel or plt.text should do the job. Documentation: plt.xlabel

I suggest you use this method to write the x-label: How to put text outside python plots?(ImportanceOfBeingErnest's answer)

Vedant36
  • 318
  • 1
  • 6