-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Axis
as marker=
#4862
Labels
enhancement
Feature requests and enhancements
Comments
I guess we could have a marker conversion that calls |
This could also be done with MakieTeX's |
We could also think about something like this: import Makie.SpecApi as S
@recipe PlotScatter (positions,) begin
marker = nothing
markersize = (60, 60)
end
Makie.conversion_trait(::Type{<:PlotScatter}) = Makie.PointBased()
Makie.data_limits(p::PlotScatter) = Rect3f(p.positions[])
function Makie.plot!(p::PlotScatter)
pscene = Makie.parent_scene(p)
broadcast_foreach(p.positions[], p.marker[], p.markersize[]) do pos, marker, markersize
rectpix = Observable(Rect2f(0, 0, 0, 0))
rectpix_off = Observable(Rect2i(0, 0, 0, 0))
onany(pscene.camera.projectionview, pscene.viewport; update=true) do pv, vp
ppix = Makie.project(pscene, pos)
rectpix[] = Rect2i(ppix, markersize)
rectpix_off[] = Rect2i(vp.origin .+ ppix, markersize)
end
sub = Scene(pscene, rectpix_off)
cam2d!(sub)
pl = plotlist!(sub, marker)
center!(sub)
linesegments!(p, rectpix, space=:pixel)
end
return
end
f, ax, pl = plotscatter(rand(Point2f, 10); marker=map(1:10) do x
S.Lines(cumsum(randn(100)), color=rand(RGBf))
end)
limits!(ax, Rect2f(data_limits(ax.scene))) # honestly not sure why this is needed
f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature description
I keep seeing cool plots which have axes positioned at data coordinates. I would like to try using an
Axis
(or some wrapper around it) as a scatter marker.I realize it's possible to do this manually using pixel coordinates. My question is if there's any possibility of using the
marker=
API to simplify such usage.Plots from paper:
The text was updated successfully, but these errors were encountered: