-
Notifications
You must be signed in to change notification settings - Fork 19
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
using plotille for a real time chart #57
Comments
btw, I managed to workaround that with:
but the color of the lines change every iteration |
I also changed to X axis to datetime.datetime.now(), and it seems it is working .. I will investiate a bit more about that. |
I created a copy of but if there is a better way to handle that .. I will appreciate a better approach. |
Hi @xmnlab , Thank you for the kind words! Here is an example for custom ticks: https://github.com/tammoippen/plotille/blob/master/examples/custom_ticks_example.py The function signature is Here are tests that use datetime on the x-axis: https://github.com/tammoippen/plotille/blob/master/tests/test_figure.py#L494-L572 When you want time on the x-axis, you have to use date, datetime or numpy.datetime, or write your own converter / formatter. See here for the default converters / formatters of date(time)s. The Regarding colors, you can either:
The parameter Please read this docstring for the color formatting in the terminal. To change the color mode of a figure, use this getter/setter. BTW, you can also set a background color: https://github.com/tammoippen/plotille/blob/master/plotille/_figure.py#L472 . I hop, this helps you. I am looking forward to see how Best, Tammo |
We might be doing similar thing. I try to visualize sar/sysstat data generally in https://github.com/brablc/lazysar I use it to observe my swarm and can see that @xmnlab uses it in similar environment. I am so far with real time data: https://asciinema.org/a/ECaK0TKivITr7kw4RtBK79RSy . It flickers, not sure if this can be avoided. |
In my I project I capture the data and display it using curses library to avoid flickering. Additionally I move the legend inside the chart area: |
Thanks @tammoippen for the detailed explanation! Appreciate that :) And thanks @brablc for sharing about your implementation! I am taking a look into that! |
that looks awesome! thanks for sharing! |
Hey everyone!
first of all, thank you all for working on plotille, that is a very nice library!
I am trying to have a real time chart, but I am having some hard time trying to figure out how to have the time in the x axis.
This is my initial code: https://github.com/osl-incubator/sugar/blob/main/src/sugar/plugins/stats.py#L94
but now I am trying to have the x axis with the time. and it seems it is not working properly.
as I saw in the source code it uses some math to calculate the ticks, so maybe it is breaking my code.
locally, in a wip, I tried x_ticks_fkt and register_label_formatter .. but it seems it is not working as I expected.
could you point me to any example that uses x axis for time? that I could use it for a real time chart?
another extra question, still about real time chart, do I need to create the figure for every iteration?
because if I use
plot
every time, it add more lines to the chart. so for now I am recreating the chart figure every time, but it would be nice to just update the data there.thanks!
The text was updated successfully, but these errors were encountered: