Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Plotting methods (line, area, ..) don't handle string x values #22334
From #22307 (review): when specifying the x labels in one of our plotting calls where this consists of strings, nothing is shown on the x labels:
The same is true for line plot, for bar plot it does work.
I think I have found the place this is happening, or not happening. Bar and barh both work with the labels as above, but lineplot and areaplot (subclass of lineplot), both do not. For bar and barh the xtick labeling happens in
... if self.use_index: str_index = [pprint_thing(key) for key in data.index] else: str_index = [pprint_thing(key) for key in range(data.shape)] name = self._get_index_name() self._decorate_ticks(ax, name, str_index) def _decorate_ticks(self, ax, name, ticklabels): ax.set_xticks(self.tick_pos) ax.set_xticklabels(ticklabels) if name is not None and self.use_index: ax.set_xlabel(name)
I have it changed and working locally in the lineplot class when using the
This seems to be partially fixed in 0.24.1 where the code from above gives
However, this just brings to light the real problem, namely that the ticks are essentially only at the correct position by coincidence. E.g. if you let the axes autoscale,
the ticks are completely off.
In total this is the same issue as plotting with index of objects should use