manpagez: man pages & more
info mathgl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.1.20 Text sample

../png/text

C++ code

mglData y(50,3);
y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0);
y.Modify("sin(2*pi*x)",1);
y.Modify("cos(2*pi*x)",2);
gr->Box();
gr->Plot(y.SubData(-1,0));
gr->Text(y,"This is very long string drawn along a curve",":k");
gr->Text(y,"Another string drawn above a curve","T:r");

MGL code

new y 50 3
modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)'
modify y 'sin(2*pi*x)' 1
modify y 'cos(2*pi*x)' 2
box
plot y(:,0)
text y 'This is very long string drawn along a curve' ':k'
text y 'Another string drawn above a curve' 'T:r'

Pure C code

HMDT y = mgl_create_data_size(50,1,1);
mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0);
mgl_box(gr,1);
mgl_plot(gr,y,NULL);
mgl_text_y(gr,y,"This is very long string drawn along a curve",":k",-1.);
mgl_text_y(gr,y,"Another string drawn above a curve","T:r",-1.);
mgl_delete_data(y);

Fortran code

integer y, mgl_create_data_size
y = mgl_create_data_size(50,1,1)
call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0)
call mgl_box(gr,1)
call mgl_plot(gr,y,'')
call mgl_text_y(gr,y,'This is very long string drawn along a curve',':k',-1.)
call mgl_text_y(gr,y,'Another string drawn above a curve','T:r',-1.)
call mgl_delete_data(y)

Python

y = mglData(50,3);
y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0);
y.Modify("sin(2*pi*x)",1);     y.Modify("cos(2*pi*x)",2);
gr.Box();
gr.Plot(y.SubData(-1,0));
gr.Text(y,"This is very long string drawn along a curve",":k");
gr.Text(y,"Another string drawn above a curve","T:r");

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.