clementfarabet / gfx.js

A graphics backend for the browser (with a Torch7 client).
MIT License
125 stars 35 forks source link

Chart behaves badly when updating very frequently #39

Open Mononofu opened 9 years ago

Mononofu commented 9 years ago

Scenario: I update a chart very frequently, e.g. at 5 or 10 Hz, to visualize change in reward over multiple episodes.

Expected behavior: The data for the chart is refreshed whenever I call gfx.chart(rewards, {chart='line', win=chartWindow}) and rendered in the background, then once rendering has finished it is swapped with the visible chart. This minimizes the time where an empty chart is visible.

Actual behavior: The chart starts updating whenever I make another call to gfx.chart, but replaces the old chart instantly, showing only a blank canvas. It also never finishes to render, the next call to gfx.chart occurs before it is done. Only after my program has finished does the chart generated by the last call render successfully.

Context: I used to do this with matplotlib in python:

line = ax.plot(x, rewards, '-')[0]
for e in episodes:
  ...
  line.set_ydata(rewards)
  fig.canvas.draw()

This produces very appealing graphs that update in real time. It would be awesome if it was possible to do something similar with gfx.js. And as far as I can tell it almost works, charts just need to update/render in the background.

soumith commented 9 years ago

hey, we are moving to an ipython kernel (similar to iJulia and iHaskell). I am keeping the charting API as close to gfx as possible, but WAY MORE reliable. I've tested your use-case and the new "iTorch" looks to be quite stable in that case. The release target is before the turn of the year, so it is just a week away. hope that makes you happy, will post here when that is released.

Mononofu commented 9 years ago

That sounds awesome, thanks! In that case I'll just wait till it's ready :)

On Mon, Dec 22, 2014 at 5:56 AM, Soumith Chintala notifications@github.com wrote:

hey, we are moving to an ipython kernel (similar to iJulia and iHaskell). I am keeping the charting API as close to gfx as possible, but WAY MORE reliable. I've tested your use-case and the new "iTorch" looks to be quite stable in that case. The release target is before the turn of the year, so it is just a week away. hope that makes you happy, will post here when that is released.

— Reply to this email directly or view it on GitHub https://github.com/clementfarabet/gfx.js/issues/39#issuecomment-67804683 .

clementfarabet commented 9 years ago

Cant' wait for this!

On Mon Dec 22 2014 at 3:42:29 PM Julian Schrittwieser < notifications@github.com> wrote:

That sounds awesome, thanks! In that case I'll just wait till it's ready :)

On Mon, Dec 22, 2014 at 5:56 AM, Soumith Chintala < notifications@github.com> wrote:

hey, we are moving to an ipython kernel (similar to iJulia and iHaskell). I am keeping the charting API as close to gfx as possible, but WAY MORE reliable. I've tested your use-case and the new "iTorch" looks to be quite stable in that case. The release target is before the turn of the year, so it is just a week away. hope that makes you happy, will post here when that is released.

— Reply to this email directly or view it on GitHub < https://github.com/clementfarabet/gfx.js/issues/39#issuecomment-67804683> .

— Reply to this email directly or view it on GitHub https://github.com/clementfarabet/gfx.js/issues/39#issuecomment-67887069 .

Mononofu commented 9 years ago

Has there been any progress on the new release?

soumith commented 9 years ago

@Mononofu https://github.com/facebook/iTorch