Plots.jl
Plots.jl copied to clipboard
Annotations in plot3d not working
plot3d(randn(10),randn(10),randn(10),annotations=(1,1,1,"Hej"))
Error showing value of type Plots.Plot{Plots.PlotlyJSBackend}:
ERROR: MethodError: `plotly_annotation_dict` has no method matching plotly_annotation_dict(::Int64, ::Int64, ::Int64, ::ASCIIString)
Closest candidates are:
plotly_annotation_dict(::Any, ::Any, ::Any)
plotly_annotation_dict(::Any, ::Any, ::Plots.PlotText)
Removing plotly as this is true for all backends
This should be fairly straightforward to fix - at least in PlotlyJS alone it works. MWE from @BoundaryValueProblems
PlotlyJS.plot(scatter3d(;x=1:5, y=[1, 6, 3, 6, 1],z=1:5, mode="markers+text", name="Team A", textposition="top center", text=["A-1", "A-2", "A-3", "A-4", "A-5"], marker_size=12))
@mkborregaard , I need to add annotations in 3D plots. Suppose I created a 3D plot using Plots.jl with plotlyjs backend. For example, I generated:
tmp=randn(10,3)
p1=scatter(tmp[:,1],tmp[:,2],tmp[:,3])
Now, I want to add some annotation to this existing plot p1. For example add some text near the first point, i.e., (tmp[1,1], tmp[1,2], tmp[1,3]). Is it possible to do this? Or do I have to do everything with PlotlyJS, not Plots.jl with plotlyjs background?
It's not implemented in Plots yet AFAIK. Shouldn't be too hard to do, but I've really had to tone down my time investment in Plots these last months
@mkborregaard , thanks. I understand you busy schedule. I hope someone could take up this task soon.
Has the ability to add text at 3D locations been added yet? I've tried unsuccessfully with series_annotation in plot recipes for a while now. series_annotations do not go near the 3D point.
Has this issue been solved?
@jquetzalcoatl ; I just checked now, but this still does not work with Plots.jl v1.10.1; PlotlyJS v0.14.0 under Julia v1.5.3. I also checked the gr and pyplot backends, but it doesn't work either. I do not remember the situation 4 years ago, but currently, with plotlyjs and gr backends, at least those texts are displayed, but at wrong locations. With the pyplot backend, no annotation is displayed.
Could be nice if this were implemented.
Using the series_annotations kwarg still does not work properly with the locations of the annotations being wrong. Annotating each point separately using annotate! seems to work.