Skip to content

Commit

Permalink
toggle contour example
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Jan 13, 2022
1 parent 143c773 commit 2c35964
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/backends/unicodeplots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function addUnicodeSeries!(
kw[:xlim][:] .= kw[:ylim][:] .= 0
return UnicodePlots.densityplot(x, y; kw...)
elseif st === :spy
kw = (; kw..., width = 0, height = 0) # w/h handled in UnicodePlots
return UnicodePlots.spy(series[:z].surf; kw...)
elseif st in (:contour, :heatmap)
kw_hm_ct = (;
Expand All @@ -125,11 +126,13 @@ function addUnicodeSeries!(
colorbar = hascolorbar(sp),
)
if st === :contour
isfilledcontour(series) && @warn "Plots(UnicodePlots): filled contour is not implemented"
return UnicodePlots.contourplot(
x, y, series[:z].surf;
levels = series[:levels], kw_hm_ct..., kw...
)
else
kw = (; kw..., width = 0, height = 0) # w/h handled in UnicodePlots
return UnicodePlots.heatmap(series[:z].surf; kw_hm_ct..., kw...)
end
end
Expand All @@ -142,7 +145,7 @@ function addUnicodeSeries!(
func = UnicodePlots.scatterplot!
series_kw = (; marker = series[:markershape])
else
error("Series type $st not supported by UnicodePlots")
error("Plots(UnicodePlots): series type $st not supported")
end

label = addlegend ? series[:label] : ""
Expand Down Expand Up @@ -172,7 +175,7 @@ function addUnicodeSeries!(
)
end

return up
up
end

# ------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -208,7 +211,7 @@ end
Base.show(plt::Plot{UnicodePlotsBackend}) = show(stdout, plt)
Base.show(io::IO, plt::Plot{UnicodePlotsBackend}) = _show(io, MIME("text/plain"), plt)

# NOTE: _show(..) must be kept for Base.showable (src/output.jl)
# NOTE: _show(...) must be kept for Base.showable (src/output.jl)
function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
unicodeplots_rebuild(plt)
nr, nc = size(plt.layout)
Expand All @@ -232,7 +235,7 @@ function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
for c in 1:nc
l = plt.layout[r, c]
if l isa GridLayout && size(l) != (1, 1)
@error "UnicodePlots: complex nested layout is currently unsupported !"
@error "Plots(UnicodePlots): complex nested layout is currently unsupported"
else
if get(l.attr, :blank, false)
lines_colored[r, c] = lines_uncolored[r, c] = nothing
Expand Down
1 change: 0 additions & 1 deletion src/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,6 @@ _backend_skips = Dict(
6, # embedded images unsupported
16, # nested layout unsupported
21, # custom markers unsupported
22, # contours unsupported
24, # 3D unsupported
26, # nested layout unsupported
27, # polar plots unsupported
Expand Down

0 comments on commit 2c35964

Please sign in to comment.