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

Geom.density2d with color grouping #1475

Closed
Mattriks opened this issue Aug 16, 2020 · 1 comment · Fixed by #1508
Closed

Geom.density2d with color grouping #1475

Mattriks opened this issue Aug 16, 2020 · 1 comment · Fixed by #1508

Comments

@Mattriks
Copy link
Member

This works on Gadfly master:

using RDatasets
using Gadfly.CategoricalArrays: cut
quakes = dataset("datasets", "quakes")
quakes.depthg = cut(quakes.Depth, 3)

lyrs = [layer(df, Geom.density2d(levels=4), color=df.depthg[1:1])  for df in groupby(quakes, :depthg)]
theme1 = Theme(point_size=1.2pt, alphas=[0.5], discrete_highlight_color=c->nothing)

p1 = plot(quakes, x=:Long, y=:Lat, color=:depthg, reverse(lyrs)..., Geom.point,
    Scale.color_discrete_manual("deepskyblue","hotpink", "yellow3"), theme1)

density2d

But it would be nice if Geom.density2d auto-grouped by color:

p2 = plot(quakes, x=:Long, y=:Lat, color=:depthg, Geom.point,
    layer(Geom.density2d(levels=4), color=:depthg), theme1)
@tlnagy
Copy link
Member

tlnagy commented Aug 17, 2020

Given that we auto-group by color for most everything else, this would be a great quality of life improvement. I recently ran into this problem when trying to simplify extremely dense scatter plots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants