Git Product home page Git Product logo

Comments (6)

 avatar commented on May 27, 2024 1

Hi @olavolav. I was not aware of the line drawing support using the line argument. However, what I am precisely looking for is the ability to draw points and then join them using lines, as you have clearly understood. Would be amazing if this feature was added. Thanks.

from uniplot.

 avatar commented on May 27, 2024 1

Sure @olavolav. Thanks a lot!!

from uniplot.

olavolav avatar olavolav commented on May 27, 2024

Hi @gourisariah thanks for the feedback! Happy to hear that uniplot was helpful 😄

There is limited line drawing support in uniplot already by using the lines option, were you aware of that?

For example:

>>> from uniplot import plot
>>> plot([1,3,2], lines=True)
┌────────────────────────────────────────────────────────────┐
│                            ▗▀▀▚▄▖                          │ 3
│                          ▗▞▘    ▝▀▄▄                       │ 
│                        ▗▞▘          ▀▀▄▖                   │ 
│                       ▄▘               ▝▀▚▄                │ 
│                     ▄▀                     ▀▀▄▖            │ 
│                   ▗▞                          ▝▀▚▄         │ 
│                 ▗▞▘                               ▀▀▄▖     │ 
│                ▄▘                                    ▝▀▚▄  │ 
│              ▄▀                                          ▀▀│ 2
│            ▗▞                                              │ 
│          ▗▞▘                                               │ 
│         ▞▘                                                 │ 
│       ▄▀                                                   │ 
│     ▗▀                                                     │ 
│   ▗▞▘                                                      │ 
│  ▞▘                                                        │ 
│▄▀                                                          │ 1
└────────────────────────────────────────────────────────────┘
 1                             2                            3

For displaying trends I suppose you would need the possibility to draw points and then a line on top, right? That would indeed not be possible currently, but wouldn't be difficult to add

from uniplot.

olavolav avatar olavolav commented on May 27, 2024

Okay, so one way to do that would be to allow for a list to be passed to the lines option.

So you would write for example:

import numpy as np
import random

# Let's say that these are your measurement points with some noise on top
xs_scatter = np.arange(0, 100)
ys_scatter = 0.5*xs_scatter + (random.random() - 0.5)

# This is your trend
xs_trend = [-10,110]
ys_trend = [-5, 55]

plot(xs=[xs_scatter, xs_trend], ys=[ys_scatter, ys_trend], lines=[False, True], legend_labels=["data points", "trend line"])

The lines=[False, True] part would make the first series drawn as points, and the second one as a line.

Here I am supplying x coordinates for both since right now you can only supply none or all x coordinates.

@gourisariah Would that flexibility in the lines option help you for your use case?

from uniplot.

 avatar commented on May 27, 2024

Yes @olavolav. That should work. I guess, for simplicity sake, you can also probably define a function as follows so that code for plotting a line graph is simpler to understand.

def line_graph(ys: Any, xs: Optional[Any] = None, **kwargs) -> None:
    plot(ys=[ys, ys], xs=[xs, xs], lines=[True, False], **kwargs)
    return

What do you think?

from uniplot.

olavolav avatar olavolav commented on May 27, 2024

Thanks @gourisariah for your input! I am somewhat hesitant to expand the API too much at this point, first want to see more where on the scale simplicity-versus-flexibility the users mostly are. But I'll keep your function in mind!

In the meantime, I have a prototype of the feature itself:

Bildschirmfoto 2021-04-07 um 10 45 35

Will clean it up and publish it soon, most likely tonight or tomorrow.

Thanks again for your input!

from uniplot.

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.