Simplify the interactive_xy_plot interface, and make it work with specified y-scale #1
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.
The old interface is to have the user create a plot function and a callback function. In the callback function, the plot is created without x/y ranges, but is initialized in interactive_xy_plot to use DataRange1d's. Then, the user is responsible for the first call to the callback, which fills the data source.
This fails under certain circumstances when the y range is specified in addition to the x-range (the docstring was also inaccurate regarding use of the y-axis). I was plotting (see Piazza code) a vector field using "segment", which exceeded the given y-range. Because the y-range is overridden to be flexible with respect the data, you get infinite re-scaling when the plot is generated, without any user input.
This change is tested against that test case, and is partially tested with HW1 solutions and some of the other test cases. If just the x-axis is specified in the bokeh.plotting.figure constructor, the y-axis is still setup to be auto-ranged by the data. I didn't rebuild the Python module, just copy and pasted the code into Jupyter and renamed the interactive_xy_plot to something local to test, so that would also be good to check.
The new interface, using an example from the lecture notes, would be just directly specifying the ranges in the bokeh.plotting.figure constructor.
I also don't have a fantastic grasp on Bokeh yet, so take this PR with a grain of salt.