0

Iam trying to show three months data , but the first month data is starting from 28 so the graph is starting from 28. But for the next month after 27 days, graph is coming at initail point that is 28. How to set the initial value of x axis.

I want x-axis data linear from 1- 30.

        plt.plot(d1_x,mean_d1)
        plt.plot(d2_x,mean_d2)
        plt.plot(d3_x,mean_d3)
        plt.plot(d_x,mean_d,linewidth=3.0)
        plt.xlabel(year)
        plt.ylabel('Temperature')
        plt.grid(True)
        plt.shoe()

enter image description here

Dhiraj Kumar
  • 93
  • 1
  • 6

1 Answers1

1

With the object oriented api, you can use set_xlim() this way:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

# Stuff

ax.set_xlim(1, 29)

# Stuff
yang5
  • 1,125
  • 11
  • 16
  • 1
    Your problem seems to be related to timeseries and the days of the months will repeat. You can convert the x-values to datetime objects and do something similar to this: https://stackoverflow.com/a/19079248 – yang5 Feb 08 '19 at 21:24