I have recently developed a dashboard to explore the merit order of power plants in Europe.
Source code : https://github.com/kavvkon/power-merit-Eur
Live version (heroku free tier) : https://power-merit.herokuapp.com/
Demo: streamable.com/i73vxk (couldn’t put links and embedding here due to new user restrictions)
This is basically a plot that shows the marginal cost of operation of the installed power plant capacity in ascending order. The main requirement was that any parameter change were immediately obvious to the user. The Figure was pretty complex to make: Variable width, variable colour bar charts with overlayed elements. Those deep parametrization options were available in matplotlib soon but I realized that the rendering of the image was taking a bit more time. More over it didn’t allow any interactivity and hover events. So I ended up with altair. I also added an interactive map with folium and a DataTable as it was pretty easy to include without much overhead.
The code initially followed the approach described panel.holoviz. org/user_guide/Param.html). Everything is organized in a class. Parameters are defined in the main body of the class. The methods return the individual panes relating the defined parameters with individual elements using
@param.depends decorators. One bug I initially had was that the tabs were always refreshing and resetting to the first one in every parameter change. In the constructor I explicitly defined the structure of the dashboard using different pane elements
pn.Tabs, pn.Columns, pn.Rows. I discovered that this was more efficient as it doesn’t redraw stuff everytime something is changing. I tried to avoid unneeded calculations and dependencies and the result is pretty snappy even when there are over 5000 datapoints plotted. I am sure that this can be improved though so feel free to suggest any improvements.
I found some examples of embedding one or more panel objects to to a template by using pn.Template, so then I could add different bootstrap elements that have nothing to do with the panel itself.