Genie Discord forum

Hello I am trying to set the bubble size for PlotData:
plotdata(data, :A, :B, groupfeature=:C, plot = "Bubble", marker = PlotDataMarker(size=data.B))
But they al l come back with the same size, where data.B is a vector of different Ints. Anything I try, all markers remain one and the same size for all. Anyone can help? Thanks.

It is better that you use Plotly objects from PlotlyBase.jl and Plotly.jl for plots. Then you can easily change the properties via attributes
https://learn.genieframework.com/reference/reactive-ui/plotting

Hello Pere, thanks for replying, I am still struggling somewhat with plotting things within the Genie Framework (I am working with the Genie Builder), although I also got some stuff working now. Concerning your reply, setting plot objects via PlotlyBase.jl is clear to me, so I follow conventions from here: https://docs.juliahub.com/PlotlyBase/RsGW9/0.8.19/autodocs/
@out some_plot = Plot()
@onchange xyz begin
some_plot = Plot(trace, layout)
end
the trace and the layout though , are recommended to be set from PlotlyJS.jl at least everything in PlotlyBase.jl points to it. In your reply you suggest Plotly.jl, which also points to PlotlyJS.jl can you verify what you see as best practice please, its not entirely clear to me.
Further, the hardly documented StipplePlotly package, with PlotData
, and plotdata
should not be used anymore, or at least not for the no-code editor?
My general idea of setting things up would be:
module App
# set up Genie development environment
using GenieFramework
using DataFrames
using PlotlyBase
using RDatasets: dataset
@genietools
df_accidents = dataset("Ecdat", "Airq") |> DataFrame
features = [:AirQ, :Rain, :Vala, :Coas]
# add reactive code to make the UI interactive
@app begin
@out features
@in plot_feature = :AirQ
@out box_plot = Plot()
@out box_plot_layout = PlotlyBase.Layout(title="Box Plot")
@onchange isready, plot_feature begin
box_trace = box(; y = df_accidents[!, plot_feature])
box_plot = Plot(box_trace)
box_plot_layout = PlotlyBase.Layout(; title="Box Plot of $(plot_feature)")
end
end
@page("/", "app.jl.html")
end
So this should run without errors, considering you link it to a Select and Chart Object in the Genie Builder.

To answer my own question, to control the size of the individual markers, a reasonable approach would be:
Plot(scatter(data, x=:A, y=:B, color=:A,
marker=attr(size=:B,
sizeref=maximum(data.B) / (20^2),
sizemode="area"), mode="markers"
))
Here data
is a dataframe, A is some x-axis attribute, B is a count of these attributes in my case, the individual size of the markers requires a reference point, which here is the maximum of the count sizeref=maximum(data.B)
. The Markers are all the same color in this solution.