Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added an option to specify existing axes for the new plots to go in. Most of the changes are in plotter.py. When the user specifies the axes using the parameter
ax=my_ax
, the rawdata plot is created in those axes, and the contrast plot is created as an inset axes next to those axes. This avoid creating an entirely new set of axes, since the inset is connected to the original axes.I did my best to maintain the spacing of the plots as best I understand them, but sometimes matplotlib spacing seems like wizardry to me, so I may have overlooked something.
I also modified one of the tests in the plotting test file and created a new test file. In my hands, the new code passes the existing tests, although it does throw a warning related to a DeprecationWarning for something that will change in python 3.8. Looks like this is only a problem in matplotlib 3.0, and it gets fixed in matplotlib 3.1.
For users who don't use this option, nothing should change. For users who do, the rawdata axes are not necessarily accessible using
FigName.axes[0]
because the specified axes might have a different index. The contrast axes can be accessed usingax.contrast_axes
whereax
is the specified axes.