Skip to content

Commit

Permalink
Fix histocurve rendering
Browse files Browse the repository at this point in the history
The x axis used a range of numbers and dates: numbers of the points and
dates for the axis range. This prevented the histocurve from being
rendered.

This changes the graph to use only numbers, but adds a formatter so that
they're still shown as dates. This allows the graph to be rendered
correctly again.
  • Loading branch information
llewelld committed Aug 27, 2022
1 parent 8a854dc commit 9343e88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion graphs.py
Expand Up @@ -716,7 +716,12 @@ def create_stackedareacurve(self, width, dpi, filename):
#ax[0].autoscale(enable=True, axis='x', tight=True)
ax[0].set_ylim(bottom=0, top=ymax)
#ax[0].set_xlim(left=dates[0], right=dates[len(dates) - 1])
ax[0].set_xlim(self.start_date, self.end_date)
ax[0].set_xlim(self.start_date.toordinal(), self.end_date.toordinal())

# Display the x axis labels as dates rather than numbers
def formatter(x, pos):
return datetime.date.fromordinal(int(x))
ax[0].xaxis.set_major_formatter(formatter)

# Averages
duration = self.dates[len(self.dates) - 1].toordinal() - self.dates[0].toordinal()
Expand Down

0 comments on commit 9343e88

Please sign in to comment.