7 ms·
Show HN: Plot directly in your terminal with matplotlib
- jpeanuts 10y agoGnuplot has an output mode - called "dumb" - that prints an ASCII plot to the terminal. See e.g. http://pastebin.com/WHcLZHPr http://pastebin.com/WHcLZHPr This is very handy when running scientific codes on remote machines, and works in any terminal (not just iTerm2 like the submission). I've been looking for a matplotlib extension to do the same thing, without success.
- dima55 10y agoWhy wouldn't you use gnuplot? If you want a numpy interface, there's this: https://github.com/dkogan/gnuplotlib https://github.com/dkogan/gnuplotlib
- Y_Y 10y agoHave you tried using cacaview on images? When I'm running scientific code on remote machines I use jupyter tunneled over ssh, but I assume you can't do that.
- jpeanuts 10y agoThanks for the two(!) nice tips. Just looked at libcaca, but I'm having trouble installing on my laptop (OSX). Anyway the idea is mainly to remove gnuplot as a dependency from my scientific code; introducing a new dependency defeats the point a bit. Jupyter would be a very nice way to interact - as you guess there are difficulties: playing well with the cluster queueing system, and currently the code is launched via an mpirun call. I'm open to suggestions. Edit: This sounds like exactly what I need! http://ipython.org/ipython-doc/stable/parallel/parallel_intro.html http://ipython.org/ipython-doc/stable/parallel/parallel_intr...
- daleroberts 10y agoYou can checkout my other project https://github.com/daleroberts/tv https://github.com/daleroberts/tv which allows you to view images in any terminal supporting Unicode 9.0 fonts and true color. It uses GDAL for the backend which is easy to install on a Mac with: brew install gdal --without-python --HEAD pip install gdal
- jxy 10y agognuplot is very nice in working like this. I've been using a script [0] to pipe data directly. [0] https://gist.github.com/jxy/88f2972d3994dfea06fd2d3833b7ac8a https://gist.github.com/jxy/88f2972d3994dfea06fd2d3833b7ac8a
- throwanem 10y agoMatplotlib has a "sixel" backend, which can render images in any terminal supporting the necessary protocol. Might be worth investigation, if you run or can run a terminal with that support - I was surprised how many do, either out of the box or recompiled to enable it.
- staz 10y agoI've looked a bit and only mlterm seems to support it out of the box at the momement (on ubuntu at least) Xterm need an optionnal compile switch. Vte (gnome-terminal, xfce-terminal etc..) has an unmerged patch. It's fun to play around with
- throwanem 10y agoMintty's newer versions support it natively, as do a number of Linux console terminals.
- JosephRedfern 10y agoIt's not as complete as matplotlib, but there is an ASCII plotting library which has a (very) similar API to matplotlib called bashplotlib: https://github.com/glamp/bashplotlib https://github.com/glamp/bashplotlib
- krick 10y agoGod, I want something like iTerm2 for Linux.
- mcpherrinm 10y agoThe iterm image support is pretty simple (just a VT100-style command wrapped around a base64 encoded png). Maybe somebody can implement it for gnome/vte or something, and see if there's any traction.
- zer0t3ch 10y agoI know it's not a traditional terminal, but GateOne actually has this. It's pretty interesting to use, weird to see a full quality picture in the middle of a terminal.
- tavert 10y agoYou can build xterm with sixel support https://github.com/saitoha/libsixel https://github.com/saitoha/libsixel
- badosu 10y agoTake a look at Terminology[0], it can print images such as the output from matplotlib. 0: https://www.enlightenment.org/about-terminology https://www.enlightenment.org/about-terminology
- rafinha 10y ago"Never again be stuck not being able to see cats do stupid things in animated gifs when you don't have your web browser available" Lol they do know how to sell their software xD. Thanks for link.
- Adaptive 10y agoiTerm2 is nice, but Linux has a zillion terminal emulators. I'm running images inside of urxvt right now using w3m. https://twitter.com/ethanschoonover/status/834227566848286720 https://twitter.com/ethanschoonover/status/83422756684828672...
- venachescu 10y agoYou are literally making my dreams come true. Thank you!
- stestagg 10y agoYou have weird dreams
- Lxr 10y agoGreat idea, I was just thinking yesterday that something like this should exist. Matplotlob seems to like automatically switching windows every time you plot something, so annoying!
- Lxr 10y agoHmm, I used the back button on my phone after submitting a comment and it must have resubmitted the form, and now I can't delete the dupe.
- Lxr 10y agoGreat idea, I was just thinking yesterday that something like this should exist. Matplotlob seems to like automatically switching windows every time you plot something, so annoying!
- maddyboo 10y agoAny idea of how to do something like this for R?
- em500 10y agohttps://cran.r-project.org/web/packages/txtplot/index.html https://cran.r-project.org/web/packages/txtplot/index.html
- wallstquant 10y agoJulia has something similar too. TerminalExtensions.jl https://groups.google.com/forum/m/#!topic/julia-users/zj4nQlDGNoc https://groups.google.com/forum/m/#!topic/julia-users/zj4nQl...
- curiousgal 10y agoReminds me of Maple, it came with a console version that can render plots in ASCII.