Open jonmmease opened 6 years ago
echo '{"data": [{"y": [2, 3, 1]}]}' > plot.json cat plot.json | orca graph > plot.png
Strange. This works just fine on my Ubuntu laptop.
limit to how large command-line arguments can be
I think the best workaround would be to save the JSON to a temporary file, call orca and then remove the temporary file.
I suspect piping a JSON of 100,000+ pts to orca might be very slow as we have to wait until the entire JSON is in memory before booting orca.
Just to remove one layer of indirection, I get the same behavior if I call the orca executable directly (rather than the wrapper in /usr/local/bin):
cat plot.json | /Applications/orca.app/Contents/MacOS/orca graph > plot.png
I wonder if there's something going on here with the application bundle. I'll try it from development environment.
Yeah, it also hangs if I use the bin/orca.js entry point from the development environment.
Converting the large scatter plots to images is actually pretty fast when I save the json to a file first, and pass the file path to orca (The save time is still dominated by orca's startup time).
I was hoping to find a way to handle large plots, and avoid writing out temp files. But the temp file approach might be preferable anyway, to make it easier to handle the batch conversion of multiple images in one call to orca.
Ahh, this is probably what's going on: https://github.com/electron/electron/issues/4218
On Windows only console programs can have stdin, but Electron is a GUI program.
That issue was for a windows application build, but maybe there's something similar going on for OS X applications as well.
Tagging as type: bug
. We should do more research on how to pipe things into electron apps in OS X. If that's something that can't be done, we should at least update our README and --help
docs accordingly.
The help info for
orca graph --help
displays this usage example:However, when I try to use this (on OS X) the command just hangs
For background, I was considering using a STDIN approach for the plotly.py integration because there's a limit to how large command-line arguments can be. For example, the Python approach in the README, of passing the JSON definition of the graph as an argument to orca, fails for a scatter plot with 100,000 points. cc @chriddyp