Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rmsrosa/cairoplot.jl
Simple and lightweight plot tool based on JuliaGraphics/Cairo.jl
https://github.com/rmsrosa/cairoplot.jl
cairo hojbot julia julia-language julialang plot
Last synced: about 2 months ago
JSON representation
Simple and lightweight plot tool based on JuliaGraphics/Cairo.jl
- Host: GitHub
- URL: https://github.com/rmsrosa/cairoplot.jl
- Owner: rmsrosa
- License: mit
- Created: 2021-07-17T13:40:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-20T10:56:04.000Z (over 3 years ago)
- Last Synced: 2024-10-13T19:27:06.234Z (3 months ago)
- Topics: cairo, hojbot, julia, julia-language, julialang, plot
- Language: Julia
- Homepage:
- Size: 545 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CairoPlot
Simple plot tool based on [JuliaGraphics/Cairo.jl](https://github.com/JuliaGraphics/Cairo.jl), which itself is an adaptation (binding) to Julia of the [Cairo](https://github.com/JuliaGraphics/Cairo.jl) C library.
The aim here is to have a plotting tool with minimal dependencies and fast.
It is still a work in progress and it is a not a registered package yet.
Ops, I just found out that there is already the package [JuliaGraphics/Winston.jl](https://github.com/JuliaGraphics/Winston.jl) that does that. 🤦♂️
Hmm, but `Winston.jl` plots are not always as pretty; the identation for multiline plots are not correct, and I don't think the background color can be changed to dark, which is what suits Discord best (for the [Humans-of-Julia/HoJBot.jl](https://github.com/Humans-of-Julia/HoJBot.jl), which was the whole point for starting this). So I definitely should continue this project.
The package can be added with
```julia
pkg> add https://github.com/rmsrosa/CairoPlot.jl
```## Examples
```julia
x = range(0, 10π, length=200)
y = sin.(x)
xticks = 0:5:30
yticks = -1.0:0.25:1.0
c = crplot(x, y; xticks, yticks, title = "Plot of a sine wave")
write_to_png(c,"sineplot.png")
```![sine plot](scripts/sineplot.png)
```julia
x = range(0, 10π, length=30)
y = sin.(x/5) .+ 0.3randn(length(x))
c = crplot(x, y; width = 600, height = 200, title = "Perturbation\n of a sine wave")
write_to_png(c,"perturbedsineplot.png")
```![perturbed sine](scripts/perturbedsineplot.png)
```julia
title = "Scattered perturbation\n of a sine wave"
x = range(0, 10π, length=100)
y = sin.(x/5) .+ 0.3randn(length(x))
c = crplot(x, y; plotstyle = :scatterplot, width = 600, height = 200,
title = "Scattered perturbation\n of a sine wave")
write_to_png(c,"scatteredperturbedsineplot.png")
```![scattered perturbed sine](scripts/scatteredperturbedsineplot.png)
```julia
xd = today():Year(1):today()+Year(20)
yd = rand(length(xd))
c = crplot(xd, yd; title="Prediction for the next 20 years")
write_to_png(c,"20years_future.png")
```![20 years ahead](scripts/20years_future.png)
```julia
xd = today()-Month(1):Day(1):today()
yd = 100.0 * rand(length(xd))
c = crplot(xd, yd; xticks = 5, yticks = 10, title="One month evolution")
write_to_png(c,"onemonth_past.png")
```![past one month](scripts/onemonth_past.png)
## License
This package is licensed under the [MIT license](https://opensource.org/licenses/MIT) (see file [LICENSE](LICENSE) in the root directory of the project).