vjd
March 8, 2021, 12:31pm
1
is there a way to groupby a dataframe column passed into color
or marker
such that each group gets a unique element? or does this have to be done as different scatter!
calls for each group
ccf = DataFrame(a = 1:4,
b = 1:4,
c = ["low", "low", "high", "high"])
fig = default_figure()
ax2 = fig[1, 1] = Axis(fig, title = "test")
scat1 = scatter!(ax2, ccf.a,ccf.b, color= :red)
fig
sijo
March 8, 2021, 2:19pm
2
Are you looking for something like this:
using DataFrames, GLMakie, ColorSchemes
ccf = DataFrame(a = 1:4,
b = 1:4,
c = ["low", "low", "high", "high"])
palette = ColorSchemes.tab10.colors
color_indices = groupindices(groupby(ccf, :c))
scatter(ccf.a, ccf.b, color=palette[color_indices])
vjd
March 8, 2021, 2:30pm
4
is there a collection of marker
’s that can be accessed like the color palette?
mike
March 8, 2021, 2:42pm
5
marker
, like color
, can also be a vector rather than a scalar, so
marker_indices = groupindices(groupby(ccf, :c))
marker = ['↓', '↑']
scatter(ccf.a, ccf.b, marker = marker[marker_indices])
should work. Though there doesn’t seem to be a “marker palette”-like collection.
sijo
March 8, 2021, 2:52pm
7
And it looks like the default list is in AbstractPlotting.default_palettes.marker
.
2 Likes