Git Product home page Git Product logo

Comments (4)

xmnlab avatar xmnlab commented on May 24, 2024

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.

xmnlab avatar xmnlab commented on May 24, 2024

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.

xmnlab avatar xmnlab commented on May 24, 2024

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.

tammoippen avatar tammoippen commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.