Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16566

Plotly - How to plot a 2d histogram with continuous cumulative Z values

$
0
0

I'm currently trying to plot a 2d histogram in Python using plotly.

I want the chart to feature cumululative, continuous Z values, like so (below is a mockup)

enter image description here

For example, if there is one sale at 12:00, and no sales at 12:01, 12:01 will still show one sale. If there are then 3 sales at 12:02, the colour of the bar will represent 4 total sales at that point.

However currently, the Z values are per-point plotted

enter image description here

Additionally, the data is streamed in realtime.

Initially I tried representing this as a plotly heatmap, and managed to get a semblance of a solution, however the code became far too complicated for my desired implementation and I was certain there had to be a simpler solution. The 2d histogram seeemed more appropriate. Here is my plotting code nowwith the following code

figure = go.Figure(data=go.Histogram2d(        x=data['time'],        y=data['sales'],        histfunc='count',        colorscale='Viridis',)    )

Any assistance is helpful. Many thanks.


Viewing all articles
Browse latest Browse all 16566

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>