Home > OS >  Formatting x-axis tickers to show only the years for a continuous time series line graph
Formatting x-axis tickers to show only the years for a continuous time series line graph

Time:04-13

I am able to plot the graph that I want but I would like to change the x-axis tickers to only show the years instead of showing the respective months of each year as the data range is really huge. Is there a possible way for me to do this without having to change my dataset? I am currently using matplotlib.pyplot to plot this graph.

This is the graph that I have currently with the tickers being each of the month of each year. enter image description here

CodePudding user response:

There are many ways to tackle this problem:

  1. Add another column for only months and use that column as X,PS:the actual plot won't change.
  2. use fig.autofmt__date() this tilts the dates so that the whole date will be visible.Check this documentation for further details.
  • Related