DataPlotly icon indicating copy to clipboard operation
DataPlotly copied to clipboard

Animations are available for offline

Open ghtmtt opened this issue 7 years ago • 5 comments

A bit complicated to implement, but the code is more or less straightforward:


f1 = [125.7, 219.12, 298.55, 132.32, 520.6, 3435.49, 2322.61, 1891.63, 216.97, 383.98, 82.01, 365.56, 199.98, 308.71, 217.58, 436.09, 711.77]
f2 = [1046.67, 1315.0, 1418.0, 997.33, 2972.3, 9700.0, 6726.0, 6002.5, 2096.0, 2470.0, 867.0, 2201.7, 1685.6, 2416.7, 1618.3, 2410.0, 2962.0]


trace1 = go.Scatter(
x = f1,
y = f2,
mode = 'markers'
)

layout = go.Layout(
    xaxis = dict(range=[min(f1), max(f1)], autorange=False),
    yaxis = dict(range=[min(f2), max(f2)], autorange=False),
    updatemenus = [{'type': 'buttons', 'buttons': 
        [{'label': 'Play',
        'method': 'animate',
        'args': [None]},
        {'label': 'Pause',
        'method': 'animate',
        'args': [[None], 
        {'frame' : {'duration':0, 'redraw': False}, 'mode':'immediate'},
        ]}
        ]}],
)


frames= []
for i, j in zip(f1, f2):
    frames.append({'data': [{'x': [i], 'y': [j]}]})

data = [trace1]
fig = go.Figure(data=data, layout = layout, frames=frames)
plotly.offline.plot(fig)

API here

https://plot.ly/python/animations/#moving-frenet-frame-along-a-planar-curve

ghtmtt avatar Jul 07 '17 13:07 ghtmtt

closing this because too wide and not useful to have animation within DataPlotly

ghtmtt avatar Mar 07 '18 13:03 ghtmtt

Would love to see animations implemented within DataPlotly. Using plotly express it is fairly straight foward but assume it is also more difficult to integrate within the QGIS canvas.

Furthermore it would be amazing to integrate plotly animations with time-series animations using the temporal controller.

BjornNyberg avatar Mar 22 '21 11:03 BjornNyberg

we are studying this implementation. While we have now temporal control also in QGIS it is a little bit difficult to put together plotly and QGIS animations:

  • map - plot interaction, how should we proceed?
  • filtering the map data depending on the plot ones (and/or viceversa)

it would definitely be a great enhancement but not straightforward.

ghtmtt avatar Mar 22 '21 11:03 ghtmtt

Has there been any further thought/experimentation about integration with the temporal control? As a proof of concept, it seems like:

  • Clicking of a point in a temporal layer could trigger a change in the selected temporal range, building on: https://github.com/ghtmtt/DataPlotly/blob/c2fd3584dad0ab766649a268fef692852abe2332/DataPlotly/gui/plot_settings_widget.py#L472
  • Filtering by temporal range could be implemented as an extension of what is considered a visible or selected feature https://github.com/ghtmtt/DataPlotly/blob/c2fd3584dad0ab766649a268fef692852abe2332/DataPlotly/core/plot_factory.py#L205

While this existing issue seemed directly relevant, I'm actually most interested in using a scatterplot as a time navigation tool rather than for animation specifically. I understand this is a fairly complex feature to get right, but would welcome any thoughts on possible pitfalls/promising paths to follow within an initial proof of concept.

josephguillaume avatar Aug 22 '21 12:08 josephguillaume

Hi @josephguillaume! No updates so far. Binding together the QGIS temporal control and DataPlotly animation plot requires a lot of work and probably some refactoring of the main function of the plugin.

We have some ideas to enhance the plugin, hopefully we can add also this one!

ghtmtt avatar Aug 26 '21 05:08 ghtmtt