diff --git a/src/Interfaces/AbstractPolyhedron_functions.jl b/src/Interfaces/AbstractPolyhedron_functions.jl index fd446076c2..d24fe5323c 100644 --- a/src/Interfaces/AbstractPolyhedron_functions.jl +++ b/src/Interfaces/AbstractPolyhedron_functions.jl @@ -821,7 +821,11 @@ function plot_recipe(P::AbstractPolyhedron{N}, ε=zero(N)) where {N} @assert isbounded(P) "cannot plot an unbounded $(typeof(P))" if dim(P) == 1 - return plot_recipe(convert(Interval, P), ε) + Q = convert(Interval, P) + if diameter(Q) < _ztol(N) # flat interval + Q = Singleton(center(Q)) + end + return plot_recipe(Q, ε) else vlist = convex_hull(vertices_list(P)) m = length(vlist) diff --git a/src/Plotting/plot_recipes.jl b/src/Plotting/plot_recipes.jl index c3d95b52f0..e1ef78bfb1 100644 --- a/src/Plotting/plot_recipes.jl +++ b/src/Plotting/plot_recipes.jl @@ -312,17 +312,21 @@ julia> plot(B, 1e-2) # faster but less accurate than the previous call ``` """ @recipe function plot_lazyset(X::LazySet{N}, ε::N=N(PLOT_PRECISION)) where {N} + label --> DEFAULT_LABEL + grid --> DEFAULT_GRID + if DEFAULT_ASPECT_RATIO != :none + aspect_ratio --> DEFAULT_ASPECT_RATIO + end + seriesalpha --> DEFAULT_ALPHA + seriescolor --> DEFAULT_COLOR + if dim(X) == 1 - plot_recipe(X, ε) - else - label --> DEFAULT_LABEL - grid --> DEFAULT_GRID - if DEFAULT_ASPECT_RATIO != :none - aspect_ratio --> DEFAULT_ASPECT_RATIO + x, y = plot_recipe(X, ε) + if length(x) == 1 + seriestype := :scatter end - seriesalpha --> DEFAULT_ALPHA - seriescolor --> DEFAULT_COLOR - + x, y + else # extract limits and extrema of already plotted sets p = plotattributes[:plot_object] lims = _extract_limits(p, plotattributes)