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

restore tipannotations; fix #53 #60

Merged
merged 3 commits into from
Jul 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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