-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic plotting support #464
Conversation
For CLI usage, I wonder if we could hook it up to ratatui's canvas or chart widgets. This probably wouldn't be all that useful in practice, but might be fun anyway :) |
Cool. Hadn't heard about ratatui. But yeah, I think a file-based backend and maybe an actual GUI backend might be more useful options. |
This changeset now uses plotly, which allows us to open interactive plots in the browser. This is also much lighter in terms of dependencies (but see plotly/plotly.rs#176). And it would also integrate with the web version naturally. |
@irevoire I had a new idea for the API. It's a bit hacky, but could be enough for a first draft. I'm now using your enhanced reverse-apply operator to add optional arguments like |
Oh yes we can now do a builder pattern quite easily! On another subject, I’m really starting to think that we may need scopes earlier than I expected:
Something like that seems easier to understand, and it will free up a lot of symbols for the users. |
Yes, absolutely. It's a problem already since I can't reuse things like |
This is now in a state where it could be merged. A drawback is that the binary size increases by about 4 MiB, which is probably mostly due to plotly/plotly.rs#176 |
This is a draft for adding basic plotting support to Numbat. Contrary to the first attempt in #147, we now implement the basic data preprocessing step in Numbat itself, using the new struct and
List
data types. We can now also implement this as a normal function, instead of having to introduce a new command.We can now write something like:
and get the following plot. The
xlabel
/ylabel
calls are optional. Note how the units here are inferred and added to the axis descriptions:Similarly, we can create a simple bar chart:
Open points:
line_plot(amplitude, 0 s, 8 s)
intoline_plot(amplitude) |> xlim(0 s, 8 s)
, for example. It would also allow us to implementylim(…, …)
. We could also store the function inside theLinePlot
struct instead of storing all the data points. We would only convert to data points before passing it to the FFI|>
reverse-apply operators in the example above to the next line. To have it look like