Comments (6)
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.
Sure @olavolav. Thanks a lot!!
from uniplot.
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.
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.
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.
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:
Will clean it up and publish it soon, most likely tonight or tomorrow.
Thanks again for your input!
from uniplot.
Related Issues (20)
- Occasional gaps in lines HOT 2
- Missing precision on x axis values, making them identical HOT 3
- [Question] Does Uniplot Support .py files? HOT 2
- Support for using datetime values for x axis labels HOT 11
- Fill area under curve HOT 1
- Get a plot as a string HOT 6
- Incorrect centering of labels with units
- Feature request: Boxplot HOT 3
- Can it support NaN? HOT 7
- Suggestion for speeding up large data HOT 6
- Incorrect axis labels in rare cases
- Manually set view bounds do not work correctly with log flags
- Label choice does not always seem optimal HOT 1
- Support for using datetime values for y axis labels
- Configurable move / zoom keys HOT 4
- Histogram x-axis range ignored HOT 3
- Missing link to repository on PyPI page HOT 3
- Use different characters instead of colors HOT 2
- plot fails when multiseries is provided with empty list HOT 2
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 uniplot.