more examples
This commit is contained in:
parent
e529e79582
commit
683032432c
@ -3,6 +3,13 @@
|
|||||||
|
|
||||||
:- initialization(main).
|
:- initialization(main).
|
||||||
|
|
||||||
|
setup_dir :-
|
||||||
|
prolog_load_context(directory, Dir),
|
||||||
|
atom_concat(Dir,'/pyx/',Base),
|
||||||
|
assert(base(Base)).
|
||||||
|
|
||||||
|
:- setup_dir.
|
||||||
|
|
||||||
main :-
|
main :-
|
||||||
ex(X),
|
ex(X),
|
||||||
flush_output,
|
flush_output,
|
||||||
@ -10,8 +17,15 @@ main :-
|
|||||||
main.
|
main.
|
||||||
|
|
||||||
ex(hello_world) :-
|
ex(hello_world) :-
|
||||||
c = pyx:canvas:canvas,
|
c := pyx:canvas:canvas,
|
||||||
:= c:text(0, 0, 'Hello, world!'),
|
:= $c:text(0, 0, 'Hello, world!'),
|
||||||
:= c:stroke(path:line(0, 0, 2, 0)),
|
:= $c:stroke(path:line(0, 0, 2, 0)),
|
||||||
c.writePDFfile('hello.pdf').
|
:= $c:writePDFfile('hello').
|
||||||
|
|
||||||
|
ex(changebar) :-
|
||||||
|
g := pyx:graph:graphxy(width=8, x=graph:axis:bar),
|
||||||
|
atomic_concat(Source, 'minimal.dat', Data),
|
||||||
|
:= $g:plot(graph:data:file(Data, xname=0, y=2), [graph:style:changebar]),
|
||||||
|
:= $g:writePDFfile(changebar).
|
||||||
|
|
||||||
|
|
||||||
|
12
packages/python/examples/pyx/minimal.dat
Normal file
12
packages/python/examples/pyx/minimal.dat
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
January -5 1
|
||||||
|
Feburary -4 3
|
||||||
|
March 0 8
|
||||||
|
April 3 13
|
||||||
|
May 7 18
|
||||||
|
June 10 21
|
||||||
|
July 12 23
|
||||||
|
August 12 23
|
||||||
|
September 8 19
|
||||||
|
October 4 13
|
||||||
|
November 0 6
|
||||||
|
December -4 2
|
Reference in New Issue
Block a user