JuliaPlots / JuliaPlots/PlotlyJS.jl
Unable to use ColorSchemes.jl to set a the colorscale when plotting with a dataframe
- Dominant language
- Julia
- Stars
- 444
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
It is extremely useful to be able to set the colorscale when using PlotlyJS for a dataframe with discrete groups, eg:
```julia
plot(df, x = :x, y = :y, color = :group)
```
Specifically I would like to be able to choose one of the colorscales from [ColorSchemes.jl](https://juliagraphics.github.io/ColorSchemes.jl/stable/) for the different groups in the dataframe.
In the documentation for Plotly in Julia, there are few examples showing usage of the `marker.colorscale` property, and my usage of the property is proving ineffective. I cannot find any examples help me in this case. The closest I could find to using `ColorSchemes.jl` with `PlotlyJS.jl` is the example in issue #292, but this doesn't translate to the dataframes case.
The following works, as per the example:
```
data = rand(20) .+ reshape(1:10, 1, :)
plot(
data,
Layout(
colorway=ColorSchemes.tab20.colors
)
)
```

But the following doesn't work, reverting to the default colorscale:
```
df = DataFrame(data, :auto) |> stack
plot(
df,
y = :value,
color = :variable,
marker = attr(
colorscale = ColorSchemes.tab20.colors
)
)
```

How can I recreate the first picture using the dataframes syntax?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.