0

here is my data format

And here is my code,

ax = sns.lineplot(x="time", y="Aerosol_Optical_Depth_Land_Ocean", data=df)

ax.tick_params(rotation=45)
fig = ax.get_figure()
fig.savefig("aod_timeSeries.png") 
plt.show()

when I run this code it saves the figure.it cuts the x-label. saved picture

But when I download the figure it looks perfect.downloaded picture but I wanted to save this with code. I also tried this way

plt.savefig("aod_timeSeries.png")

1 Answers1

1

You can use tight_layout function

ax = sns.lineplot(x="time", y="Aerosol_Optical_Depth_Land_Ocean", data=df)
ax.tick_params(rotation=45)
plt.tight_layout()
plt.savefig("a.jpg")
phi
  • 10,572
  • 3
  • 21
  • 30