ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
6.64k stars 399 forks source link

Embedding plots ? #134

Closed journeytosilius closed 3 years ago

journeytosilius commented 3 years ago

Is it somehow possible or would it be possible to embed Plplot inside FTXUI containers ?

http://plplot.sourceforge.net/

Thanks !

ArthurSonzogni commented 3 years ago

Hi!

I don't understand the question. Can Plplot output something that could be drawn inside a terminal, with a grid of characters?

Or maybe you would like to use brailles characters to have extra definition for plotting function like: https://github.com/tammoippen/plotille ?

journeytosilius commented 3 years ago

From the Plplot site :

PLplot is a cross-platform software package for creating scientific plots whose (UTF-8) plot symbols and text are limited in practice only by what Unicode-aware system fonts are installed on a user's computer. The PLplot software, which is primarily licensed under the LGPL, has a clean architecture that is organized as a core C library, separate language bindings for that library, and separate device drivers that are dynamically loaded by the core library which control how the plots are presented in noninteractive and interactive plotting contexts.

Plplot is a terminal plotter, and it's honestly fantastic. Written in C but also has C++ bindings. In my oppinion is the best terminal plotting software. It would amazing if we could add plotting functions and embed them on FTXUI containers.

I'm not sure if this would be possible though, but if was, this would the ultimate solution!

journeytosilius commented 3 years ago

If enabling to use something like Plplot would be too out of bounds, maybe something like plotille would also do the job. I'm only suggesting Plplot because I have used it quite a bit, but I'm sure you know better what would make a complete real time plotting solution for FXTUI

ArthurSonzogni commented 3 years ago

This doesn't seems hard to make an adapter that will draw the output of plplot into a ftxui::screen as a ftxui dom element. I won't force anyone to pay the cost of embedding directly plplot into FTXUI, but that an use case I want for people to be easy to support. I can make a demo and make it public for other people to do it.

I don't see an image on internet showing the output of plplot into a terminal. Do you have one?

journeytosilius commented 3 years ago

Sounds great

I've been looking in to some old images taken when I was coding some plot functions and saved screenshots straight from a full screen terminal, but I don't have any where you can actually see the terminal. I'd just use some of the pictures available at the Plplot site, and I can make some detailed screenshots for you once I have it running again ? Let me know

journeytosilius commented 3 years ago

Taking a deeper look in to this, since I'm pretty sure you can plot to a terminal ... I just retrieved an old project and I used xwin to plot tho. Will get back to you

journeytosilius commented 3 years ago

sorry, got totally confused as it's been a good three years since I don't use Plplot and forgot that you can't plot to an actual terminal :) Maybe then, the correct way to do this would be something like plotille

ArthurSonzogni commented 3 years ago

;-) that's what I suspected about Plplot.

Note that you can use ftxui::graph to plot some functions: https://arthursonzogni.com/FTXUI/examples/?file=./dom/graph.js

Note as nice as plotille, but this one is already available.