Update README.md
This commit is contained in:
parent
e5d3ec467f
commit
2ca67b19d9
40
README.md
40
README.md
@ -4,7 +4,6 @@
|
||||
[](https://travis-ci.org/gcalderone/Gnuplot.jl)
|
||||
[](LICENSE.md)
|
||||
[](https://gcalderone.github.io/Gnuplot.jl/dev/)
|
||||

|
||||
|
||||
|
||||
**Gnuplot.jl** is a simple package able to send both data and commands from Julia to an underlying [gnuplot](http://gnuplot.sourceforge.net/) process. Its main purpose it to provide a fast and powerful data visualization framework, using an extremely concise Julia syntax.
|
||||
@ -27,6 +26,45 @@ test_terminal()
|
||||
```
|
||||
|
||||
## Quick start
|
||||
The following examples are supposed to be rather self-explaining. See [documentation](https://gcalderone.github.io/Gnuplot.jl/dev/) for further informations.
|
||||
|
||||
### A simple parabola
|
||||
```julia
|
||||
x = 1.:20
|
||||
@gp x x.^2 "with lines title 'Parabola'"
|
||||
save(term="pngcairo size 640,480", output="ex1.png")
|
||||
save("parabola.gp") # => save a script file with both data and command to re-create the plot.
|
||||
```
|
||||
|
||||
### A slightly more complex plot, with unicode on X tics
|
||||
```julia
|
||||
x = -2pi:0.1:2pi
|
||||
approx = fill(0., length(x));
|
||||
@gp t="Polynomial approximation of sin(x)" key="opaque"
|
||||
@gp :- "set encoding utf8" raw"""set xtics ('-π' -pi, 'π/2' -pi/2, 0, 'π/2' pi/2, 'π' pi)"""
|
||||
@gp :- xr=3.8.*[-1, 1] yr=[-1.5,1.5]
|
||||
@gp :- x sin.(x) approx .+= x "w filledcurve t 'n=0' lt 1"
|
||||
@gp :- x sin.(x) approx .+= -x.^3/6 "w filledcurve t 'n=1' lt 2"
|
||||
@gp :- x sin.(x) approx .+= x.^5/120 "w filledcurve t 'n=2' lt 3"
|
||||
@gp :- x sin.(x) approx .+= -x.^7/5040 "w filledcurve t 'n=3' lt 4"
|
||||
@gp :- x sin.(x) "w l t 'sin(x)' lw 2 lc rgb 'black'"
|
||||
save(term="pngcairo size 640,480", output="ex2.png")
|
||||
```
|
||||
|
||||
### Multiplot: a 2D histogram contour plot and a 3D surface plot
|
||||
```julia
|
||||
x = randn(10_000)
|
||||
y = randn(10_000)
|
||||
h = hist(x, y, bs1=0.25, nbins2=20)
|
||||
@gp "set multiplot layout 1,2"
|
||||
@gp :- 1 key="outside top center box horizontal" "set size ratio -1" h
|
||||
clines = contourlines(h.bins1, h.bins2, h.counts, cntrparam="levels discrete 10, 30, 60, 90");
|
||||
for i in 1:length(clines)
|
||||
@gp :- clines[i].data "w l t '$(clines[i].z)' lw $i lc rgb 'gray'" :-
|
||||
end
|
||||
@gsp :- 2 h.bins1 h.bins2 h.counts "w pm3d notit"
|
||||
save(term="pngcairo size 660,350 fontscale 0.8", output="ex3.png")
|
||||
```
|
||||
|
||||
## Examples
|
||||
The main gallery of examples is maintained in a separate repository:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user