-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in option to pass an axis to axelrod.Plot.boxplot
#896
Comments
I expect this is up @marcharper's street but I'm also tagging in @geraintpalmer who might have an idea :) |
I've got a fix, pushing it to |
I have pushed 90be7ca. EDIT (for info): >>> fig, axarr = plt.subplots(2, 2)
>>> plot.boxplot(ax=axarr[1, 0], title="Scores")
>>> plot.stackplot(evo, ax=axarr[0, 1], title="Evo plot", logscale=False) |
Thanks for looking into this. In my ternary plotting library I use the AxesSubplot as you've done now for the same reason, so as far as I know this is the right way to do it. |
It was fun: I think my Thanks for confirming it's the way to go. |
(EDIT: Fix on
issue-984
branch. Commit hash: 90be7ca)For a given tournament:
We can obtain a plot using:
We get:
We have the option to pass a Matplotlib axes object so we could theoretically plot multiple things together. For example here's a plot of a straight line and a plot of the tournament results:
If we change that slightly to move the plots around:
We see that the line plot has moved as expected but that the boxplot has not. This is due to the following lines in
axelrod.plot.Plot
:We are picking up the axes properly but we're then plotting on
plt
(see line 68 etc) and not on the axis in question.plt
which is an imported alias formatplotlib.pyplot
is a wrapper for thefig, ax
api and if used in conjunction with it, plots (always) on the last subfigure.It is not as simple as simply changing all
plt
s toax
(becauseplt
is a wrapper). This is the closest I came to fixing this:but that's not quite right:
gives:
so the plots are moving properly now but the axes labels are off (or the spacing or something). And this also now happens even when we just want a single plot:
In order to test this (relevant to coverage #894), we can use something based on this:
which will give different y limits for the two subgraphs:
The text was updated successfully, but these errors were encountered: