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

9.7.12 Tick values sample

../png/tval

C++ code

gr->Axis(mglPoint(-M_PI, 0), mglPoint(M_PI, 2));
gr->SetTicksVal('x', 6, -M_PI, "-\\pi", -M_PI/2, "-\\pi/2", 0., "0", 
                0.886, "x^*", M_PI/2, "\\pi/2", M_PI, "\\pi");
gr->Axis();     gr->Grid();
gr->Plot("2*cos(x^2)^2", "r2", NAN, 300);

MGL code

axis -pi 0 pi 2
xtick -pi '-\pi' -1.571 '-\pi/2' 0 '0' 0.886 'x^*' 1.571 '\pi/2' pi '\pi'
axis 
grid
fplot '2*cos(x^2)^2' 'r2' nan 300

Pure C code

mgl_set_axis_2d(gr, -M_PI, 0, M_PI, 2);
mgl_set_ticks_val(gr, 'x', 6, -M_PI, "-\\pi", -M_PI/2, "-\\pi/2",
            0., "0", 0.886, "x^*", M_PI/2, "\\pi/2", M_PI, "\\pi");
mgl_axis(gr,"xyz");
mgl_axis_grid(gr,"xyz", "B-");
mgl_fplot(gr, "2*cos(x^2)^2", "r2", 300);

Fortran code

NOT AVAILABLE

Python

gr.SetRanges(-pi, pi, 0, 2);
parser = mglParse();
# very "stupid" way because SWIG not support variable arguments
parser.Execute(gr, "xtick -pi '-\pi' -1.571 '-\pi/2' 0 '0' "
                    "0.886 'x^*' 1.571 '\pi/2' pi '\pi'");
gr.Axis();     gr.Grid();
gr.Plot("2*cos(x^2)^2", "r2", 300);

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