StipplePlotly.jl icon indicating copy to clipboard operation
StipplePlotly.jl copied to clipboard

PlotLayout has no field coloraxis

Open honghuzi opened this issue 3 years ago • 3 comments

as the doc string of PlotDataMarker says

`coloraxis::String` - Sets a reference to a shared color axis. References to these shared color axes are "coloraxis", "coloraxis2", "coloraxis3", etc. Settings for these shared color axes are set in the layout, under `layout.coloraxis`, `layout.coloraxis2`, etc. Note that multiple color scales can be linked to the same color axis.

however, when i write a PlotLayout like

const preview_layout = PlotLayout(
    title = PlotLayoutTitle(text = "Densified Overlay preview", font = Font(24)),
    showlegend = true,
    grid = PlotLayoutGrid(rows = 1, columns = 2, pattern = "independent"),
    xaxis = [PlotLayoutAxis(xy = "x", index = i, title = "x") for i = 1:2],
    yaxis = [PlotLayoutAxis(xy = "y", index = i, title = "y") for i = 1:2],
    coloraxis = [PlotLayoutAxis(xy = "z", index = i, title = "z") for i = 1:2]
    )

the error message shows that

ERROR: type PlotLayout has no field coloraxis

honghuzi avatar Jul 21 '22 06:07 honghuzi

Hi,

Thanks for reporting. Looks the problem here you are trying to assign an object of type Vector{PlotLayoutAxis} in coloraxis instead of string

AbhimanyuAryan avatar Jul 21 '22 12:07 AbhimanyuAryan

I write the code as:

PlotData(
        x = sort(unique(df.x)),
        y = sort(unique(df.y)),
        z = [res[i, :] for i = 1:size(res, 1)],
        xaxis = "x$idx",
        yaxis = "y$idx",
        coloraxis = "z$idx",
        name = name,
        plot = StipplePlotly.Charts.PLOT_TYPE_HEATMAP,
    )

In StipplePlotly/src/Charts.jl, the docstring of the PlotData coloraxis keyword argument is

Settings for these shared color axes are set in the layout, under layout.coloraxis, layout.coloraxis2

however, i searched StipplePlotly/src/Layout.jl, and found no "coloraxis", this might be a not yet implemented feature in Layout.jl but referenced in Charts.jl

honghuzi avatar Jul 22 '22 01:07 honghuzi

Hi @honghuzi thanks for posting the example, do you get the same result with PlotyBase?

https://github.com/GenieFramework/StippleDemos/blob/master/StipplePlotly/PlotlyBaseDemo.jl

Example of bar: https://github.com/GenieFramework/ScoringEngineApp/blob/4895c6b20b8bb4f7c63397c96539107d835178f1/models/scoringengine/explain.jl#L18

https://github.com/GenieFramework/ScoringEngineApp/blob/4895c6b20b8bb4f7c63397c96539107d835178f1/models/ScoringEngine.jl#L166

If you are aware of PlotyBase please give it a shot. Otherwise, I'll try on my end

AbhimanyuAryan avatar Aug 01 '22 09:08 AbhimanyuAryan