Hello, I'm interested (since long ago) in doing web-based real time plotting to troubleshoot running systems (robots, actually). From Python.
I've seen your example: https://plot.ly/python/streaming-tutorial/
And it references using an API key and with that, most probably, traffic thru the internet. Is there any way to do this all locally?
Thank you very much for your feedback.
From the announcement (https://plot.ly/javascript/open-source-announcement/):
R, PYTHON, & MATLAB ENGINEERS AND DATA SCIENTISTS
Plotly can now be used 100% offline in RStudio, MATLAB, or Jupyter notebook free-of-charge. The R, Python, and MATLAB clients for Plotly have always been open-source, while the core graphics layer—plotly.js—was closed-source. Now the entire stack is open-source.
This makes for a better user experience:
I'm still not sure about the JS version. Can anyone confirm if the JS version can now also be used entirely offline?
I would gladly try, but the instructions of the tutorial mention login/get
api keys, which, if I don't need them, I guess I need to run some kind of
server. So I don't know where to start. Maybe it's just a matter of time to
get things updated.
2015-11-18 16:00 GMT+01:00 voodah [email protected]:
From the announcement (
https://plot.ly/javascript/open-source-announcement/):
R, PYTHON, & MATLAB ENGINEERS AND DATA SCIENTISTS
Plotly can now be used 100% offline in RStudio, MATLAB, or Jupyter
notebook free-of-charge. The R, Python, and MATLAB clients for Plotly have
always been open-source, while the core graphics layer—plotly.js—was
closed-source. Now the entire stack is open-source.This makes for a better user experience:
- There is no round-trip to Plotly’s server, so plotting is fast.
- For the same reason, you can plot more data.
- In RStudio, Plotly charts now appear natively in RStudio instead of
opening in a browser tab.- Everything is local — You can create charts completely independently
from Plotly’s online platform.
I'm still not sure about the JS version. Can anyone confirm if the JS
version can now also be used entirely offline?—
Reply to this email directly or view it on GitHub
https://github.com/plotly/plotly.js/issues/16#issuecomment-157740415.
Hey @awesomebytes - the streaming API is a hosted service that's provided by plotly - it handles the real-time data-store and the web-socket connections to the charts in the browser. The underlying charting library that streaming uses, plotly.js, is what's contained in this repo.
You can refresh your own charts in "real-time" by successively calling Plotly.newPlot in the client.
@voodah - Yes, the JS version can be used entirely offline. See https://plot.ly/javascript for documentation and examples.
Hey @chriddyp, so it will behave fast as you say in the example with your API (20Hz)?
Is there any example that does that where I can hook up some data to test?
Thank you very much for your answer.
@awesomebytes for fast data updates, I'd recommend using Plotly.extendTraces.
More info: https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_api.js#L1349
@awesomebytes Yes it will. Check out any of the examples in the javascript docs (https://plot.ly/javascript) to get started. For live updating, to refresh the entire graph, the code would look something like:
setInterval(function(){Plotly.plot(divid, [{"x": i, "y": i}]);}, 50)
@chriddyp But... I have no idea of JavaScript, what about the Python interface?
I'm very sorry if my comments are annoying but I'm very curious to try this stuff. Should I open an issue at https://github.com/plotly/plotly.py ?
I've seen the offline python documentation: https://plot.ly/python/offline/ but I see only an ipython notebook example, not updating the data once the plot is done.
Is there a streaming-like demo, offline?
Is there a way of just publishing to a local url to be accessed by any browser?
Thanks once again.
Hi @awesomebytes - yes, please open an issue in the python library repo. You won't be able to remotely update your charts on the web without using the streaming API or your own server infrastructure. If you want to just update your chart locally, you can successively call plotly.offline.iplot in a loop.
If you want your chart to be accessed by any browser, you need to host your graph on a server. The easiest way to do this is to host your graphs on Plotly (https://plot.ly), which provides a hosting service that is free for public data.
For questions about the python library, post to https://github.com/plotly/plotly.py and for general plotly questions, ask the community at http://community.plot.ly/.
Thanks for your interest!
Hi everyone, I'm also very interested by this feature (offlline streaming).
@awesomebytes : have you eventually found a way to do it? I've looked at the plotly.py github issues but haven't found anything related.
@chriddyp : actually calling plotly.offline.iplot in a loop create one plot per call (so resulting in many plots displayed in the notebook).
Thanks a lot!
I didn't find a way, I'm sorry.
2016-01-28 15:54 GMT+01:00 Clément Moulin-Frier [email protected]:
Hi everyone, I'm also very interested by this feature (offlline streaming).
@awesomebytes https://github.com/awesomebytes : have you eventually
find a way to do it? I've looked at the plotly.py
https://github.com/plotly/plotly.py issues but haven't found anything
related.@chriddyp https://github.com/chriddyp : actually calling call
plotly.offline.iplot in a loop create one plot per call (so resulting in
many plots displayed in the notebook).Thanks a lot!
—
Reply to this email directly or view it on GitHub
https://github.com/plotly/plotly.js/issues/16#issuecomment-176223867.
Any update on your work awesomebytes? That's a feature I really want to in my notebook.
Didn't find a way and I'm not actively working on it anymore.
2016-04-24 4:22 GMT+02:00 Jean Bilheux [email protected]:
Any update on your work awesomebytes? That's a feature I really want to in
my notebook.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/plotly/plotly.js/issues/16#issuecomment-213869108
After reading through this very helpful issue I concluded that you can easily redraw your plots by constantly calling plotly.offline.plot in a loop as mentioned by @chriddyp - this may not be exactly what @awesomebytes @JeanBilheux @clement-moulin-frier where after, but here is a very simple example that will redraw a plot random input data once every second for 10 iterations:
import time
import numpy as np
from plotly.offline import plot
from plotly.graph_objs import *
for i in range(10):
time.sleep(1)
plot([Box(y = np.random.randn(50), showlegend=False) for i in range(45)], show_link=False)
Of course this will simply reload a temporary webpage and won't get you high frame rates (I don't think 20 Hz is possible this way), but it's a start.
@hyliu1989 Made a very nice solution here:
https://github.com/hyliu1989/PlotlyOfflineStream
@jackparmer FYI that's not really streaming, it's replacing the whole plot each timestep, which is not really optimal.
Hi there. Hopefully this can be a first step toward the offline streaming. I just found @etpinard gave an example of using extendTraces() in JS. With that we can probably do the streaming.
Question, if there is a heatmap that I want to update and it is in a subplot, do we still have something like extendTraces() for it?
extend traces is one way to do something like streaming, but it's not close to what plotly does under the hood to allow rich live updating. I understand the motivation for the plotly folks to keep that bit private - it is of course one of the proprietary features of their paid service.
Personally, I've switched to bokeh as it supports true streaming and interactivity.
but it's not close to what plotly does under the hood to allow rich live updating.
@nzjrs I'm curious, what kind of _rich live updating_ features are you looking for?
@etpinard at least the ability to update the traces via websocket
@nzjrs I'm new to plotting via python, but am in the same spot.
Will be streaming live graph via browser and will need to add / shift many data points in small time interval.
Performance is in top 3 objectives, so wanting something that can handle efficient streaming / updates.
If this is not natural / intuitive for plotly, I may need to checkout Bokeh or another solution for pushing data to frontend websocket subscribers which can then update/repaint/rerender graph efficiently.
@chrisidefix and @chriddyp isn't calling plot repeatedly in a loop going to open up a new tab in the browser for every plot? Or is there a way to have it keep updating the single tab?
Most helpful comment
@etpinard at least the ability to update the traces via websocket