Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #661 from JuliaPlots/sd/cleanups
Browse files Browse the repository at this point in the history
cleanups + fixes
  • Loading branch information
SimonDanisch authored Mar 17, 2021
2 parents 61cd4c5 + 079c1fb commit df2e052
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
version:
- '1'
os:
- ubuntu-latest
- ubuntu-18.04
arch:
- x64
steps:
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
authors = ["Simon Danisch", "Julius Krumbiegel"]
name = "AbstractPlotting"
uuid = "537997a7-5e4e-5d89-9595-2241ea00577e"
authors = ["Simon Danisch", "Julius Krumbiegel"]
version = "0.15.24"

[deps]
Expand Down Expand Up @@ -65,7 +65,7 @@ IntervalSets = "0.3, 0.4, 0.5"
Isoband = "0.1"
KernelDensity = "0.5, 0.6"
Match = "1.1"
Observables = "0.3.1"
Observables = "0.3.1, 0.4"
Packing = "0.4"
PlotUtils = "1"
PolygonOps = "0.1.1"
Expand Down
13 changes: 9 additions & 4 deletions src/AbstractPlotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ import GridLayoutBase
using Base: RefValue
using Base.Iterators: repeated, drop
import Base: getindex, setindex!, push!, append!, parent, get, get!, delete!, haskey
using Observables: listeners, notify!, to_value
# Imports from Observables which we use a lot
using Observables: notify!, listeners
using Observables: listeners, to_value

# Backwards compatability for Observables 0.3
if hasmethod(Observables.notify, Tuple{Observable})
using Observables: notify
else
Base.notify(obs::Observable) = Observables.notify!(obs)
end

module ContoursHygiene
import Contour
Expand Down Expand Up @@ -162,7 +167,7 @@ export xtickrotation, ytickrotation, ztickrotation
export xtickrotation!, ytickrotation!, ztickrotation!

# Node/Signal related
export Node, Observable, lift, map_once, to_value, on, @lift
export Node, Observable, lift, map_once, to_value, on, @lift, off, connect!

# utilities and macros
export @recipe, @extract, @extractvalue, @key_str, @get_attribute
Expand Down
2 changes: 1 addition & 1 deletion src/basic_recipes/annotations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ function plot!(plot::Annotations)
return
end
# update one time in the beginning, since otherwise the above won't run
notify!(sargs[1])
notify(sargs[1])
plot
end
2 changes: 1 addition & 1 deletion src/basic_recipes/buffers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function finish!(tb::Annotations)
if length(tb[1][]) != length(tb.textsize[])
error("Inconsistent buffer state for $(tb[1][])")
end
notify!(tb[1])
notify(tb[1])
return
end

Expand Down
10 changes: 5 additions & 5 deletions src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ function to_vertices(verts::AbstractMatrix{T}, ::Val{1}) where T <: Number
to_ndim(Point3f0, ntuple(i-> lverts[i, vidx], n), 0.0)
end
end
end
end
end

function to_vertices(verts::AbstractMatrix{T}, ::Val{2}) where T <: Number
Expand Down Expand Up @@ -751,9 +751,9 @@ function line_diff_pattern(ls_str::AbstractString, gaps = :normal)
dot = 1
dash = 3
check_line_pattern(ls_str)

dot_gap, dash_gap = convert_gaps(gaps)

pattern = Float64[]
for i in 1:length(ls_str)
curr_char = ls_str[i]
Expand All @@ -778,7 +778,7 @@ end
function check_line_pattern(ls_str)
isnothing(match(r"^[.-]+$", ls_str)) &&
throw(ArgumentError("If you provide a string as linestyle, it must only consist of dashes (-) and dots (.)"))

nothing
end

Expand All @@ -788,7 +788,7 @@ function convert_gaps(gaps)
gaps in [:normal, :dense, :loose] || throw(ArgumentError(error_msg))
dot_gaps = (normal = 2, dense = 1, loose = 4)
dash_gaps = (normal = 3, dense = 2, loose = 6)

dot_gap = getproperty(dot_gaps, gaps)
dash_gap = getproperty(dash_gaps, gaps)
elseif gaps isa Real
Expand Down
3 changes: 1 addition & 2 deletions src/stats/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ function AbstractPlotting.plot!(plot::Hist)

# update the barplot points without triggering, then trigger with `width`
on(widths) do w
setindex!(bp[1], points[], notify = _ -> false)
bp[1].val = points[]
bp.width = w
end

plot
end
2 changes: 1 addition & 1 deletion test/ReferenceTests/src/tests/examples2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ end
)
end

@cell "colored triangle" begin
@cell "colored triangle with poly" begin
poly(
[(0.0, 0.0), (0.5, 1.0), (1.0, 0.0)],
color=[:red, :green, :blue],
Expand Down

0 comments on commit df2e052

Please sign in to comment.