Comments (11)
@leighleighleigh Quick update: Inspired by your work, I have started work on this. Check out this branch if you are interested: https://github.com/olavolav/uniplot/tree/os_from_leighleighleighz-datetime_support
It is similar to your approach, but differs in a few areas to keep with uniplot's (as of yet undocumented) design goals:
- No additional dependencies, just Python and NumPy
- No required configuration, it should "just work". In building uniplot I tried to take on complexity as part of the library, such that the user could just throw data at the plot function and uniplot would figure out the rest.
- Nice & friendly axis labels: This is 99% missing right now, I'm just trying to find any date labels right now.
Example of what I have so far:
import numpy as np
dates = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]')
plot(xs=dates, ys=[1,2,3,2])
yields:
┌────────────────────────────────────────────────────────────┐
│ ▝ │ 3
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ ▘ ▝│ 2
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│▖ │ 1
└────────────────────────────────────────────────────────────┘
04:52:21.900 05:37:27.300 06:22:32.700 07:07:38.100
I'll update this thread as work progresses.
from uniplot.
Just checked it out - looks great! The auto-scaling axis labels are really nice.
Have confirmed our test suite still runs perfectly fine with this new version, too.
uniplot
has been fantastic for understanding our unit-test failures by the way, many thanks!
from uniplot.
And we are live as of version v0.12.1 🚀
Thanks everyone for your support and your patience 😄
from uniplot.
Hi @gourisariah that's a good point, indeed plotting data with time stamps and/or categorical data would be great.
I suppose a simple workaround for now would be to ask the users to map the timestamps to "number of day since X" or similar before plotting. But I agree with you that what you showed would be much nicer.
I'll think about it, and will also refresh my memory on how matplotlib and other plotting libraries handle this.
Can't promise anything right now, but I'll look into it. Thanks for the input! 😄
from uniplot.
Adding my vote for this. Using datetime.datetime
would helpful tons of data visualizations.
from uniplot.
I've got a proof-of-concept implementation of this here, which I haven't PR'd due to it being tangled up with other changes.
I'd appreciate your thoughts on it, @olavolav - it feels a little hacky to me, but it does work :)
from uniplot.
Sure @olavolav. That would be great! Thanks a lot.
from uniplot.
Awesome, thanks @leighleighleigh ! I will have a detailed look once I had a bit more time.
from uniplot.
@leighleighleigh I've opened a pull request with a first working version, feel free to check it out and let me know what you think.
from uniplot.
Just keeping this open until the feature is complete
from uniplot.
Just for the record, I wanted to see how the original request from 2021 would look like now. Taking the stock price of Meta from Yahoo as a CSV, we have:
data = pd.read_csv("META.csv")
data["Timestamp"] = pd.to_datetime(data["Date"])
plot(xs=data.Timestamp, ys=data.Close, title="Meta stock price", y_unit=" $", lines=True)
which yields
Meta stock price
┌────────────────────────────────────────────────────────────┐
│ ▐│
│ ▞│
│ ▌│ 400 $
│ ▗▖ ▌│
│ ▌▌ ▐ │
│ ▞ ▚▞▖ ▗ ▛ │
│ ▗ ▐ ▌ ▞▞▘ │ 300 $
│ ▐▙▜▞ ▌ ▗▘ │
│ ▌ ▝▘ ▌ ▞ │
│ ▞ ▜▖ ▌ │
│ ▖▗ ▟ ▐▟▚▐▀▙▘ ▜ ▐ │ 200 $
│ ▗▀▝▘▛ ▀▖▐▞▘ ▘ ▝ ▙▖ ▞ │
│ ▄▖▗▀▀ ▝▌ ▙▗▘ │
│ ▄▚▀▀ ▝▘ ▐▛ │ 100 $
│ ▗▄▄▄▄▀▀ ▝ │
│ ▄▄▀▀▘ │
│▙▄▄▄▄▞▘ │
└────────────────────────────────────────────────────────────┘
2013 2014 2016 2017 2019 2020 2021 2023
There is room for improvement, but it works for the moment, I would say.
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
- Requesting Support for Plotting Line Graphs HOT 6
- 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.