Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Milestone
Description
In theDate tick labels example, the code for setting the cursor coords message overwrites the default formatters:
ax.format_xdata=mdates.DateFormatter('%Y-%m-%d')ax.format_ydata=lambdax:'$%1.2f'%x# format the price.
This creates confusion because runs counter to how basically everything else in matplotlib is set via setter but especially the formatters:
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y'))
andthe docs aren't especially clear either on this being a property:
Axes.format_xdata(self, x) Return x formatted as an x-value. This function will use the fmt_xdata attribute if it is not None, else will fall back on the xaxis major formatter.
To be consistent with the API, I'm proposing properties/functions of the form:
ax.{x,y}data_formatter(mdates.DateFormatter('%Y-%m-%d'))
ax.data_formatter(which=(x,y, both), mdates.DateFormatter('%Y-%m-%d'))