This chapter contain information about basic and advanced MathGL, hints and samples for all types of graphics. I recommend you read first 2 sections one after another and at least look on Hints section. Also I recommend you to look at General concepts and FAQ.
Note, that MathGL v.2.* have only 2 end-user interfaces: one for C/Fortran and similar languages which don’t support classes, another one for C++/Python/Octave and similar languages which support classes. So, most of samples placed in this chapter can be run as is (after minor changes due to different syntaxes for different languages). For example, the C++ code
#include <mgl2/mgl.h> int main() { mglGraph gr; gr.FPlot("sin(pi*x)"); gr.WriteFrame("test.png"); }
in Python will be as
from mathgl import * gr = mglGraph(); gr.FPlot("sin(pi*x)"); gr.WriteFrame("test.png");
in Octave will be as (you need first execute mathgl;
in newer Octave versions)
gr = mglGraph(); gr.FPlot("sin(pi*x)"); gr.WriteFrame("test.png");
in C will be as
#include <mgl2/mgl_cf.h> int main() { HMGL gr = mgl_create_graph(600,400); mgl_fplot(gr,"sin(pi*x)","",""); mgl_write_frame(gr,"test.png",""); mgl_delete_graph(gr); }
in Fortran will be as
integer gr, mgl_create_graph gr = mgl_create_graph(600,400); call mgl_fplot(gr,'sin(pi*x)','',''); call mgl_write_frame(gr,'test.png',''); call mgl_delete_graph(gr);
and so on.