Davide-sd / sympy-plot-backends

An improved plotting module for SymPy
BSD 3-Clause "New" or "Revised" License
44 stars 10 forks source link

Include/Exclude the `range` `min` & `max` values #14

Closed James-G-Hill closed 1 year ago

James-G-Hill commented 1 year ago

This is a suggestion that could make the package a little neater if it was implemented. The following plot will complete the chart:

plot(log(x), (x, 0, 10))

However, it will also produce an error:

<lambdifygenerated-94>:2: RuntimeWarning: divide by zero encountered in log
  return log(x)

It would be neater if the min or max values themselves could be optionally excluded from the range of values being plotted so as to avoid such errors.

Davide-sd commented 1 year ago

I see two options. The first:

plot(log(x), (x, 1e-5, 10))

The second:

plot(log(x), (x, 0, 10), exlude=something)

I very much prefer the first because I type less... It would be relatively easy to implement an exclusion list, but that would only work with adaptive=False.

However, it will also produce an error:

That's not an error: it's a warning. An error stops the execution, whereas a warning allows the execution to continue.

James-G-Hill commented 1 year ago

I've no strong feeling either way although being able to list exclusions may be useful. Maybe the user could exclude ranges too? I don't feel this is a big deal though; maybe something to keep in mind. Thanks.