Skip to content

Commit

Permalink
gh-35596: Fix Max=Min warning in coin interacts
Browse files Browse the repository at this point in the history
    
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

New versions of matplotlib complained about ymin = ymax (= 0). And I
guess it makes more sense to have a float-slider in this case anyway.

<!-- Describe your changes here in detail. -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35596
Reported by: Tobias Diez
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed May 27, 2023
2 parents a105ea6 + cc1859e commit ebb9473
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/sage/interacts/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ def line_to_points(x1_y1, x2_y2, **plot_kwargs):
@library_interact(
n=lambda: slider(2, 10000, 100, default=1000, label="Number of Tosses"),
interval=lambda: range_slider(
0, 1, default=(0.45, 0.55), label="Plotting range (y)"
0.0, 1.0, default=(0.45, 0.55), label="Plotting range (y)"
),
)
def coin(n, interval):
Expand Down Expand Up @@ -877,7 +877,7 @@ def coin(n, interval):
sage: interacts.statistics.coin()
...Interactive function <function coin at ...> with 2 widgets
n: IntSlider(value=1000, description='Number of Tosses', max=10000, min=2, step=100)
interval: IntRangeSlider(value=(0, 0), description='Plotting range (y)', max=1)
interval: FloatRangeSlider(value=(0.45, 0.55), description='Plotting range (y)', max=1.0)
"""
from random import random
c = []
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interacts/test_jupyter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Test all interacts from the Sage interact library::
sage: test(interacts.statistics.coin)
...Interactive function <function coin at ...> with 2 widgets
n: IntSlider(value=1000, description='Number of Tosses', max=10000, min=2, step=100)
interval: IntRangeSlider(value=(0, 0), description='Plotting range (y)', max=1)
interval: FloatRangeSlider(value=(0.45, 0.55), description='Plotting range (y)', max=1.0)

Test matrix control (see :trac:`27735`)::

Expand Down

0 comments on commit ebb9473

Please sign in to comment.