-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conversation
Great, I'll have a look. I can say immediately that adding a Plots dep is not acceptable, but I don't think that should be necessary either. |
src/plot.jl
Outdated
@series begin | ||
seriestype := :scatter | ||
markersize := 0 | ||
series_annotations := map(x -> text(x[3], :left, dend.tipfont...), dend.tipannotations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need the text
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this solution, yes. It writes out the unformatted entire tuple otherwise.
I can't work out why the original code doesn't work as it is. Consider struct MyType end
@recipe function f(x::MyType)
seriestype := :myseries
1:10, 1:10
end
@recipe function f(::Type{Val{:myseries}}, x, y, z)
annotations := [(2, 4, ( "test", :right, 20)), (3, 4, ("test2", :left, 10))]
seriestype := :path
x, y
end
plot(MyType()) Seems to me like exactly what we have in the original code? |
Thanks for the test example, I don't really know why, but changing the location of the i.e. Doesn't workstruct MyType end
struct myseries; x; y; end
@recipe function f(x::MyType)
seriestype := :myseries
myseries(1:10, 1:10)
end
@recipe function f(ms::myseries)
@series begin
seriestype := :path
ms.x, ms.y
end
annotations := [(2, 4, ( "test", :right, 20)), (3, 4, ("test2", :left, 10))]
nothing
end
plot(MyType()) worksstruct MyType end
struct myseries; x; y; end
@recipe function f(x::MyType)
seriestype := :myseries
myseries(1:10, 1:10)
end
@recipe function f(ms::myseries)
annotations := [(2, 4, ( "test", :right, 20)), (3, 4, ("test2", :left, 10))]
@series begin
seriestype := :path
ms.x, ms.y
end
nothing
end
plot(MyType()) I agree it is a much better solution, than needing the plots dependency. I reverted my commit and just moved your code blocks to above the other series blocks. And, it seems to work now! |
src/plot.jl
Outdated
series_annotations := map(x -> text(x[3], :left, dend.tipfont...), dend.tipannotations) | ||
getindex.(dend.tipannotations, 1), getindex.(dend.tipannotations, 2) | ||
end | ||
end | ||
primary = false | ||
label = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also what are these two lines doing? are they meant to be primary := false; label := ""
? or just deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primary := false; label := ""
as you say 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mind updating that before I merge?
Awesome! |
Pull Request Test Coverage Report for Build 1008891194
💛 - Coveralls |
Thanks a lot @BenjaminDoran ! |
Yes, thanks so much for fixing this - knowing nothing about plotting it has just been sitting around mildly annoying me for ages! Looking at the PR, it's not remotely clear to me why this solution works either, but never mind :) |
This should fix issue #53,
what I had to do
There may be a better way. but I put in a new
@series begin ... end
block with changes below, which seems to show the annotations again.It required adding Plots as a dependency to get access to the Plots.text function. Pending issue JuliaPlots/RecipesBase.jl#72 this seemed to be the only way to do it.
dendrogram example
fan example
Minimum example