Skip to content
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

possible Bug plotting discontinuous function #4800

Open
azev77 opened this issue Aug 15, 2023 · 6 comments
Open

possible Bug plotting discontinuous function #4800

azev77 opened this issue Aug 15, 2023 · 6 comments
Labels
enhancement improving existing functionality

Comments

@azev77
Copy link

azev77 commented Aug 15, 2023

using Plots;
grid= 0.0:0.0001:1.0
g(x)= (x<0.5) ? (x) : (x-0.5)
plot(grid, g)
image

The weird looking vertical line at 3.41842 should not be there.
How can I remove it?
I'm hoping for some kind of option to omit singularities.
scatter() looks way too weird.

@azev77 azev77 added the bug label Aug 15, 2023
@azev77
Copy link
Author

azev77 commented Aug 15, 2023

Instead of a bug, this is a Feature Request to create an option to fixdiscontinuity

@azev77 azev77 changed the title possible Bug plotting piecewise function possible Bug plotting discontinuous function Aug 15, 2023
@BeastyBlacksmith BeastyBlacksmith added enhancement improving existing functionality and removed bug labels Aug 15, 2023
@BeastyBlacksmith
Copy link
Member

BeastyBlacksmith commented Aug 15, 2023

It is a bit unclear, what should happen here and how. If you know the point of discontinuity, just plot it separately like:

using Plots;
g(x)= (x<0.5) ? (x) : (x-0.5)
plot(g, 0, 0.499)
plot!(g, 0.5, 1, primary = false)

Otherwise I am not exactly sure how one would detect discontinuities to account for them.

@azev77
Copy link
Author

azev77 commented Aug 15, 2023

Mathematica plots discontinuity correctly

@azev77
Copy link
Author

azev77 commented Aug 15, 2023

In my case I didn’t know the function would be discontinuous or at what points

@BeastyBlacksmith
Copy link
Member

Mathematica plots discontinuity correctly

Fine, but it doesn't tell us how. And in that example it can know from the explicit PiecewiseFunction where the discontinuities are

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants