You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Dash
using Plots
using EpistemicNetworkAnalysis
# Load ENA packageusing EpistemicNetworkAnalysis
# Load sample dataset, codes from my first year on hormone replacement therapy
data =loadExample("transitions") # NOTE: To load your own data, see DataFrame(CSV.File(...))# Derive some new codes based on old onesderiveAnyCode!(data, :BODY, :Changes, :Mood, :Oily, :Dysphoria, :Cry)
deriveAnyCode!(data, :REFLECT, :Identity, :Longing, :Dream, :Childhood, :Family, :Name, :Letter, :Doubt, :Religion)
deriveAnyCode!(data, :LEARN, :WWW, :Experiment, :Recipe)
deriveAnyCode!(data, :PROGRESS, :Strangers, :Passed, :Out, :Affirmation)
# Add new columns for splitting the year's data in half, third, ...
data[!, :All] .="All"
data[!, :Half] .="First"
data[183:end, :Half] .="Second"
data[!, :Third] .="First"
data[122:243, :Third] .="Second"
data[244:end, :Third] .="Third"
data[!, :Fourth] .="First"
data[92:183, :Fourth] .="Second"
data[184:275, :Fourth] .="Third"
data[276:end, :Fourth] .="Fourth"# List columns to use as codes, convos, and units
codes = [:DoseTracking, :SkippedDose, :Happy, :NonHappy, :Sweets, :BODY, :REFLECT, :LEARN, :PROGRESS]
conversations = [:Date]
units = [:Date]
# Run the model and plot it
model =ENAModel(data, codes, conversations, units)
p =plot(model)
# Helper to make Dash plotting easierfunctionmake_dash_plot(p)
dcc_graph(figure=(
data=Plots.plotly_series(p),
layout=Plots.plotly_layout(p)
))
end# Make app
app =dash(external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"])
app.layout =html_div() domake_dash_plot(plot(p.subplots[1], size=(700,700))),
make_dash_plot(plot(p.subplots[2], size=(700,700))),
make_dash_plot(plot(p.subplots[3], size=(700,700)))
end# Go! :)run_server(app)
Note, this seems a little buggy, perhaps Dash isn't quite mature enough yet
for #13, an example could be building an interface (a la shiny, etc.) using https://github.com/plotly/Dash.jl
The text was updated successfully, but these errors were encountered: