Comments (4)
btw, I managed to workaround that with:
self.fig_mem._plots.clear()
self.fig_cpu._plots.clear()
but the color of the lines change every iteration
from plotille.
I also changed to X axis to datetime.datetime.now(), and it seems it is working .. I will investiate a bit more about that.
from plotille.
I created a copy of _color_seq
with tee
in order to handle keep the same color always.
but if there is a better way to handle that .. I will appreciate a better approach.
thanks!
from plotille.
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 def default_tick(min_, max_):
where min_
and max_
both have the type of the x- or y-axis data (e.g. datetime
). They are the minimum and maximum value of the current tick. The return value will be rendered as the tick value - if there is a formatter for the value, it will be formatted. If the return value is a str
, the string will be rendered.
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 delta
is the difference between the smallest and largest x-value, hence the formatting can be 'refined' depending on how large the difference is (you only have a certain amount of characters per tick to write the tick-value).
Regarding colors, you can either:
-
create a new figure every time - the color order for the plots is the same.
-
set the color explicitly:
self.fig_mem.plot( container_stats['times'], container_stats['mem_usages'], label=name, lc="red", # <=== )
The parameter lc
means line color
and can be either color names, color codes or rgb values.
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 suger
evolves :D.
Best, Tammo
from plotille.
Related Issues (20)
- weird spike at zero HOT 4
- install failed: AttributeError: module 'enum' has no attribute 'IntFlag' HOT 1
- Accept `datetime.date` as X input HOT 6
- Draw vertical or horizontal lines on plots HOT 4
- [feature request] Provide a CLI HOT 3
- Make y-values exakt or approximate values of the data inputs HOT 5
- Histogram breaks when all values are the same HOT 1
- Index out of bounds for hist() on negative values HOT 3
- Two plots side-by-side HOT 4
- has someone ever integrated this on a curses-like interface ? HOT 4
- hex colors not showing up when parsing terminal results HOT 3
- `Figure.axvline(x) coordinates are wrong` HOT 2
- Windows 10 terminal does not display brailles HOT 2
- Log scale for plot() HOT 2
- [Feature request] support arrow HOT 2
- [Feature Request] Treemaps HOT 1
- Feature request: Network graph HOT 1
- Feature request: Are Candlestick and Indicators are supported
- using plotille for stock market charts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plotille.