Skip to content

Commit

Permalink
Merge pull request #60 from BenjaminDoran/fixplotrecipe
Browse files Browse the repository at this point in the history
restore tipannotations; fix #53
  • Loading branch information
mkborregaard committed Jul 8, 2021
2 parents 07dfeea + 04ddcfc commit fcaaec2
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ struct Fan; x; y; tipannotations; marker_x; marker_y; showtips; tipfont; marker_
ex = extrema(filter(isfinite, dend.x))
xlims --> (ex[1] - 0.05 * ex[2], ex[2] * 1.15)

# tip annotations
dend.showtips && (annotations := map(x -> (x[1], x[2], (x[3], :left, dend.tipfont...)), dend.tipannotations))

sa = get(plotattributes, :series_annotations, nothing)
@series begin
seriestype := :path
Expand Down Expand Up @@ -85,15 +88,25 @@ struct Fan; x; y; tipannotations; marker_x; marker_y; showtips; tipfont; marker_
end
end
end
dend.showtips && (annotations := map(x -> (x[1], x[2], (x[3], :left, dend.tipfont...)), dend.tipannotations))
primary = false
label = ""
primary := false
label := ""
nothing
end

@recipe function f(fan::Fan)
adjust(y) = 2pi*y / (length(fan.tipannotations) + 1)

aspect_ratio := 1

# tip annotations
mx = maximum(filter(isfinite, fan.x))
if fan.showtips
xlims --> (1.5 .* (-mx, mx))
ylims --> (1.5 .* (-mx, mx))
annotations := map(x -> (_tocirc(x[1], adjust(x[2]))..., (x[3], :left,
rad2deg(adjust(x[2])), fan.tipfont...)), fan.tipannotations)
end

sa = get(plotattributes, :series_annotations, nothing)
@series begin
seriestype := :path
Expand Down Expand Up @@ -132,14 +145,8 @@ end
end
end
end
aspect_ratio := 1
mx = maximum(filter(isfinite, fan.x))
if fan.showtips
xlim --> (1.5 .* (-mx, mx))
ylim --> (1.5 .* (-mx, mx))
annotations := map(x -> (_tocirc(x[1], adjust(x[2]))..., (x[3], :left,
rad2deg(adjust(x[2])), fan.tipfont...)), fan.tipannotations)
end
primary := false
label := ""
nothing
end

Expand Down

2 comments on commit fcaaec2

@richardreeve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.4.19 already exists and points to a different commit"

Please sign in to comment.