Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/szymon423/yapl
Another C++ plot library
https://github.com/szymon423/yapl
cario chart cpp17 plot
Last synced: 5 days ago
JSON representation
Another C++ plot library
- Host: GitHub
- URL: https://github.com/szymon423/yapl
- Owner: Szymon423
- Created: 2024-07-10T17:33:10.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-07-16T16:13:07.000Z (3 months ago)
- Last Synced: 2024-09-28T23:42:04.180Z (5 days ago)
- Topics: cario, chart, cpp17, plot
- Language: C++
- Homepage:
- Size: 296 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![logo](./img/logo.png)
# Yet Another Plot Library
This is my attempt to create simple plot library for `C++`. Especially one that is willing to work on `Raspberry Pi` devices on `arm64` OS.> [!NOTE]
> This library will not display any plots. It can only save them to `.png`## But Why?
Why to choose this library when you can use `python` and all it goodness like `matplotlib`?Well.. I also do not know. But maybe when writing somethig that need to work without any other programs like amazing `gnuplot`, running on constrained hardware resources system maybe it is worth checking out on this something.
## Example
```cpp
#include "yapl.hpp"
#includeint main() {
try {
yapl::Plot plot;
plot.addData({10, 50, 30, 10}, {10, 90, 50, 90});
plot.addData({80, 120, 160, 140, 100}, {10, 90, 10, 50, 50});
plot.addData({190, 190, 240, 240, 190}, {10, 90, 90, 50, 50});
plot.addData({270, 270, 320}, {90, 10, 10});
plot.grid(true);
plot.xLabel("X value");
plot.yLabel("Y value");
plot.title("Yet Another Plot Library");
plot.setLabelMaker([](double val) -> std::string {
return "X: " + std::to_string((int)val);
});
plot.save("/YAPL/img/test/example_plot.png", 800, 600);
}
catch (const yapl::Exception& e) {
std::cout << "Caught error during plot generation" << std::endl;
}
return 0;
}
```![output](./img/example_plot.png)
## Documentation
To run documentation just use:
```sh
cd docs && mkdocs serve
```## Dependencies
- [cario](https://www.cairographics.org/)## License
This software is released under `GPLv2+` license.