From 92bee39f244541a23d6a3703ec34260cfb22c0bb Mon Sep 17 00:00:00 2001 From: Alastair McKinstry Date: Tue, 26 Mar 2019 10:03:43 +0000 Subject: [PATCH] Upstream release 2.4.3 --- CMakeLists.txt | 36 +- ChangeLog.txt | 25 +- brush.ods | Bin 19306 -> 43187 bytes examples/full_test.cpp | 15 +- examples/qgl_example.cpp | 36 +- examples/qgl_example.h | 10 +- examples/samples.cpp | 10 +- include/mgl2/abstract.h | 6 +- include/mgl2/base.h | 13 +- include/mgl2/canvas.h | 2 +- include/mgl2/data.h | 4 +- include/mgl2/data_cf.h | 2 +- include/mgl2/datac.h | 14 +- include/mgl2/datac_cf.h | 72 +- include/mgl2/define.h | 80 +- include/mgl2/font.h | 13 +- include/mgl2/pde.h | 8 +- include/mgl2/vect.h | 12 +- include/mgl2/wnd.h | 3 + mathgl_es.po | 426 +- mathgl_ru.po | 426 +- mgllab/editor.cpp | 11 +- mgllab/help.cpp | 33 +- mgllab/mgllab.cpp | 8 +- mgllab/mgllab.h | 12 +- scripts/CMakeLists.txt | 4 +- src/CMakeLists.txt | 2 +- src/addon.cpp | 4 +- src/axis.cpp | 72 +- src/base.cpp | 28 +- src/c2mdual.c | 8 + src/canvas.cpp | 11 +- src/complex.cpp | 146 +- src/complex_ex.cpp | 24 +- src/complex_io.cpp | 17 +- src/data.cpp | 155 +- src/data_ex.cpp | 2 +- src/data_io.cpp | 16 +- src/data_png.cpp | 8 +- src/evalc.cpp | 22 +- src/evalp.cpp | 14 +- src/exec_prm.cpp | 10 + src/exec_set.cpp | 27 +- src/export_2d.cpp | 81 +- src/fft.cpp | 4 +- src/font.cpp | 163 +- src/parser.cpp | 2 +- src/pde.cpp | 58 +- src/pixel.cpp | 59 +- src/pixel_gen.cpp | 4 +- src/pixel_pix.cpp | 3 +- src/vect.cpp | 12 +- src/window.cpp | 85 + texinfo/core_en.texi | 21 +- texinfo/core_ru.texi | 23 +- texinfo/data_en.texi | 6 +- texinfo/data_ru.texi | 6 +- texinfo/example_en.texi | 86 +- texinfo/example_ru.texi | 88 +- texinfo/other_en.texi | 6 +- texinfo/other_ru.texi | 6 +- texinfo/web_en.texi | 36 +- texinfo/web_ru.texi | 35 +- todo.txt | 31 +- udav/hint_dlg.cpp | 22 +- udav/prop_dlg.cpp | 4 +- udav_ico_new.mgl | 21 + utils/CMakeLists.txt | 9 +- utils/mglcgi.cpp | 21 +- utils/mglconv.cpp | 16 +- utils/mgltask.cpp | 149 + utils/mglview.cpp | 4 +- website/accordion.js | 84 + website/classes.png | Bin 0 -> 138494 bytes website/colorex.png | Bin 0 -> 1120 bytes website/columns.png | Bin 0 -> 1503 bytes website/datadvance.png | Bin 0 -> 7077 bytes website/emblem_sm.png | Bin 0 -> 8370 bytes website/fltk.png | Bin 0 -> 49099 bytes website/games/colorex.html | 548 + website/games/columns.html | 439 + website/games/hextris.html | 549 + website/games/jumps.html | 230 + website/games/mk61.html | 368 + website/games/mk61.js | 672 + website/games/pentix.html | 528 + website/games/shiftix.html | 546 + website/games/tetris.html | 501 + website/hextris.png | Bin 0 -> 3879 bytes website/index.html | 98 + website/json/json.html | 127 + website/json/mathgl.js | 532 + website/json/mgl_cgi.html | 21 + website/mathgl_emblem.png | Bin 0 -> 24603 bytes website/mathgl_en.html | 21350 ++++++++++++++++++++++++++++++++ website/mathgl_ru.html | 21340 +++++++++++++++++++++++++++++++ website/mgl_en.html | 12618 +++++++++++++++++++ website/mgl_ru.html | 12613 +++++++++++++++++++ website/mk61.png | Bin 0 -> 5592 bytes website/pentix.png | Bin 0 -> 1716 bytes website/prepare_doc.sh | 18 + website/qt.png | Bin 0 -> 46186 bytes website/shiftix.png | Bin 0 -> 2742 bytes website/styles.css | 176 + website/tetris.png | Bin 0 -> 1233 bytes website/udav/udav_arg.png | Bin 0 -> 18514 bytes website/udav/udav_calc.png | Bin 0 -> 135630 bytes website/udav/udav_cmd.png | Bin 0 -> 73819 bytes website/udav/udav_data.png | Bin 0 -> 62476 bytes website/udav/udav_gen_set.png | Bin 0 -> 37646 bytes website/udav/udav_help.png | Bin 0 -> 104574 bytes website/udav/udav_inplot.png | Bin 0 -> 50679 bytes website/udav/udav_light.png | Bin 0 -> 49240 bytes website/udav/udav_main.png | Bin 0 -> 138291 bytes website/udav/udav_mask.png | Bin 0 -> 27025 bytes website/udav/udav_opt.png | Bin 0 -> 21210 bytes website/udav/udav_pen.png | Bin 0 -> 32751 bytes website/udav/udav_prop.png | Bin 0 -> 55987 bytes website/udav/udav_sch.png | Bin 0 -> 50834 bytes website/udav/udav_txt.png | Bin 0 -> 32231 bytes website/udav/udav_var.png | Bin 0 -> 17253 bytes website/udav_new.png | Bin 0 -> 16129 bytes widgets/fltk.cpp | 2 +- widgets/image.h | 2 +- 124 files changed, 75243 insertions(+), 1027 deletions(-) create mode 100644 src/c2mdual.c create mode 100644 udav_ico_new.mgl create mode 100644 utils/mgltask.cpp create mode 100644 website/accordion.js create mode 100644 website/classes.png create mode 100644 website/colorex.png create mode 100644 website/columns.png create mode 100644 website/datadvance.png create mode 100644 website/emblem_sm.png create mode 100644 website/fltk.png create mode 100644 website/games/colorex.html create mode 100644 website/games/columns.html create mode 100644 website/games/hextris.html create mode 100644 website/games/jumps.html create mode 100644 website/games/mk61.html create mode 100644 website/games/mk61.js create mode 100644 website/games/pentix.html create mode 100644 website/games/shiftix.html create mode 100644 website/games/tetris.html create mode 100644 website/hextris.png create mode 100644 website/index.html create mode 100644 website/json/json.html create mode 100644 website/json/mathgl.js create mode 100644 website/json/mgl_cgi.html create mode 100644 website/mathgl_emblem.png create mode 100644 website/mathgl_en.html create mode 100644 website/mathgl_ru.html create mode 100644 website/mgl_en.html create mode 100644 website/mgl_ru.html create mode 100644 website/mk61.png create mode 100644 website/pentix.png create mode 100755 website/prepare_doc.sh create mode 100644 website/qt.png create mode 100644 website/shiftix.png create mode 100644 website/styles.css create mode 100644 website/tetris.png create mode 100644 website/udav/udav_arg.png create mode 100644 website/udav/udav_calc.png create mode 100644 website/udav/udav_cmd.png create mode 100644 website/udav/udav_data.png create mode 100644 website/udav/udav_gen_set.png create mode 100644 website/udav/udav_help.png create mode 100644 website/udav/udav_inplot.png create mode 100644 website/udav/udav_light.png create mode 100644 website/udav/udav_main.png create mode 100644 website/udav/udav_mask.png create mode 100644 website/udav/udav_opt.png create mode 100644 website/udav/udav_pen.png create mode 100644 website/udav/udav_prop.png create mode 100644 website/udav/udav_sch.png create mode 100644 website/udav/udav_txt.png create mode 100644 website/udav/udav_var.png create mode 100644 website/udav_new.png diff --git a/CMakeLists.txt b/CMakeLists.txt index f58fcd5..d0c779d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,4 @@ cmake_minimum_required(VERSION 3.1.0) -if(POLICY CMP0043) - cmake_policy(SET CMP0043 OLD) -endif() project( MathGL2 ) @@ -20,7 +17,7 @@ endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_VERBOSE_MAKEFILE ON) set(MathGL_VERSION_MAJOR 2) set(MathGL_VERSION_MINOR 4) -set(MathGL_PATCH_VERSION 2) +set(MathGL_PATCH_VERSION 3) set(MathGL_VERSION ${MathGL_VERSION_MAJOR}.${MathGL_VERSION_MINOR}.${MathGL_PATCH_VERSION}) set(MathGL_SOVERSION 7.5.0) string(TIMESTAMP MathGL_DATE UTC) @@ -175,6 +172,7 @@ else(MSVC) option(enable-pthr-widget "Enable POSIX threads for widgets" ON) endif(MSVC) option(enable-openmp "Enable OpenMP support" ON) +option(disable-C99complex "Enable C99 complex number support" OFF) if(enable-pthread AND enable-openmp) message(SEND_ERROR "You can't enable POSIX threads and OpenMP at the same time!") @@ -254,7 +252,8 @@ MGL_DEPENDENT_OPTION(enable-octave-install "Octave interface will install for al include_directories( ${MathGL2_SOURCE_DIR}/include ${MathGL2_BINARY_DIR}/include) set(MGL_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/include/mgl2") -set(MGL_CGI_PATH_INSTALL "share/mathgl" CACHE STRING "Set CGI install directory") +set(MGL_CGI_PATH_INSTALL "lib/cgi-bin" CACHE STRING "Set CGI install directory") +#set(MGL_CGI_PATH_INSTALL "share/mathgl" CACHE STRING "Set CGI install directory") set(MGL_CGI_PATH "${CMAKE_INSTALL_PREFIX}/${MGL_CGI_PATH_INSTALL}") set(MGL_DEF_FONT "STIX" CACHE STRING "Set default font name") @@ -300,18 +299,22 @@ endif(HAVE_MEMRCHR) include(CheckTypeSize) check_type_size("long" SIZEOF_LONG) -#unset(MGL_HAVE_C99_COMPLEX) -CHECK_CXX_SOURCE_COMPILES( -"#include -#include -int main(int argc, char *args[]) -{std::complex c(2.0, 1.0); -double _Complex i=1.0i; -double _Complex *a = reinterpret_cast(&c); -std::complex b(*a);return 0;}" MGL_HAVE_C99_COMPLEX) -if(NOT MGL_HAVE_C99_COMPLEX) +if(NOT disable-C99complex) +# unset(MGL_HAVE_C99_COMPLEX) + CHECK_CXX_SOURCE_COMPILES( + "#include + #include + int main(int argc, char *args[]) + {std::complex c(2.0, 1.0); + double _Complex i=1.0i; + double _Complex *a = reinterpret_cast(&c); + std::complex b(*a);return 0;}" MGL_HAVE_C99_COMPLEX) + if(NOT MGL_HAVE_C99_COMPLEX) + set(MGL_HAVE_C99_COMPLEX 0) + endif(NOT MGL_HAVE_C99_COMPLEX) +else(NOT disable-C99complex) set(MGL_HAVE_C99_COMPLEX 0) -endif(NOT MGL_HAVE_C99_COMPLEX) +endif(NOT disable-C99complex) #unset(MGL_HAVE_NAN_INF) CHECK_CXX_SOURCE_COMPILES( @@ -560,6 +563,7 @@ endif(enable-gif) if(enable-opengl) set(MGL_HAVE_OPENGL 1) + set(OpenGL_GL_PREFERENCE LEGACY) include(FindOpenGL) if(NOT OPENGL_FOUND) message(SEND_ERROR "Couldn't find OpenGL libraries.") diff --git a/ChangeLog.txt b/ChangeLog.txt index f0f9dc4..cb31f12 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,27 @@ -2.4.3 Released ?? March 2018 +2.4.3 Released 14 March 2019 + +* Add 'clabel' command -- draw labels for colorbar. Should be used *after* drawing colorbar! +* Extend 'ctick' command +* Add subpixel smoothing for masks +* Boxes around text (style '@') now use actual height and position of the text. +* Add mask to EPS export. Note, mask angles are reduced to 45*(0,1,...7) degrees for decreasing pattern size in the EPS. +* Update default masks: '*' become dot, '^' become bricks, 'd' become plus, 'D' become tacks, ';' and 'j' change lengths. Note, you can use brush.ods to prepare user-defined masks. +* Add styles '^' and '_' for command 'smooth' to find upper/lower bound of the data. +* Improve FlowP() to draw both branches (in positive and negative time direction). +* Improve CGI interface and update website. +* Introduce struct mdual as interface for C and C++ complex numbers. It is implicitly converted to std::complex<> in C++. And need to call c2mdual() and mdual2c() in pure C. However mdual is binary compatible with C _Complex numbers. +* Add flag in CMake to manually disable support of C99 complex numbers. +* Bypass user-specified extension in base font family name. +* Improve hints in mgllab and udav. +* Add utility 'mgltask' for making output file with a set of copies of mask-file. It useful for making set of initial conditions with a few parameters varied in specified range. +* Add example of OpenGL output. +* Bugfix for approximate min and max position. +* Bugfix for position of SVG output. +* Compatibility fixes for new versions of CMake, compilers and libraries. +INCOMPATIBLE: +* Formally pure C interface handle complex numbers by new way due to strict following of C/C++ standards. However, the MathGL library is binary compatible with previous version(s). + +2.4.2.1 Released 31 March 2018 * Bugfix for panel placement in mgllab. * Move colorbars close to axis by default. diff --git a/brush.ods b/brush.ods index ae9110c28c3abc8317432ab21b7059bc9f965930..83da5aab99bc7f0e7008b22262c395c4b6675979 100644 GIT binary patch literal 43187 zcmafZ1ymf(w(j5r4+Mt*fslj*2{UMLcM>$X&oH>VYmh*KGiV?%xVuYm26qYW?#?{^ z^X_|Vy|>Oix7MoaUR}MbyY|;zd)MCIXL&UA7XSb@0B~uet{7~^7tRI%0RE{@mjKpK zYcnTzJ2N9YJ1eM(krUL`hTX-+l+D)25$echYiDL-YHQ+bZD!-d=4j_&W@PGUZf556 z`TrTy(CMSbEeinfPo;PoQ_bAj+StYjYURl8^nXs->}()mpOvKXaj0;fZo!w8kx+R$ z4n9>RHri7g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IIbWFZuaNm0Wq;?_|Er$a z-{|=}-~M+!FO2(FKot4U8v9rN{qLIo^~ofDr|EBe{8P`bHvBu0yfE@#!55(CxBM(G W1rG3;fPh{Ber&*ifVMShearPlot(3, 0, 0.2, 0.1); gr->Box("r"); return; - mglParse par; - par.Execute(gr,"call 'test' -1\n func 'test' 1\nline $1 0 1 1 'b'\nreturn\n"); +// par.Execute(gr,"call 'test' -1\n func 'test' 1\nline $1 0 1 1 'b'\nreturn\n"); // par.Execute(gr,"load '/home/balakin/mathgl-code/mathgl-2x/build/examples/libmgl_module.so':baxis\n"); // par.Execute(gr,"subplot 1 1 0:#rotate 40 60\nperspective 1.22:box:axis\n"); - return; +// return; } //----------------------------------------------------------------------------- void mgl_generate_texi() diff --git a/examples/qgl_example.cpp b/examples/qgl_example.cpp index b0f0d5c..d23ffed 100644 --- a/examples/qgl_example.cpp +++ b/examples/qgl_example.cpp @@ -19,30 +19,27 @@ ***************************************************************************/ #include "qgl_example.h" #include -//#include -//----------------------------------------------------------------------------- -int main(int argc, char *argv[]) -{ - mgl_textdomain(argv?argv[0]:NULL,""); - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} +//#include //----------------------------------------------------------------------------- MainWindow::MainWindow(QWidget *parent) : QGLWidget(parent) { gr=0; } //----------------------------------------------------------------------------- MainWindow::~MainWindow() { if(gr) delete gr; } //----------------------------------------------------------------------------- -void MainWindow::initializeGL() +void MainWindow::initializeGL() // recreate instance of MathGL core { if(gr) delete gr; - gr = new mglGraph(1); + gr = new mglGraph(1); // use '1' for argument to force OpenGL output in MathGL +} +//----------------------------------------------------------------------------- +void MainWindow::resizeGL(int w, int h) // standard resize replace +{ + QGLWidget::resizeGL(w, h); + glViewport (0, 0, w, h); } //----------------------------------------------------------------------------- -void MainWindow::paintGL() +void MainWindow::paintGL() // main drawing function { - gr->Clf(); + gr->Clf(); // clear previous OpenGL primitives gr->SubPlot(1,1,0); gr->Rotate(40,60); gr->Light(true); @@ -53,12 +50,15 @@ void MainWindow::paintGL() gr->FPlot("cos(pi*x)","|"); gr->FSurf("cos(2*pi*(x^2+y^2))"); gr->Finish(); - swapBuffers(); + swapBuffers(); // show output on the screen } //----------------------------------------------------------------------------- -void MainWindow::resizeGL(int w, int h) +int main(int argc, char *argv[]) // create application { - QGLWidget::resizeGL(w, h); - glViewport (0, 0, w, h); + mgl_textdomain(argv?argv[0]:NULL,""); + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); } //----------------------------------------------------------------------------- diff --git a/examples/qgl_example.h b/examples/qgl_example.h index 1d3ca0f..f709621 100644 --- a/examples/qgl_example.h +++ b/examples/qgl_example.h @@ -1,19 +1,17 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -//#include #include -#include #include class MainWindow : public QGLWidget { Q_OBJECT protected: - mglGraph *gr; - void resizeGL(int nWidth, int nHeight); // Метод вызываемый после каждого изменения размера окна - void paintGL(); // Метод для вывода изображения на экран -void initializeGL(); // Метод для инициализирования opengl + mglGraph *gr; // pointer to MathGL core class + void resizeGL(int nWidth, int nHeight); // Method called after each window resize + void paintGL(); // Method to display the image on the screen + void initializeGL(); // Method to initialize OpenGL public: MainWindow(QWidget *parent = 0); ~MainWindow(); diff --git a/examples/samples.cpp b/examples/samples.cpp index 3114c8a..9a450b1 100644 --- a/examples/samples.cpp +++ b/examples/samples.cpp @@ -184,13 +184,13 @@ const char *mmgl_mask="new a 10 10 'x'\n" "subplot 5 4 11 '':title '\"<\" mask':dens a '3<'\n" "subplot 5 4 12 '':title '\">\" mask':dens a '3>'\n" "subplot 5 4 13 '':title '\"j\" mask':dens a '3j'\n" -"subplot 5 4 14 '':title '\"-;\\\" mask':dens a '3;\\ '\n" +"subplot 5 4 14 '':title '\"-;\\\" mask':dens a '3\\;'\n" "subplot 5 4 15 '':title '\"d\" mask':dens a '3d'\n" "subplot 5 4 16 '':title '\"D\" mask':dens a '3D'\n" "subplot 5 4 17 '':title '\"*\" mask':dens a '3*'\n" -"subplot 5 4 18 '':title '\"^\" mask':dens a '3^'\n" +"subplot 5 4 18 '':title '\"\\^\" mask':dens a '3^'\n" "subplot 5 4 19 '':title 'manual mask'\n" -"mask '+' 'ff00182424f800':dens a '3+'"; +"mask '+' '24242424FF0101FF':dens a '3+'"; void smgl_mask(mglGraph *gr) { mglData a(10,10); a.Fill(-1,1); @@ -212,9 +212,9 @@ void smgl_mask(mglGraph *gr) gr->SubPlot(5,4,15,""); gr->Title("'d' mask"); gr->Dens(a,"3d"); gr->SubPlot(5,4,16,""); gr->Title("'D' mask"); gr->Dens(a,"3D"); gr->SubPlot(5,4,17,""); gr->Title("'*' mask"); gr->Dens(a,"3*"); - gr->SubPlot(5,4,18,""); gr->Title("'^' mask"); gr->Dens(a,"3^"); + gr->SubPlot(5,4,18,""); gr->Title("'\\^' mask"); gr->Dens(a,"3^"); gr->SubPlot(5,4,19,""); gr->Title("manual mask"); - gr->SetMask('+', "ff00182424f80000"); gr->Dens(a,"3+"); + gr->SetMask('+', "24242424FF0101FF"); gr->Dens(a,"3+"); } //----------------------------------------------------------------------------- const char *mmgl_export="new a 100 100 'x^2*y':new b 100 100\n" diff --git a/include/mgl2/abstract.h b/include/mgl2/abstract.h index 515b814..3293e1b 100644 --- a/include/mgl2/abstract.h +++ b/include/mgl2/abstract.h @@ -194,10 +194,10 @@ uintptr_t MGL_EXPORT mgl_create_cexpr_(const char *expr, int); void MGL_EXPORT mgl_delete_cexpr(HAEX ex); void MGL_EXPORT mgl_delete_cexpr_(uintptr_t *ex); /// Return value of expression for given x,y,z variables -mdual MGL_EXPORT mgl_cexpr_eval(HAEX ex, dual x, dual y,dual z); -mdual MGL_EXPORT mgl_cexpr_eval_(uintptr_t *ex, dual *x, dual *y, dual *z); +cmdual MGL_EXPORT mgl_cexpr_eval(HAEX ex, mdual x, mdual y, mdual z); +cmdual MGL_EXPORT mgl_cexpr_eval_(uintptr_t *ex, mdual *x, mdual *y, mdual *z); /// Return value of expression for given variables -mdual MGL_EXPORT mgl_cexpr_eval_v(HAEX ex, dual *vars); +cmdual MGL_EXPORT mgl_cexpr_eval_v(HAEX ex, mdual *vars); //----------------------------------------------------------------------------- /// Callback function for asking user a question. Result shouldn't exceed 1024. diff --git a/include/mgl2/base.h b/include/mgl2/base.h index 154640a..665c406 100644 --- a/include/mgl2/base.h +++ b/include/mgl2/base.h @@ -156,7 +156,8 @@ struct MGL_EXPORT mglPrim // NOTE: use float for reducing memory size mglPrim():n1(0),n2(0),n3(0),n4(0),type(0),angl(0),id(0),z(0),w(0),m(0) {} explicit mglPrim(int t):n1(0),n2(0),n3(0),n4(0),type(t),angl(0),id(0),z(0),w(0),m(0) {} mglPrim(const mglPrim &aa) : n1(aa.n1),n2(aa.n2),n3(aa.n3),n4(aa.n4),type(aa.type),angl(aa.angl),id(aa.id),z(aa.z),w(aa.w),m(aa.m) {} - const mglPrim &operator=(const mglPrim &aa) { memcpy(this, &aa, sizeof(mglPrim)); return aa; } + const mglPrim &operator=(const mglPrim &aa) + { n1=aa.n1; n2=aa.n2; n3=aa.n3; n4=aa.n4; type=aa.type; angl=aa.angl; id=aa.id; z=aa.z; w=aa.w; m=aa.m; return aa; } }; bool operator<(const mglPrim &a,const mglPrim &b); bool operator>(const mglPrim &a,const mglPrim &b); @@ -167,7 +168,7 @@ struct MGL_EXPORT mglLight mglLight():a(0),b(0),n(false) {} mglLight(const mglLight &aa) : d(aa.d),r(aa.r),q(aa.q),p(aa.p),c(aa.c),a(aa.a),b(aa.b),n(aa.n) {} const mglLight &operator=(const mglLight &aa) - { memcpy(this,&aa,sizeof(mglLight)); return aa; } + { d=aa.d; r=aa.r; q=aa.q; p=aa.p; c=aa.c; a=aa.a; b=aa.b; n=aa.n; return aa; } mglPoint d; ///< Direction of light sources mglPoint r; ///< Position of light sources (NAN for infinity) @@ -192,7 +193,9 @@ struct MGL_EXPORT mglBlock mglBlock():n1(0),n2(0),n3(0),n4(0),AmbBr(0.5),DifBr(0.5),id(0) {} mglBlock(const mglBlock &aa) { memcpy(this, &aa, sizeof(mglBlock)); } - const mglBlock &operator=(const mglBlock &aa) { memcpy(this, &aa, sizeof(mglBlock)); return aa; } + const mglBlock &operator=(const mglBlock &aa) + { n1=aa.n1; n2=aa.n2; n3=aa.n3; n4=aa.n4; for(int i=0;i<10;i++) light[i]=aa.light[i]; + AmbBr=aa.AmbBr; DifBr=aa.DifBr; B=aa.B; id=aa.id; return aa; } }; //----------------------------------------------------------------------------- /// Structure for group of primitives @@ -496,6 +499,8 @@ public: inline mreal GetFontSize() const { return FontSize; } mreal TextWidth(const char *text, const char *font, mreal size) const MGL_FUNC_PURE; mreal TextWidth(const wchar_t *text, const char *font, mreal size) const MGL_FUNC_PURE; + mreal TextHeight(const char *text, const char *font, mreal size) const MGL_FUNC_PURE; + mreal TextHeight(const wchar_t *text, const char *font, mreal size) const MGL_FUNC_PURE; mreal TextHeight(const char *font, mreal size) const MGL_FUNC_PURE; inline mreal FontFactor() const { return font_factor; } virtual mreal GetRatio() const MGL_FUNC_CONST; @@ -747,7 +752,7 @@ bool MGL_EXPORT mgl_check_vec3(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay bool MGL_EXPORT mgl_check_trig(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT a, const char *name, int d=3); bool MGL_EXPORT mgl_isnboth(HCDT x, HCDT y, HCDT z, HCDT a); bool MGL_EXPORT mgl_isboth(HCDT x, HCDT y, HCDT z, HCDT a); -inline bool mgl_islog(mreal a,mreal b) { return (a>0 && b>10*a) || (b<0 && a<10*b); } +inline bool mgl_islog(mreal a,mreal b) { return a*b>0 && (b/a+a/b)>=10.1; } //----------------------------------------------------------------------------- #endif #endif diff --git a/include/mgl2/canvas.h b/include/mgl2/canvas.h index 10e695e..c1be2bf 100644 --- a/include/mgl2/canvas.h +++ b/include/mgl2/canvas.h @@ -77,7 +77,7 @@ struct MGL_EXPORT mglDrawReg { PDef = p.n3; pPos = p.s; ObjId = p.id; PenWidth=p.w; angle = p.angl; if(p.type==2 || p.type==3) PDef = p.m; } inline const mglDrawReg &operator=(const mglDrawReg &aa) - { memcpy(this,&aa,sizeof(mglDrawReg)); return aa; } + { PDef=aa.PDef; angle=aa.angle; ObjId=aa.ObjId; PenWidth=aa.PenWidth; pPos=aa.pPos; x1=aa.x1; x2=aa.x2; y1=aa.y1; y2=aa.y2; return aa; } union { uint64_t PDef; diff --git a/include/mgl2/data.h b/include/mgl2/data.h index 06658ff..b496606 100644 --- a/include/mgl2/data.h +++ b/include/mgl2/data.h @@ -373,7 +373,9 @@ using mglDataA::Momentum; * ‘x’, ‘y’, ‘z’ for 1st, 2nd or 3d dimension; * ‘dN’ for linear averaging over N points; * ‘3’ for linear averaging over 3 points; - * ‘5’ for linear averaging over 5 points. + * ‘5’ for linear averaging over 5 points; + * ‘^’ for finding upper bound; + * ‘_’ for finding lower bound. * By default quadratic averaging over 5 points is used. */ inline void Smooth(const char *dirs="xyz",mreal delta=0) { mgl_data_smooth(this,dirs,delta); } diff --git a/include/mgl2/data_cf.h b/include/mgl2/data_cf.h index a5b291a..5ba7eb8 100644 --- a/include/mgl2/data_cf.h +++ b/include/mgl2/data_cf.h @@ -150,7 +150,7 @@ void MGL_EXPORT mgl_data_limit(HMDT dat, mreal v); void MGL_EXPORT mgl_data_limit_(uintptr_t *dat, mreal *v); /// Project the periodical data to range [v1,v2] (like mod() function). Separate branches by NAN if sep=true. void MGL_EXPORT mgl_data_coil(HMDT dat, mreal v1, mreal v2, int sep); -void MGL_EXPORT mgl_data_coil_(uintptr_t *dat, mreal &v1, mreal *v2, int *sep); +void MGL_EXPORT mgl_data_coil_(uintptr_t *dat, mreal *v1, mreal *v2, int *sep); /// Get sub-array of the data with given fixed indexes HMDT MGL_EXPORT mgl_data_subdata(HCDT dat, long xx,long yy,long zz); diff --git a/include/mgl2/datac.h b/include/mgl2/datac.h index 64e3e1d..f2c0251 100644 --- a/include/mgl2/datac.h +++ b/include/mgl2/datac.h @@ -105,7 +105,7 @@ using mglDataA::Momentum; /// Link external data array (don't delete it at exit) inline void Link(dual *A, long NX, long NY=1, long NZ=1) - { mgl_datac_link(this,A,NX,NY,NZ); } + { mgl_datac_link(this,reinterpret_cast(A),NX,NY,NZ); } inline void Link(mglDataC &d) { Link(d.a,d.nx,d.ny,d.nz); } /// Allocate memory and copy the data from the gsl_vector inline void Set(gsl_vector *m) { mgl_datac_set_vector(this,m); } @@ -120,7 +120,7 @@ using mglDataA::Momentum; { mgl_datac_set_double(this,A,NX,NY,NZ); } /// Allocate memory and copy the data from the (complex *) array inline void Set(const dual *A,long NX,long NY=1,long NZ=1) - { mgl_datac_set_complex(this,A,NX,NY,NZ); } + { mgl_datac_set_complex(this,reinterpret_cast(A),NX,NY,NZ); } /// Allocate memory and scanf the data from the string inline void Set(const char *str,long NX,long NY=1,long NZ=1) { mgl_datac_set_values(this,str,NX,NY,NZ); } @@ -409,14 +409,14 @@ using mglDataA::Momentum; /// Interpolate by linear function the data and return its derivatives at given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1] inline dual Linear(mglPoint &dif, mreal x,mreal y=0,mreal z=0) const { - dual val,dx,dy,dz; + mdual val,dx,dy,dz; val = mgl_datac_linear_ext(this,x,y,z, &dx, &dy, &dz); dif.Set(dx.real(),dy.real(),dz.real()); return val; } /// Interpolate by line the data and return its derivatives at given point x,\a y,\a z which normalized in range [0, 1] inline dual Linear1(mglPoint &dif, mreal x,mreal y=0,mreal z=0) const { - dual val,dx,dy,dz; + mdual val,dx,dy,dz; val = mgl_datac_linear_ext(this,x,y,z, &dx, &dy, &dz); dif.Set(dx.real(),dy.real(),dz.real()); dif.x/=nx>1?nx-1:1; dif.y/=ny>1?ny-1:1; dif.z/=nz>1?nz-1:1; @@ -549,7 +549,7 @@ inline mglDataC mglGSplineCInit(const mglDataA &xdat, const mglDataA &ydat) { return mglDataC(true,mgl_gsplinec_init(&xdat, &ydat)); } /// Evaluate global spline (and its derivatives d1, d2 if not NULL) using prepared coefficients \a coef inline dual mglGSplineC(const mglDataA &coef, mreal dx, dual *d1=0, dual *d2=0) -{ return mgl_gsplinec(&coef, dx, d1,d2); } +{ return mgl_gsplinec(&coef, dx, reinterpret_cast(d1), reinterpret_cast(d2)); } //----------------------------------------------------------------------------- #define _DN_(a) ((mglDataC *)*(a)) #define _DC_ ((mglDataC *)*d) @@ -570,13 +570,13 @@ public: /// Return value of expression for given x,y,z,u,v,w variables inline dual Eval(dual x, dual y, dual z, dual u, dual v, dual w) { - dual var[26]; + mdual var[26]; var['x'-'a']=x; var['y'-'a']=y; var['z'-'a']=z; var['u'-'a']=u; var['v'-'a']=v; var['w'-'a']=w; return mgl_cexpr_eval_v(ex,var); } /// Return value of expression for given variables inline dual Eval(dual var[26]) - { return mgl_cexpr_eval_v(ex,var); } + { return mgl_cexpr_eval_v(ex,reinterpret_cast(var)); } }; #endif //----------------------------------------------------------------------------- diff --git a/include/mgl2/datac_cf.h b/include/mgl2/datac_cf.h index cd83b5d..076b90f 100644 --- a/include/mgl2/datac_cf.h +++ b/include/mgl2/datac_cf.h @@ -38,12 +38,12 @@ extern "C" { typedef void *HADT; #endif /// Get integer power of x -mdual MGL_EXPORT_CONST mgl_ipowc(dual x,int n); -mdual MGL_EXPORT mgl_ipowc_(dual *x,int *n); +cmdual MGL_EXPORT_CONST mgl_ipowc(mdual x,int n); +cmdual MGL_EXPORT mgl_ipowc_(mdual *x,int *n); /// Get complex number from string. Parse (%g,%g), {%g,%g} and [%g,%g] if adv!=0. -mdual MGL_EXPORT mgl_atoc(const char *s, int adv); +cmdual MGL_EXPORT mgl_atoc(const char *s, int adv); /// Get exp(i*a) -mdual MGL_EXPORT_CONST mgl_expi(dual a); +cmdual MGL_EXPORT_CONST mgl_expi(mdual a); /// Create HMDT object HADT MGL_EXPORT mgl_create_datac(); @@ -62,8 +62,8 @@ void MGL_EXPORT mgl_delete_datac_(uintptr_t *dat); void MGL_EXPORT mgl_datac_rearrange(HADT dat, long mx,long my,long mz); void MGL_EXPORT mgl_datac_rearrange_(uintptr_t *dat, int *mx, int *my, int *mz); /// Link external data array (don't delete it at exit) -void MGL_EXPORT mgl_datac_link(HADT dat, dual *A,long mx,long my,long mz); -void MGL_EXPORT mgl_datac_link_(uintptr_t *d, dual *A, int *nx,int *ny,int *nz); +void MGL_EXPORT mgl_datac_link(HADT dat, mdual *A,long mx,long my,long mz); +void MGL_EXPORT mgl_datac_link_(uintptr_t *d, mdual *A, int *nx,int *ny,int *nz); /// Allocate memory and copy the data from the (float *) array void MGL_EXPORT mgl_datac_set_float(HADT dat, const float *A,long mx,long my,long mz); void MGL_EXPORT mgl_datac_set_float_(uintptr_t *dat, const float *A,int *NX,int *NY,int *NZ); @@ -71,8 +71,8 @@ void MGL_EXPORT mgl_datac_set_float_(uintptr_t *dat, const float *A,int *NX,int void MGL_EXPORT mgl_datac_set_double(HADT dat, const double *A,long mx,long my,long mz); void MGL_EXPORT mgl_datac_set_double_(uintptr_t *dat, const double *A,int *NX,int *NY,int *NZ); /// Allocate memory and copy the data from the (dual *) array -void MGL_EXPORT mgl_datac_set_complex(HADT dat, const dual *A,long mx,long my,long mz); -void MGL_EXPORT mgl_datac_set_complex_(uintptr_t *d, const dual *A,int *NX,int *NY,int *NZ); +void MGL_EXPORT mgl_datac_set_complex(HADT dat, const mdual *A,long mx,long my,long mz); +void MGL_EXPORT mgl_datac_set_complex_(uintptr_t *d, const mdual *A,int *NX,int *NY,int *NZ); /// Import data from abstract type void MGL_EXPORT mgl_datac_set(HADT dat, HCDT a); void MGL_EXPORT mgl_datac_set_(uintptr_t *dat, uintptr_t *a); @@ -81,11 +81,11 @@ void MGL_EXPORT mgl_datac_set_vector(HADT dat, gsl_vector *v); /// Allocate memory and copy the data from the gsl_matrix void MGL_EXPORT mgl_datac_set_matrix(HADT dat, gsl_matrix *m); /// Set value of data element [i,j,k] -void MGL_EXPORT mgl_datac_set_value(HADT dat, dual v, long i, long j, long k); -void MGL_EXPORT mgl_datac_set_value_(uintptr_t *d, dual *v, int *i, int *j, int *k); +void MGL_EXPORT mgl_datac_set_value(HADT dat, mdual v, long i, long j, long k); +void MGL_EXPORT mgl_datac_set_value_(uintptr_t *d, mdual *v, int *i, int *j, int *k); /// Get value of data element [i,j,k] -mdual MGL_EXPORT mgl_datac_get_value(HCDT dat, long i, long j, long k); -mdual MGL_EXPORT mgl_datac_get_value_(uintptr_t *d, int *i, int *j, int *k); +cmdual MGL_EXPORT mgl_datac_get_value(HCDT dat, long i, long j, long k); +cmdual MGL_EXPORT mgl_datac_get_value_(uintptr_t *d, int *i, int *j, int *k); /// Allocate memory and scanf the data from the string void MGL_EXPORT mgl_datac_set_values(HADT dat, const char *val, long nx, long ny, long nz); void MGL_EXPORT mgl_datac_set_values_(uintptr_t *d, const char *val, int *nx, int *ny, int *nz, int l); @@ -101,9 +101,9 @@ HADT MGL_EXPORT mgl_datac_tridmat(HCDT A, HCDT B, HCDT C, HCDT D, const char *ho uintptr_t MGL_EXPORT mgl_datac_tridmat_(uintptr_t *A, uintptr_t *B, uintptr_t *C, uintptr_t *D, const char *how, int); /// Returns pointer to internal data array -MGL_EXPORT dual *mgl_datac_data(HADT dat); +MGL_EXPORT mdual *mgl_datac_data(HADT dat); /// Returns pointer to data element [i,j,k] -MGL_EXPORT dual *mgl_datac_value(HADT dat, long i,long j,long k); +MGL_EXPORT mdual *mgl_datac_value(HADT dat, long i,long j,long k); /// Set the data from HCDT objects for real and imaginary parts void MGL_EXPORT mgl_datac_set_ri(HADT dat, HCDT re, HCDT im); @@ -185,8 +185,8 @@ HADT MGL_EXPORT mgl_datac_section_val(HCDT dat, long id, char dir, mreal val); uintptr_t MGL_EXPORT mgl_datac_section_val_(uintptr_t *d, int *id, const char *dir, mreal *val,int); /// Equidistantly fill the data to range [x1,x2] in direction dir -void MGL_EXPORT mgl_datac_fill(HADT dat, dual x1,dual x2,char dir); -void MGL_EXPORT mgl_datac_fill_(uintptr_t *dat, dual *x1,dual *x2,const char *dir,int); +void MGL_EXPORT mgl_datac_fill(HADT dat, mdual x1,mdual x2,char dir); +void MGL_EXPORT mgl_datac_fill_(uintptr_t *dat, mdual *x1,mdual *x2,const char *dir,int); /// Modify the data by specified formula assuming x,y,z in range [r1,r2] void MGL_EXPORT mgl_datac_fill_eq(HMGL gr, HADT dat, const char *eq, HCDT vdat, HCDT wdat,const char *opt); void MGL_EXPORT mgl_datac_fill_eq_(uintptr_t *gr, uintptr_t *dat, const char *eq, uintptr_t *vdat, uintptr_t *wdat,const char *opt, int, int); @@ -218,8 +218,8 @@ void MGL_EXPORT mgl_datac_limit(HADT dat, mreal v); void MGL_EXPORT mgl_datac_limit_(uintptr_t *dat, mreal *v); /// Put value to data element(s) -void MGL_EXPORT mgl_datac_put_val(HADT dat, dual val, long i, long j, long k); -void MGL_EXPORT mgl_datac_put_val_(uintptr_t *dat, dual *val, int *i, int *j, int *k); +void MGL_EXPORT mgl_datac_put_val(HADT dat, mdual val, long i, long j, long k); +void MGL_EXPORT mgl_datac_put_val_(uintptr_t *dat, mdual *val, int *i, int *j, int *k); /// Put array to data element(s) void MGL_EXPORT mgl_datac_put_dat(HADT dat, HCDT val, long i, long j, long k); void MGL_EXPORT mgl_datac_put_dat_(uintptr_t *dat, uintptr_t *val, int *i, int *j, int *k); @@ -293,17 +293,17 @@ void MGL_EXPORT mgl_datac_add_dat_(uintptr_t *dat, uintptr_t *d); void MGL_EXPORT mgl_datac_sub_dat(HADT dat, HCDT d); void MGL_EXPORT mgl_datac_sub_dat_(uintptr_t *dat, uintptr_t *d); /// Multiply each element by the number -void MGL_EXPORT mgl_datac_mul_num(HADT dat, dual d); -void MGL_EXPORT mgl_datac_mul_num_(uintptr_t *dat, dual *d); +void MGL_EXPORT mgl_datac_mul_num(HADT dat, mdual d); +void MGL_EXPORT mgl_datac_mul_num_(uintptr_t *dat, mdual *d); /// Divide each element by the number -void MGL_EXPORT mgl_datac_div_num(HADT dat, dual d); -void MGL_EXPORT mgl_datac_div_num_(uintptr_t *dat, dual *d); +void MGL_EXPORT mgl_datac_div_num(HADT dat, mdual d); +void MGL_EXPORT mgl_datac_div_num_(uintptr_t *dat, mdual *d); /// Add the number -void MGL_EXPORT mgl_datac_add_num(HADT dat, dual d); -void MGL_EXPORT mgl_datac_add_num_(uintptr_t *dat, dual *d); +void MGL_EXPORT mgl_datac_add_num(HADT dat, mdual d); +void MGL_EXPORT mgl_datac_add_num_(uintptr_t *dat, mdual *d); /// Subtract the number -void MGL_EXPORT mgl_datac_sub_num(HADT dat, dual d); -void MGL_EXPORT mgl_datac_sub_num_(uintptr_t *dat, dual *d); +void MGL_EXPORT mgl_datac_sub_num(HADT dat, mdual d); +void MGL_EXPORT mgl_datac_sub_num_(uintptr_t *dat, mdual *d); /// Apply Hankel transform void MGL_EXPORT mgl_datac_hankel(HADT dat, const char *dir); @@ -353,23 +353,23 @@ HMDT MGL_EXPORT mgl_datac_norm(HCDT dat); uintptr_t MGL_EXPORT mgl_datac_norm_(uintptr_t *dat); /// Interpolate by linear function the data to given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1] -mdual MGL_EXPORT mgl_datac_linear(HCDT d, mreal x,mreal y,mreal z); -mdual MGL_EXPORT mgl_datac_linear_(uintptr_t *d, mreal *x,mreal *y,mreal *z); +cmdual MGL_EXPORT mgl_datac_linear(HCDT d, mreal x,mreal y,mreal z); +cmdual MGL_EXPORT mgl_datac_linear_(uintptr_t *d, mreal *x,mreal *y,mreal *z); /// Interpolate by linear function the data and return its derivatives at given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1] -mdual MGL_EXPORT mgl_datac_linear_ext(HCDT d, mreal x,mreal y,mreal z, dual *dx,dual *dy,dual *dz); -mdual MGL_EXPORT mgl_datac_linear_ext_(uintptr_t *d, mreal *x,mreal *y,mreal *z, dual *dx,dual *dy,dual *dz); +cmdual MGL_EXPORT mgl_datac_linear_ext(HCDT d, mreal x,mreal y,mreal z, mdual *dx,mdual *dy,mdual *dz); +cmdual MGL_EXPORT mgl_datac_linear_ext_(uintptr_t *d, mreal *x,mreal *y,mreal *z, mdual *dx,mdual *dy,mdual *dz); /// Interpolate by cubic spline the data to given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1] -mdual MGL_EXPORT mgl_datac_spline(HCDT dat, mreal x,mreal y,mreal z); -mdual MGL_EXPORT mgl_datac_spline_(uintptr_t *dat, mreal *x,mreal *y,mreal *z); +cmdual MGL_EXPORT mgl_datac_spline(HCDT dat, mreal x,mreal y,mreal z); +cmdual MGL_EXPORT mgl_datac_spline_(uintptr_t *dat, mreal *x,mreal *y,mreal *z); /// Interpolate by cubic spline the data and return its derivatives at given point x=[0...nx-1], y=[0...ny-1], z=[0...nz-1] -mdual MGL_EXPORT mgl_datac_spline_ext(HCDT dat, mreal x,mreal y,mreal z, dual *dx,dual *dy,dual *dz); -mdual MGL_EXPORT mgl_datac_spline_ext_(uintptr_t *dat, mreal *x,mreal *y,mreal *z, dual *dx,dual *dy,dual *dz); +cmdual MGL_EXPORT mgl_datac_spline_ext(HCDT dat, mreal x,mreal y,mreal z, mdual *dx,mdual *dy,mdual *dz); +cmdual MGL_EXPORT mgl_datac_spline_ext_(uintptr_t *dat, mreal *x,mreal *y,mreal *z, mdual *dx,mdual *dy,mdual *dz); /// Prepare coefficients for global spline interpolation HADT MGL_EXPORT mgl_gsplinec_init(HCDT x, HCDT v); uintptr_t MGL_EXPORT mgl_gspline_init_(uintptr_t *x, uintptr_t *v); /// Evaluate global spline (and its derivatives d1, d2 if not NULL) using prepared coefficients \a coef -mdual MGL_EXPORT mgl_gsplinec(HCDT coef, mreal dx, dual *d1, dual *d2); -mdual MGL_EXPORT mgl_gsplinec_(uintptr_t *c, mreal *dx, dual *d1, dual *d2); +cmdual MGL_EXPORT mgl_gsplinec(HCDT coef, mreal dx, mdual *d1, mdual *d2); +cmdual MGL_EXPORT mgl_gsplinec_(uintptr_t *c, mreal *dx, mdual *d1, mdual *d2); /// Find roots for set of nonlinear equations defined by textual formulas HADT MGL_EXPORT mgl_find_roots_txt_c(const char *func, const char *vars, HCDT ini); diff --git a/include/mgl2/define.h b/include/mgl2/define.h index 77cb8a9..c657b63 100644 --- a/include/mgl2/define.h +++ b/include/mgl2/define.h @@ -71,9 +71,6 @@ #define MGL_LOCAL_PURE MGL_NO_EXPORT MGL_FUNC_PURE #if MGL_HAVE_RVAL // C++11 don't support register keyword -#if (!defined(_MSC_VER)) || (defined(_MSC_VER) && (_MSC_VER < 1310)) -#define register -#endif #endif #endif @@ -291,47 +288,11 @@ extern MGL_EXPORT uint64_t mgl_mask_val[16]; #define MGL_FULL_CURV 0x00400000 ///< Disable omitting points in straight-line part(s). #define MGL_NO_SCALE_REL 0x00800000 ///< Disable font scaling in relative inplots //----------------------------------------------------------------------------- -#if MGL_HAVE_C99_COMPLEX -#include -#if MGL_USE_DOUBLE -typedef double _Complex mdual; -#else -typedef float _Complex mdual; -#endif -#ifndef _Complex_I -#define _Complex_I 1.0i -#endif -const mdual mgl_I=_Complex_I; -#define mgl_abs(x) cabs(x) -#endif #ifdef __cplusplus #include #include -// #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) -// MGL_EXTERN template class MGL_EXPORT std::allocator; -// MGL_EXTERN template class MGL_EXPORT std::allocator; -// MGL_EXTERN template struct MGL_EXPORT std::char_traits; -// MGL_EXTERN template struct MGL_EXPORT std::char_traits; -// MGL_EXTERN template class MGL_EXPORT std::basic_string< char, std::char_traits, std::allocator >; -// MGL_EXTERN template class MGL_EXPORT std::basic_string< wchar_t, std::char_traits, std::allocator >; -// MGL_EXTERN template class MGL_EXPORT std::vector; -// MGL_EXTERN template class MGL_EXPORT std::vector; -// #endif -//----------------------------------------------------------------------------- -extern float mgl_cos[360]; ///< contain cosine with step 1 degree -//----------------------------------------------------------------------------- #include -// #if defined(_MSC_VER) -// MGL_EXTERN template class MGL_EXPORT std::complex; -// MGL_EXTERN template class MGL_EXPORT std::complex; -// #endif typedef std::complex dual; -typedef std::complex ddual; -#if !MGL_HAVE_C99_COMPLEX -#define mdual dual -#define mgl_I dual(0,1) -#define mgl_abs(x) abs(x) -#endif //----------------------------------------------------------------------------- inline bool mgl_isrange(double a, double b) { return fabs(a-b)>MGL_MIN_VAL && a-a==0. && b-b==0.; } @@ -352,11 +313,46 @@ inline long mgl_imax(long a, long b) { return a>b?a:b; } inline void mgl_strncpy(char *a, const char *b, size_t s) { strncpy(a,b,s); a[s-1]=0; } //----------------------------------------------------------------------------- extern "C" { +#endif +//----------------------------------------------------------------------------- +struct cmdual // complex number (bypass C/C++ incompatibility) +{ + mreal re,im; // real and imaginary parts +#ifdef __cplusplus + operator dual() const { return dual(re,im); } + mreal real() const { return re; } + mreal imag() const { return im; } +#endif +}; +#ifdef __cplusplus +struct mdual : public cmdual +{ + mdual(const cmdual &c) { re=c.re; im=c.im; } + mdual(const std::complex &c) { re=c.real(); im=c.imag(); } + mdual(const std::complex &c){ re=c.real(); im=c.imag(); } + mdual(mreal r=0, mreal i=0) { re=r; im=i; } + mdual &operator=(const cmdual &c) { re=c.re; im=c.im; return *this; } + mdual &operator=(const std::complex &c) { re=c.real(); im=c.imag(); return *this; } + mdual &operator=(const std::complex &c) { re=c.real(); im=c.imag(); return *this; } + mdual &operator=(mreal r) { re=r; im=0; return *this; } +}; #else -#include -typedef double _Complex ddual; -#define dual mdual +typedef struct cmdual cmdual; +typedef cmdual mdual; +#if MGL_HAVE_C99_COMPLEX + #include + #if MGL_USE_DOUBLE + typedef double _Complex dual; + #else + typedef float _Complex dual; + #endif + MGL_EXPORT dual mdual2c(cmdual c); + MGL_EXPORT cmdual c2mdual(dual c); +#endif #endif +//----------------------------------------------------------------------------- +extern float mgl_cos[360]; ///< contain cosine with step 1 degree +//----------------------------------------------------------------------------- /// Find length of wchar_t string (bypass standard wcslen bug) double MGL_EXPORT_CONST mgl_hypot(double x, double y); /// Find length of wchar_t string (bypass standard wcslen bug) diff --git a/include/mgl2/font.h b/include/mgl2/font.h index e735e24..28499ab 100644 --- a/include/mgl2/font.h +++ b/include/mgl2/font.h @@ -45,6 +45,7 @@ struct mglGlyphDescr short numt[4]; ///< Number of triangles in glyph description (for solid font) short numl[4]; ///< Number of lines in glyph description (for wire font) short width[4]; ///< Width of glyph for wire font + short y1[4], y2[4]; ///< minimal and maximal y-coordinates mglGlyphDescr() { memset(this,0,sizeof(mglGlyphDescr)); } }; inline bool operator<(const mglGlyphDescr &a,const mglGlyphDescr &b) { return a.id=7 - x,y,z,px,py,pz,tau or nx=5 - x,y,px,py,tau) HADT MGL_EXPORT mgl_qo2d_solve_c(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy); -HADT MGL_EXPORT mgl_qo2d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy); +HADT MGL_EXPORT mgl_qo2d_func_c(mdual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy); uintptr_t MGL_EXPORT mgl_qo2d_solve_c_(const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, uintptr_t* ray, mreal *r, mreal *k0, uintptr_t* xx, uintptr_t* yy, int); /// Saves result of PDE solving for "Hamiltonian" ham with initial conditions ini along a curve ray (must have nx>=7 - x,y,z,px,py,pz,tau or nx=5 - x,y,px,py,tau) HMDT MGL_EXPORT mgl_qo2d_solve(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy); -HMDT MGL_EXPORT mgl_qo2d_func(ddual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy); +HMDT MGL_EXPORT mgl_qo2d_func(mdual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy); uintptr_t MGL_EXPORT mgl_qo2d_solve_(const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, uintptr_t* ray, mreal *r, mreal *k0, uintptr_t* xx, uintptr_t* yy, int); /// Saves result of PDE solving for "Hamiltonian" ham with initial conditions ini along a curve ray (must have nx>=7 - x,y,z,px,py,pz,tau or nx=5 - x,y,px,py,tau) HADT MGL_EXPORT mgl_qo3d_solve_c(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz); -HADT MGL_EXPORT mgl_qo3d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz); +HADT MGL_EXPORT mgl_qo3d_func_c(mdual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz); uintptr_t MGL_EXPORT mgl_qo3d_solve_c_(const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, uintptr_t* ray, mreal *r, mreal *k0, uintptr_t* xx, uintptr_t* yy, uintptr_t* zz, int); /// Saves result of PDE solving for "Hamiltonian" ham with initial conditions ini along a curve ray (must have nx>=7 - x,y,z,px,py,pz,tau or nx=5 - x,y,px,py,tau) HMDT MGL_EXPORT mgl_qo3d_solve(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz); -HMDT MGL_EXPORT mgl_qo3d_func(ddual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz); +HMDT MGL_EXPORT mgl_qo3d_func(mdual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz); uintptr_t MGL_EXPORT mgl_qo3d_solve_(const char *ham, uintptr_t* ini_re, uintptr_t* ini_im, uintptr_t* ray, mreal *r, mreal *k0, uintptr_t* xx, uintptr_t* yy, uintptr_t* zz, int); /// Saves result of ODE solving of n equations with right part func and initial conditions x0 over time interval [0,tmax] with time step dt diff --git a/include/mgl2/vect.h b/include/mgl2/vect.h index fbe4443..cf8c5c1 100644 --- a/include/mgl2/vect.h +++ b/include/mgl2/vect.h @@ -124,21 +124,24 @@ void MGL_EXPORT mgl_flow3_(uintptr_t *gr, uintptr_t *ax, uintptr_t *ay, uintptr_ /// Plot flow from point p for vector field {ax,ay} parametrically depended on coordinate {x,y} with color proportional to |a| /** String \a sch may contain: * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); - * ‘#’ for starting threads from edges only; + * ‘>’ for drawing in forward direction only; + * ‘<’ for drawing in backward direction only; * ‘v’ for drawing arrows on the threads. */ void MGL_EXPORT mgl_flowp_xy(HMGL gr, double x0, double y0, double z0, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt); void MGL_EXPORT mgl_flowp_xy_(uintptr_t *gr, mreal *x0, mreal *y0, mreal *z0, uintptr_t *x, uintptr_t *y, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int, int); /// Plot flow from point p for vector field {ax,ay} with color proportional to |a| /** String \a sch may contain: * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); - * ‘#’ for starting threads from edges only; + * ‘>’ for drawing in forward direction only; + * ‘<’ for drawing in backward direction only; * ‘v’ for drawing arrows on the threads. */ void MGL_EXPORT mgl_flowp_2d(HMGL gr, double x0, double y0, double z0, HCDT ax, HCDT ay, const char *sch, const char *opt); void MGL_EXPORT mgl_flowp_2d_(uintptr_t *gr, mreal *x0, mreal *y0, mreal *z0, uintptr_t *ax, uintptr_t *ay, const char *sch, const char *opt,int, int); /// Plot flow from point p for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color proportional to |a| /** String \a sch may contain: * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); - * ‘#’ for starting threads from edges only; + * ‘>’ for drawing in forward direction only; + * ‘<’ for drawing in backward direction only; * ‘v’ for drawing arrows on the threads; * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. */ void MGL_EXPORT mgl_flowp_xyz(HMGL gr, double x0, double y0, double z0, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt); @@ -146,7 +149,8 @@ void MGL_EXPORT mgl_flowp_xyz_(uintptr_t *gr, mreal *x0, mreal *y0, mreal *z0, u /// Plot flow from point p for vector field {ax,ay,az} with color proportional to |a| /** String \a sch may contain: * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); - * ‘#’ for starting threads from edges only; + * ‘>’ for drawing in forward direction only; + * ‘<’ for drawing in backward direction only; * ‘v’ for drawing arrows on the threads; * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. */ void MGL_EXPORT mgl_flowp_3d(HMGL gr, double x0, double y0, double z0, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt); diff --git a/include/mgl2/wnd.h b/include/mgl2/wnd.h index d174c2b..4e7a8f8 100644 --- a/include/mgl2/wnd.h +++ b/include/mgl2/wnd.h @@ -24,7 +24,9 @@ //----------------------------------------------------------------------------- MGL_EXPORT void *mgl_draw_calc(void *p); void MGL_EXPORT mgl_parse_comments(const char *text, double &a1, double &a2, double &da, std::vector &anim, std::string &dlg_ids, std::vector &dlg_par); +void MGL_EXPORT mgl_parse_comments(const wchar_t *text, double &a1, double &a2, double &da, std::vector &anim, std::string &dlg_ids, std::vector &dlg_par); void MGL_EXPORT mgl_parse_animation(const char *text, std::vector &anim); +void MGL_EXPORT mgl_parse_animation(const wchar_t *text, std::vector &anim); //----------------------------------------------------------------------------- /// Class for drawing in windows (like, mglCanvasFL, mglCanvasQT and so on) /// Make inherited class and redefine Draw() function if you don't want to use function pointers. @@ -74,6 +76,7 @@ void MGL_EXPORT mgl_click_class(void *p); void MGL_EXPORT mgl_reload_class(void *p); void MGL_EXPORT mgl_prop_class(char id, const char *val, void *p); void MGL_EXPORT mgl_prop_func(char id, const char *val, void *p); +extern MGL_EXPORT const char *mgl_hints[]; } //----------------------------------------------------------------------------- /// Abstract class for windows displaying graphics diff --git a/mathgl_es.po b/mathgl_es.po index 527c31d..90b6f13 100644 --- a/mathgl_es.po +++ b/mathgl_es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: MathGL2 2.4.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-29 06:37+0300\n" +"POT-Creation-Date: 2019-03-02 14:41+0300\n" "PO-Revision-Date: 2018-03-24 11:08-0400\n" "Last-Translator: Diego Sejas Viscarra \n" "Language-Team: \n" @@ -33,7 +33,7 @@ msgstr "" "\t-L loc especificar lenguaje como loc\n" "\t-h imprimir este mensaje\n" -#: utils/mglconv.cpp:85 +#: utils/mglconv.cpp:86 #, c-format msgid "" "\t-1 str set str as argument $1 for script\n" @@ -488,7 +488,7 @@ msgstr "Gráfico 1D" msgid "1D plots" msgstr "Gráficos 1D" -#: mgllab/help.cpp:364 +#: mgllab/help.cpp:341 msgid "1D view" msgstr "Vista 1D" @@ -504,7 +504,7 @@ msgstr "Gráfico 2D" msgid "2D plots" msgstr "Gráficos 2D" -#: mgllab/help.cpp:366 +#: mgllab/help.cpp:343 msgid "2D view" msgstr "Vista 2D" @@ -520,7 +520,7 @@ msgstr "Datos 3D con tamaños de archivo" msgid "3D plots" msgstr "Gráficos 3D" -#: mgllab/help.cpp:368 +#: mgllab/help.cpp:345 msgid "3D view" msgstr "Vista 3D" @@ -556,7 +556,7 @@ msgstr "" "
(c) Alexey Balakin, 2007-presente

Bajo licencia GPL v.2 o posterior." -#: mgllab/help.cpp:308 +#: mgllab/help.cpp:285 msgid "@<- Prev" msgstr "@<- Prev." @@ -607,7 +607,7 @@ msgid "Add inplot" msgstr "Añadir gráfico interno" # Anadir a la leyenda? -#: src/exec_set.cpp:775 +#: src/exec_set.cpp:792 msgid "Add legend entry" msgstr "Añadir entrada a leyenda" @@ -669,7 +669,7 @@ msgstr "Añadir texto" msgid "Add text which properties can be changed later by mouse." msgstr "Añadir texto configurable por el mouse." -#: src/exec_prm.cpp:648 +#: src/exec_prm.cpp:658 msgid "Add title for current subplot/inplot" msgstr "Añadir titulo al subgráfica/gráfica interna" @@ -678,7 +678,7 @@ msgid "Add to" msgstr "Añadir a" # user-defined -#: src/exec_set.cpp:776 +#: src/exec_set.cpp:793 msgid "Add user-defined symbol" msgstr "Añadir símbolo personalizado" @@ -690,7 +690,7 @@ msgstr "Ajustar imagen al área de dibujo" msgid "Adjust size" msgstr "Ajustar tamaño" -#: src/exec_set.cpp:777 +#: src/exec_set.cpp:794 msgid "Adjust ticks for best view" msgstr "Optimizar marcas de los ejes" @@ -698,7 +698,7 @@ msgstr "Optimizar marcas de los ejes" msgid "Airy and Gamma" msgstr "Funciones de Airy y Gamma" -#: udav/hint_dlg.cpp:42 mgllab/help.cpp:280 +#: src/window.cpp:394 msgid "" "All indexes (of data arrays, subplots and so on) are always start from 0." msgstr "" @@ -793,7 +793,7 @@ msgstr "Proporción de escala y a escala z" msgid "Aspect x/z" msgstr "Aspecto x/z" -#: src/exec_set.cpp:783 +#: src/exec_set.cpp:800 msgid "Attach light settings to inplot" msgstr "Vincular configuración de luz a gráfico interno" @@ -817,7 +817,7 @@ msgstr "Ejecutar script automáticamente al cargarlo" msgid "Automatically save before redrawing (F5)" msgstr "Guardar automáticamente antes de graficar (F5)" -#: src/data.cpp:1425 +#: src/data.cpp:1488 #, c-format msgid "" "Averages are:\n" @@ -855,7 +855,7 @@ msgstr "B - azul marino" msgid "Backward" msgstr "Retroceder" -#: src/font.cpp:953 +#: src/font.cpp:1021 #, c-format msgid "Bad '%ls' at %zu\n" msgstr "\"%ls\" incorrecto en %zu\n" @@ -985,7 +985,7 @@ msgstr "Cambiar (tamaño de) datos" msgid "Change canvas size to fill whole region (F6)." msgstr "Maximizar el área de dibujo (F6)." -#: src/exec_set.cpp:787 +#: src/exec_set.cpp:804 msgid "Change current directory" msgstr "Cambiar directorio actual" @@ -1005,7 +1005,7 @@ msgstr "Cambiar valores y cerrar esta ventana" msgid "Change font" msgstr "Cambiar fuente" -#: src/exec_set.cpp:838 +#: src/exec_set.cpp:855 msgid "Change view angles - use 'rotate' for plot rotation" msgstr "Modificar ángulos - use \"rotate\" para rotar gráfico" @@ -1018,18 +1018,18 @@ msgstr "Borrar" msgid "Clear all" msgstr "Borrar todo" -#: src/exec_set.cpp:788 +#: src/exec_set.cpp:805 msgid "Clear legend entries" msgstr "Borrar entradas de leyenda" -#: src/exec_set.cpp:789 +#: src/exec_set.cpp:806 msgid "Clear picture" msgstr "Borrar imagen" #. o = new Fl_Button(180, 130, 25, 25);o->image(img_save); o->tooltip("img_save"); #: widgets/fltk.cpp:1102 widgets/qt.cpp:1104 udav/find_dlg.cpp:52 -#: udav/hint_dlg.cpp:70 mgllab/editor.cpp:565 mgllab/help.cpp:312 -#: mgllab/help.cpp:372 mgllab/help.cpp:488 +#: udav/hint_dlg.cpp:52 mgllab/editor.cpp:566 mgllab/help.cpp:289 +#: mgllab/help.cpp:349 mgllab/help.cpp:465 msgid "Close" msgstr "Cerrar" @@ -1099,19 +1099,19 @@ msgstr "Opciones de comando" msgid "Comments" msgstr "Comentarios" -#: src/exec_prm.cpp:636 +#: src/exec_prm.cpp:646 msgid "Computes the attractor of an IFS" msgstr "Calcula el atractor de un IFS" -#: src/exec_prm.cpp:637 +#: src/exec_prm.cpp:647 msgid "Computes the attractor of an IFS for 3d case" msgstr "Calcula el atractor de un IFS para el caso 3d" -#: src/exec_prm.cpp:638 +#: src/exec_prm.cpp:648 msgid "Computes the attractor of an IFS with parameters from *.ifs file" msgstr "Calcula el atractor de un IFS con parámetros de un archivo *.ifs" -#: src/exec_prm.cpp:632 +#: src/exec_prm.cpp:642 msgid "Computes the flame fractal" msgstr "Calcula un fractal de flama" @@ -1164,7 +1164,7 @@ msgstr "Copiar rango de números a memoria (Ctrl+Shift+C)." msgid "Copy selected text or data to clipboard (Ctrl+C)." msgstr "Copiar texto seleccionado o datos a memoria (Ctrl+C)." -#: mgllab/editor.cpp:511 +#: mgllab/editor.cpp:512 msgid "Copy selection to clipboard" msgstr "Copiar selección a memoria" @@ -1528,7 +1528,7 @@ msgstr "Diagrama STFA" msgid "Draw TeX mark at point position" msgstr "Graficar marca de TeX en posición" -#: src/exec_prm.cpp:615 +#: src/exec_prm.cpp:624 msgid "Draw angle arc" msgstr "Graficar arco" @@ -1552,11 +1552,11 @@ msgstr "Gráfica de correas coloreada por otros datos" msgid "Draw binormales for 1D data" msgstr "Gráfica de binormales para datos 1D" -#: src/exec_prm.cpp:641 +#: src/exec_prm.cpp:651 msgid "Draw bitmap (logo) along axis range" msgstr "Graficar imagen (logo) en el rango de ejes" -#: src/exec_prm.cpp:619 +#: src/exec_prm.cpp:628 msgid "Draw bounding box" msgstr "Graficar bordes" @@ -1576,7 +1576,7 @@ msgstr "Diagrama de velas" msgid "Draw chart" msgstr "Gráfica de cuadros" -#: src/exec_prm.cpp:620 +#: src/exec_prm.cpp:629 msgid "Draw circle" msgstr "Graficar círculo" @@ -1584,11 +1584,11 @@ msgstr "Graficar círculo" msgid "Draw cloud" msgstr "Gráfica de nube" -#: src/exec_prm.cpp:621 +#: src/exec_prm.cpp:631 msgid "Draw colorbar" msgstr "Graficar barra de colores" -#: src/exec_prm.cpp:622 +#: src/exec_prm.cpp:632 msgid "Draw cone" msgstr "Dibujar cono" @@ -1632,7 +1632,7 @@ msgstr "Cilindros de nivel" msgid "Draw contour tubes for surface of triangles" msgstr "Cilindros de nivel para superficie de triángulos" -#: src/exec_prm.cpp:623 +#: src/exec_prm.cpp:633 msgid "Draw curve" msgstr "Graficar curva" @@ -1669,15 +1669,15 @@ msgstr "Gráfica de gotas" msgid "Draw dots for arbitrary data points" msgstr "Diagrama de puntos para datos arbitrarios" -#: src/exec_prm.cpp:624 +#: src/exec_prm.cpp:634 msgid "Draw drop" msgstr "Graficar gota" -#: src/exec_prm.cpp:625 +#: src/exec_prm.cpp:635 msgid "Draw ellipse" msgstr "Graficar elipse" -#: src/exec_prm.cpp:626 +#: src/exec_prm.cpp:636 msgid "Draw error box" msgstr "Graficar caja de error" @@ -1685,19 +1685,19 @@ msgstr "Graficar caja de error" msgid "Draw error boxes" msgstr "Graficar cajas de error" -#: src/exec_prm.cpp:627 +#: src/exec_prm.cpp:637 msgid "Draw face (quadrangle)" msgstr "Graficar faceta (cuadrángulo)" -#: src/exec_prm.cpp:628 +#: src/exec_prm.cpp:638 msgid "Draw face perpendicular to x-axis" msgstr "Graficar faceta perpendicular al eje x" -#: src/exec_prm.cpp:629 +#: src/exec_prm.cpp:639 msgid "Draw face perpendicular to y-axis" msgstr "Graficar faceta perpendicular al eje y" -#: src/exec_prm.cpp:630 +#: src/exec_prm.cpp:640 msgid "Draw face perpendicular to z-axis" msgstr "Graficar faceta perpendicular al eje z" @@ -1721,7 +1721,7 @@ msgstr "Graficar de líneas de flujo desde plano para campo vectorial" msgid "Draw gradient lines for scalar field" msgstr "Graficar líneas de gradiente para campo escalar" -#: src/exec_prm.cpp:635 +#: src/exec_prm.cpp:645 msgid "Draw grid" msgstr "Graficar grilla" @@ -1766,27 +1766,32 @@ msgstr "Isosuperficie para datos 3D con transparencia de otros datos" msgid "Draw label at arbitrary position" msgstr "Etiqueta en posición arbitraria" -#: src/exec_prm.cpp:649 +#: src/exec_prm.cpp:630 +#, fuzzy +msgid "Draw label for colorbar" +msgstr "Etiqueta para eje t" + +#: src/exec_prm.cpp:659 msgid "Draw label for t-axis" msgstr "Etiqueta para eje t" -#: src/exec_prm.cpp:650 +#: src/exec_prm.cpp:660 msgid "Draw label for x-axis" msgstr "Etiqueta para el eje x" -#: src/exec_prm.cpp:651 +#: src/exec_prm.cpp:661 msgid "Draw label for y-axis" msgstr "Etiqueta para el eje y" -#: src/exec_prm.cpp:652 +#: src/exec_prm.cpp:662 msgid "Draw label for z-axis" msgstr "Etiqueta para el eje z" -#: src/exec_prm.cpp:639 +#: src/exec_prm.cpp:649 msgid "Draw legend" msgstr "Graficar leyenda" -#: src/exec_prm.cpp:640 +#: src/exec_prm.cpp:650 msgid "Draw line" msgstr "Graficar recta" @@ -1802,11 +1807,11 @@ msgstr "Gráfica de marcas para datos 1D" msgid "Draw mesh surface" msgstr "Graficar grilla de superficie" -#: src/exec_prm.cpp:618 +#: src/exec_prm.cpp:627 msgid "Draw point (ball)" msgstr "Graficar punto (esfera)" -#: src/exec_prm.cpp:642 +#: src/exec_prm.cpp:652 msgid "Draw polygon" msgstr "Graficar polígono" @@ -1822,11 +1827,11 @@ msgstr "Diagrama de radar" msgid "Draw reconstructed surface for arbitrary data points" msgstr "Graficar superficie reconstruida para puntos arbitrarios" -#: src/exec_prm.cpp:643 +#: src/exec_prm.cpp:653 msgid "Draw rectangle" msgstr "Graficar rectángulo" -#: src/exec_prm.cpp:644 +#: src/exec_prm.cpp:654 msgid "Draw rhombus" msgstr "Graficar rombo" @@ -1870,7 +1875,7 @@ msgstr "Superficie sólida con coloración de otros datos" msgid "Draw solid surface transpared by other data" msgstr "Superficie sólida con transparencia de otros datos" -#: src/exec_prm.cpp:645 +#: src/exec_prm.cpp:655 msgid "Draw sphere" msgstr "Graficar esfera" @@ -1906,11 +1911,11 @@ msgstr "Graficar tabla de valores" msgid "Draw tension plot for 1D data" msgstr "Gráfica de tensión para datos 1D" -#: src/exec_prm.cpp:647 +#: src/exec_prm.cpp:657 msgid "Draw text at some position or along curve" msgstr "Texto en posición especifica o curva" -#: src/exec_prm.cpp:646 +#: src/exec_prm.cpp:656 msgid "Draw user-defined symbol at given position and direction" msgstr "Símbolo personalizado en posición y dirección dadas" @@ -2249,7 +2254,7 @@ msgstr "Llenar en rango" msgid "Fill x-,k-samples for transforms" msgstr "Llenar muestreo x o k para transformada" -#: udav/find_dlg.cpp:48 mgllab/editor.cpp:559 +#: udav/find_dlg.cpp:48 mgllab/editor.cpp:560 msgid "Find" msgstr "Buscar" @@ -2281,7 +2286,7 @@ msgstr "Valor minimal en una dirección" msgid "Find next" msgstr "Buscar siguiente" -#: mgllab/editor.cpp:515 +#: mgllab/editor.cpp:516 msgid "Find or replace text" msgstr "Buscar o reemplazar texto" @@ -2301,11 +2306,11 @@ msgstr "Suma en una dirección" msgid "Find triangles of randomly placed points" msgstr "Triangulación de puntos arbitrarios" -#: udav/find_dlg.cpp:36 mgllab/editor.cpp:558 +#: udav/find_dlg.cpp:36 mgllab/editor.cpp:559 msgid "Find what:" msgstr "Buscar:" -#: udav/text_pnl.cpp:546 mgllab/editor.cpp:557 +#: udav/text_pnl.cpp:546 mgllab/editor.cpp:558 msgid "Find/Replace" msgstr "Buscar/Reemplazar" @@ -2649,7 +2654,7 @@ msgstr "H - gris oscuro" msgid "HDF4 support was disabled. Please, enable it and rebuild MathGL." msgstr "Formato HDF4 deshabilitado. Habilítelo y recompile MathGL." -#: src/complex_io.cpp:925 src/complex_io.cpp:927 src/data_io.cpp:1191 +#: src/complex_io.cpp:924 src/complex_io.cpp:926 src/data_io.cpp:1191 #: src/data_io.cpp:1193 src/data_io.cpp:1195 src/data_io.cpp:1197 msgid "HDF5 support was disabled. Please, enable it and rebuild MathGL." msgstr "Formato HDF5 deshabilitado. Habilítelo y recompile MathGL." @@ -2784,7 +2789,7 @@ msgstr "Aumentar tamaño de fuente" msgid "Info" msgstr "Info" -#: udav/info_dlg.cpp:55 mgllab/help.cpp:358 +#: udav/info_dlg.cpp:55 mgllab/help.cpp:335 msgid "Information" msgstr "Información" @@ -2797,7 +2802,7 @@ msgstr "Gráfica interna" msgid "Insert" msgstr "Insertar" -#: mgllab/editor.cpp:518 +#: mgllab/editor.cpp:519 msgid "Insert MGL command" msgstr "Insertar comando de MGL" @@ -2805,7 +2810,7 @@ msgstr "Insertar comando de MGL" msgid "Insert as 'list'" msgstr "Insertar como \"list\"" -#: mgllab/editor.cpp:486 +#: mgllab/editor.cpp:487 msgid "Insert file content?" msgstr "¿Insertar contenido de archivo?" @@ -2813,11 +2818,11 @@ msgstr "¿Insertar contenido de archivo?" msgid "Insert file name?" msgstr "¿Insertar nombre de archivo?" -#: mgllab/editor.cpp:520 +#: mgllab/editor.cpp:521 msgid "Insert filename" msgstr "Insertar nombre de archivo" -#: mgllab/editor.cpp:522 +#: mgllab/editor.cpp:523 msgid "Insert inplot command" msgstr "Insertar comando de gráfica interna" @@ -2989,7 +2994,7 @@ msgstr "Lista de datos disponibles." msgid "Load Data?" msgstr "¿Cargar datos?" -#: src/exec_set.cpp:804 +#: src/exec_set.cpp:821 msgid "Load commands from external DLL" msgstr "Cargar comandos de librería externa" @@ -3009,7 +3014,7 @@ msgstr "" "Cargar datos de archivo. Estos se borraran solo al\n" "cerrar UDAV, sin advertencia explicita (Ctrl+Shift+O)." -#: src/exec_set.cpp:805 +#: src/exec_set.cpp:822 msgid "Load fontfaces" msgstr "Cargar fuentes" @@ -3017,7 +3022,7 @@ msgstr "Cargar fuentes" msgid "Load from file" msgstr "Cargar de archivo" -#: src/exec_prm.cpp:617 +#: src/exec_prm.cpp:626 msgid "Load image for background" msgstr "Cargar imagen como fondo" @@ -3154,7 +3159,7 @@ msgstr "Ángulo de rotacion de máscara" msgid "Mask size" msgstr "Tamaño de máscara" -#: udav/find_dlg.cpp:42 mgllab/editor.cpp:562 +#: udav/find_dlg.cpp:42 mgllab/editor.cpp:563 msgid "Match case" msgstr "Match case" @@ -3162,7 +3167,7 @@ msgstr "Match case" msgid "MathGL - about" msgstr "MathGL - acerca de" -#: src/base.cpp:259 +#: src/base.cpp:265 #, c-format msgid "MathGL message - %s\n" msgstr "Mensaje de MathGL - %s\n" @@ -3203,7 +3208,7 @@ msgstr "Valor maximal de Y para o para llenado de coord." msgid "Maximal value of Z for cutting or for coordinate filling" msgstr "Valor maximal de Z para corte o para llenado de coord." -#: src/data.cpp:1417 +#: src/data.cpp:1480 #, c-format msgid "Maximum is %g\t at x = %ld\ty = %ld\tz = %ld\n" msgstr "Maximo es %g\t en x = %ld\ty = %ld\tz = %ld\n" @@ -3260,7 +3265,7 @@ msgstr "Valor minimal de Y para corte o para llenado de coord." msgid "Minimal value of Z for cutting or for coordinate filling" msgstr "Valor minimal de Z para corte o para llenado de coord." -#: src/data.cpp:1420 +#: src/data.cpp:1483 #, c-format msgid "Minimum is %g\t at x = %ld\ty = %ld\tz = %ld\n" msgstr "Minimo es %g\t en x = %ld\ty = %ld\tz = %ld\n" @@ -3387,7 +3392,7 @@ msgstr "Navegacion" msgid "New command" msgstr "Nuevo comando" -#: udav/hint_dlg.cpp:40 mgllab/help.cpp:278 +#: src/window.cpp:392 msgid "" "New drawing never clears things drawn already. For example, you can make a " "surface with contour lines by calling commands 'surf' and 'cont' one after " @@ -3421,11 +3426,11 @@ msgstr "Nuevo tamaño de datos en la 2da dimension (dirección y)" msgid "New size of data on 3d dimension (z-direction)" msgstr "Nuevo tamaño de datos en la 3ra dimension (dirección z)" -#: udav/hint_dlg.cpp:68 +#: udav/hint_dlg.cpp:50 msgid "Next" msgstr "Siguiente" -#: mgllab/help.cpp:310 +#: mgllab/help.cpp:287 msgid "Next @->" msgstr "Sgte. @->" @@ -3460,7 +3465,7 @@ msgstr "No se ingreso dirección/fórmula. No proceder." msgid "No filename." msgstr "No se ingreso nombre de archivo." -#: mgllab/editor.cpp:584 mgllab/editor.cpp:606 mgllab/editor.cpp:631 +#: mgllab/editor.cpp:585 mgllab/editor.cpp:607 mgllab/editor.cpp:632 #, c-format msgid "No occurrences of '%s' found!" msgstr "¡No se encontró ningun '%s'!" @@ -3589,7 +3594,7 @@ msgstr "Abrir archivo ..." msgid "Open printer dialog and print graphics (Ctrl+P)" msgstr "Abrir dialogo de impresion e imprimir gráfica (Ctrl+P)" -#: mgllab/editor.cpp:506 +#: mgllab/editor.cpp:507 msgid "Open script or data file" msgstr "Abrir script o archivo de datos" @@ -3681,7 +3686,7 @@ msgstr "Pegar rango de números desde memoria (Ctrl+Shift+P)." msgid "Paste text" msgstr "Pegar texto" -#: mgllab/editor.cpp:513 +#: mgllab/editor.cpp:514 msgid "Paste text from clipboard" msgstr "Pegar texto desde memoria" @@ -3726,7 +3731,7 @@ msgstr "Mover editor arriba" msgid "Plot ID" msgstr "ID del gráfico" -#: src/exec_prm.cpp:633 +#: src/exec_prm.cpp:643 msgid "Plot curve by formula" msgstr "Gráficar curva por fórmula" @@ -3755,7 +3760,7 @@ msgstr "Gráfica" msgid "Plot style" msgstr "Estilo de gráfica" -#: src/exec_prm.cpp:634 +#: src/exec_prm.cpp:644 msgid "Plot surface by formula" msgstr "Graficar superficie por fórmula" @@ -3763,7 +3768,7 @@ msgstr "Graficar superficie por fórmula" msgid "Popular color schemes" msgstr "Esquemas de colores populares" -#: udav/hint_dlg.cpp:66 +#: udav/hint_dlg.cpp:48 msgid "Prev" msgstr "Prev" @@ -3791,7 +3796,7 @@ msgstr "Primitivas" msgid "Primitives ..." msgstr "Primitivas ..." -#: src/exec_set.cpp:837 +#: src/exec_set.cpp:854 msgid "Print MathGL version or check if it is valid" msgstr "Imprimir version de MathGL o verificar su validez" @@ -3823,7 +3828,7 @@ msgstr "Imprimir gráfica" msgid "Print script" msgstr "Imprimir script" -#: src/exec_prm.cpp:631 +#: src/exec_prm.cpp:641 msgid "Print string from file" msgstr "Imprimir texto de archivo" @@ -3893,7 +3898,7 @@ msgstr "Salir" msgid "R - maroon" msgstr "R - carmesí" -#: src/exec_set.cpp:818 +#: src/exec_set.cpp:835 msgid "Rasterize plot and save to background" msgstr "Rasterizar gráfica y guardar de fondo" @@ -3982,15 +3987,15 @@ msgstr "Borrar filas duplicadas" msgid "Remove jump into the data, like phase jumps" msgstr "Remover saltos en datos, como saltos de fase" -#: udav/find_dlg.cpp:50 mgllab/editor.cpp:561 +#: udav/find_dlg.cpp:50 mgllab/editor.cpp:562 msgid "Replace" msgstr "Reemplazar" -#: mgllab/editor.cpp:564 +#: mgllab/editor.cpp:565 msgid "Replace all" msgstr "Reemplazar todo" -#: udav/find_dlg.cpp:39 mgllab/editor.cpp:560 +#: udav/find_dlg.cpp:39 mgllab/editor.cpp:561 msgid "Replace by:" msgstr "Reemplazar con:" @@ -3998,7 +4003,7 @@ msgstr "Reemplazar con:" msgid "Replace expression by its numerical value." msgstr "Reemplazar expresiones con sus valore numericos." -#: mgllab/editor.cpp:630 +#: mgllab/editor.cpp:631 #, c-format msgid "Replaced %ld occurrences." msgstr "%ld ocurrencias reemplazadas." @@ -4032,7 +4037,7 @@ msgstr "Reservar espacio para etiquetas a la der. (estilo '>')" msgid "Reserve space for labels at top side (style '^')" msgstr "Reservar espacio para etiquetas arriba (estilo '^')" -#: src/exec_set.cpp:819 +#: src/exec_set.cpp:836 msgid "Reset settings and clear picture" msgstr "Reestablecer config. y limpiar imagen" @@ -4130,7 +4135,7 @@ msgstr "Rotate on" msgid "Rotate picture by holding left mouse button" msgstr "Rotar figura al presionando el botón izq. del mouse" -#: src/exec_set.cpp:820 +#: src/exec_set.cpp:837 msgid "Rotate plot" msgstr "Rotar gráfica" @@ -4230,7 +4235,7 @@ msgstr "Guardar script" msgid "Save script to a file (Ctrl+S)" msgstr "Guardar script a archivo (Ctrl+S)" -#: mgllab/editor.cpp:508 +#: mgllab/editor.cpp:509 msgid "Save script to file" msgstr "Guardar script a archivo" @@ -4254,7 +4259,7 @@ msgstr "Escalar y rotar" msgid "Script" msgstr "Script" -#: udav/find_dlg.cpp:43 mgllab/editor.cpp:563 +#: udav/find_dlg.cpp:43 mgllab/editor.cpp:564 msgid "Search backward" msgstr "Buscar atras" @@ -4278,7 +4283,7 @@ msgstr "Seleccionar argumento de datos" msgid "Select direction" msgstr "Seleccionar dirección" -#: mgllab/editor.cpp:653 +#: mgllab/editor.cpp:654 msgid "Select file name" msgstr "Seleccionar nombre de archivo" @@ -4286,7 +4291,7 @@ msgstr "Seleccionar nombre de archivo" msgid "Select first the proper kind of arguments" msgstr "Seleccione primero los tipos adecuados de argumentos" -#: mgllab/editor.cpp:666 +#: mgllab/editor.cpp:667 msgid "Select folder name" msgstr "Seleccionar nombre de directorio" @@ -4294,7 +4299,7 @@ msgstr "Seleccionar nombre de directorio" msgid "Select kind of plot" msgstr "Seleccionar tipo de gráfica" -#: src/exec_set.cpp:836 +#: src/exec_set.cpp:853 msgid "Select variant of plot style(s)" msgstr "Seleccionar variante de estilo(s) de gráfica" @@ -4302,15 +4307,15 @@ msgstr "Seleccionar variante de estilo(s) de gráfica" msgid "Set" msgstr "Especificar" -#: src/exec_set.cpp:832 +#: src/exec_set.cpp:849 msgid "Set additional tick and axis labels shift" msgstr "Desplazamiento adicional para etiquetas y escala del eje" -#: src/exec_set.cpp:780 +#: src/exec_set.cpp:797 msgid "Set ambient light brightness" msgstr "Especificar brillo de luz ambiental" -#: src/exec_set.cpp:801 +#: src/exec_set.cpp:818 msgid "Set arbitrary position of plot in picture" msgstr "Especificar posición arbitraria de gráfica en imagen" @@ -4318,35 +4323,35 @@ msgstr "Especificar posición arbitraria de gráfica en imagen" msgid "Set arguments" msgstr "Argumentos" -#: src/exec_set.cpp:782 +#: src/exec_set.cpp:799 msgid "Set aspect ration" msgstr "Especificar proporcion de apariencia" -#: src/exec_set.cpp:784 +#: src/exec_set.cpp:801 msgid "Set axis and tick style" msgstr "Especificar estilos de eje y escala" -#: src/exec_set.cpp:810 +#: src/exec_set.cpp:827 msgid "Set axis origin" msgstr "Especificar origen de ejes" -#: src/exec_set.cpp:817 +#: src/exec_set.cpp:834 msgid "Set axis ranges" msgstr "Especificar rango de ejes" -#: src/exec_set.cpp:825 +#: src/exec_set.cpp:842 msgid "Set bit-flags (for advanced users only)" msgstr "Especificar bit-flags (para usuarios avanzados)" -#: src/exec_set.cpp:786 +#: src/exec_set.cpp:803 msgid "Set bounding box for 2d export" msgstr "Especificar \"bounding box\" para exportar 2D" -#: src/exec_set.cpp:807 +#: src/exec_set.cpp:824 msgid "Set brush for given mask id" msgstr "Especificar brocha para máscara id dada" -#: src/exec_set.cpp:791 +#: src/exec_set.cpp:808 msgid "Set color range" msgstr "Especificar rango de colores" @@ -4362,23 +4367,23 @@ msgstr "Activar/desactivar cortado para gráfica particular" msgid "Set data sizes manually" msgstr "Especificar tamaño de datos manualmente" -#: src/exec_set.cpp:785 +#: src/exec_set.cpp:802 msgid "Set default bars width" msgstr "Especificar ancho de barras" -#: src/exec_set.cpp:815 +#: src/exec_set.cpp:832 msgid "Set default filename" msgstr "Especificar nombre de archivo" -#: src/exec_set.cpp:779 +#: src/exec_set.cpp:796 msgid "Set default transparency" msgstr "Especificar transparencia" -#: src/exec_set.cpp:794 +#: src/exec_set.cpp:811 msgid "Set diffusive light brightness" msgstr "Especificar brillo de luz difusa" -#: src/exec_set.cpp:795 +#: src/exec_set.cpp:812 msgid "Set draw region for quality&4" msgstr "Especificar region de dibujo para calida&4" @@ -4402,75 +4407,75 @@ msgstr "Especificar area de dibujo como celda de barra." msgid "Set lighting off/on for particular plot" msgstr "Activar/desactivar luz para gráfica particular" -#: src/exec_set.cpp:808 +#: src/exec_set.cpp:825 msgid "Set number of lines in mesh/fall/vect and so on" msgstr "Especificar número de líneas en grilla/cascada/etc." -#: src/exec_set.cpp:802 +#: src/exec_set.cpp:819 msgid "Set number of marks in the legend" msgstr "Especificar número de marcas en leyenda" -#: src/exec_set.cpp:796 +#: src/exec_set.cpp:813 msgid "Set number of visible faces" msgstr "Especificar número de facetas visibles" -#: src/exec_set.cpp:812 +#: src/exec_set.cpp:829 msgid "Set palette for 1D plots" msgstr "Especificar paleta para gráficas 1D" -#: src/exec_set.cpp:814 +#: src/exec_set.cpp:831 msgid "Set perspective" msgstr "Especificar perspectiva" -#: src/exec_set.cpp:823 +#: src/exec_set.cpp:840 msgid "Set picture size" msgstr "Especificar tamaño de imagen" -#: src/exec_set.cpp:816 +#: src/exec_set.cpp:833 msgid "Set plot quality" msgstr "Especificar calidad de gráfica" -#: src/exec_set.cpp:829 +#: src/exec_set.cpp:846 msgid "Set position of plot as cell of matrix" msgstr "Especificar posición de gráfica como celda de matriz" -#: src/exec_set.cpp:809 +#: src/exec_set.cpp:826 msgid "Set position of plot block in matrix" msgstr "Especificar posición de gráfica en matriz" -#: src/exec_set.cpp:790 +#: src/exec_set.cpp:807 msgid "Set position of plot inside cell of column" msgstr "Especificar posición de gráfica en celda de columna" -#: src/exec_set.cpp:800 +#: src/exec_set.cpp:817 msgid "Set position of plot inside cell of matrix" msgstr "Especificar posición de gráfica en celda de matriz" -#: src/exec_set.cpp:828 +#: src/exec_set.cpp:845 msgid "Set position of plot inside cell of rotated stick" msgstr "Especificar posición de gráfica en celda de barra rotada" -#: src/exec_set.cpp:827 +#: src/exec_set.cpp:844 msgid "Set position of plot inside cell of sheared stick" msgstr "Especificar posición de gráfica en celda de barra recortada" -#: src/exec_set.cpp:840 +#: src/exec_set.cpp:857 msgid "Set range for x-axis" msgstr "Especificar rango de eje x" -#: src/exec_set.cpp:842 +#: src/exec_set.cpp:859 msgid "Set range for y-axis" msgstr "Especificar rango de eje y" -#: src/exec_set.cpp:846 +#: src/exec_set.cpp:863 msgid "Set range for z-axis" msgstr "Especificar rango de eje z" -#: src/exec_set.cpp:822 +#: src/exec_set.cpp:839 msgid "Set scale text in relative subplots too" msgstr "Set scale text in relative subplots too" -#: src/exec_set.cpp:824 +#: src/exec_set.cpp:841 msgid "Set scaling factor for further setsize" msgstr "Especificar factor de escala para \"setsize\"" @@ -4482,51 +4487,51 @@ msgstr "Especificar argumentos de script" msgid "Set size for text, marks and others" msgstr "Especificar tamaño de texto, marcas y otros" -#: src/exec_set.cpp:781 +#: src/exec_set.cpp:798 msgid "Set size of arrows" msgstr "Especificar tamaño de flechas" -#: src/exec_set.cpp:806 +#: src/exec_set.cpp:823 msgid "Set size of markers" msgstr "Especificar tamaño de marcadores" -#: src/exec_set.cpp:813 +#: src/exec_set.cpp:830 msgid "Set size of semi-transparent area around line" msgstr "Especificar tamaño de area semitransparente alrededor de línea" -#: src/exec_set.cpp:811 +#: src/exec_set.cpp:828 msgid "Set tick labels drawing at origin" msgstr "Set tick labels drawing at origin" -#: src/exec_set.cpp:831 +#: src/exec_set.cpp:848 msgid "Set tick length" msgstr "Especificar longtud de marcas" -#: src/exec_set.cpp:792 +#: src/exec_set.cpp:809 msgid "Set ticks for colorbar" msgstr "Especificar escala para barra de colores" -#: src/exec_set.cpp:841 +#: src/exec_set.cpp:858 msgid "Set ticks for x-axis" msgstr "Especificar escala para el eje x" -#: src/exec_set.cpp:843 +#: src/exec_set.cpp:860 msgid "Set ticks for y-axis" msgstr "Especificar escala para el eje y" -#: src/exec_set.cpp:847 +#: src/exec_set.cpp:864 msgid "Set ticks for z-axis" msgstr "Especificar escala para el eje z" -#: src/exec_set.cpp:833 +#: src/exec_set.cpp:850 msgid "Set ticks in time format" msgstr "Especificar escala en formato de tiempo" -#: src/exec_set.cpp:835 +#: src/exec_set.cpp:852 msgid "Set ticks tuning" msgstr "Afinar escala" -#: src/exec_set.cpp:821 +#: src/exec_set.cpp:838 msgid "Set to auto rotate text or not" msgstr "Activar/desactivar rotacion de texto" @@ -4534,7 +4539,7 @@ msgstr "Activar/desactivar rotacion de texto" msgid "Set to use whole area (style '#')" msgstr "Usar toda el area (estilo '#')" -#: src/exec_set.cpp:834 +#: src/exec_set.cpp:851 msgid "Set type transparency" msgstr "Especificar tipo de transparencia" @@ -4578,19 +4583,19 @@ msgstr "Animación" msgid "Setup colors for:" msgstr "Config. colores para:" -#: src/exec_set.cpp:798 +#: src/exec_set.cpp:815 msgid "Setup font" msgstr "Config. fuente" -#: src/exec_set.cpp:803 +#: src/exec_set.cpp:820 msgid "Setup light" msgstr "Config. luz" -#: src/exec_prm.cpp:616 +#: src/exec_prm.cpp:625 msgid "Setup or draw axis" msgstr "Config. o graficar eje" -#: src/exec_set.cpp:793 +#: src/exec_set.cpp:810 msgid "Setup plot points cutting" msgstr "Config. cortado de gráfica" @@ -4614,7 +4619,7 @@ msgstr "Sew phase" msgid "Sharp colors" msgstr "Colores fuertes" -#: src/exec_set.cpp:826 +#: src/exec_set.cpp:843 msgid "Shear plot" msgstr "Recortar gráfica" @@ -4642,7 +4647,7 @@ msgstr "Descripción corta del comando seleccionado" msgid "Short information about the data." msgstr "Info. resumida de los datos." -#: udav/hint_dlg.cpp:62 +#: udav/hint_dlg.cpp:44 msgid "Show at startup" msgstr "Mostrar al iniciar" @@ -4654,7 +4659,7 @@ msgstr "" "Mostrar calculadora que escribe y evalua formulas textuales.\n" "Las formulas textuales pueden contener variables también." -#: mgllab/editor.cpp:525 mgllab/editor.cpp:527 +#: mgllab/editor.cpp:526 mgllab/editor.cpp:528 msgid "Show calculator window" msgstr "Mostrar ventana de calculadora" @@ -4711,7 +4716,7 @@ msgstr "Mostrar ayuda de comandos de MGL (F1)." msgid "Show hidden plots" msgstr "Mostrar gráficos ocultos" -#: mgllab/help.cpp:307 +#: mgllab/help.cpp:284 msgid "Show hint on startup" msgstr "Mostrar sugerencias al iniciar" @@ -5044,11 +5049,11 @@ msgstr "Invertir orden de datos en dirección(es)" msgid "Swap parts" msgstr "Intercambiar partes" -#: src/exec_set.cpp:797 +#: src/exec_set.cpp:814 msgid "Switch on/off fog" msgstr "Activar/desactivar niebla" -#: src/exec_set.cpp:799 +#: src/exec_set.cpp:816 msgid "Switch on/off gray-scale mode" msgstr "Activar/desactivar modo B/N" @@ -5086,11 +5091,11 @@ msgid "Switch on/off mouse zoom of selected region." msgstr "Activar/desactivar zoom con el mouse de la región seleccionada." # Ternario or triple? -#: src/exec_set.cpp:830 +#: src/exec_set.cpp:847 msgid "Switch on/off to use ternary axis" msgstr "Activar/desactivar uso de ejes ternarios" -#: src/exec_set.cpp:778 +#: src/exec_set.cpp:795 msgid "Switch on/off transparency" msgstr "Activar/desactivar transparencia" @@ -5159,7 +5164,7 @@ msgstr "Texto en contornos" msgid "Text style" msgstr "Estilo de texto" -#: udav/hint_dlg.cpp:48 mgllab/help.cpp:286 +#: src/window.cpp:400 msgid "" "The calculator can help you to put complex expression in the script. Just " "type the expression (which may depend on coordinates x,y,z and so on) and " @@ -5177,7 +5182,7 @@ msgstr "" "El archivo actual no se ha guardado.\n" "¿Desea guardarlo ahora?" -#: udav/hint_dlg.cpp:50 mgllab/help.cpp:288 +#: src/window.cpp:402 msgid "" "The special dialog (Edit|Insert|New Command) help you select the command, " "fill its arguments and put it into the script." @@ -5192,7 +5197,7 @@ msgstr "" "Hay puntos duplicados o indistinguiblemente juntos para la triangulación." #. mglScrStr -#: src/base.cpp:245 +#: src/base.cpp:251 msgid "There is changing temporary data in script" msgstr "Algunos datos temporales cambiaron en el script" @@ -5204,7 +5209,7 @@ msgstr "Hay primitivas del usuario." msgid "There is no 'fmt' argument for this command" msgstr "No hay argumento \"fmt\" para este comando" -#: udav/text_pnl.cpp:137 mgllab/editor.cpp:680 +#: udav/text_pnl.cpp:137 mgllab/editor.cpp:681 msgid "There is no fitted formula." msgstr "No hay fórmula ajustada." @@ -5217,7 +5222,7 @@ msgstr "No hay solicitud. Salir.\n" msgid "There is no selection to evaluate." msgstr "No hay selección para evaluar." -#: udav/hint_dlg.cpp:47 mgllab/help.cpp:285 +#: src/window.cpp:399 msgid "" "There is powerful calculator with a lot of special functions. You can use " "buttons or keyboard to type the expression. Also you can use existed " @@ -5228,22 +5233,22 @@ msgstr "" "existentes en las expresiones." #. mglScrCmd -#: src/base.cpp:243 +#: src/base.cpp:249 msgid "There is too long string(s) in script" msgstr "Texto muy largo en el script" #. mglScrLong -#: src/base.cpp:244 +#: src/base.cpp:250 msgid "There is unbalanced ' in script" msgstr "Desbalance de ' en el script" #. mglWarnSpc -#: src/base.cpp:241 +#: src/base.cpp:247 msgid "There is wrong argument(s) in script" msgstr "Argumento(s) incorrecto(s) en el script" #. mglScrArg -#: src/base.cpp:242 +#: src/base.cpp:248 msgid "There is wrong command(s) in script" msgstr "Comando(s) incorrecto(s) en el script" @@ -5382,7 +5387,7 @@ msgstr "UDAV - Buscar" msgid "UDAV - Go to slice" msgstr "UDAV - Ir a sección" -#: udav/hint_dlg.cpp:55 +#: udav/hint_dlg.cpp:37 msgid "UDAV - Hint" msgstr "UDAV - Sugerencia" @@ -5555,7 +5560,7 @@ msgstr "Actualizar lista de arreglos de datos" msgid "Upper border for determining color or alpha" msgstr "Limite superior para determinar color o alfa" -#: utils/mglconv.cpp:83 +#: utils/mglconv.cpp:84 #, c-format msgid "Usage:\tmglconv [parameter(s)] scriptfile\n" msgstr "Uso:\tmglconv [parámetro(s)] script\n" @@ -5677,7 +5682,7 @@ msgstr "Ancho" msgid "Width of selected cells" msgstr "Ancho de las celdas seleccionadas" -#: src/data.cpp:1427 +#: src/data.cpp:1490 #, c-format msgid "" "Widths are:\n" @@ -5698,7 +5703,7 @@ msgstr "Gráfica de cables o grilla" msgid "Wire style" msgstr "Estilo de alambre" -#: src/exec_set.cpp:839 +#: src/exec_set.cpp:856 msgid "Write current image to graphical file" msgstr "Guardar imagen actual a archivo gráfico" @@ -5779,7 +5784,17 @@ msgstr "Y/Z" msgid "Yes" msgstr "Sí" -#: udav/hint_dlg.cpp:36 mgllab/help.cpp:274 +#: src/window.cpp:404 +msgid "" +"You can concatenation of strings and numbers using `,` with out spaces (for " +"example, `'max(u)=',u.max,' a.u.'` or `'u=',!(1+i2)` for complex numbers). " +"Also you can get n-th symbol of the string using `[]` (for example, " +"`'abc'[1]` will give 'b'), or add a value to the last character of the " +"string using `+` (for example, `'abc'+3` will give 'abf'), or use it all " +"together." +msgstr "" + +#: src/window.cpp:388 msgid "" "You can copy the current image to clipboard by pressing Ctrl-Shift-C. Later " "you can paste it directly into yours document or presentation." @@ -5787,7 +5802,7 @@ msgstr "" "Puede copiar la imagen actual a memoria presionando Ctrl-Shift-C. Luego se " "puede pegar directamente en un documento o presentación." -#: udav/hint_dlg.cpp:49 mgllab/help.cpp:287 +#: src/window.cpp:401 msgid "" "You can easily insert file or folder names, last fitted formula or numerical " "value of selection by using menu Edit|Insert." @@ -5796,7 +5811,7 @@ msgstr "" "fórmula ajustada o o valores numéricos seleccionados usando el menú Editar|" "Insertar." -#: udav/hint_dlg.cpp:43 mgllab/help.cpp:281 +#: src/window.cpp:395 msgid "" "You can edit MGL file in any text editor. Also you can run it in console by " "help of commands: mglconv, mglview." @@ -5804,7 +5819,7 @@ msgstr "" "Puede editar un archivo MGL en cualquier editor. También lo puede ejecutar " "en una terminal con ayuda de los comandos mglconv, mglview." -#: udav/hint_dlg.cpp:37 mgllab/help.cpp:275 +#: src/window.cpp:389 msgid "" "You can export image into a set of format (EPS, SVG, PNG, JPEG) by pressing " "right mouse button inside image and selecting 'Export as ...'." @@ -5813,7 +5828,7 @@ msgstr "" "presionando el botón derecho del mouse sobre la imagen y seleccionado " "\"Exportar como ...'." -#: udav/hint_dlg.cpp:41 mgllab/help.cpp:279 +#: src/window.cpp:393 msgid "" "You can put several plots in the same image by help of commands 'subplot' or " "'inplot'." @@ -5821,7 +5836,7 @@ msgstr "" "Puede poner varias gráficas en la misma imagen con ayuda de los comando " "\"subplot\" o \"inplot\"." -#: udav/hint_dlg.cpp:51 mgllab/help.cpp:289 +#: src/window.cpp:403 msgid "" "You can put several plotting commands in the same line or in separate " "function, for highlighting all of them simultaneously." @@ -5829,7 +5844,7 @@ msgstr "" "Puede poner varios comandos en la misma línea o en una función separada, " "para resaltarlos todos simultáneamente." -#: udav/hint_dlg.cpp:34 mgllab/help.cpp:272 +#: src/window.cpp:386 msgid "" "You can rotate/shift/zoom whole plot by mouse. Just press 'Rotate' " "toolbutton, click image and hold a mouse button: left button for rotation, " @@ -5840,7 +5855,7 @@ msgstr "" "mouse: izquierdo para rotación, derecho para zoom/perspectiva, del medio " "para traslación." -#: udav/hint_dlg.cpp:39 mgllab/help.cpp:277 +#: src/window.cpp:391 msgid "" "You can save the parameter of animation inside MGL script by using comment " "started from '##a ' or '##c ' for loops." @@ -5848,7 +5863,7 @@ msgstr "" "Puede guardar los parámetros de una animación en un script MGL usando " "comentarios que inicien con '##a ' o '##c ' para bucles." -#: udav/hint_dlg.cpp:38 mgllab/help.cpp:276 +#: src/window.cpp:390 msgid "" "You can setup colors for script highlighting in Property dialog. Just select " "menu item 'Settings/Properties'." @@ -5856,7 +5871,7 @@ msgstr "" "Puede configurar los colores para el resaltado del script en el dialogo " "\"Propiedades\". Solo seleccione 'Configuración/Propiedades'." -#: udav/hint_dlg.cpp:33 mgllab/help.cpp:271 +#: src/window.cpp:385 msgid "" "You can shift axis range by pressing middle button and moving mouse. Also, " "you can zoom in/out axis range by using mouse wheel." @@ -5866,7 +5881,7 @@ msgstr "" "rueda del mouse." # Needs revision of the English version -#: udav/hint_dlg.cpp:46 mgllab/help.cpp:284 +#: src/window.cpp:398 msgid "" "You can type arbitrary expression as input argument for data or number. In " "last case (for numbers), the first value of data array is used." @@ -5875,7 +5890,7 @@ msgstr "" "datos. En el primer caso (para números), el primer valor del arreglo es " "usado." -#: udav/hint_dlg.cpp:44 mgllab/help.cpp:282 +#: src/window.cpp:396 msgid "" "You can use command 'once on|off' for marking the block which should be " "executed only once. For example, this can be the block of large data reading/" @@ -5887,7 +5902,7 @@ msgstr "" "un bloque largo de lectura/creación/manipulación de datos. Presione F9 (o " "seleccione 'Gráfica/Recargar') para volver a ejecutar el bloque." -#: udav/hint_dlg.cpp:45 mgllab/help.cpp:283 +#: src/window.cpp:397 msgid "" "You can use command 'stop' for terminating script parsing. It is useful if " "you don't want to execute a part of script." @@ -5895,7 +5910,7 @@ msgstr "" "Puede usar el comando \"stop\" para terminar la ejecución del script. Esto " "es útil si se desea que una parte de este no se ejecute." -#: mgllab/help.cpp:273 +#: src/window.cpp:387 msgid "" "You may quickly draw the data from file. Just use: mgllab 'filename.dat' in " "command line." @@ -5903,14 +5918,6 @@ msgstr "" "Puede graficar rápidamente los datos de un archivo. Solo escriba \"mgllab " "'archivo.dat'\" en la línea de comandos." -#: udav/hint_dlg.cpp:35 -msgid "" -"You may quickly draw the data from file. Just use: udav 'filename.dat' in " -"command line." -msgstr "" -"Puede graficar rápidamente los datos de un archivo. Solo escriba \"udav " -"'archivo.dat'\" en la línea de comandos." - #: mgllab/dialogs.cpp:1529 msgid "You need to enter text!" msgstr "¡Debe ingresar texto!" @@ -5980,7 +5987,7 @@ msgstr "Tamaño z" msgid "Z-slice from" msgstr "Sección z para" -#: src/exec_set.cpp:845 +#: src/exec_set.cpp:862 msgid "Zoom axis range" msgstr "Rango de zoom para eje" @@ -6030,7 +6037,7 @@ msgstr "Reducir texto" msgid "Zoom out the picture" msgstr "Reducir la imagen" -#: src/exec_set.cpp:844 +#: src/exec_set.cpp:861 msgid "Zoom plot region" msgstr "Escalar región de gráfica" @@ -6101,7 +6108,7 @@ msgid "attach light" msgstr "vincular luz" #. mglWarnFmt -#: src/base.cpp:238 +#: src/base.cpp:244 msgid "axis ranges are incompatible" msgstr "rangos de ejes incompletos" @@ -6142,7 +6149,7 @@ msgid "click at %g, %g, %g" msgstr "clic en %g, %g, %g" #. mglWarnCnt -#: src/base.cpp:234 +#: src/base.cpp:240 msgid "couldn't open file" msgstr "no se pudo abrir archivo" @@ -6155,17 +6162,17 @@ msgid "cutting" msgstr "cortado" #. ----------------------------------------------------------------------------- -#: src/base.cpp:225 +#: src/base.cpp:231 msgid "data dimension(s) is incompatible" msgstr "dimensión(es) de datos incompatible(s)" #. mglWarnDim -#: src/base.cpp:226 +#: src/base.cpp:232 msgid "data dimension(s) is too small" msgstr "dimensión(es) de datos muy pequeña(s)" #. mglWarnMem -#: src/base.cpp:230 +#: src/base.cpp:236 msgid "data values are zero" msgstr "valores nulos" @@ -6197,7 +6204,7 @@ msgid "factor" msgstr "factor" #. mglWarnSize -#: src/base.cpp:237 +#: src/base.cpp:243 msgid "format is not supported for that build" msgstr "formato no soportado" @@ -6263,7 +6270,7 @@ msgid "left" msgstr "izquierda" #. mglWarnOpen -#: src/base.cpp:235 +#: src/base.cpp:241 msgid "light: ID is out of range" msgstr "luz: ID fuera de rango" @@ -6312,7 +6319,7 @@ msgstr "meshnum" msgid "mgl_en" msgstr "mgl_en" -#: utils/mglconv.cpp:82 +#: utils/mglconv.cpp:83 #, c-format msgid "" "mglconv convert mgl script to image file (default PNG).\n" @@ -6355,7 +6362,7 @@ msgid "min" msgstr "min" #. mglWarnLow -#: src/base.cpp:227 +#: src/base.cpp:233 msgid "minimal data value is negative" msgstr "valor minimal de datos es negativo" @@ -6369,12 +6376,12 @@ msgid "name" msgstr "nombre" #. mglWarnNeg -#: src/base.cpp:228 +#: src/base.cpp:234 msgid "no file or wrong data dimensions" msgstr "archivo no existe o las dimensiones de datos son incorrectas" #. mglWarnZero -#: src/base.cpp:231 +#: src/base.cpp:237 msgid "no legend entries" msgstr "leyenda vacia" @@ -6396,12 +6403,12 @@ msgid "none or default" msgstr "ninguno o por defecto" #. mglWarnFile -#: src/base.cpp:229 +#: src/base.cpp:235 msgid "not enough memory" msgstr "no hay suficiente memoria" #. mglWarnNull -#: src/base.cpp:240 +#: src/base.cpp:246 msgid "not enough space for plot" msgstr "no hay suficiente espacio para gráfica" @@ -6410,7 +6417,7 @@ msgid "not used" msgstr "no usado" #. mglWarnSlc -#: src/base.cpp:233 +#: src/base.cpp:239 msgid "number of contours is zero or negative" msgstr "número de curvas de nivel es cero o negativo" @@ -6441,7 +6448,7 @@ msgid "plain" msgstr "plano" #. mglWarnTern -#: src/base.cpp:239 +#: src/base.cpp:245 msgid "pointer is NULL" msgstr "puntero es NULL" @@ -6496,12 +6503,12 @@ msgid "save slides" msgstr "guardar cuadros" #. mglWarnLId -#: src/base.cpp:236 +#: src/base.cpp:242 msgid "size(s) is zero or negative" msgstr "tamaño(s) nulo(s) o negativo(s)" #. mglWarnLeg -#: src/base.cpp:232 +#: src/base.cpp:238 msgid "slice value is out of range" msgstr "valor de sección fuera de rango" @@ -6609,3 +6616,10 @@ msgstr "con paso" #: udav/style_dlg.cpp:227 mgllab/dialogs.cpp:34 msgid "y - yellow" msgstr "y - amarillo" + +#~ msgid "" +#~ "You may quickly draw the data from file. Just use: udav 'filename.dat' in " +#~ "command line." +#~ msgstr "" +#~ "Puede graficar rápidamente los datos de un archivo. Solo escriba \"udav " +#~ "'archivo.dat'\" en la línea de comandos." diff --git a/mathgl_ru.po b/mathgl_ru.po index 51a2873..f530d33 100644 --- a/mathgl_ru.po +++ b/mathgl_ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: MathGL2 2.4.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-29 06:37+0300\n" +"POT-Creation-Date: 2019-03-02 14:41+0300\n" "PO-Revision-Date: 2017-04-19 01:17+0300\n" "Last-Translator: Alexey Balakin \n" "Language-Team: Russian\n" @@ -33,7 +33,7 @@ msgstr "" "\t-L loc изменить локаль на loc\n" "\t-h показать справку \n" -#: utils/mglconv.cpp:85 +#: utils/mglconv.cpp:86 #, c-format msgid "" "\t-1 str set str as argument $1 for script\n" @@ -488,7 +488,7 @@ msgstr "1D график" msgid "1D plots" msgstr "1D графики" -#: mgllab/help.cpp:364 +#: mgllab/help.cpp:341 msgid "1D view" msgstr "1D вид" @@ -504,7 +504,7 @@ msgstr "2D график" msgid "2D plots" msgstr "2D графики" -#: mgllab/help.cpp:366 +#: mgllab/help.cpp:343 msgid "2D view" msgstr "2D вид" @@ -520,7 +520,7 @@ msgstr "3D данные с размерами из файла" msgid "3D plots" msgstr "3D графики" -#: mgllab/help.cpp:368 +#: mgllab/help.cpp:345 msgid "3D view" msgstr "3D вид" @@ -556,7 +556,7 @@ msgstr "" "
(c) Алексей Балакин, 2007-наст.вр.

Лицензия GPL v.2 или более поздняя." -#: mgllab/help.cpp:308 +#: mgllab/help.cpp:285 msgid "@<- Prev" msgstr "@<- Пред." @@ -606,7 +606,7 @@ msgstr "Добавить эллипс. Его свойства можно изм msgid "Add inplot" msgstr "Добавить под-график" -#: src/exec_set.cpp:775 +#: src/exec_set.cpp:792 msgid "Add legend entry" msgstr "Добавить запись легенды" @@ -666,7 +666,7 @@ msgstr "Добавить текст" msgid "Add text which properties can be changed later by mouse." msgstr "Добавить текст. Его свойства можно изменить позже мышью." -#: src/exec_prm.cpp:648 +#: src/exec_prm.cpp:658 msgid "Add title for current subplot/inplot" msgstr "Добавить заголовок к текущему под-графику" @@ -674,7 +674,7 @@ msgstr "Добавить заголовок к текущему под-граф msgid "Add to" msgstr "Добавить к" -#: src/exec_set.cpp:776 +#: src/exec_set.cpp:793 msgid "Add user-defined symbol" msgstr "Добавить пользовательский символ" @@ -686,7 +686,7 @@ msgstr "Подогнать размер картинки под область msgid "Adjust size" msgstr "Подогнать размер" -#: src/exec_set.cpp:777 +#: src/exec_set.cpp:794 msgid "Adjust ticks for best view" msgstr "Подобрать метки осей для лучшего вида" @@ -694,7 +694,7 @@ msgstr "Подобрать метки осей для лучшего вида" msgid "Airy and Gamma" msgstr "Эйри и Гамма" -#: udav/hint_dlg.cpp:42 mgllab/help.cpp:280 +#: src/window.cpp:394 msgid "" "All indexes (of data arrays, subplots and so on) are always start from 0." msgstr "Все индексы (данных, под-графиков и пр.) всегда начинаются с 0." @@ -787,7 +787,7 @@ msgstr "Соотношение сторон по y и z" msgid "Aspect x/z" msgstr "Стороны x/z" -#: src/exec_set.cpp:783 +#: src/exec_set.cpp:800 msgid "Attach light settings to inplot" msgstr "Привязать настройки света к под-графику" @@ -811,7 +811,7 @@ msgstr "Выполнить скрипт после загрузки" msgid "Automatically save before redrawing (F5)" msgstr "Сохранять скрипт перед рисованием (F5)" -#: src/data.cpp:1425 +#: src/data.cpp:1488 #, c-format msgid "" "Averages are:\n" @@ -847,7 +847,7 @@ msgstr "B - темно-синий" msgid "Backward" msgstr "Назад" -#: src/font.cpp:953 +#: src/font.cpp:1021 #, c-format msgid "Bad '%ls' at %zu\n" msgstr "Неправильный '%ls' при %zu\n" @@ -976,7 +976,7 @@ msgstr "Изменить размер данных" msgid "Change canvas size to fill whole region (F6)." msgstr "Подогнать размер рисунка под размер окна (F6)." -#: src/exec_set.cpp:787 +#: src/exec_set.cpp:804 msgid "Change current directory" msgstr "Сменить директорию" @@ -996,7 +996,7 @@ msgstr "Изменить данные и закрыть окно" msgid "Change font" msgstr "Изменить шрифт" -#: src/exec_set.cpp:838 +#: src/exec_set.cpp:855 msgid "Change view angles - use 'rotate' for plot rotation" msgstr "Изменяет углы обзора, а не поворот как 'rotate'" @@ -1008,18 +1008,18 @@ msgstr "Очистить" msgid "Clear all" msgstr "Удалить все" -#: src/exec_set.cpp:788 +#: src/exec_set.cpp:805 msgid "Clear legend entries" msgstr "Удалить записи легенды" -#: src/exec_set.cpp:789 +#: src/exec_set.cpp:806 msgid "Clear picture" msgstr "Очистить рисунок" #. o = new Fl_Button(180, 130, 25, 25);o->image(img_save); o->tooltip("img_save"); #: widgets/fltk.cpp:1102 widgets/qt.cpp:1104 udav/find_dlg.cpp:52 -#: udav/hint_dlg.cpp:70 mgllab/editor.cpp:565 mgllab/help.cpp:312 -#: mgllab/help.cpp:372 mgllab/help.cpp:488 +#: udav/hint_dlg.cpp:52 mgllab/editor.cpp:566 mgllab/help.cpp:289 +#: mgllab/help.cpp:349 mgllab/help.cpp:465 msgid "Close" msgstr "Закрыть" @@ -1090,19 +1090,19 @@ msgstr "Опции команды" msgid "Comments" msgstr "Комментарий" -#: src/exec_prm.cpp:636 +#: src/exec_prm.cpp:646 msgid "Computes the attractor of an IFS" msgstr "Вычисляет точки фрактала IFS" -#: src/exec_prm.cpp:637 +#: src/exec_prm.cpp:647 msgid "Computes the attractor of an IFS for 3d case" msgstr "Вычисляет точки фрактала IFS в 3d случае" -#: src/exec_prm.cpp:638 +#: src/exec_prm.cpp:648 msgid "Computes the attractor of an IFS with parameters from *.ifs file" msgstr "Вычисляет точки фрактала IFS с параметрами из файла" -#: src/exec_prm.cpp:632 +#: src/exec_prm.cpp:642 msgid "Computes the flame fractal" msgstr "Вычисляет точки фрактала flame" @@ -1154,7 +1154,7 @@ msgstr "Копировать диапазон чисел в буфер обме msgid "Copy selected text or data to clipboard (Ctrl+C)." msgstr "Копировать выделенный текст или данные в буфер обмена (Ctrl+C)." -#: mgllab/editor.cpp:511 +#: mgllab/editor.cpp:512 msgid "Copy selection to clipboard" msgstr "Копировать выделение в буфер обмена" @@ -1518,7 +1518,7 @@ msgstr "Нарисовать диаграмму STFA" msgid "Draw TeX mark at point position" msgstr "Нарисовать ТеХ символы в положении точек" -#: src/exec_prm.cpp:615 +#: src/exec_prm.cpp:624 msgid "Draw angle arc" msgstr "Нарисовать дугу" @@ -1542,11 +1542,11 @@ msgstr "Нарисовать поверхность ленточками с за msgid "Draw binormales for 1D data" msgstr "Нарисовать нормаль и бинормаль для кривой" -#: src/exec_prm.cpp:641 +#: src/exec_prm.cpp:651 msgid "Draw bitmap (logo) along axis range" msgstr "Нарисовать растр (логотип) в области осей координат" -#: src/exec_prm.cpp:619 +#: src/exec_prm.cpp:628 msgid "Draw bounding box" msgstr "Нарисовать ограничивающий параллелепипед" @@ -1566,7 +1566,7 @@ msgstr "Нарисовать свечной график" msgid "Draw chart" msgstr "Нарисовать линейчатую (круговую) диаграмму" -#: src/exec_prm.cpp:620 +#: src/exec_prm.cpp:629 msgid "Draw circle" msgstr "Нарисовать окружность (круг)" @@ -1574,11 +1574,11 @@ msgstr "Нарисовать окружность (круг)" msgid "Draw cloud" msgstr "Нарисовать облако для 3D данных" -#: src/exec_prm.cpp:621 +#: src/exec_prm.cpp:631 msgid "Draw colorbar" msgstr "Нарисовать цветовую шкалу" -#: src/exec_prm.cpp:622 +#: src/exec_prm.cpp:632 msgid "Draw cone" msgstr "Нарисовать конус" @@ -1622,7 +1622,7 @@ msgstr "Нарисовать цилиндры по линиям уровней" msgid "Draw contour tubes for surface of triangles" msgstr "Нарисовать цилиндры по линиям уровней для поверхности из треугольников" -#: src/exec_prm.cpp:623 +#: src/exec_prm.cpp:633 msgid "Draw curve" msgstr "Нарисовать кривую" @@ -1658,15 +1658,15 @@ msgstr "Нарисовать векторное поле каплями" msgid "Draw dots for arbitrary data points" msgstr "Нарисовать набор точек" -#: src/exec_prm.cpp:624 +#: src/exec_prm.cpp:634 msgid "Draw drop" msgstr "Нарисовать каплю" -#: src/exec_prm.cpp:625 +#: src/exec_prm.cpp:635 msgid "Draw ellipse" msgstr "Нарисовать эллипс" -#: src/exec_prm.cpp:626 +#: src/exec_prm.cpp:636 msgid "Draw error box" msgstr "Нарисовать размер ошибки" @@ -1674,19 +1674,19 @@ msgstr "Нарисовать размер ошибки" msgid "Draw error boxes" msgstr "Нарисовать размеры ошибок для 1D данных" -#: src/exec_prm.cpp:627 +#: src/exec_prm.cpp:637 msgid "Draw face (quadrangle)" msgstr "Нарисовать грань (четырехугольник)" -#: src/exec_prm.cpp:628 +#: src/exec_prm.cpp:638 msgid "Draw face perpendicular to x-axis" msgstr "Нарисовать грань поперек оси x" -#: src/exec_prm.cpp:629 +#: src/exec_prm.cpp:639 msgid "Draw face perpendicular to y-axis" msgstr "Нарисовать грань поперек оси y" -#: src/exec_prm.cpp:630 +#: src/exec_prm.cpp:640 msgid "Draw face perpendicular to z-axis" msgstr "Нарисовать грань поперек оси z" @@ -1710,7 +1710,7 @@ msgstr "Нарисовать линии тока для векторного п msgid "Draw gradient lines for scalar field" msgstr "Нарисовать линии градиента для скалярного поля" -#: src/exec_prm.cpp:635 +#: src/exec_prm.cpp:645 msgid "Draw grid" msgstr "Нарисовать сетку осей координат" @@ -1754,27 +1754,32 @@ msgstr "Нарисовать поверхность уровня с заданн msgid "Draw label at arbitrary position" msgstr "Вывести надписи для 1D данных" -#: src/exec_prm.cpp:649 +#: src/exec_prm.cpp:630 +#, fuzzy +msgid "Draw label for colorbar" +msgstr "Вывести подпись оси t" + +#: src/exec_prm.cpp:659 msgid "Draw label for t-axis" msgstr "Вывести подпись оси t" -#: src/exec_prm.cpp:650 +#: src/exec_prm.cpp:660 msgid "Draw label for x-axis" msgstr "Вывести подпись оси x" -#: src/exec_prm.cpp:651 +#: src/exec_prm.cpp:661 msgid "Draw label for y-axis" msgstr "Вывести подпись оси y" -#: src/exec_prm.cpp:652 +#: src/exec_prm.cpp:662 msgid "Draw label for z-axis" msgstr "Вывести подпись оси z" -#: src/exec_prm.cpp:639 +#: src/exec_prm.cpp:649 msgid "Draw legend" msgstr "Нарисовать легенду графика" -#: src/exec_prm.cpp:640 +#: src/exec_prm.cpp:650 msgid "Draw line" msgstr "Нарисовать прямую линию" @@ -1790,11 +1795,11 @@ msgstr "Нарисовать маркеры переменного размер msgid "Draw mesh surface" msgstr "Нарисовать сетчатую поверхность" -#: src/exec_prm.cpp:618 +#: src/exec_prm.cpp:627 msgid "Draw point (ball)" msgstr "Нарисовать точку" -#: src/exec_prm.cpp:642 +#: src/exec_prm.cpp:652 msgid "Draw polygon" msgstr "Нарисовать полигон" @@ -1810,11 +1815,11 @@ msgstr "Нарисовать круговой график" msgid "Draw reconstructed surface for arbitrary data points" msgstr "Нарисовать поверхность по произвольным точкам" -#: src/exec_prm.cpp:643 +#: src/exec_prm.cpp:653 msgid "Draw rectangle" msgstr "Нарисовать прямоугольник" -#: src/exec_prm.cpp:644 +#: src/exec_prm.cpp:654 msgid "Draw rhombus" msgstr "Нарисовать ромб" @@ -1858,7 +1863,7 @@ msgstr "Нарисовать поверхность с заданным цвет msgid "Draw solid surface transpared by other data" msgstr "Нарисовать поверхность с заданной прозрачностью" -#: src/exec_prm.cpp:645 +#: src/exec_prm.cpp:655 msgid "Draw sphere" msgstr "Нарисовать сферу" @@ -1894,11 +1899,11 @@ msgstr "Нарисовать таблицу значений данных" msgid "Draw tension plot for 1D data" msgstr "Нарисовать кривую с заданным цветом" -#: src/exec_prm.cpp:647 +#: src/exec_prm.cpp:657 msgid "Draw text at some position or along curve" msgstr "Вывести текст в точке или вдоль кривой" -#: src/exec_prm.cpp:646 +#: src/exec_prm.cpp:656 msgid "Draw user-defined symbol at given position and direction" msgstr "Нарисовать символ в заданных точке и направлении" @@ -2234,7 +2239,7 @@ msgstr "Заполнить в диапазоне" msgid "Fill x-,k-samples for transforms" msgstr "Заполнить как x-,k-координаты для трансформации" -#: udav/find_dlg.cpp:48 mgllab/editor.cpp:559 +#: udav/find_dlg.cpp:48 mgllab/editor.cpp:560 msgid "Find" msgstr "Найти" @@ -2266,7 +2271,7 @@ msgstr "Найти минимум по направлению" msgid "Find next" msgstr "Найти следующее" -#: mgllab/editor.cpp:515 +#: mgllab/editor.cpp:516 msgid "Find or replace text" msgstr "Найти или заменить" @@ -2286,11 +2291,11 @@ msgstr "Найти сумму по направлению" msgid "Find triangles of randomly placed points" msgstr "Триангулировать произвольно расположенные точки" -#: udav/find_dlg.cpp:36 mgllab/editor.cpp:558 +#: udav/find_dlg.cpp:36 mgllab/editor.cpp:559 msgid "Find what:" msgstr "Найти что:" -#: udav/text_pnl.cpp:546 mgllab/editor.cpp:557 +#: udav/text_pnl.cpp:546 mgllab/editor.cpp:558 msgid "Find/Replace" msgstr "Найти/Заменить" @@ -2634,7 +2639,7 @@ msgstr "H - темно-серый" msgid "HDF4 support was disabled. Please, enable it and rebuild MathGL." msgstr "HDF4 поддержка отключена. Включите ее и пересоберите MathGL." -#: src/complex_io.cpp:925 src/complex_io.cpp:927 src/data_io.cpp:1191 +#: src/complex_io.cpp:924 src/complex_io.cpp:926 src/data_io.cpp:1191 #: src/data_io.cpp:1193 src/data_io.cpp:1195 src/data_io.cpp:1197 msgid "HDF5 support was disabled. Please, enable it and rebuild MathGL." msgstr "HDF5 поддержка отключена. Включите ее и пересоберите MathGL." @@ -2769,7 +2774,7 @@ msgstr "Увеличить размер шрифта" msgid "Info" msgstr "Инфо" -#: udav/info_dlg.cpp:55 mgllab/help.cpp:358 +#: udav/info_dlg.cpp:55 mgllab/help.cpp:335 msgid "Information" msgstr "Информация" @@ -2782,7 +2787,7 @@ msgstr "Под-график" msgid "Insert" msgstr "Вставить" -#: mgllab/editor.cpp:518 +#: mgllab/editor.cpp:519 msgid "Insert MGL command" msgstr "Вставить команду MGL" @@ -2790,7 +2795,7 @@ msgstr "Вставить команду MGL" msgid "Insert as 'list'" msgstr "Вставить как 'list'" -#: mgllab/editor.cpp:486 +#: mgllab/editor.cpp:487 msgid "Insert file content?" msgstr "Вставить содержимое файла?" @@ -2798,11 +2803,11 @@ msgstr "Вставить содержимое файла?" msgid "Insert file name?" msgstr "Вставить имя файла?" -#: mgllab/editor.cpp:520 +#: mgllab/editor.cpp:521 msgid "Insert filename" msgstr "Вставить имя файла" -#: mgllab/editor.cpp:522 +#: mgllab/editor.cpp:523 msgid "Insert inplot command" msgstr "Вставить под-график" @@ -2974,7 +2979,7 @@ msgstr "Список доступных данных." msgid "Load Data?" msgstr "Загрузить данные?" -#: src/exec_set.cpp:804 +#: src/exec_set.cpp:821 msgid "Load commands from external DLL" msgstr "Загрузить команды из внешней DLL" @@ -2994,7 +2999,7 @@ msgstr "" "Загрузить данные. Данные будут удалены только\n" "при выходе из программы без запроса на сохранение (Ctrl+Shift+O)." -#: src/exec_set.cpp:805 +#: src/exec_set.cpp:822 msgid "Load fontfaces" msgstr "Загрузить шрифт" @@ -3002,7 +3007,7 @@ msgstr "Загрузить шрифт" msgid "Load from file" msgstr "Загрузить из файла" -#: src/exec_prm.cpp:617 +#: src/exec_prm.cpp:626 msgid "Load image for background" msgstr "Загрузить фоновое изображение" @@ -3139,7 +3144,7 @@ msgstr "Угол поворота маски" msgid "Mask size" msgstr "Размер маски" -#: udav/find_dlg.cpp:42 mgllab/editor.cpp:562 +#: udav/find_dlg.cpp:42 mgllab/editor.cpp:563 msgid "Match case" msgstr "Учитывать регистр" @@ -3147,7 +3152,7 @@ msgstr "Учитывать регистр" msgid "MathGL - about" msgstr "MathGL - о программе" -#: src/base.cpp:259 +#: src/base.cpp:265 #, c-format msgid "MathGL message - %s\n" msgstr "Сообщение MathGL - %s\n" @@ -3188,7 +3193,7 @@ msgstr "Максимум Y для обрезания или координат" msgid "Maximal value of Z for cutting or for coordinate filling" msgstr "Максимум Z для обрезания или координат" -#: src/data.cpp:1417 +#: src/data.cpp:1480 #, c-format msgid "Maximum is %g\t at x = %ld\ty = %ld\tz = %ld\n" msgstr "Максимум %g\t при x = %ld\ty = %ld\tz = %ld\n" @@ -3245,7 +3250,7 @@ msgstr "Минимум Y для обрезания или координат" msgid "Minimal value of Z for cutting or for coordinate filling" msgstr "Минимум Z для обрезания или координат" -#: src/data.cpp:1420 +#: src/data.cpp:1483 #, c-format msgid "Minimum is %g\t at x = %ld\ty = %ld\tz = %ld\n" msgstr "Минимум %g\t при x = %ld\ty = %ld\tz = %ld\n" @@ -3372,7 +3377,7 @@ msgstr "Навигация" msgid "New command" msgstr "Новая команда" -#: udav/hint_dlg.cpp:40 mgllab/help.cpp:278 +#: src/window.cpp:392 msgid "" "New drawing never clears things drawn already. For example, you can make a " "surface with contour lines by calling commands 'surf' and 'cont' one after " @@ -3406,11 +3411,11 @@ msgstr "Новый размер данных по y" msgid "New size of data on 3d dimension (z-direction)" msgstr "Новый размер данных по z" -#: udav/hint_dlg.cpp:68 +#: udav/hint_dlg.cpp:50 msgid "Next" msgstr "Следующий" -#: mgllab/help.cpp:310 +#: mgllab/help.cpp:287 msgid "Next @->" msgstr "Следующий @->" @@ -3445,7 +3450,7 @@ msgstr "Не введено направление/формула" msgid "No filename." msgstr "Отсутствует имя файла." -#: mgllab/editor.cpp:584 mgllab/editor.cpp:606 mgllab/editor.cpp:631 +#: mgllab/editor.cpp:585 mgllab/editor.cpp:607 mgllab/editor.cpp:632 #, c-format msgid "No occurrences of '%s' found!" msgstr "Вхождения '%s' не найдены!" @@ -3574,7 +3579,7 @@ msgstr "Открыть файл ..." msgid "Open printer dialog and print graphics (Ctrl+P)" msgstr "Открыть диалог и напечатать график (CTRl+P)" -#: mgllab/editor.cpp:506 +#: mgllab/editor.cpp:507 msgid "Open script or data file" msgstr "Загрузить скрипт или файл данных" @@ -3665,7 +3670,7 @@ msgstr "Вставить диапазон значений из буфера о msgid "Paste text" msgstr "Вставить текст" -#: mgllab/editor.cpp:513 +#: mgllab/editor.cpp:514 msgid "Paste text from clipboard" msgstr "Вставить текст из буфера обмена" @@ -3710,7 +3715,7 @@ msgstr "Поместить редактор сверху" msgid "Plot ID" msgstr "ID графика" -#: src/exec_prm.cpp:633 +#: src/exec_prm.cpp:643 msgid "Plot curve by formula" msgstr "Построить кривую по формуле" @@ -3739,7 +3744,7 @@ msgstr "Настройки графика" msgid "Plot style" msgstr "Стиль графика" -#: src/exec_prm.cpp:634 +#: src/exec_prm.cpp:644 msgid "Plot surface by formula" msgstr "Построить поверхность по формуле" @@ -3747,7 +3752,7 @@ msgstr "Построить поверхность по формуле" msgid "Popular color schemes" msgstr "Популярные цв.схемы" -#: udav/hint_dlg.cpp:66 +#: udav/hint_dlg.cpp:48 msgid "Prev" msgstr "Предыдущий" @@ -3775,7 +3780,7 @@ msgstr "Примитивы" msgid "Primitives ..." msgstr "Примитивы ..." -#: src/exec_set.cpp:837 +#: src/exec_set.cpp:854 msgid "Print MathGL version or check if it is valid" msgstr "Вывести версию MathGL или проверить, что она подходит" @@ -3807,7 +3812,7 @@ msgstr "Напечатать график" msgid "Print script" msgstr "Напечатать скрипт" -#: src/exec_prm.cpp:631 +#: src/exec_prm.cpp:641 msgid "Print string from file" msgstr "Вывести строку в файл" @@ -3877,7 +3882,7 @@ msgstr "Выход" msgid "R - maroon" msgstr "R - темно-красный" -#: src/exec_set.cpp:818 +#: src/exec_set.cpp:835 msgid "Rasterize plot and save to background" msgstr "Растеризовать график и установить вместо фона" @@ -3965,15 +3970,15 @@ msgstr "Удалить одинаковые строки" msgid "Remove jump into the data, like phase jumps" msgstr "Убрать скачки данных, например скачки фазы" -#: udav/find_dlg.cpp:50 mgllab/editor.cpp:561 +#: udav/find_dlg.cpp:50 mgllab/editor.cpp:562 msgid "Replace" msgstr "Заменить" -#: mgllab/editor.cpp:564 +#: mgllab/editor.cpp:565 msgid "Replace all" msgstr "Заменить все" -#: udav/find_dlg.cpp:39 mgllab/editor.cpp:560 +#: udav/find_dlg.cpp:39 mgllab/editor.cpp:561 msgid "Replace by:" msgstr "Заменить на:" @@ -3981,7 +3986,7 @@ msgstr "Заменить на:" msgid "Replace expression by its numerical value." msgstr "Заменить выражение на его числовое значение." -#: mgllab/editor.cpp:630 +#: mgllab/editor.cpp:631 #, c-format msgid "Replaced %ld occurrences." msgstr "Заменено %ld вхождений." @@ -4015,7 +4020,7 @@ msgstr "Оставить место для подписей справа (сти msgid "Reserve space for labels at top side (style '^')" msgstr "Оставить место для подписей сверху (стиль '^')" -#: src/exec_set.cpp:819 +#: src/exec_set.cpp:836 msgid "Reset settings and clear picture" msgstr "Сбросить настройки и обновить рисунок" @@ -4113,7 +4118,7 @@ msgstr "Поворот" msgid "Rotate picture by holding left mouse button" msgstr "Вращать рисунок при удержании кнопок мыши" -#: src/exec_set.cpp:820 +#: src/exec_set.cpp:837 msgid "Rotate plot" msgstr "Вращать график" @@ -4213,7 +4218,7 @@ msgstr "Сохранить скрипт" msgid "Save script to a file (Ctrl+S)" msgstr "Сохранить скрипт в файл (Ctrl+S)" -#: mgllab/editor.cpp:508 +#: mgllab/editor.cpp:509 msgid "Save script to file" msgstr "Сохранить скрипт в файл" @@ -4237,7 +4242,7 @@ msgstr "Масштаб и вращение" msgid "Script" msgstr "Скрипт" -#: udav/find_dlg.cpp:43 mgllab/editor.cpp:563 +#: udav/find_dlg.cpp:43 mgllab/editor.cpp:564 msgid "Search backward" msgstr "Искать назад" @@ -4261,7 +4266,7 @@ msgstr "Выбрать данные" msgid "Select direction" msgstr "Выбрать направление" -#: mgllab/editor.cpp:653 +#: mgllab/editor.cpp:654 msgid "Select file name" msgstr "Выбрать имя файла" @@ -4269,7 +4274,7 @@ msgstr "Выбрать имя файла" msgid "Select first the proper kind of arguments" msgstr "Сначала выберите вариант аргументов" -#: mgllab/editor.cpp:666 +#: mgllab/editor.cpp:667 msgid "Select folder name" msgstr "Выбрать путь к папке" @@ -4277,7 +4282,7 @@ msgstr "Выбрать путь к папке" msgid "Select kind of plot" msgstr "Выбрать тип графика" -#: src/exec_set.cpp:836 +#: src/exec_set.cpp:853 msgid "Select variant of plot style(s)" msgstr "Выбрать вариант стиля графика" @@ -4285,15 +4290,15 @@ msgstr "Выбрать вариант стиля графика" msgid "Set" msgstr "Задать" -#: src/exec_set.cpp:832 +#: src/exec_set.cpp:849 msgid "Set additional tick and axis labels shift" msgstr "Задает дополнительный сдвиш меток осей" -#: src/exec_set.cpp:780 +#: src/exec_set.cpp:797 msgid "Set ambient light brightness" msgstr "Задает яркость фонового освещения" -#: src/exec_set.cpp:801 +#: src/exec_set.cpp:818 msgid "Set arbitrary position of plot in picture" msgstr "Задать произвольную область рисования внутри рисунка" @@ -4301,35 +4306,35 @@ msgstr "Задать произвольную область рисования msgid "Set arguments" msgstr "Задать аргументы" -#: src/exec_set.cpp:782 +#: src/exec_set.cpp:799 msgid "Set aspect ration" msgstr "Задать соотношение сторон" -#: src/exec_set.cpp:784 +#: src/exec_set.cpp:801 msgid "Set axis and tick style" msgstr "Задать стиль осей и меток" -#: src/exec_set.cpp:810 +#: src/exec_set.cpp:827 msgid "Set axis origin" msgstr "Задать начало координат" -#: src/exec_set.cpp:817 +#: src/exec_set.cpp:834 msgid "Set axis ranges" msgstr "Задать диапазон осей" -#: src/exec_set.cpp:825 +#: src/exec_set.cpp:842 msgid "Set bit-flags (for advanced users only)" msgstr "Задает битовый флаг (для опытных пользователей)" -#: src/exec_set.cpp:786 +#: src/exec_set.cpp:803 msgid "Set bounding box for 2d export" msgstr "Задать границы для 2d экспорта" -#: src/exec_set.cpp:807 +#: src/exec_set.cpp:824 msgid "Set brush for given mask id" msgstr "Задать кисть для маски с выбранным id" -#: src/exec_set.cpp:791 +#: src/exec_set.cpp:808 msgid "Set color range" msgstr "Задать диапазон цвета" @@ -4345,23 +4350,23 @@ msgstr "Вкл/выкл обрезание для конкретного гра msgid "Set data sizes manually" msgstr "Задать размеры данных вручную" -#: src/exec_set.cpp:785 +#: src/exec_set.cpp:802 msgid "Set default bars width" msgstr "Задать размер полос по умолчанию" -#: src/exec_set.cpp:815 +#: src/exec_set.cpp:832 msgid "Set default filename" msgstr "Задать имя файла по умолчанию" -#: src/exec_set.cpp:779 +#: src/exec_set.cpp:796 msgid "Set default transparency" msgstr "Задать прозрачность по умолчанию" -#: src/exec_set.cpp:794 +#: src/exec_set.cpp:811 msgid "Set diffusive light brightness" msgstr "Задать яркость рассеянного света" -#: src/exec_set.cpp:795 +#: src/exec_set.cpp:812 msgid "Set draw region for quality&4" msgstr "Задать область рисования при quality&4" @@ -4385,75 +4390,75 @@ msgstr "Задать область рисования как ячейку бр msgid "Set lighting off/on for particular plot" msgstr "Вкл/выкл освещение отдельного графика" -#: src/exec_set.cpp:808 +#: src/exec_set.cpp:825 msgid "Set number of lines in mesh/fall/vect and so on" msgstr "Задать примерное число линий в mesh/fall/vect ..." -#: src/exec_set.cpp:802 +#: src/exec_set.cpp:819 msgid "Set number of marks in the legend" msgstr "Задать число маркеров в легенде" -#: src/exec_set.cpp:796 +#: src/exec_set.cpp:813 msgid "Set number of visible faces" msgstr "Задать число видимых граней" -#: src/exec_set.cpp:812 +#: src/exec_set.cpp:829 msgid "Set palette for 1D plots" msgstr "Задать палитру для 1D графиков" -#: src/exec_set.cpp:814 +#: src/exec_set.cpp:831 msgid "Set perspective" msgstr "Задать перспективу" -#: src/exec_set.cpp:823 +#: src/exec_set.cpp:840 msgid "Set picture size" msgstr "Задать размер рисунка" -#: src/exec_set.cpp:816 +#: src/exec_set.cpp:833 msgid "Set plot quality" msgstr "Задать качество рисования картинки" -#: src/exec_set.cpp:829 +#: src/exec_set.cpp:846 msgid "Set position of plot as cell of matrix" msgstr "Задать область рисования как ячейку матрицы" -#: src/exec_set.cpp:809 +#: src/exec_set.cpp:826 msgid "Set position of plot block in matrix" msgstr "Задать область рисования как блок в матрице" -#: src/exec_set.cpp:790 +#: src/exec_set.cpp:807 msgid "Set position of plot inside cell of column" msgstr "Задать область рисования как ячейку колонки" -#: src/exec_set.cpp:800 +#: src/exec_set.cpp:817 msgid "Set position of plot inside cell of matrix" msgstr "Задать область рисования внутри ячейки колонки" -#: src/exec_set.cpp:828 +#: src/exec_set.cpp:845 msgid "Set position of plot inside cell of rotated stick" msgstr "Задать область рисования как ячейку повернутого бруска" -#: src/exec_set.cpp:827 +#: src/exec_set.cpp:844 msgid "Set position of plot inside cell of sheared stick" msgstr "Задать область рисования как ячейку наклоненной колонки" -#: src/exec_set.cpp:840 +#: src/exec_set.cpp:857 msgid "Set range for x-axis" msgstr "Задать диапазон по x" -#: src/exec_set.cpp:842 +#: src/exec_set.cpp:859 msgid "Set range for y-axis" msgstr "Задать диапазон по y" -#: src/exec_set.cpp:846 +#: src/exec_set.cpp:863 msgid "Set range for z-axis" msgstr "Задать диапазон по z" -#: src/exec_set.cpp:822 +#: src/exec_set.cpp:839 msgid "Set scale text in relative subplots too" msgstr "Задает масштабирование текста в отн.подграфиках" -#: src/exec_set.cpp:824 +#: src/exec_set.cpp:841 msgid "Set scaling factor for further setsize" msgstr "Задать множитель для всех 'setsize'" @@ -4465,51 +4470,51 @@ msgstr "Задать аргументы скрипта" msgid "Set size for text, marks and others" msgstr "Задать размер текста, маркеров и пр." -#: src/exec_set.cpp:781 +#: src/exec_set.cpp:798 msgid "Set size of arrows" msgstr "Задать размер стрелок" -#: src/exec_set.cpp:806 +#: src/exec_set.cpp:823 msgid "Set size of markers" msgstr "Задать размер маркеров" -#: src/exec_set.cpp:813 +#: src/exec_set.cpp:830 msgid "Set size of semi-transparent area around line" msgstr "Задать размер полупрозрачной области около линии" -#: src/exec_set.cpp:811 +#: src/exec_set.cpp:828 msgid "Set tick labels drawing at origin" msgstr "Разрешить вывод меток осей в начале координат" -#: src/exec_set.cpp:831 +#: src/exec_set.cpp:848 msgid "Set tick length" msgstr "Задать длину меток осей" -#: src/exec_set.cpp:792 +#: src/exec_set.cpp:809 msgid "Set ticks for colorbar" msgstr "Задать метки для цветовой шкалы" -#: src/exec_set.cpp:841 +#: src/exec_set.cpp:858 msgid "Set ticks for x-axis" msgstr "Задать метки для оси x" -#: src/exec_set.cpp:843 +#: src/exec_set.cpp:860 msgid "Set ticks for y-axis" msgstr "Задать метки для оси y" -#: src/exec_set.cpp:847 +#: src/exec_set.cpp:864 msgid "Set ticks for z-axis" msgstr "Задать метки для оси z" -#: src/exec_set.cpp:833 +#: src/exec_set.cpp:850 msgid "Set ticks in time format" msgstr "Задать метки в формате времени" -#: src/exec_set.cpp:835 +#: src/exec_set.cpp:852 msgid "Set ticks tuning" msgstr "Включить оптимизацию меток осей" -#: src/exec_set.cpp:821 +#: src/exec_set.cpp:838 msgid "Set to auto rotate text or not" msgstr "Разрешить поворот текста" @@ -4517,7 +4522,7 @@ msgstr "Разрешить поворот текста" msgid "Set to use whole area (style '#')" msgstr "Задать использование всей области (стиль '#')" -#: src/exec_set.cpp:834 +#: src/exec_set.cpp:851 msgid "Set type transparency" msgstr "Задать тип прозрачности" @@ -4561,19 +4566,19 @@ msgstr "Настроить анимацию" msgid "Setup colors for:" msgstr "Настроить цвета:" -#: src/exec_set.cpp:798 +#: src/exec_set.cpp:815 msgid "Setup font" msgstr "Настроить шрифт" -#: src/exec_set.cpp:803 +#: src/exec_set.cpp:820 msgid "Setup light" msgstr "Настроить освещение" -#: src/exec_prm.cpp:616 +#: src/exec_prm.cpp:625 msgid "Setup or draw axis" msgstr "Настроить или нарисовать оси" -#: src/exec_set.cpp:793 +#: src/exec_set.cpp:810 msgid "Setup plot points cutting" msgstr "Настроить обрезание точек графика" @@ -4597,7 +4602,7 @@ msgstr "Сшить фазу" msgid "Sharp colors" msgstr "Контрастные" -#: src/exec_set.cpp:826 +#: src/exec_set.cpp:843 msgid "Shear plot" msgstr "Наклон графика" @@ -4625,7 +4630,7 @@ msgstr "Краткое описание выбранной команды" msgid "Short information about the data." msgstr "Краткая информация о данных" -#: udav/hint_dlg.cpp:62 +#: udav/hint_dlg.cpp:44 msgid "Show at startup" msgstr "Показать при запуске" @@ -4637,7 +4642,7 @@ msgstr "" "Показать калькулятор, который вычисляет текстовые формулы,\n" "которые могут содержать и переменные из скрипта." -#: mgllab/editor.cpp:525 mgllab/editor.cpp:527 +#: mgllab/editor.cpp:526 mgllab/editor.cpp:528 msgid "Show calculator window" msgstr "Показать окно калькулятора" @@ -4691,7 +4696,7 @@ msgstr "Показать справку по командам MGL (F1)." msgid "Show hidden plots" msgstr "Показать скрытые графики" -#: mgllab/help.cpp:307 +#: mgllab/help.cpp:284 msgid "Show hint on startup" msgstr "Показать подсказки при старте" @@ -5022,11 +5027,11 @@ msgstr "Поменять местами данные по направлению msgid "Swap parts" msgstr "Поменять местами" -#: src/exec_set.cpp:797 +#: src/exec_set.cpp:814 msgid "Switch on/off fog" msgstr "Вкл/выкл туман" -#: src/exec_set.cpp:799 +#: src/exec_set.cpp:816 msgid "Switch on/off gray-scale mode" msgstr "Вкл/выкл режим оттенков серого" @@ -5062,11 +5067,11 @@ msgstr "" msgid "Switch on/off mouse zoom of selected region." msgstr "Вкл/выкл приближение мышью выбранной области." -#: src/exec_set.cpp:830 +#: src/exec_set.cpp:847 msgid "Switch on/off to use ternary axis" msgstr "Указать тип тернарных координат или проекций" -#: src/exec_set.cpp:778 +#: src/exec_set.cpp:795 msgid "Switch on/off transparency" msgstr "Вкл/выкл прозрачность" @@ -5135,7 +5140,7 @@ msgstr "Текст на кривых" msgid "Text style" msgstr "Стиль текста" -#: udav/hint_dlg.cpp:48 mgllab/help.cpp:286 +#: src/window.cpp:400 msgid "" "The calculator can help you to put complex expression in the script. Just " "type the expression (which may depend on coordinates x,y,z and so on) and " @@ -5151,7 +5156,7 @@ msgid "" "Would you like to save it now?" msgstr "Текущий документ не сохранен. Сохранить сейчас?" -#: udav/hint_dlg.cpp:50 mgllab/help.cpp:288 +#: src/window.cpp:402 msgid "" "The special dialog (Edit|Insert|New Command) help you select the command, " "fill its arguments and put it into the script." @@ -5165,7 +5170,7 @@ msgid "" msgstr "Повторяющиеся или близкие точки при триангуляции" #. mglScrStr -#: src/base.cpp:245 +#: src/base.cpp:251 msgid "There is changing temporary data in script" msgstr "Попытка изменить временные данные в скрипте" @@ -5177,7 +5182,7 @@ msgstr "Есть примитивы, заданные вручную" msgid "There is no 'fmt' argument for this command" msgstr "Отсутствует 'fmt' аргумент для этой команды" -#: udav/text_pnl.cpp:137 mgllab/editor.cpp:680 +#: udav/text_pnl.cpp:137 mgllab/editor.cpp:681 msgid "There is no fitted formula." msgstr "Нет подобранной формулы." @@ -5190,7 +5195,7 @@ msgstr "Нет запроса. Выхожу.\n" msgid "There is no selection to evaluate." msgstr "Ничего не выделено для вычисления." -#: udav/hint_dlg.cpp:47 mgllab/help.cpp:285 +#: src/window.cpp:399 msgid "" "There is powerful calculator with a lot of special functions. You can use " "buttons or keyboard to type the expression. Also you can use existed " @@ -5201,22 +5206,22 @@ msgstr "" "переменные из скрипта." #. mglScrCmd -#: src/base.cpp:243 +#: src/base.cpp:249 msgid "There is too long string(s) in script" msgstr "Слишком длинная строка в скрипте" #. mglScrLong -#: src/base.cpp:244 +#: src/base.cpp:250 msgid "There is unbalanced ' in script" msgstr "Лишняя кавычка ' в скрипте" #. mglWarnSpc -#: src/base.cpp:241 +#: src/base.cpp:247 msgid "There is wrong argument(s) in script" msgstr "Неправильные аргументы команды в скрипте" #. mglScrArg -#: src/base.cpp:242 +#: src/base.cpp:248 msgid "There is wrong command(s) in script" msgstr "В скрипте неправильная команд(ы)" @@ -5355,7 +5360,7 @@ msgstr "UDAV - найти" msgid "UDAV - Go to slice" msgstr "UDAV - перейти к срезу" -#: udav/hint_dlg.cpp:55 +#: udav/hint_dlg.cpp:37 msgid "UDAV - Hint" msgstr "UDAV - подсказки" @@ -5527,7 +5532,7 @@ msgstr "Обновить список массивов данных" msgid "Upper border for determining color or alpha" msgstr "Верхняя граница для цвета или прозрачности" -#: utils/mglconv.cpp:83 +#: utils/mglconv.cpp:84 #, c-format msgid "Usage:\tmglconv [parameter(s)] scriptfile\n" msgstr "Использование:\tmglconv [параметр(ы)] имя_скрипта\n" @@ -5648,7 +5653,7 @@ msgstr "Ширина" msgid "Width of selected cells" msgstr "Ширины выбранных ячеек" -#: src/data.cpp:1427 +#: src/data.cpp:1490 #, c-format msgid "" "Widths are:\n" @@ -5667,7 +5672,7 @@ msgstr "Сетчатый график" msgid "Wire style" msgstr "Контур" -#: src/exec_set.cpp:839 +#: src/exec_set.cpp:856 msgid "Write current image to graphical file" msgstr "Сохранить текущий рисунок в файл" @@ -5748,7 +5753,17 @@ msgstr "" msgid "Yes" msgstr "Да" -#: udav/hint_dlg.cpp:36 mgllab/help.cpp:274 +#: src/window.cpp:404 +msgid "" +"You can concatenation of strings and numbers using `,` with out spaces (for " +"example, `'max(u)=',u.max,' a.u.'` or `'u=',!(1+i2)` for complex numbers). " +"Also you can get n-th symbol of the string using `[]` (for example, " +"`'abc'[1]` will give 'b'), or add a value to the last character of the " +"string using `+` (for example, `'abc'+3` will give 'abf'), or use it all " +"together." +msgstr "" + +#: src/window.cpp:388 msgid "" "You can copy the current image to clipboard by pressing Ctrl-Shift-C. Later " "you can paste it directly into yours document or presentation." @@ -5756,7 +5771,7 @@ msgstr "" "Текущий рисунок можно скопировать нажав Ctrl-Shift-C. Позже его можно " "вставить в документ или презентацию." -#: udav/hint_dlg.cpp:49 mgllab/help.cpp:287 +#: src/window.cpp:401 msgid "" "You can easily insert file or folder names, last fitted formula or numerical " "value of selection by using menu Edit|Insert." @@ -5764,7 +5779,7 @@ msgstr "" "Можно легко вставить имя файла, путь к папке, последнюю подобранную формулу " "и т.л., используя меню Правка|Вставить" -#: udav/hint_dlg.cpp:43 mgllab/help.cpp:281 +#: src/window.cpp:395 msgid "" "You can edit MGL file in any text editor. Also you can run it in console by " "help of commands: mglconv, mglview." @@ -5773,7 +5788,7 @@ msgstr "" "запустить (и просмотреть) прямо из консоли с помошью программ mglconv, " "mglview." -#: udav/hint_dlg.cpp:37 mgllab/help.cpp:275 +#: src/window.cpp:389 msgid "" "You can export image into a set of format (EPS, SVG, PNG, JPEG) by pressing " "right mouse button inside image and selecting 'Export as ...'." @@ -5781,7 +5796,7 @@ msgstr "" "Текущий рисунок можно экспортировать во множество форматов (EPS, SVG, PNG, " "JPEG и др.), просто нажав правой кнопкой на рисунке и выбрать 'Экспорт'" -#: udav/hint_dlg.cpp:41 mgllab/help.cpp:279 +#: src/window.cpp:393 msgid "" "You can put several plots in the same image by help of commands 'subplot' or " "'inplot'." @@ -5789,7 +5804,7 @@ msgstr "" "Рисунок может содержать несколько вставок (под-графиков) при использовании " "команд 'subplot', 'inplot' и пр." -#: udav/hint_dlg.cpp:51 mgllab/help.cpp:289 +#: src/window.cpp:403 msgid "" "You can put several plotting commands in the same line or in separate " "function, for highlighting all of them simultaneously." @@ -5798,7 +5813,7 @@ msgstr "" "разделителем ':' или в функцию. Группа графиков будет подсвечиваться и " "перемещаться как целое." -#: udav/hint_dlg.cpp:34 mgllab/help.cpp:272 +#: src/window.cpp:386 msgid "" "You can rotate/shift/zoom whole plot by mouse. Just press 'Rotate' " "toolbutton, click image and hold a mouse button: left button for rotation, " @@ -5808,7 +5823,7 @@ msgstr "" "кнопку 'Вращать' и удерживайте кнопку мыши: левую для вращения, правую для " "приближения/перспективы, среднюю для сдвига." -#: udav/hint_dlg.cpp:39 mgllab/help.cpp:277 +#: src/window.cpp:391 msgid "" "You can save the parameter of animation inside MGL script by using comment " "started from '##a ' or '##c ' for loops." @@ -5816,13 +5831,13 @@ msgstr "" "Параметры анимации можно сохранить внутри скрипта с помощью комментариев " "'##a' или '##c'." -#: udav/hint_dlg.cpp:38 mgllab/help.cpp:276 +#: src/window.cpp:390 msgid "" "You can setup colors for script highlighting in Property dialog. Just select " "menu item 'Settings/Properties'." msgstr "Расцветку скрипта можно настроить в диалоге 'Свойства'." -#: udav/hint_dlg.cpp:33 mgllab/help.cpp:271 +#: src/window.cpp:385 msgid "" "You can shift axis range by pressing middle button and moving mouse. Also, " "you can zoom in/out axis range by using mouse wheel." @@ -5830,7 +5845,7 @@ msgstr "" "Диапазон осей координат можно сместить нажав среднюю кнопку мыши, при этом " "колесо мыши приближает/отдаляет график." -#: udav/hint_dlg.cpp:46 mgllab/help.cpp:284 +#: src/window.cpp:398 msgid "" "You can type arbitrary expression as input argument for data or number. In " "last case (for numbers), the first value of data array is used." @@ -5838,7 +5853,7 @@ msgstr "" "Аргументом может быть любое выражение. Если требуется число, то будет " "использован первый элемент массива." -#: udav/hint_dlg.cpp:44 mgllab/help.cpp:282 +#: src/window.cpp:396 msgid "" "You can use command 'once on|off' for marking the block which should be " "executed only once. For example, this can be the block of large data reading/" @@ -5850,7 +5865,7 @@ msgstr "" "длительные вычисления и т.д. Нажмите F9 (меню 'Графика|Перезагрузить') для " "повторного выполнения этого блока команд." -#: udav/hint_dlg.cpp:45 mgllab/help.cpp:283 +#: src/window.cpp:397 msgid "" "You can use command 'stop' for terminating script parsing. It is useful if " "you don't want to execute a part of script." @@ -5858,7 +5873,7 @@ msgstr "" "Команда 'stop' останавливает выполение скрипта. Она полезна если Вы не " "хотите выполнять часть скрипта." -#: mgllab/help.cpp:273 +#: src/window.cpp:387 msgid "" "You may quickly draw the data from file. Just use: mgllab 'filename.dat' in " "command line." @@ -5866,14 +5881,6 @@ msgstr "" "Быстро построить данные из файла можно при использовании: mgllab 'filename." "dat'." -#: udav/hint_dlg.cpp:35 -msgid "" -"You may quickly draw the data from file. Just use: udav 'filename.dat' in " -"command line." -msgstr "" -"Быстро построить данные из файла можно при использовании: udav 'filename." -"dat'." - #: mgllab/dialogs.cpp:1529 msgid "You need to enter text!" msgstr "Необходимо ввести текст!" @@ -5942,7 +5949,7 @@ msgstr "Размер по Z" msgid "Z-slice from" msgstr "Z срез от" -#: src/exec_set.cpp:845 +#: src/exec_set.cpp:862 msgid "Zoom axis range" msgstr "Увеличить диапазон осей координат" @@ -5991,7 +5998,7 @@ msgstr "Уменьшить текст" msgid "Zoom out the picture" msgstr "Отдалить рисунок" -#: src/exec_set.cpp:844 +#: src/exec_set.cpp:861 msgid "Zoom plot region" msgstr "Приблизить область рисунка" @@ -6061,7 +6068,7 @@ msgid "attach light" msgstr "прикрепить свет" #. mglWarnFmt -#: src/base.cpp:238 +#: src/base.cpp:244 msgid "axis ranges are incompatible" msgstr "размеры осей неправильные" @@ -6102,7 +6109,7 @@ msgid "click at %g, %g, %g" msgstr "клик в %g, %g, %g" #. mglWarnCnt -#: src/base.cpp:234 +#: src/base.cpp:240 msgid "couldn't open file" msgstr "не могу открыть файл" @@ -6115,17 +6122,17 @@ msgid "cutting" msgstr "обрезание" #. ----------------------------------------------------------------------------- -#: src/base.cpp:225 +#: src/base.cpp:231 msgid "data dimension(s) is incompatible" msgstr "размеры данных несовместимы" #. mglWarnDim -#: src/base.cpp:226 +#: src/base.cpp:232 msgid "data dimension(s) is too small" msgstr "размеры данных слишком малы" #. mglWarnMem -#: src/base.cpp:230 +#: src/base.cpp:236 msgid "data values are zero" msgstr "значение данных равно нулю" @@ -6157,7 +6164,7 @@ msgid "factor" msgstr "множитель" #. mglWarnSize -#: src/base.cpp:237 +#: src/base.cpp:243 msgid "format is not supported for that build" msgstr "формат не поддерживается для этой сборки" @@ -6223,7 +6230,7 @@ msgid "left" msgstr "слева" #. mglWarnOpen -#: src/base.cpp:235 +#: src/base.cpp:241 msgid "light: ID is out of range" msgstr "light: ID вне диапазона" @@ -6271,7 +6278,7 @@ msgstr "" msgid "mgl_en" msgstr "mgl_ru" -#: utils/mglconv.cpp:82 +#: utils/mglconv.cpp:83 #, c-format msgid "" "mglconv convert mgl script to image file (default PNG).\n" @@ -6314,7 +6321,7 @@ msgid "min" msgstr "min" #. mglWarnLow -#: src/base.cpp:227 +#: src/base.cpp:233 msgid "minimal data value is negative" msgstr "минимальное значение отрицательно" @@ -6328,12 +6335,12 @@ msgid "name" msgstr "имя" #. mglWarnNeg -#: src/base.cpp:228 +#: src/base.cpp:234 msgid "no file or wrong data dimensions" msgstr "нет файла или неверные размеры" #. mglWarnZero -#: src/base.cpp:231 +#: src/base.cpp:237 msgid "no legend entries" msgstr "нет записей легенды" @@ -6355,12 +6362,12 @@ msgid "none or default" msgstr "нет или по умолчанию" #. mglWarnFile -#: src/base.cpp:229 +#: src/base.cpp:235 msgid "not enough memory" msgstr "не хватает памяти" #. mglWarnNull -#: src/base.cpp:240 +#: src/base.cpp:246 msgid "not enough space for plot" msgstr "не достаточно места для графика" @@ -6369,7 +6376,7 @@ msgid "not used" msgstr "не используется" #. mglWarnSlc -#: src/base.cpp:233 +#: src/base.cpp:239 msgid "number of contours is zero or negative" msgstr "число контуров меньше или равно нуля" @@ -6399,7 +6406,7 @@ msgid "plain" msgstr "карта" #. mglWarnTern -#: src/base.cpp:239 +#: src/base.cpp:245 msgid "pointer is NULL" msgstr "указатель равен NULL" @@ -6452,12 +6459,12 @@ msgid "save slides" msgstr "сохранить кадры" #. mglWarnLId -#: src/base.cpp:236 +#: src/base.cpp:242 msgid "size(s) is zero or negative" msgstr "размер(ы) меньше или равны нулю" #. mglWarnLeg -#: src/base.cpp:232 +#: src/base.cpp:238 msgid "slice value is out of range" msgstr "срез вне диапазона" @@ -6565,6 +6572,13 @@ msgstr "с шагом" msgid "y - yellow" msgstr "y - желтый" +#~ msgid "" +#~ "You may quickly draw the data from file. Just use: udav 'filename.dat' in " +#~ "command line." +#~ msgstr "" +#~ "Быстро построить данные из файла можно при использовании: udav 'filename." +#~ "dat'." + #~ msgid "Lower bound" #~ msgstr "Нижняя граница" diff --git a/mgllab/editor.cpp b/mgllab/editor.cpp index 6d1689c..589dcaf 100644 --- a/mgllab/editor.cpp +++ b/mgllab/editor.cpp @@ -109,7 +109,7 @@ bool is_num(const char *s) // number //----------------------------------------------------------------------------- char is_cmd(const char *s) // command { - register long i,n=strlen(s)+1; + long i,n=strlen(s)+1; char res=0, *w=new char[n]; strcpy(w,s); for(i=0;iCmdType(w); @@ -338,7 +338,7 @@ void load_file(const char *newfile, int ipos, ScriptWindow *e) char *t = textbuf->text(); #ifndef WIN32 - register size_t i,l=strlen(t); + size_t i,l=strlen(t); for(i=0;itext(t); #endif @@ -358,9 +358,10 @@ void save_file(const char *newfile, ScriptWindow *e) if (textbuf->savefile(newfile)) fl_alert(_("Error writing to file \'%s\':\n%s."), newfile, strerror(errno)); else - { filename = newfile; add_filename(filename.c_str(),e); } - changed = 0; - textbuf->call_modify_callbacks(); + { + filename = newfile; add_filename(filename.c_str(),e); + changed = 0; textbuf->call_modify_callbacks(); + } } //----------------------------------------------------------------------------- void undo_cb(Fl_Widget*, void* v) diff --git a/mgllab/help.cpp b/mgllab/help.cpp index 518cd1c..9661176 100644 --- a/mgllab/help.cpp +++ b/mgllab/help.cpp @@ -267,29 +267,6 @@ void ScriptWindow::mem_pressed(int kind) mem_init(); } //----------------------------------------------------------------------------- -const char *hints[] = { - _("You can shift axis range by pressing middle button and moving mouse. Also, you can zoom in/out axis range by using mouse wheel."), - _("You can rotate/shift/zoom whole plot by mouse. Just press 'Rotate' toolbutton, click image and hold a mouse button: left button for rotation, right button for zoom/perspective, middle button for shift."), - _("You may quickly draw the data from file. Just use: mgllab 'filename.dat' in command line."), - _("You can copy the current image to clipboard by pressing Ctrl-Shift-C. Later you can paste it directly into yours document or presentation."), - _("You can export image into a set of format (EPS, SVG, PNG, JPEG) by pressing right mouse button inside image and selecting 'Export as ...'."), - _("You can setup colors for script highlighting in Property dialog. Just select menu item 'Settings/Properties'."), - _("You can save the parameter of animation inside MGL script by using comment started from '##a ' or '##c ' for loops."), - _("New drawing never clears things drawn already. For example, you can make a surface with contour lines by calling commands 'surf' and 'cont' one after another (in any order). "), - _("You can put several plots in the same image by help of commands 'subplot' or 'inplot'."), - _("All indexes (of data arrays, subplots and so on) are always start from 0."), - _("You can edit MGL file in any text editor. Also you can run it in console by help of commands: mglconv, mglview."), - _("You can use command 'once on|off' for marking the block which should be executed only once. For example, this can be the block of large data reading/creating/handling. Press F9 (or menu item 'Graphics/Reload') to re-execute this block."), - _("You can use command 'stop' for terminating script parsing. It is useful if you don't want to execute a part of script."), - _("You can type arbitrary expression as input argument for data or number. In last case (for numbers), the first value of data array is used."), - _("There is powerful calculator with a lot of special functions. You can use buttons or keyboard to type the expression. Also you can use existed variables in the expression."), - _("The calculator can help you to put complex expression in the script. Just type the expression (which may depend on coordinates x,y,z and so on) and put it into the script."), - _("You can easily insert file or folder names, last fitted formula or numerical value of selection by using menu Edit|Insert."), - _("The special dialog (Edit|Insert|New Command) help you select the command, fill its arguments and put it into the script."), - _("You can put several plotting commands in the same line or in separate function, for highlighting all of them simultaneously."), - NULL -}; -//----------------------------------------------------------------------------- void cb_hint_prev(Fl_Widget*,void*); void cb_hint_next(Fl_Widget*,void*); class HintDlg : public GeneralDlg @@ -303,7 +280,7 @@ public: Fl_Button *o; w = new Fl_Double_Window(280, 265); cur=0; hint = new Fl_Help_View(10, 10, 260, 185); - hint->value(hints[0]); + hint->value(mgl_hints[0]); start = new Fl_Check_Button(10, 200, 260, 25, _("Show hint on startup")); o = new Fl_Button(10, 230, 80, 25, _("@<- Prev")); o->callback(cb_hint_prev); @@ -319,15 +296,15 @@ public: { pref.set("show_hint",start->value()); hide(); } void prev() { - int n=0; while(hints[n]) n++; + int n=0; while(mgl_hints[n]) n++; cur = cur>0?cur-1:n-1; - hint->value(hints[cur]); + hint->value(mgl_hints[cur]); } void next() { - int n=0; while(hints[n]) n++; + int n=0; while(mgl_hints[n]) n++; cur = curvalue(hints[cur]); + hint->value(mgl_hints[cur]); } } hint_dlg; //----------------------------------------------------------------------------- diff --git a/mgllab/mgllab.cpp b/mgllab/mgllab.cpp index 30d406c..8323cd8 100644 --- a/mgllab/mgllab.cpp +++ b/mgllab/mgllab.cpp @@ -19,10 +19,10 @@ #include #include #include "mgllab.h" -#include -#include -#include -#include +#include +#include +#include +#include //----------------------------------------------------------------------------- #ifndef MGL_DOC_DIR #ifdef WIN32 diff --git a/mgllab/mgllab.h b/mgllab/mgllab.h index fbaaee7..f6f2886 100644 --- a/mgllab/mgllab.h +++ b/mgllab/mgllab.h @@ -34,14 +34,14 @@ #include #include #include -#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include //----------------------------------------------------------------------------- #include "mgl2/Fl_MathGL.h" //----------------------------------------------------------------------------- diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 4f1a80c..f5364a3 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -13,10 +13,10 @@ endif(enable-dep-dll) if(WIN32) set(dest ${CMAKE_INSTALL_PREFIX}) -# install(FILES ${CMAKE_SOURCE_DIR}/scripts/FindMathGL2.cmake DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME mathgl2-config.cmake) + install(FILES ${CMAKE_SOURCE_DIR}/scripts/FindMathGL2.cmake DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME mathgl2-config.cmake) else(WIN32) set(dest ${MathGL_INSTALL_LIB_DIR}/cmake/mathgl2/) -# install(FILES ${CMAKE_SOURCE_DIR}/scripts/FindMathGL2.cmake DESTINATION ${MathGL_INSTALL_LIB_DIR}/cmake/mathgl2/ RENAME mathgl2-config.cmake) + install(FILES ${CMAKE_SOURCE_DIR}/scripts/FindMathGL2.cmake DESTINATION ${MathGL_INSTALL_LIB_DIR}/cmake/mathgl2/ RENAME mathgl2-config.cmake) endif(WIN32) #export(TARGETS MathGLTargets FILE "${PROJECT_BINARY_DIR}/MathGL2Targets.cmake") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 39d3ad5..ae6b0bd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ set(mgl_src fit.cpp font.cpp obj.cpp other.cpp parser.cpp pde.cpp pixel.cpp pixel_gen.cpp plot.cpp prim.cpp surf.cpp vect.cpp volume.cpp evalc.cpp s_hull/s_hull_pro.cpp window.cpp fractal.cpp - exec_dat.cpp exec_gr.cpp exec_set.cpp exec_prm.cpp + exec_dat.cpp exec_gr.cpp exec_set.cpp exec_prm.cpp c2mdual.c ) set(mgl_hdr diff --git a/src/addon.cpp b/src/addon.cpp index 82d231c..725aa16 100644 --- a/src/addon.cpp +++ b/src/addon.cpp @@ -234,10 +234,10 @@ void MGL_EXPORT mgl_difr_axial_old(dual *a,int n,int step,dual q,int Border,dual b[n-1] = b[n-4] + mreal(3)*(b[n-2]-b[n-3]); break; case -1: // exponent at border - b[n-1] = norm(b[n-3])norm(b[n-2]) ? b[n-2]*b[n-2]/b[n-3] : mreal(2)*b[n-2]-b[n-3]; break; case -2: // gaussian at border - b[n-1] = norm(b[n-3])norm(b[n-2]) ? pow(b[n-2]/b[n-3],3)*b[n-4] : b[n-4] + mreal(3)*(b[n-2]-b[n-3]); break; } } diff --git a/src/axis.cpp b/src/axis.cpp index 0e7f3b3..3ec57c0 100644 --- a/src/axis.cpp +++ b/src/axis.cpp @@ -395,18 +395,18 @@ void mglCanvas::LabelTicks(mglAxis &aa) if(aa.ch=='z') aa.v0 = aa.org.z; wchar_t buf[64]=L""; - mreal v,v0,v1,w=0; - int d,ds; if(aa.f) return; aa.txt.clear(); bool minus = mglchr(aa.stl.c_str(),'-') && !mglchr(aa.stl.c_str(),'+'); if(aa.dv==0 && aa.v1>0) // positive log-scale { - v0 = exp(M_LN10*floor(0.1+log10(aa.v1))); - ds = int(floor(0.1+log10(aa.v2/v0))/7)+1; - for(v=v0;v<=aa.v2*MGL_EPSILON;v*=10) if(v*MGL_EPSILON>=aa.v1) + mreal v1 = aa.v1, v2 = aa.v2; + if(v1>v2) { v1 = aa.v2; v2 = aa.v1; } + mreal v0 = exp(M_LN10*floor(0.1+log10(v1))); + int ds = int(floor(0.1+log10(v2/v0))/7)+1; + for(mreal v=v0;v<=v2*MGL_EPSILON;v*=10) if(v*MGL_EPSILON>=v1) { - d = int(floor(0.1+log10(v))); + int d = int(floor(0.1+log10(v))); if(d==0) wcscpy(buf,L"1"); else if(d==1) wcscpy(buf,L"10"); else if(d>0) mglprintf(buf,64,L"10^{%d}",d); @@ -417,11 +417,13 @@ void mglCanvas::LabelTicks(mglAxis &aa) } else if(aa.dv==0 && aa.v2<0) // negative log-scale { - v0 = -exp(M_LN10*floor(0.1+log10(-aa.v2))); - ds = int(floor(0.1+log10(aa.v1/v0))/7)+1; - for(v=v0;v>=aa.v1*MGL_EPSILON;v*=10) if(v*MGL_EPSILON<=aa.v2) + mreal v1 = aa.v1, v2 = aa.v2; + if(v1>v2) { v1 = aa.v2; v2 = aa.v1; } + mreal v0 = -exp(M_LN10*floor(0.1+log10(-v2))); + int ds = int(floor(0.1+log10(v1/v0))/7)+1; + for(mreal v=v0;v>=v1*MGL_EPSILON;v*=10) if(v*MGL_EPSILON<=v2) { - d = int(floor(0.1+log10(-v))); + int d = int(floor(0.1+log10(-v))); if(d==0) wcscpy(buf,minus?L"-1":L"\u22121"); else if(d==1) wcscpy(buf,minus?L"-10":L"\u221210"); else if(d>0) mglprintf(buf,64,minus?L"-10^{%d}":L"\u221210^{%d}",d); @@ -432,6 +434,7 @@ void mglCanvas::LabelTicks(mglAxis &aa) } else if(aa.dv) // ticks drawing { + mreal w=0; int kind=0; wchar_t s[32]=L""; if(aa.t.empty() && TuneTicks && !strchr(aa.stl.c_str(),'!')) @@ -439,7 +442,7 @@ void mglCanvas::LabelTicks(mglAxis &aa) if(((TuneTicks&1)==0 && kind==2) || ((TuneTicks&2)==0 && kind!=2)) kind=0; - v0 = mgl_isnan(aa.o) ? aa.v0 : aa.o; + mreal v0 = mgl_isnan(aa.o) ? aa.v0 : aa.o, v1; if(mgl_isnan(v0)) v0=0; if(aa.v2>aa.v1) { v1 = aa.v2; v0 = v0 - aa.dv*floor((v0-aa.v1)/aa.dv+1e-3); } @@ -448,9 +451,9 @@ void mglCanvas::LabelTicks(mglAxis &aa) if(v0+aa.dv!=v0 && v1+aa.dv!=v1) { - if(aa.t.empty()) for(v=v0;v<=v1;v+=aa.dv) + if(aa.t.empty()) for(mreal v=v0;v<=v1;v+=aa.dv) aa.AddLabel(mgl_tick_text(v,v0,aa.dv/100,w,kind,aa.fact,aa.d,aa.stl.c_str()),v); - else for(v=v0;v<=v1;v+=aa.dv) + else for(mreal v=v0;v<=v1;v+=aa.dv) { if(aa.t[0]!='&') mglprintf(buf, 64, aa.t.c_str(), fabs(v)0?1:-1; shift += ac.sh; + } if(dir=='x') { AdjustTicks(ax,fx!=0); aa = &ax; @@ -863,8 +872,16 @@ void mglCanvas::Labelw(char dir, const wchar_t *text, mreal pos, const char *opt mglPnt &pp = Pnt[kk]; if(pp.u<0 || (pp.u==0 && pp.v<0)) { pp.u=-pp.u; pp.v=-pp.v; pp.w=-pp.w; } - ff[0] = GetLabelPos(t, kk, *aa); strcat(font,ff); - text_plot(kk,text,font,-1.4,(ff[0]=='T'?0.3:0.35)+shift); + if(dir=='c' && ac.a.y!=0) + { + ff[0] = ac.a.y>0?'T':'t'; strcat(font,ff); + text_plot(kk,text,font,-1.4,ac.a.y>0?shift:0); + } + else + { + ff[0] = GetLabelPos(t, kk, *aa); strcat(font,ff); + text_plot(kk,text,font,-1.4,(ff[0]=='T'?0.3:0.35)+shift); + } } } LoadState(); @@ -986,10 +1003,10 @@ void mglCanvas::Colorbar(const char *sch, mreal x, mreal y, mreal w, mreal h) long n=256, s = AddTexture(sch); mglData v(n); - if(ac.d || Min.c*Max.c<=0) v.Fill(Min.c,Max.c); - else if(Max.c>Min.c && Min.c>0) + if(ac.d || fa==0 || Min.c*Max.c<=0) v.Fill(Min.c,Max.c); + else if(Min.c>0) { v.Fill(log(Min.c), log(Max.c)); v.Modify("exp(u)"); } - else if(Min.cv(i))*2-1; p1 = p2 = mglPoint((ss*d+1)*w+x, (ss*d+1)*h+y, s3); @@ -1058,18 +1077,11 @@ void mglCanvas::colorbar(HCDT vv, const mreal *c, int where, mreal x, mreal y, m case 3: p1.y = y; p2.y = y+0.1*h; break; default:p1.x = x-0.1*w; p2.x = x; break; } - long n1 = AddPnt(&M, p1,c[i]), n2 = AddPnt(&M, p2,c[i]); - d = GetA(vv->v(i+1))*2-1; - p1 = p2 = mglPoint((ss*d+1)*w+x, (ss*d+1)*h+y, s3); - switch(where) - { - case 1: p1.x = x; p2.x = x+0.1*w; break; - case 2: p1.y = y-0.1*h; p2.y = y; break; - case 3: p1.y = y; p2.y = y+0.1*h; break; - default:p1.x = x-0.1*w; p2.x = x; break; - } - quad_plot(n1,n2, AddPnt(&M, p1,c[i]), AddPnt(&M, p2,c[i])); + AddPntQ(kq+i, &M, p1,c[i]); + AddPntQ(kq+i+n, &M, p2,c[i]); } + for(long i=0;iWidth(text,(font&&*font)?font:FontDef)/20.16; } mreal mglBase::TextWidth(const wchar_t *text, const char *font, mreal size) const { return (size<0?-size*FontSize:size)*font_factor*fnt->Width(text,(font&&*font)?font:FontDef)/20.16; } +mreal mglBase::TextHeight(const char *text, const char *font, mreal size) const +{ float y1,y2; fnt->Width(text,(font&&*font)?font:FontDef,&y1,&y2); + return (size<0?-size*FontSize:size)*font_factor*(y2-y1)/20.16; } +mreal mglBase::TextHeight(const wchar_t *text, const char *font, mreal size) const +{ float y1,y2; fnt->Width(text,(font&&*font)?font:FontDef,&y1,&y2); + return (size<0?-size*FontSize:size)*font_factor*(y2-y1)/20.16; } mreal mglBase::TextHeight(const char *font, mreal size) const { return (size<0?-size*FontSize:size)*font_factor*fnt->Height(font?font:FontDef)/20.16; } void mglBase::AddActive(long k,int n) @@ -1287,14 +1293,20 @@ char mglBase::SetPenPal(const char *p, long *Id, bool pal) } //----------------------------------------------------------------------------- // keep this for restore default mask -MGL_EXPORT uint64_t mgl_mask_def[16]={0x000000FF00000000, 0x080808FF08080808, 0x0000FF00FF000000, 0x0000007700000000, - 0x0000182424180000, 0x0000183C3C180000, 0x00003C24243C0000, 0x00003C3C3C3C0000, - 0x0000060990600000, 0x0060584658600000, 0x00061A621A060000, 0x0000005F00000000, - 0x0008142214080000, 0x00081C3E1C080000, 0x8142241818244281, 0x0000001824420000}; -MGL_EXPORT uint64_t mgl_mask_val[16]={0x000000FF00000000, 0x080808FF08080808, 0x0000FF00FF000000, 0x0000007700000000, - 0x0000182424180000, 0x0000183C3C180000, 0x00003C24243C0000, 0x00003C3C3C3C0000, - 0x0000060990600000, 0x0060584658600000, 0x00061A621A060000, 0x0000005F00000000, - 0x0008142214080000, 0x00081C3E1C080000, 0x8142241818244281, 0x0000001824420000}; +MGL_EXPORT uint64_t mgl_mask_def[16]={ + 0x000000FF00000000, 0x080808FF08080808, 0x0000FF00FF000000, 0x0000000F00000000, + 0x0000182424180000, 0x0000183C3C180000, 0x00003C24243C0000, 0x00003C3C3C3C0000, + 0x0000060990600000, 0x0060584658600000, 0x00061A621A060000, 0x0000002700000000, + 0x0008083E08080000, 0x0139010010931000, 0x0000001818000000, 0x101010FF010101FF}; +MGL_EXPORT uint64_t mgl_mask_val[16]={ + 0x000000FF00000000, 0x080808FF08080808, 0x0000FF00FF000000, 0x0000000F00000000, + 0x0000182424180000, 0x0000183C3C180000, 0x00003C24243C0000, 0x00003C3C3C3C0000, + 0x0000060990600000, 0x0060584658600000, 0x00061A621A060000, 0x0000002700000000, + 0x0008083E08080000, 0x0139010010931000, 0x0000001818000000, 0x101010FF010101FF}; +// 0x000000FF00000000, 0x080808FF08080808, 0x0000FF00FF000000, 0x0000007700000000, +// 0x0000182424180000, 0x0000183C3C180000, 0x00003C24243C0000, 0x00003C3C3C3C0000, +// 0x0000060990600000, 0x0060584658600000, 0x00061A621A060000, 0x0000005F00000000, +// 0x0008142214080000, 0x00081C3E1C080000, 0x8142241818244281, 0x0000001824420000}; void mglBase::SetMask(const char *p) { mask = MGL_SOLID_MASK; // reset to solid face diff --git a/src/c2mdual.c b/src/c2mdual.c new file mode 100644 index 0000000..c70c54a --- /dev/null +++ b/src/c2mdual.c @@ -0,0 +1,8 @@ +#include "mgl2/define.h" + +#if MGL_HAVE_C99_COMPLEX +MGL_EXPORT dual mdual2c(cmdual c) +{ return c.re+1.0i*c.im; } +MGL_EXPORT cmdual c2mdual(dual c) +{ cmdual r; r.re=creal(c); r.im=cimag(c); return r; } +#endif diff --git a/src/canvas.cpp b/src/canvas.cpp index c007513..3c5abbe 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -522,21 +522,22 @@ pthread_mutex_lock(&mutexPtx); if(strchr(font,'@')) // draw box around text { long k1,k2,k3,k4; mglPnt pt; mglPoint pp; - w = fnt->Width(text,font); h = fnt->Height(font); + float y1, y2; + w = fnt->Width(text,font, &y1,&y2); h = fnt->Height(font); float d=-w*align/2.-h*0.2; w+=h*0.4; - pt = q; pp.Set(d,-h*0.4); PostScale(&Bt,pp); + pt = q; pp.Set(d,y1-h*0.2); PostScale(&Bt,pp); pt.x=pt.xx=pp.x; pt.y=pt.yy=pp.y; #pragma omp critical(pnt) {k1=Pnt.size(); MGL_PUSH(Pnt,pt,mutexPnt);} - pt = q; pp.Set(w+d,-h*0.4); PostScale(&Bt,pp); + pt = q; pp.Set(w+d,y1-h*0.2); PostScale(&Bt,pp); pt.x=pt.xx=pp.x; pt.y=pt.yy=pp.y; #pragma omp critical(pnt) {k2=Pnt.size(); MGL_PUSH(Pnt,pt,mutexPnt);} - pt = q; pp.Set(d,h*1.2); PostScale(&Bt,pp); + pt = q; pp.Set(d,y2+h*0.2); PostScale(&Bt,pp); pt.x=pt.xx=pp.x; pt.y=pt.yy=pp.y; #pragma omp critical(pnt) {k3=Pnt.size(); MGL_PUSH(Pnt,pt,mutexPnt);} - pt = q; pp.Set(w+d,h*1.2); PostScale(&Bt,pp); + pt = q; pp.Set(w+d,y2+h*0.2); PostScale(&Bt,pp); pt.x=pt.xx=pp.x; pt.y=pt.yy=pp.y; #pragma omp critical(pnt) {k4=Pnt.size(); MGL_PUSH(Pnt,pt,mutexPnt);} diff --git a/src/complex.cpp b/src/complex.cpp index 4450a24..a52241d 100644 --- a/src/complex.cpp +++ b/src/complex.cpp @@ -86,10 +86,9 @@ void MGL_EXPORT mglStartThreadV(void *(*func)(void *), long n, dual *a, const vo } } //----------------------------------------------------------------------------- -mdual MGL_EXPORT_CONST mgl_expi(dual a) +cmdual MGL_EXPORT_CONST mgl_expi(mdual a) { - dual r = exp(dual(0,1)*dual(a)); - return r.real()+r.imag()*mgl_I; + return mdual(exp(dual(0,1)*dual(a))); } //----------------------------------------------------------------------------- static void *mgl_csmth_x(void *par) @@ -103,14 +102,14 @@ static void *mgl_csmth_x(void *par) #pragma omp parallel for #endif for(long i=t->id;in;i+=mglNumThr) - { - long j = i%nx; - if(j-kind<0) j = i+kind-j; - else if(j+kind>nx-1) j = i+nx-1-j-kind; - else j=i; - for(long k=-kind;k<=kind;k++) b[i] += a[j+k]/mreal(2*kind+1); - } - else + if(mgl_isnum(a[i])) // bypass NAN values + { + long j = i%nx, nk = 2*kind+1; + for(long k=-kind;k<=kind;k++) + if(j+k>=0 && j+kid;in;i+=mglNumThr) - { - long j = (i/nx)%ny; - if(j-kind<0) j = i+(kind-j)*nx; - else if(j+kind>ny-1) j = i+(ny-1-j-kind)*nx; - else j=i; - for(long k=-kind;k<=kind;k++) b[i] += a[j+k*nx]/mreal(2*kind+1); - } + if(mgl_isnum(a[i])) // bypass NAN values + { + long j = (i/nx)%ny, nk = 2*kind+1; + for(long k=-kind;k<=kind;k++) + if(j+k>=0 && j+kid;in;i+=mglNumThr) - { - long j = i/nn; - if(j-kind<0) j = i+(kind-j)*nn; - else if(j+kind>nz-1) j = i+(nz-1-j-kind)*nn; - else j=i; - for(long k=-kind;k<=kind;k++) b[i] += a[j+k*nn]/mreal(2*kind+1); - } + if(mgl_isnum(a[i])) // bypass NAN values + { + long j = i/nn, nk = 2*kind+1; + for(long k=-kind;k<=kind;k++) + if(j+k>=0 && j+knx,ny=d->ny,nz=d->nz; // if(Type == SMOOTH_NONE) return; long p[3]={nx,ny,Type}; dual *b = new dual[nx*ny*nz]; - // ����������� �� x memset(b,0,nx*ny*nz*sizeof(dual)); - if(nx>4 && strchr(dirs,'x')) + if(nx>4 && xdir) { mglStartThreadC(mgl_csmth_x,0,nx*ny*nz,b,d->a,0,p); memcpy(d->a,b,nx*ny*nz*sizeof(dual)); memset(b,0,nx*ny*nz*sizeof(dual)); } - if(ny>4 && strchr(dirs,'y')) + if(ny>4 && ydir) { mglStartThreadC(mgl_csmth_y,0,nx*ny*nz,b,d->a,0,p); memcpy(d->a,b,nx*ny*nz*sizeof(dual)); memset(b,0,nx*ny*nz*sizeof(dual)); } - if(nz>4 && strchr(dirs,'z')) + if(nz>4 && zdir) { mglStartThreadC(mgl_csmth_z,0,nx*ny*nz,b,d->a,0,p); memcpy(d->a,b,nx*ny*nz*sizeof(dual)); @@ -640,14 +639,13 @@ dual MGL_EXPORT mglSpline3C(const dual *a, long nx, long ny, long nz, mreal x, m dual MGL_EXPORT mglLinearC(const dual *a, long nx, long ny, long nz, mreal x, mreal y, mreal z) { return mglLineart(a,nx,ny,nz,x,y,z); } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_datac_spline(HCDT d, mreal x,mreal y,mreal z) +cmdual MGL_EXPORT mgl_datac_spline(HCDT d, mreal x,mreal y,mreal z) { const mglDataC *dd=dynamic_cast(d); - dual r = dd ? mglSpline3st(dd->a,dd->nx,dd->ny,dd->nz,x,y,z) : d->value(x,y,z); - return r.real()+r.imag()*mgl_I; + return mdual(dd ? mglSpline3st(dd->a,dd->nx,dd->ny,dd->nz,x,y,z) : d->value(x,y,z)); } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_datac_spline_ext(HCDT d, mreal x,mreal y,mreal z, dual *dx,dual *dy,dual *dz) +cmdual MGL_EXPORT mgl_datac_spline_ext(HCDT d, mreal x,mreal y,mreal z, dual *dx,dual *dy,dual *dz) { const mglDataC *dd=dynamic_cast(d); if(!dd) @@ -657,18 +655,17 @@ mdual MGL_EXPORT mgl_datac_spline_ext(HCDT d, mreal x,mreal y,mreal z, dual *dx, if(dx) *dx=rx; if(dy) *dy=ry; if(dz) *dz=rz; - return res; + return mdual(res); } - dual r = mglSpline3t(dd->a,dd->nx,dd->ny,dd->nz,x,y,z,dx,dy,dz); - return r.real()+r.imag()*mgl_I; + return mdual(mglSpline3t(dd->a,dd->nx,dd->ny,dd->nz,x,y,z,dx,dy,dz)); } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_datac_spline_(uintptr_t *d, mreal *x,mreal *y,mreal *z) +cmdual MGL_EXPORT mgl_datac_spline_(uintptr_t *d, mreal *x,mreal *y,mreal *z) { return mgl_datac_spline(_DA_(d),*x,*y,*z); } -mdual MGL_EXPORT mgl_datac_spline_ext_(uintptr_t *d, mreal *x,mreal *y,mreal *z, dual *dx,dual *dy,dual *dz) +cmdual MGL_EXPORT mgl_datac_spline_ext_(uintptr_t *d, mreal *x,mreal *y,mreal *z, dual *dx,dual *dy,dual *dz) { return mgl_datac_spline_ext(_DA_(d),*x,*y,*z,dx,dy,dz); } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_datac_linear_ext(HCDT d, mreal x,mreal y,mreal z, dual *dx,dual *dy,dual *dz) +cmdual MGL_EXPORT mgl_datac_linear_ext(HCDT d, mreal x,mreal y,mreal z, mdual *dx,mdual *dy,mdual *dz) { long kx=long(x), ky=long(y), kz=long(z); dual b0,b1; @@ -680,7 +677,7 @@ mdual MGL_EXPORT mgl_datac_linear_ext(HCDT d, mreal x,mreal y,mreal z, dual *dx, if(dx) *dx=rx; if(dy) *dy=ry; if(dz) *dz=rz; - return res; + return mdual(res); } long nx=dd->nx, ny=dd->ny, nz=dd->nz, dn=ny>1?nx:0; @@ -712,15 +709,14 @@ mdual MGL_EXPORT mgl_datac_linear_ext(HCDT d, mreal x,mreal y,mreal z, dual *dx, if(dx) *dx = kx>=0?aa[1]-aa[0]:0; if(dy) *dy = ky>=0?aa[dn]-aa[0]:0; if(dz) *dz = b1-b0; - dual r = b0 + z*(b1-b0); - return r.real()+r.imag()*mgl_I; + return mdual(b0 + z*(b1-b0)); } -mdual MGL_EXPORT mgl_datac_linear(HCDT d, mreal x,mreal y,mreal z) +cmdual MGL_EXPORT mgl_datac_linear(HCDT d, mreal x,mreal y,mreal z) { return mgl_datac_linear_ext(d, x,y,z, 0,0,0); } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_datac_linear_(uintptr_t *d, mreal *x,mreal *y,mreal *z) +cmdual MGL_EXPORT mgl_datac_linear_(uintptr_t *d, mreal *x,mreal *y,mreal *z) { return mgl_datac_linear(_DA_(d),*x,*y,*z); } -mdual MGL_EXPORT mgl_datac_linear_ext_(uintptr_t *d, mreal *x,mreal *y,mreal *z, dual *dx,dual *dy,dual *dz) +cmdual MGL_EXPORT mgl_datac_linear_ext_(uintptr_t *d, mreal *x,mreal *y,mreal *z, mdual *dx,mdual *dy,mdual *dz) { return mgl_datac_linear_ext(_DA_(d),*x,*y,*z,dx,dy,dz); } //----------------------------------------------------------------------------- long MGL_NO_EXPORT mgl_powers(long N, const char *how); @@ -875,23 +871,23 @@ void MGL_EXPORT mgl_datac_set_value(HADT dat, dual v, long i, long j, long k) void MGL_EXPORT mgl_datac_set_value_(uintptr_t *d, dual *v, int *i, int *j, int *k) { mgl_datac_set_value(_DC_,*v,*i,*j,*k); } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_datac_get_value(HCDT dat, long i, long j, long k) +cmdual MGL_EXPORT mgl_datac_get_value(HCDT dat, long i, long j, long k) { long nx=dat->GetNx(), ny=dat->GetNy(), i0=i+nx*(j+ny*k); if(i<0 || i>=nx || j<0 || j>=ny || k<0 || k>=dat->GetNz()) - return NAN; + return mdual(NAN); const mglDataC *d = dynamic_cast(dat); - dual r = d ? d->a[i0] : dual(dat->vthr(i0),0); - return r.real()+r.imag()*mgl_I; + return mdual(d ? d->a[i0] : dual(dat->vthr(i0),0)); } -mdual MGL_EXPORT mgl_datac_get_value_(uintptr_t *d, int *i, int *j, int *k) +cmdual MGL_EXPORT mgl_datac_get_value_(uintptr_t *d, int *i, int *j, int *k) { return mgl_datac_get_value(_DA_(d),*i,*j,*k); } //----------------------------------------------------------------------------- -MGL_EXPORT dual *mgl_datac_data(HADT dat) { return dat->a; } +MGL_EXPORT mdual *mgl_datac_data(HADT dat) +{ return reinterpret_cast(dat->a); } //----------------------------------------------------------------------------- -MGL_EXPORT dual *mgl_datac_value(HADT dat, long i,long j,long k) +MGL_EXPORT mdual *mgl_datac_value(HADT dat, long i,long j,long k) { long ii=i*dat->nx*(j+dat->ny*k); - return ii>=0 && iiGetNN() ? dat->a+ii : 0; } + return ii>=0 && iiGetNN() ? reinterpret_cast(dat->a+ii) : 0; } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_join(HADT d, HCDT v) { @@ -921,7 +917,7 @@ void MGL_EXPORT mgl_datac_join(HADT d, HCDT v) void MGL_EXPORT mgl_datac_join_(uintptr_t *d, uintptr_t *val) { mgl_datac_join(_DC_,_DA_(val)); } //----------------------------------------------------------------------------- -void MGL_EXPORT mgl_datac_put_val(HADT d, dual val, long xx, long yy, long zz) +void MGL_EXPORT mgl_datac_put_val(HADT d, mdual val, long xx, long yy, long zz) { long nx=d->nx, ny=d->ny, nz=d->nz; if(xx>=nx || yy>=ny || zz>=nz) return; @@ -1061,7 +1057,7 @@ void MGL_EXPORT mgl_datac_put_dat(HADT d, HCDT v, long xx, long yy, long zz) else a[xx+nx*(yy+ny*zz)] = vv; } //----------------------------------------------------------------------------- -void MGL_EXPORT mgl_datac_put_val_(uintptr_t *d, dual *val, int *i, int *j, int *k) +void MGL_EXPORT mgl_datac_put_val_(uintptr_t *d, mdual *val, int *i, int *j, int *k) { mgl_datac_put_val(_DC_,*val, *i,*j,*k); } void MGL_EXPORT mgl_datac_put_dat_(uintptr_t *d, uintptr_t *val, int *i, int *j, int *k) { mgl_datac_put_dat(_DC_,_DA_(val), *i,*j,*k); } @@ -1162,10 +1158,10 @@ HADT MGL_EXPORT mgl_gsplinec_init(HCDT x, HCDT v) uintptr_t MGL_EXPORT mgl_gsplinec_init_(uintptr_t *x, uintptr_t *v) { return uintptr_t(mgl_gspline_init(_DA_(x),_DA_(v))); } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_gsplinec(HCDT c, mreal dx, dual *d1, dual *d2) +cmdual MGL_EXPORT mgl_gsplinec(HCDT c, mreal dx, mdual *d1, mdual *d2) { long i=0, n = c->GetNx(); - if(n%5) return NAN; // not the table of coefficients + if(n%5) return mdual(NAN); // not the table of coefficients while(dx>c->v(5*i) && iv(5*i); i++; } dual res; const mglDataC *d = dynamic_cast(c); @@ -1182,9 +1178,9 @@ mdual MGL_EXPORT mgl_gsplinec(HCDT c, mreal dx, dual *d1, dual *d2) if(d2) *d2 = 2*c->v(5*i+3)+6*dx*c->v(5*i+4); res = c->v(5*i+1)+dx*(c->v(5*i+2)+dx*(c->v(5*i+3)+dx*c->v(5*i+4))); } - return res.real()+res.imag()*mgl_I; + return mdual(res); } -mdual MGL_EXPORT mgl_gsplinec_(uintptr_t *c, mreal *dx, dual *d1, dual *d2) +cmdual MGL_EXPORT mgl_gsplinec_(uintptr_t *c, mreal *dx, mdual *d1, mdual *d2) { return mgl_gsplinec(_DA_(c),*dx,d1,d2); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_refill_gs(HADT dat, HCDT xdat, HCDT vdat, mreal x1, mreal x2, long sl) diff --git a/src/complex_ex.cpp b/src/complex_ex.cpp index dd8aed8..718f7ee 100644 --- a/src/complex_ex.cpp +++ b/src/complex_ex.cpp @@ -503,11 +503,11 @@ void MGL_EXPORT mgl_datac_mul_dat(HADT d, HCDT a) } } //----------------------------------------------------------------------------- -void MGL_EXPORT mgl_datac_mul_num(HADT d, dual a) +void MGL_EXPORT mgl_datac_mul_num(HADT d, mdual a) { long n=d->GetNN(); #pragma omp parallel for - for(long i=0;ia[i] *= a; + for(long i=0;ia[i] *= dual(a); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_div_dat(HADT d, HCDT a) @@ -537,11 +537,11 @@ void MGL_EXPORT mgl_datac_div_dat(HADT d, HCDT a) } } //----------------------------------------------------------------------------- -void MGL_EXPORT mgl_datac_div_num(HADT d, dual a) +void MGL_EXPORT mgl_datac_div_num(HADT d, mdual a) { long n=d->GetNN(); #pragma omp parallel for - for(long i=0;ia[i] /= a; + for(long i=0;ia[i] /= dual(a); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_add_dat(HADT d, HCDT a) @@ -571,11 +571,11 @@ void MGL_EXPORT mgl_datac_add_dat(HADT d, HCDT a) } } //----------------------------------------------------------------------------- -void MGL_EXPORT mgl_datac_add_num(HADT d, dual a) +void MGL_EXPORT mgl_datac_add_num(HADT d, mdual a) { long n=d->GetNN(); #pragma omp parallel for - for(long i=0;ia[i] += a; + for(long i=0;ia[i] += dual(a); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_sub_dat(HADT d, HCDT a) @@ -605,21 +605,21 @@ void MGL_EXPORT mgl_datac_sub_dat(HADT d, HCDT a) } } //----------------------------------------------------------------------------- -void MGL_EXPORT mgl_datac_sub_num(HADT d, dual a) +void MGL_EXPORT mgl_datac_sub_num(HADT d, mdual a) { long n=d->GetNN(); #pragma omp parallel for - for(long i=0;ia[i] -= a; + for(long i=0;ia[i] -= dual(a); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_mul_dat_(uintptr_t *d, uintptr_t *b) { mgl_datac_mul_dat(_DC_, _DA_(b)); } void MGL_EXPORT mgl_datac_div_dat_(uintptr_t *d, uintptr_t *b) { mgl_datac_div_dat(_DC_, _DA_(b)); } void MGL_EXPORT mgl_datac_add_dat_(uintptr_t *d, uintptr_t *b) { mgl_datac_add_dat(_DC_, _DA_(b)); } void MGL_EXPORT mgl_datac_sub_dat_(uintptr_t *d, uintptr_t *b) { mgl_datac_sub_dat(_DC_, _DA_(b)); } -void MGL_EXPORT mgl_datac_mul_num_(uintptr_t *d, dual *b) { mgl_datac_mul_num(_DC_, *b); } -void MGL_EXPORT mgl_datac_div_num_(uintptr_t *d, dual *b) { mgl_datac_div_num(_DC_, *b); } -void MGL_EXPORT mgl_datac_add_num_(uintptr_t *d, dual *b) { mgl_datac_add_num(_DC_, *b); } -void MGL_EXPORT mgl_datac_sub_num_(uintptr_t *d, dual *b) { mgl_datac_sub_num(_DC_, *b); } +void MGL_EXPORT mgl_datac_mul_num_(uintptr_t *d, mdual *b) { mgl_datac_mul_num(_DC_, *b); } +void MGL_EXPORT mgl_datac_div_num_(uintptr_t *d, mdual *b) { mgl_datac_div_num(_DC_, *b); } +void MGL_EXPORT mgl_datac_add_num_(uintptr_t *d, mdual *b) { mgl_datac_add_num(_DC_, *b); } +void MGL_EXPORT mgl_datac_sub_num_(uintptr_t *d, mdual *b) { mgl_datac_sub_num(_DC_, *b); } //----------------------------------------------------------------------------- HADT MGL_EXPORT mgl_datac_section(HCDT dat, HCDT ids, char dir, mreal val) { diff --git a/src/complex_io.cpp b/src/complex_io.cpp index 0080a2a..31133bc 100644 --- a/src/complex_io.cpp +++ b/src/complex_io.cpp @@ -51,7 +51,7 @@ uintptr_t MGL_EXPORT mgl_create_datac_file_(const char *fname,int l) void MGL_EXPORT mgl_delete_datac_(uintptr_t *d) { if(_DC_) delete _DC_; } //----------------------------------------------------------------------------- -mdual MGL_EXPORT mgl_atoc(const char *s, int adv) +cmdual MGL_EXPORT mgl_atoc(const char *s, int adv) { double re=0,im=0; size_t ll=strlen(s); while(s[ll]<=' ') ll--; @@ -81,7 +81,7 @@ mdual MGL_EXPORT mgl_atoc(const char *s, int adv) else { re=atof(s); im=0; } } } - return re+im*mgl_I; + return mdual(re,im); } //----------------------------------------------------------------------------- void mglFromStr(HADT d,char *buf,long NX,long NY,long NZ) @@ -201,18 +201,18 @@ void MGL_EXPORT mgl_datac_set_double(HADT d, const double *A,long NX,long NY,lon for(long i=0;ia[i] = A[i]; } //----------------------------------------------------------------------------- -void MGL_EXPORT mgl_datac_set_complex(HADT d, const dual *A,long NX,long NY,long NZ) +void MGL_EXPORT mgl_datac_set_complex(HADT d, const mdual *A,long NX,long NY,long NZ) { if(NX<=0 || NY<=0 || NZ<=0) return; mgl_datac_create(d, NX,NY,NZ); if(!A) return; - memcpy(d->a,A,NX*NY*NZ*sizeof(float)); + memcpy(d->a,reinterpret_cast(A),NX*NY*NZ*sizeof(float)); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_set_float_(uintptr_t *d, const float *A,int *NX,int *NY,int *NZ) { mgl_datac_set_float(_DC_,A,*NX,*NY,*NZ); } void MGL_EXPORT mgl_datac_set_double_(uintptr_t *d, const double *A,int *NX,int *NY,int *NZ) { mgl_datac_set_double(_DC_,A,*NX,*NY,*NZ); } -void MGL_EXPORT mgl_datac_set_complex_(uintptr_t *d, const dual *A,int *NX,int *NY,int *NZ) +void MGL_EXPORT mgl_datac_set_complex_(uintptr_t *d, const mdual *A,int *NX,int *NY,int *NZ) { mgl_datac_set_complex(_DC_,A,*NX,*NY,*NZ); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_rearrange(HADT d, long mx,long my,long mz) @@ -441,18 +441,18 @@ static void *mgl_cfill_x(void *par) } return 0; } -void MGL_EXPORT mgl_datac_fill(HADT d, dual x1,dual x2,char dir) +void MGL_EXPORT mgl_datac_fill(HADT d, mdual x1, mdual x2,char dir) { if(mgl_isnan(x2)) x2=x1; if(dir<'x' || dir>'z') dir='x'; long par[2]={d->nx,d->ny}; - dual b[2]={x1,x2-x1}; + dual b[2]={x1,dual(x2)-dual(x1)}; if(dir=='x') b[1] *= d->nx>1 ? 1./(d->nx-1):0; if(dir=='y') b[1] *= d->ny>1 ? 1./(d->ny-1):0; if(dir=='z') b[1] *= d->nz>1 ? 1./(d->nz-1):0; mglStartThreadC(mgl_cfill_x,0,d->nx*d->ny*d->nz,d->a,b,0,par,0,0,0,&dir); } -void MGL_EXPORT mgl_datac_fill_(uintptr_t *d, dual *x1,dual *x2,const char *dir,int) +void MGL_EXPORT mgl_datac_fill_(uintptr_t *d, mdual *x1, mdual *x2, const char *dir,int) { mgl_datac_fill(_DC_,*x1,*x2,*dir); } //----------------------------------------------------------------------------- void MGL_EXPORT mgl_datac_squeeze(HADT d, long rx,long ry,long rz,long smooth) @@ -516,7 +516,6 @@ void MGL_EXPORT mgl_datac_extend(HADT d, long n1, long n2) mx = -n1; my = n2<0 ? -n2 : nx; mz = n2<0 ? nx : ny; if(n2>0 && ny==1) mz = n2; b = new dual[mx*my*mz]; - dual v; if(n2<0) #pragma omp parallel for collapse(2) for(long j=0;jid;in;i+=mglNumThr) - { - long j = i%nx; - if(j-kind<0) j = i+kind-j; - else if(j+kind>nx-1) j = i+nx-1-j-kind; - else j=i; - for(long k=-kind;k<=kind;k++) b[i] += a[j+k]/(2*kind+1); - } - else + if(mgl_isnum(a[i])) // bypass NAN values + { + long j = i%nx, nk = 2*kind+1; + for(long k=-kind;k<=kind;k++) + if(j+k>=0 && j+kid;in;i+=mglNumThr) + { + long j = i%nx; + mreal v = (j>0 && jid;in;i+=mglNumThr) + { + long j = i%nx; + mreal v = (j>0 && ja[i]?v:a[i]; + } if(delta>0) #if !MGL_HAVE_PTHREAD #pragma omp parallel for @@ -202,14 +222,14 @@ static void *mgl_smth_y(void *par) #pragma omp parallel for #endif for(long i=t->id;in;i+=mglNumThr) - { - long j = (i/nx)%ny; - if(j-kind<0) j = i+(kind-j)*nx; - else if(j+kind>ny-1) j = i+(ny-1-j-kind)*nx; - else j=i; - for(long k=-kind;k<=kind;k++) b[i] += a[j+k*nx]/(2*kind+1); - } - else + if(mgl_isnum(a[i])) // bypass NAN values + { + long j = (i/nx)%ny, nk = 2*kind+1; + for(long k=-kind;k<=kind;k++) + if(j+k>=0 && j+kid;in;i+=mglNumThr) + { + long j = (i/nx)%ny; + mreal v = (j>0 && jid;in;i+=mglNumThr) + { + long j = (i/nx)%ny; + mreal v = (j>0 && ja[i]?v:a[i]; + } if(delta>0) #if !MGL_HAVE_PTHREAD #pragma omp parallel for @@ -242,14 +282,14 @@ static void *mgl_smth_z(void *par) #pragma omp parallel for #endif for(long i=t->id;in;i+=mglNumThr) - { - long j = i/nn; - if(j-kind<0) j = i+(kind-j)*nn; - else if(j+kind>nz-1) j = i+(nz-1-j-kind)*nn; - else j=i; - for(long k=-kind;k<=kind;k++) b[i] += a[j+k*nn]/(2*kind+1); - } - else + if(mgl_isnum(a[i])) // bypass NAN values + { + long j = i/nn, nk = 2*kind+1; + for(long k=-kind;k<=kind;k++) + if(j+k>=0 && j+kid;in;i+=mglNumThr) + { + long j = i/nn; + mreal v = (j>0 && jid;in;i+=mglNumThr) + { + long j = i/nn; + mreal v = (j>0 && ja[i]?v:a[i]; + } if(delta>0) #if !MGL_HAVE_PTHREAD #pragma omp parallel for @@ -274,45 +334,48 @@ static void *mgl_smth_z(void *par) void MGL_EXPORT mgl_data_smooth(HMDT d, const char *dirs, mreal delta) { long Type = -1; - if(!dirs || *dirs==0) dirs = "xyz"; - if(strchr(dirs,'0')) return; - if(strchr(dirs,'d')) - { - if(strchr(dirs,'1')) Type = 1; - if(strchr(dirs,'2')) Type = 2; - if(strchr(dirs,'3')) Type = 3; - if(strchr(dirs,'4')) Type = 4; - if(strchr(dirs,'5')) Type = 5; - if(strchr(dirs,'6')) Type = 6; - if(strchr(dirs,'7')) Type = 7; - if(strchr(dirs,'8')) Type = 8; - if(strchr(dirs,'9')) Type = 9; + if(mglchr(dirs,'0')) return; + bool xdir=mglchr(dirs,'x'), ydir=mglchr(dirs,'y'), zdir=mglchr(dirs,'z'); + if(!xdir && !ydir && !zdir) xdir=ydir=zdir=true; + if(mglchr(dirs,'d')) + { + if(mglchr(dirs,'1')) Type = 1; + if(mglchr(dirs,'2')) Type = 2; + if(mglchr(dirs,'3')) Type = 3; + if(mglchr(dirs,'4')) Type = 4; + if(mglchr(dirs,'5')) Type = 5; + if(mglchr(dirs,'6')) Type = 6; + if(mglchr(dirs,'7')) Type = 7; + if(mglchr(dirs,'8')) Type = 8; + if(mglchr(dirs,'9')) Type = 9; } else { - if(strchr(dirs,'1')) return; - if(strchr(dirs,'3')) Type = 1; - if(strchr(dirs,'5')) Type = 2; + if(mglchr(dirs,'1')) return; + if(mglchr(dirs,'3')) Type = 1; + if(mglchr(dirs,'5')) Type = 2; } + if(mglchr(dirs,'_')) Type = -2; + if(mglchr(dirs,'^')) Type = -3; long nx=d->nx,ny=d->ny,nz=d->nz; // if(Type == SMOOTH_NONE) return; long p[3]={nx,ny,Type}; mreal *b = new mreal[nx*ny*nz],dd=delta; // ����������� �� x memset(b,0,nx*ny*nz*sizeof(mreal)); - if(nx>4 && strchr(dirs,'x')) + if(nx>4 && xdir) { mglStartThread(mgl_smth_x,0,nx*ny*nz,b,d->a,&dd,p); memcpy(d->a,b,nx*ny*nz*sizeof(mreal)); memset(b,0,nx*ny*nz*sizeof(mreal)); } - if(ny>4 && strchr(dirs,'y')) + if(ny>4 && ydir) { mglStartThread(mgl_smth_y,0,nx*ny*nz,b,d->a,&dd,p); memcpy(d->a,b,nx*ny*nz*sizeof(mreal)); memset(b,0,nx*ny*nz*sizeof(mreal)); } - if(nz>4 && strchr(dirs,'z')) + if(nz>4 && zdir) { mglStartThread(mgl_smth_z,0,nx*ny*nz,b,d->a,&dd,p); memcpy(d->a,b,nx*ny*nz*sizeof(mreal)); @@ -559,7 +622,7 @@ static void *mgl_dif2_z(void *par) { mglThreadD *t=(mglThreadD *)par; long nz=t->p[2], nn=t->n; - mreal *b=t->a, dd=0.5*nz*nz; + mreal *b=t->a, dd=nz*nz; const mreal *a=t->b; #if !MGL_HAVE_PTHREAD #pragma omp parallel for @@ -575,7 +638,7 @@ static void *mgl_dif2_y(void *par) { mglThreadD *t=(mglThreadD *)par; long nx=t->p[0], ny=t->p[1], nn=t->n; - mreal *b=t->a, dd=0.5*ny*ny; + mreal *b=t->a, dd=ny*ny; const mreal *a=t->b; #if !MGL_HAVE_PTHREAD #pragma omp parallel for @@ -591,7 +654,7 @@ static void *mgl_dif2_x(void *par) { mglThreadD *t=(mglThreadD *)par; long nx=t->p[0], nn=t->n; - mreal *b=t->a, dd=0.5*nx*nx; + mreal *b=t->a, dd=nx*nx; const mreal *a=t->b; #if !MGL_HAVE_PTHREAD #pragma omp parallel for diff --git a/src/data_ex.cpp b/src/data_ex.cpp index 6bc2d23..4fd788c 100644 --- a/src/data_ex.cpp +++ b/src/data_ex.cpp @@ -837,7 +837,7 @@ HMDT MGL_EXPORT mgl_find_roots_txt(const char *func, const char *vars, HCDT ini) mglEqTxT par; par.var=vars; par.FillReal(func); size_t n = par.str.size(); - if(ini->GetNx()!=n) return 0; + if(ini->GetNx()!=long(n)) return 0; mreal *xx = new mreal[n]; mglData *res = new mglData(ini); for(long j=0;jGetNy()*ini->GetNz();j++) diff --git a/src/data_io.cpp b/src/data_io.cpp index c60b726..9f00d33 100644 --- a/src/data_io.cpp +++ b/src/data_io.cpp @@ -302,8 +302,8 @@ std::string MGL_EXPORT mgl_str_arg(const std::string &str, char ch, int n1, int { p=str.find(ch,p+1); pos.push_back(p?p+1:0); } std::string res; if(n2<0) n2=n1; - if(n1<0 || n1>=pos.size()-1 || n2=pos.size()) n2=pos.size()-1; + if(n1<0 || n1>=long(pos.size())-1 || n2=long(pos.size())) n2=pos.size()-1; res = str.substr(pos[n1],pos[n2+1]-pos[n1]-1); if(res.size()==1 && res[0]==ch) res.clear(); return res; @@ -751,21 +751,21 @@ mreal MGL_EXPORT mgl_data_max_real(HCDT d, mreal *x, mreal *y, mreal *z) if(im==0) im=1; if(im==nx-1)im=nx-2; v1 = d->v(im+1,jm,km); v2 = d->v(im-1,jm,km); - *x = (v1+v2-2*v)==0 ? im : im+(v1-v2)/(v1+v2-2*v)/2; + *x = (v1+v2-2*v)==0 ? im : im+(v2-v1)/(v1+v2-2*v)/2; } if(ny>2) { if(jm==0) jm=1; if(jm==ny-1)jm=ny-2; v1 = d->v(im,jm+1,km); v2 = d->v(im,jm-1,km); - *y = (v1+v2-2*v)==0 ? jm : jm+(v1-v2)/(v1+v2-2*v)/2; + *y = (v1+v2-2*v)==0 ? jm : jm+(v2-v1)/(v1+v2-2*v)/2; } if(nz>2) { if(km==0) km=1; if(km==nz-1)km=nz-2; v1 = d->v(im,jm,km+1); v2 = d->v(im,jm,km-1); - *z = (v1+v2-2*v)==0 ? km : km+(v1-v2)/(v1+v2-2*v)/2; + *z = (v1+v2-2*v)==0 ? km : km+(v2-v1)/(v1+v2-2*v)/2; } return m; } @@ -785,21 +785,21 @@ mreal MGL_EXPORT mgl_data_min_real(HCDT d, mreal *x, mreal *y, mreal *z) if(im==0) im=1; if(im==nx-1)im=nx-2; v1 = d->v(im+1,jm,km); v2 = d->v(im-1,jm,km); - *x = (v1+v2-2*v)==0 ? im : im+(v1-v2)/(v1+v2-2*v)/2; + *x = (v1+v2-2*v)==0 ? im : im+(v2-v1)/(v1+v2-2*v)/2; } if(ny>2) { if(jm==0) jm=1; if(jm==ny-1)jm=ny-2; v1 = d->v(im,jm+1,km); v2 = d->v(im,jm-1,km); - *y = (v1+v2-2*v)==0 ? jm : jm+(v1-v2)/(v1+v2-2*v)/2; + *y = (v1+v2-2*v)==0 ? jm : jm+(v2-v1)/(v1+v2-2*v)/2; } if(nz>2) { if(km==0) km=1; if(km==nz-1)km=nz-2; v1 = d->v(im,jm,km+1); v2 = d->v(im,jm,km-1); - *z = (v1+v2-2*v)==0 ? km : km+(v1-v2)/(v1+v2-2*v)/2; + *z = (v1+v2-2*v)==0 ? km : km+(v2-v1)/(v1+v2-2*v)/2; } return m; } diff --git a/src/data_png.cpp b/src/data_png.cpp index 2a53bdb..b72ada0 100644 --- a/src/data_png.cpp +++ b/src/data_png.cpp @@ -227,10 +227,10 @@ printf("\n"); for(long k=0;kCalc(x,y,z); return r.real()+r.imag()*mgl_I; } -mdual MGL_EXPORT mgl_cexpr_eval_(uintptr_t *ex, dual *x, dual *y, dual *z) +cmdual MGL_EXPORT mgl_cexpr_eval(HAEX ex, mdual x, mdual y, mdual z) +{ return mdual(ex->Calc(x,y,z)); } +cmdual MGL_EXPORT mgl_cexpr_eval_(uintptr_t *ex, mdual *x, mdual *y, mdual *z) { return mgl_cexpr_eval((HAEX) ex, *x,*y,*z); } -mdual MGL_EXPORT mgl_cexpr_eval_v(HAEX ex, dual *var) -{ dual r = ex->Calc(var); return r.real()+r.imag()*mgl_I; } +cmdual MGL_EXPORT mgl_cexpr_eval_v(HAEX ex, mdual *var) +{ return mdual(ex->Calc(reinterpret_cast(var))); } //----------------------------------------------------------------------------- diff --git a/src/evalp.cpp b/src/evalp.cpp index 99ae923..7d07a50 100644 --- a/src/evalp.cpp +++ b/src/evalp.cpp @@ -450,7 +450,7 @@ HMDT MGL_NO_EXPORT mglFormulaCalc(std::wstring str, mglParser *arg, const std::v { mreal x,y,z,k,v=NAN; HMDT d = mglFormulaCalc(str.substr(0,n), arg, head); - long ns[3] = {d->nx, d->ny, d->nz}; + long ns[3] = {d->nx-1, d->ny-1, d->nz-1}; const std::wstring &p=str.substr(n+1); wchar_t ch = p[1]; if(c0=='a') @@ -465,7 +465,7 @@ HMDT MGL_NO_EXPORT mglFormulaCalc(std::wstring str, mglParser *arg, const std::v } else if(c0=='n') { - if(ch>='x' && ch<='z') v = ns[p[1]-'x']; + if(ch>='x' && ch<='z') v = ns[p[1]-'x']+1; else if(!p.compare(L"nmax")) { v=d->MaximalNeg(); } else if(!p.compare(L"nmin")) { v=d->Minimal(); v = v<0?v:0; } } @@ -908,7 +908,7 @@ HADT MGL_NO_EXPORT mglFormulaCalcC(std::wstring str, mglParser *arg, const std:: { dual v=NAN; HADT d = mglFormulaCalcC(str.substr(0,n), arg, head); - long ns[3] = {d->nx, d->ny, d->nz}; + long ns[3] = {d->nx-1, d->ny-1, d->nz-1}; const std::wstring &p=str.substr(n+1); wchar_t ch = p[1]; if(c0=='a') @@ -922,7 +922,7 @@ HADT MGL_NO_EXPORT mglFormulaCalcC(std::wstring str, mglParser *arg, const std:: else if(ch>='x' && ch<='z') v = x/ns[ch-'x']; } } - else if(c0=='n' && ch>='x' && ch<='z') v = ns[ch-'x']; + else if(c0=='n' && ch>='x' && ch<='z') v = ns[ch-'x']+1; else if(c0=='k') { mreal x,y,z,k; @@ -942,8 +942,14 @@ HADT MGL_NO_EXPORT mglFormulaCalcC(std::wstring str, mglParser *arg, const std:: mreal x,y,z; if(ch=='a' && p[2]=='x') v = d->Maximal(); else if(ch=='i' && p[2]=='n') v = d->Minimal(); + else if(ch=='x' && p[2]=='f') v = d->Maximal('x',0)/mreal(ns[0]); + else if(ch=='x' && p[2]=='l') v = d->Maximal('x',-1)/mreal(ns[0]); else if(ch=='x') { d->Maximal(x,y,z); v = x/ns[0]; } + else if(ch=='y' && p[2]=='f') v = d->Maximal('y',0)/mreal(ns[1]); + else if(ch=='y' && p[2]=='l') v = d->Maximal('y',-1)/mreal(ns[1]); else if(ch=='y') { d->Maximal(x,y,z); v = y/ns[1]; } + else if(ch=='z' && p[2]=='f') v = d->Maximal('z',0)/mreal(ns[2]); + else if(ch=='z' && p[2]=='l') v = d->Maximal('z',-1)/mreal(ns[2]); else if(ch=='z') { d->Maximal(x,y,z); v = z/ns[2]; } } else if(c0=='s') diff --git a/src/exec_prm.cpp b/src/exec_prm.cpp index b2d953a..9e88964 100644 --- a/src/exec_prm.cpp +++ b/src/exec_prm.cpp @@ -575,6 +575,15 @@ int static mgls_title(mglGraph *gr, long , mglArg *a, const char *k, const char gr->Self()->LoadState(); return res; } //----------------------------------------------------------------------------- +int static mgls_clabel(mglGraph *gr, long , mglArg *a, const char *k, const char *opt) +{ + int res=0; + if(!strcmp(k,"s")) gr->Label('c', a[0].s.w, 1, opt); + else if(!strcmp(k,"sn")) gr->Label('c', a[0].s.w, a[1].v, opt); + else res = 1; + return res; +} +//----------------------------------------------------------------------------- int static mgls_tlabel(mglGraph *gr, long , mglArg *a, const char *k, const char *opt) { int res=0; @@ -618,6 +627,7 @@ mglCommand mgls_prm_cmd[] = { {"ball",_("Draw point (ball)"),"ball posx posy ['fmt']|posx posy posz ['fmt']", mgls_ball ,13}, {"box",_("Draw bounding box"),"box ['fmt' ticks]", mgls_box ,12}, {"circle",_("Draw circle"),"circle x y r ['fmt']|x y z r ['fmt']", mgls_circle ,13}, + {"clabel",_("Draw label for colorbar"),"clabel 'txt' [pos]", mgls_clabel ,12}, {"colorbar",_("Draw colorbar"),"colorbar ['fmt']|Vdat ['fmt']|'sch' x y [w h]|Vdat 'sch' x y [w h]", mgls_colorbar ,12}, {"cone",_("Draw cone"),"cone x1 y1 z1 x2 y2 z2 r1 [r2 'fmt' edge]", mgls_cone ,13}, {"curve",_("Draw curve"),"curve x1 y1 dx1 dy1 x2 y2 dx2 dy2 ['fmt']|x1 y1 z1 dx1 dy1 dz1 x2 y2 z2 dx2 dy2 dz2 ['fmt']", mgls_curve ,13}, diff --git a/src/exec_set.cpp b/src/exec_set.cpp index b6c23c3..bd37129 100644 --- a/src/exec_set.cpp +++ b/src/exec_set.cpp @@ -185,13 +185,26 @@ int static mgls_crange(mglGraph *gr, long , mglArg *a, const char *k, const char return res; } //----------------------------------------------------------------------------- -int static mgls_ctick(mglGraph *gr, long , mglArg *a, const char *k, const char *) +int static mgls_ctick(mglGraph *gr, long n, mglArg *a, const char *k, const char *) { int res=0; if(!strcmp(k,"s")) gr->SetTickTempl('c',a[0].s.w); else if(!strcmp(k,"n")) gr->SetTicks('c',a[0].v,0,0); else if(!strcmp(k,"ns")) gr->SetTicks('c',a[0].v,0,0,a[1].s.w); - else res = 1; + else if(!strcmp(k,"ds")) gr->SetTicksVal('c', *(a[0].d), a[1].s.w); + else if(!strcmp(k,"dsn")) gr->SetTicksVal('c', *(a[0].d), a[1].s.w, a[2].v); + else if(!strncmp(k,"ns",2)) + { + std::wstring s; + std::vector v; + for(long i=0;iSetTicksVal('c',mglDataS(v),s.c_str(),v.size()==1?true:false); + } else res = 1; return res; } //----------------------------------------------------------------------------- @@ -337,6 +350,10 @@ int static mgls_mask(mglGraph *gr, long , mglArg *a, const char *k, const char * int res=0; if(!strcmp(k,"sn")) gr->SetMask(a[0].s[0],a[1].v); else if(!strcmp(k,"ss")) gr->SetMask(a[0].s[0],a[1].s.s); + else if(!strcmp(k,"snn")) + { gr->SetMask(a[0].s[0],a[1].v); gr->SetMaskAngle(mgl_int(a[2].v)); } + else if(!strcmp(k,"ssn")) + { gr->SetMask(a[0].s[0],a[1].s.s);gr->SetMaskAngle(mgl_int(a[2].v)); } else if(!strcmp(k,"n")) gr->SetMaskAngle(mgl_int(a[0].v)); else res = 1; return res; @@ -838,12 +855,12 @@ mglCommand mgls_set_cmd[] = { {"view",_("Change view angles - use 'rotate' for plot rotation"),"view tetz tetx [tety]", mgls_view ,5}, {"write",_("Write current image to graphical file"),"write ['fname']", mgls_write ,2}, {"xrange",_("Set range for x-axis"),"xrange Dat [add]|x1 x2 [add]", mgls_xrange ,14}, - {"xtick",_("Set ticks for x-axis"),"xtick dx ['factor']|dx sx ['factor']|dx sx tx ['factor']|'tmpl'|Xdat 'lbl' [add]|v1 'lbl1' ...", mgls_xtick,14}, + {"xtick",_("Set ticks for x-axis"),"xtick dx sx ['factor']|dx sx tx ['factor']|'tmpl'|Xdat 'lbl' [add]|v1 'lbl1' ...", mgls_xtick,14}, {"yrange",_("Set range for y-axis"),"yrange Dat [add]|y1 y2 [add]", mgls_yrange,14}, - {"ytick",_("Set ticks for y-axis"),"ytick dy ['factor']|dy sy ['factor']|dy sy ty ['factor']|'tmpl'|Ydat 'lbl' [add]|v1 'lbl1' ...", mgls_ytick,14}, + {"ytick",_("Set ticks for y-axis"),"ytick dy sy ['factor']|dy sy ty ['factor']|'tmpl'|Ydat 'lbl' [add]|v1 'lbl1' ...", mgls_ytick,14}, {"zoom",_("Zoom plot region"),"zoom x1 x2 y1 y2", mgls_zoom,5}, {"zoomaxis",_("Zoom axis range"),"zoomaxis x1 x2|x1 y1 x2 y2|x1 y1 z1 x2 y2 z2|x1 y1 z1 c1 x2 y2 z2 c2", mgls_zoomaxis,14}, {"zrange",_("Set range for z-axis"),"yrange Dat [add]|z1 z2 [add]", mgls_zrange ,14}, - {"ztick",_("Set ticks for z-axis"),"ztick dz ['factor']|dz sz ['factor']|dz sz tz ['factor']|'tmpl'|Zdat 'lbl' [add]|v1 'lbl1' ...", mgls_ztick,14}, + {"ztick",_("Set ticks for z-axis"),"ztick dz sz ['factor']|dz sz tz ['factor']|'tmpl'|Zdat 'lbl' [add]|v1 'lbl1' ...", mgls_ztick,14}, {"","","",NULL,0}}; //----------------------------------------------------------------------------- diff --git a/src/export_2d.cpp b/src/export_2d.cpp index 555cb36..9d71486 100644 --- a/src/export_2d.cpp +++ b/src/export_2d.cpp @@ -158,6 +158,43 @@ void static put_desc(HMGL gr, void *fp, bool gz, const char *pre, const char *ln delete []g; delete []s; } //----------------------------------------------------------------------------- +bool MGL_NO_EXPORT mgl_eps_pattern(void *fp, bool gz, const mglPrim &q) +{ + static uint64_t pd=MGL_SOLID_MASK; // mask if !=MGL_SOLID_MASK + static mreal pw=0; // width (like pen width) if !=0 + static int ang=0; // angle (default is 0,45,90,315) + int aa = 45*int(0.5+q.angl/45.); + if(q.m==MGL_SOLID_MASK || q.w<=0) return false; + if(q.m==pd && q.w==pw && aa==ang) return true; + pd = q.m; pw=q.w; ang=aa; + mreal d = ang%90 ? 4*M_SQRT2*pw : 4*pw; + mgl_printf(fp, gz, "<<\n/PaintType 2 /PatternType 1 /TilingType 1\n"); + mgl_printf(fp, gz, "/BBox [-%g -%g %g %g] /XStep %g /YStep %g\n", d,d,d,d, 2*d,2*d); + if(ang%90) + { + mgl_printf(fp, gz, "/PaintProc { gsave %d rotate\n",-ang); + for(int i=-8;i<8;i++) for(int j=-8;j<8;j++) + { + int ii = (8+i)&7, jj = (8+j)&7; // TODO reduce number of used rectangles + if(pd & (1L<<(ii+8*jj))) + mgl_printf(fp, gz, "%g %g %g %g rf\n",i*pw,j*pw,pw,pw); + } + mgl_printf(fp, gz, "grestore}\n>> pat\n"); + } + else + { + mgl_printf(fp, gz, "/PaintProc { gsave %d rotate\n",-ang); + for(int i=-4;i<4;i++) for(int j=-4;j<4;j++) + { + int ii = (8+i)&7, jj = (8+j)&7; + if(pd & (1L<<(ii+8*jj))) + mgl_printf(fp, gz, "%g %g %g %g rf\n",i*pw,j*pw,pw,pw); + } + mgl_printf(fp, gz, "grestore}\n>> pat\n"); + } + return true; +} +//----------------------------------------------------------------------------- void MGL_EXPORT mgl_write_eps(HMGL gr, const char *fname,const char *descr) { if(!fname || *fname==0) return; @@ -193,6 +230,7 @@ void MGL_EXPORT mgl_write_eps(HMGL gr, const char *fname,const char *descr) mgl_printf(fp, gz, "%%!PS-Adobe-3.0 EPSF-3.0\n%%%%BoundingBox: %d %d %d %d\n", x1, h-y2, x2, h-y1); mgl_printf(fp, gz, "%%%%Created by MathGL library\n%%%%Title: %s\n",descr ? descr : fname); mgl_printf(fp, gz, "%%%%CreationDate: %s\n",ctime(&now)); + mgl_printf(fp, gz, "%%%%LanguageLevel: 2\n50 dict begin"); mgl_printf(fp, gz, "/lw {setlinewidth} def\n/rgb {setrgbcolor} def\n"); mgl_printf(fp, gz, "/np {newpath} def\n/cp {closepath} def\n"); mgl_printf(fp, gz, "/ll {lineto} def\n/mt {moveto} def\n"); @@ -202,6 +240,8 @@ void MGL_EXPORT mgl_write_eps(HMGL gr, const char *fname,const char *descr) mgl_printf(fp, gz, "/sm {-%g} def\n",0.35*gr->mark_size()); mgl_printf(fp, gz, "/m_c {ss 0.3 mul 0 360 arc} def\n"); mgl_printf(fp, gz, "/d0 {[] 0 setdash} def\n/sd {setdash} def\n"); + mgl_printf(fp, gz, "/pat {[1 0 0 1 0 0] makepattern /Mask exch def [/Pattern /DeviceRGB] setcolorspace} def\n"); + mgl_printf(fp, gz, "/mask {Mask setpattern} def\n/rf {rectfill} def\n"); bool m_p=false,m_x=false,m_d=false,m_v=false,m_t=false, m_s=false,m_a=false,m_o=false,m_T=false, @@ -283,7 +323,7 @@ void MGL_EXPORT mgl_write_eps(HMGL gr, const char *fname,const char *descr) float qs_old=gr->mark_size()/gr->FontFactor(); mglRGBA cp; int st=0; - char str[256]=""; + char str[256]="", msk[256]=""; for(long i=0;iGetPrmNum();i++) { const mglPrim &q = gr->GetPrm(i); @@ -291,7 +331,10 @@ void MGL_EXPORT mgl_write_eps(HMGL gr, const char *fname,const char *descr) cp.c = _Gr_->GetPrmCol(i); const mglPnt p1 = gr->GetPnt(q.n1); if(q.type>1) - { snprintf(str,256,"%.2g %.2g %.2g rgb ", cp.r[0]/255.,cp.r[1]/255.,cp.r[2]/255.); str[255]=0; } + { + snprintf(str,256,"%.2g %.2g %.2g rgb ", cp.r[0]/255.,cp.r[1]/255.,cp.r[2]/255.); str[255]=0; + snprintf(msk,256,"%.2g %.2g %.2g mask ", cp.r[0]/255.,cp.r[1]/255.,cp.r[2]/255.); msk[255]=0; + } if(q.type==0) // mark { @@ -336,13 +379,19 @@ void MGL_EXPORT mgl_write_eps(HMGL gr, const char *fname,const char *descr) { const mglPnt &p2=gr->GetPnt(q.n2), &p3=gr->GetPnt(q.n3), &p4=gr->GetPnt(q.n4); if(cp.r[3]) // TODO && gr->quad_vis(p1,p2,p3,p4)) - mgl_printf(fp, gz, "np %g %g mt %g %g ll %g %g ll %g %g ll cp %sfill\n", p1.x, p1.y, p2.x, p2.y, p4.x, p4.y, p3.x, p3.y, str); + { + bool mask = mgl_eps_pattern(fp,gz,q); + mgl_printf(fp, gz, "np %g %g mt %g %g ll %g %g ll %g %g ll cp %sfill\n", p1.x, p1.y, p2.x, p2.y, p4.x, p4.y, p3.x, p3.y, mask?msk:str); + } } else if(q.type==2) // trig { const mglPnt &p2=gr->GetPnt(q.n2), &p3=gr->GetPnt(q.n3); if(cp.r[3]) // TODO && gr->trig_vis(p1,p2,p3)) - mgl_printf(fp, gz, "np %g %g mt %g %g ll %g %g ll cp %sfill\n", p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, str); + { + bool mask = mgl_eps_pattern(fp,gz,q); + mgl_printf(fp, gz, "np %g %g mt %g %g ll %g %g ll cp %sfill\n", p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, mask?msk:str); + } } else if(q.type==1) // line { @@ -404,7 +453,9 @@ void MGL_EXPORT mgl_write_svg(HMGL gr, const char *fname,const char *descr) bool gz = fname[strlen(fname)-1]=='z'; long hh = _Gr_->GetHeight(), ww = _Gr_->GetWidth(); void *fp = stdout; // allow to write in stdout + bool head = true; if(strcmp(fname,"-")) fp = gz ? (void*)gzopen(fname,"wt") : (void*)fopen(fname,"wt"); + else head = false; if(!fp) { gr->SetWarn(mglWarnOpen,fname); return; } int x1=gr->BBoxX1, x2=gr->BBoxX2<0?ww:gr->BBoxX2, y1=gr->BBoxY1, y2=gr->BBoxY2<0?hh:gr->BBoxY2; @@ -412,18 +463,24 @@ void MGL_EXPORT mgl_write_svg(HMGL gr, const char *fname,const char *descr) ww = x2-x1; hh = y2-y1; const std::string loc = setlocale(LC_NUMERIC, "C"); - mgl_printf(fp, gz, "\n"); - mgl_printf(fp, gz, "\n"); - mgl_printf(fp, gz, "\n", ww, hh); - - mgl_printf(fp, gz, "\n"); - mgl_printf(fp, gz, "\n\n\n",descr?descr:fname,ctime(&now)); + if(head) + { + mgl_printf(fp, gz, "\n"); + mgl_printf(fp, gz, "\n"); + mgl_printf(fp, gz, "\n", ww, hh); + mgl_printf(fp, gz, "\n"); + mgl_printf(fp, gz, "\n\n\n",descr?descr:fname,ctime(&now)); + } + else + { + mgl_printf(fp, gz, "\n"); + mgl_printf(fp, gz, "\n", ww, hh); + } // write definition for all glyphs put_desc(gr,fp,gz,"\n"); - // Write background image first const unsigned char *img = mgl_get_background(gr); bool same = true; @@ -454,7 +511,7 @@ void MGL_EXPORT mgl_write_svg(HMGL gr, const char *fname,const char *descr) int st=0; mglRGBA cp; - hh += (y2+y1)/2; +// hh += (y2+y1)/2; for(long i=0;iGetPrmNum();i++) { const mglPrim &q = gr->GetPrm(i); diff --git a/src/fft.cpp b/src/fft.cpp index 7e839ad..4ac3021 100644 --- a/src/fft.cpp +++ b/src/fft.cpp @@ -1169,7 +1169,7 @@ void MGL_EXPORT mgl_datac_sinfft_(uintptr_t *d, const char *dir,int l) { char *s=new char[l+1]; memcpy(s,dir,l); s[l]=0; mgl_datac_sinfft(_DC_,s); delete []s; } //----------------------------------------------------------------------------- -static void* mgl_cor(void *par) +/*static void* mgl_cor(void *par) { mglThreadC *t=(mglThreadC *)par; dual *a = t->a; @@ -1179,7 +1179,7 @@ static void* mgl_cor(void *par) #endif for(long i=t->id;in;i+=mglNumThr) a[i] *= conj(b[i]); return 0; -} +}*/ HADT MGL_EXPORT mgl_datac_correl(HCDT d1, HCDT d2, const char *dir) { if(!dir || *dir==0) return 0; diff --git a/src/font.cpp b/src/font.cpp index 444f67b..120ae00 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -40,6 +40,7 @@ //----------------------------------------------------------------------------- //mglFont mglDefFont("nofont"); mglFont mglDefFont; +#define MGL_USE_H12 {if(h1y2) y2=h2; h1=1e5; h2=-1e5;} //----------------------------------------------------------------------------- size_t MGL_EXPORT mgl_wcslen(const wchar_t *str) { @@ -102,11 +103,10 @@ float mglFont::Puts(const char *str,const char *how,float c1,float c2) const return w; } //----------------------------------------------------------------------------- -float mglFont::Width(const char *str,const char *how) const +float mglFont::Width(const char *str,const char *how, float *y1, float *y2) const { - int font=0; float w=0; - mglGetStyle(how,&font); - MGL_TO_WCS(str,w = Width(wcs,font)); + float w=0; + MGL_TO_WCS(str,w = Width(wcs,how,y1,y2)); return w; } //----------------------------------------------------------------------------- @@ -117,17 +117,20 @@ float mglFont::Puts(const wchar_t *str,const char *how,float c1,float c2) const return Puts(str, font, align,c1,c2); } //----------------------------------------------------------------------------- -float mglFont::Width(const wchar_t *str,const char *how) const +float mglFont::Width(const wchar_t *str,const char *how, float *y1, float *y2) const { - int font=0; - mglGetStyle(how,&font); - return Width(str, font); + int font=0, align=1; + float v1,v2; + if(!y1) y1 = &v1; + if(!y2) y2 = &v2; + mglGetStyle(how,&font,&align); + return Width(str, font, align, *y1, *y2); } //----------------------------------------------------------------------------- float mglFont::Puts(const wchar_t *str,int font,int align, float c1,float c2) const { if(GetNumGlyph()==0 || !str || *str==0) return 0; - float ww=0,w=0,h = (align&4) ? 500./fact[0] : 0; + float ww=0,w=0,h = (align&4) ? 500./fact[0] : 0, y1=0,y2=0; size_t size = mgl_wcslen(str)+1,num=0; if(parse) { @@ -138,8 +141,8 @@ float mglFont::Puts(const wchar_t *str,int font,int align, float c1,float c2) co { if(wcs[i]=='\n') // parse '\n' symbol { - wcs[i]=0; w = Puts(buf,0,0,1.f,0x10|font,c1,c2); // find width - Puts(buf,-w*(align&3)/2.f,-h - 660*num/fact[0],1.f,font,c1,c2); // draw it really + wcs[i]=0; w = Puts(buf,0,0,1.f,0x10|font,c1,c2, y1,y2); // find width + Puts(buf,-w*(align&3)/2.f,-h - 660*num/fact[0],1.f,font,c1,c2, y1,y2); // draw it really buf=wcs+i+1; num++; if(w>ww) ww=w; } // if(wcs[i]=='\\' && wcs[i+1]=='n' && (wcs[i+2]>' ' || wcschr(L"{}[]()!@#$%^&*/-?.,_=+\\\"", wcs[i+2]))) // parse '\n' symbol @@ -150,8 +153,8 @@ float mglFont::Puts(const wchar_t *str,int font,int align, float c1,float c2) co // } } // draw string itself - w = Puts(buf,0,0,1.f,0x10|font,c1,c2); // find width - Puts(buf,-w*(align&3)/2.f,-h - 660*num/fact[0],1.f,font,c1,c2); // draw it really + w = Puts(buf,0,0,1.f,0x10|font,c1,c2, y1,y2); // find width + Puts(buf,-w*(align&3)/2.f,-h - 660*num/fact[0],1.f,font,c1,c2, y1,y2); // draw it really if(w>ww) ww=w; delete []wcs; } @@ -181,11 +184,13 @@ float mglFont::Puts(const wchar_t *str,int font,int align, float c1,float c2) co return ww; } //----------------------------------------------------------------------------- -float mglFont::Width(const wchar_t *str,int font) const +float mglFont::Width(const wchar_t *str,int font, int align, float &y1, float &y2) const { if(GetNumGlyph()==0 || !str || *str==0) return 0; - float ww=0,w=0; - size_t size = mgl_wcslen(str)+1; + float ww=0,w=0, h1=1e5,h2=-1e5; + float h = (align&4) ? 500./fact[0] : 0; + size_t size = mgl_wcslen(str)+1, num=0; + y1=1e5; y2=-1e5; if(parse) { unsigned *wcs = new unsigned[size], *buf=wcs; @@ -193,10 +198,14 @@ float mglFont::Width(const wchar_t *str,int font) const Convert(str, wcs); for(size_t i=0;wcs[i];i++) if(wcs[i]=='\n') // parse '\n' symbol { - wcs[i]=0; w = Puts(buf,0,0,1.,0x10|font,'k','k'); // find width - buf=wcs+i+1; if(w>ww) ww=w; + wcs[i]=0; w = Puts(buf,0,0,1.,0x10|font,'k','k', h1,h2); // find width + h1 -= h+660*num/fact[0]; h2 -= h+660*num/fact[0]; + MGL_USE_H12 + buf=wcs+i+1; if(w>ww) ww=w; num++; } - w = Puts(buf,0,0,1.,0x10|font,'k','k'); + w = Puts(buf,0,0,1.,0x10|font,'k','k', h1,h2); + h1 -= h+660*num/fact[0]; h2 -= h+660*num/fact[0]; + MGL_USE_H12 if(ww2 ? w1 : w2; } //----------------------------------------------------------------------------- @@ -374,14 +386,14 @@ void mglFont::draw_ouline(int st, float x, float y, float f, float g, float ww, } //----------------------------------------------------------------------------- #define MGL_CLEAR_STYLE {st = style; yy = y; ff = f; ccol=c1+dc*i; a = (st/MGL_FONT_BOLD)&3;} -float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,float c1,float c2) const +float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,float c1,float c2, float &y1,float &y2) const { if(GetNumGlyph()==0) return 0; float w=0; // string width int st = style; // current style unsigned *b1, *b2; // pointer to substring unsigned *str; // string itself - float yy=y, ff=f, ww, w1, w2; + float yy=y, ff=f, ww, w1, w2, h1=1e5,h2=-1e5; int a = (st/MGL_FONT_BOLD)&3; long i; for(i=0;text[i];i++); @@ -394,7 +406,7 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa { ccol = ccol<0?ccol:c1+dc*i; unsigned s = str[i]; ww = 0; - if(s==unsigned(-3)) // recursion call here + if(s==unsigned(-3)) // recursion call here for {}-block { i++; b1 = str+i; for(long k=1;k>0 && str[i];i++) @@ -403,7 +415,8 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa if(str[i]==unsigned(-3)) k++; } str[i-1]=0; i--; - ww = Puts(b1, x, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + ww = Puts(b1, x, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now draw_ouline(st,x,y,f,fact[a],ww,ccol); MGL_CLEAR_STYLE @@ -411,15 +424,19 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa else if(s=='\n') // newline { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff, ff, st); - Puts(b1, x+(ww-w1)/2, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x+(ww-w2)/2, yy-660*ff/fact[a], ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x+(ww-w1)/2, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x+(ww-w2)/2, yy-660*ff/fact[a], ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 MGL_CLEAR_STYLE } else if(s==unsigned(-9)) // underset or sub { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff, ff/4, st); - Puts(b1, x+(ww-w1)/2, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x+(ww-w2)/2, yy-175*ff/fact[a], ff/3, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x+(ww-w1)/2, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x+(ww-w2)/2, yy-175*ff/fact[a], ff/3, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now draw_ouline(st,x,y,f,fact[a],ww,ccol); MGL_CLEAR_STYLE @@ -427,8 +444,10 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa else if(s==unsigned(-8)) // overset or sup { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff, ff/4, st); - Puts(b1, x+(ww-w1)/2, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x+(ww-w2)/2, yy+400*ff/fact[a], ff/3, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x+(ww-w1)/2, yy, ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x+(ww-w2)/2, yy+400*ff/fact[a], ff/3, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h2,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now draw_ouline(st,x,y,f,fact[a],ww,ccol); MGL_CLEAR_STYLE @@ -454,8 +473,10 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa else if(s==unsigned(-11)) // stackl { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff*0.45, ff*0.45, st); - Puts(b1, x, yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x, yy-110*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x, yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x, yy-110*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now draw_ouline(st,x,y,f,fact[a],ww,ccol); MGL_CLEAR_STYLE @@ -463,8 +484,10 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa else if(s==unsigned(-10)) // stacr { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff*0.45, ff*0.45, st); - Puts(b1, x+(ww-w1), yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x+(ww-w2), yy-110*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x+(ww-w1), yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x+(ww-w2), yy-110*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now draw_ouline(st,x,y,f,fact[a],ww,ccol); MGL_CLEAR_STYLE @@ -472,8 +495,10 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa else if(s==unsigned(-7)) // stack { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff*0.45, ff*0.45, st); - Puts(b1, x+(ww-w1)/2, yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x+(ww-w2)/2, yy-110*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x+(ww-w1)/2, yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x+(ww-w2)/2, yy-110*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now draw_ouline(st,x,y,f,fact[a],ww,ccol); MGL_CLEAR_STYLE @@ -481,8 +506,10 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa else if(s==unsigned(-6)) // frac { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff*0.45, ff*0.45, st); - Puts(b1, x+(ww-w1)/2, yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x+(ww-w2)/2, yy-60*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x+(ww-w1)/2, yy+250*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x+(ww-w2)/2, yy-60*ff/fact[a], ff*0.45, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now { draw_ouline(st,x,y,f,fact[a],ww,ccol); @@ -493,8 +520,10 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa else if(s==unsigned(-15)) // dfrac { ww = get_ptr(i, str, &b1, &b2, w1, w2, ff, ff, st); - Puts(b1, x+(ww-w1)/2, yy+315*ff/fact[a], ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); - Puts(b2, x+(ww-w2)/2, yy-405*ff/fact[a], ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol); + Puts(b1, x+(ww-w1)/2, yy+315*ff/fact[a], ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 + Puts(b2, x+(ww-w2)/2, yy-405*ff/fact[a], ff, (st&(~MGL_FONT_OLINE)&(~MGL_FONT_ULINE)), ccol,ccol, h1,h2); + MGL_USE_H12 if(gr && !(style&0x10)) // add under-/over- line now { draw_ouline(st,x,y,f,fact[a],ww,ccol); @@ -544,6 +573,8 @@ float mglFont::Puts(const unsigned *text, float x,float y,float f,int style,floa if(dx<0) dx=0; } } + h1 = yy+ff*glyphs[j].y1[a]/fact[a]; h2 = yy+ff*glyphs[j].y2[a]/fact[a]; + MGL_USE_H12 if(gr && !(style&0x10)) { if(st & MGL_FONT_WIRE) gr->Glyph(x+dx,yy,ff,a+4,j,ccol); @@ -698,6 +729,28 @@ bool mglFont::read_main(const char *fname, std::vector &buf) return true; } //----------------------------------------------------------------------------- +void mglFont::FillY12() +{ +#pragma omp parallel + for(long i=0;iy2) y2=y; + } + glyphs[i].y1[s] = y1; + glyphs[i].y2[s] = y2; + } + } +} +//----------------------------------------------------------------------------- size_t mglFont::SaveBin(const char *fname) { FILE *fp = fopen(fname,"wb"); @@ -717,7 +770,11 @@ bool mglFont::LoadBin(const char *base, const char *path) Clear(); // first clear old if(!path) path = MGL_FONT_PATH; char str[256], sep='/'; - snprintf(str,256,"%s%c%s.vfmb",path,sep,base?base:""); str[255]=0; + if(base && strstr(base,".vfmb")) + snprintf(str,256,"%s%c%s",path,sep,base); + else + snprintf(str,256,"%s%c%s.vfmb",path,sep,base?base:""); + str[255]=0; FILE *fp = fopen(str,"rb"); if(!fp) return false; size_t s, len; bool res = true; @@ -737,7 +794,9 @@ bool mglFont::LoadBin(const char *base, const char *path) if(s norm, bold, ital, both; if(!(base && *base) || !read_main(str,norm)) { read_def(); setlocale(LC_NUMERIC,loc.c_str()); if(buf) delete []buf; + FillY12(); return true; } fact[1] = fact[2] = fact[3] = fact[0]; @@ -882,6 +949,7 @@ bool mglFont::Load(const char *base, const char *path) // Finally normalize all factors fact[0] *= mgl_fgen; fact[1] *= mgl_fgen; fact[2] *= mgl_fgen; fact[3] *= mgl_fgen; + FillY12(); setlocale(LC_NUMERIC,loc.c_str()); if(buf) delete []buf; return true; @@ -979,8 +1047,11 @@ void MGL_EXPORT mgl_textdomain(const char *argv0, const char *loc) if(!test_transl(MGL_INSTALL_DIR"/share/locale/")) if(!test_transl("/usr/share/locale/")) if(!test_transl("/usr/local/share/locale/")) - if(!test_transl(getcwd(NULL,0))) + { + char* cwd = getcwd(NULL,0); + if(!test_transl(cwd)) { + free(cwd); const char *f = argv0?strrchr(argv0,'/'):NULL; #ifdef WIN32 if(!f) f = argv0?strrchr(argv0,'\\'):NULL; @@ -993,6 +1064,8 @@ void MGL_EXPORT mgl_textdomain(const char *argv0, const char *loc) } else return; } + else if(cwd) free(cwd); + } #endif } void MGL_EXPORT mgl_textdomain_(const char *locale, int l) diff --git a/src/parser.cpp b/src/parser.cpp index 0ca6220..577191d 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -116,7 +116,7 @@ MGL_NO_EXPORT wchar_t *mgl_str_copy(const char *s) //----------------------------------------------------------------------------- bool mglParser::CheckForName(const std::wstring &s) { - return !isalpha(s[0]) || s.find_first_of(L"!@#$%%^&*()-+|,.<>:")!=std::wstring::npos || s==L"rnd" || FindNum(s.c_str()); + return !isalpha(s[0]) || s.find_first_of(L"!@#$%%^&*/()-+|,.<>:")!=std::wstring::npos || s==L"rnd" || FindNum(s.c_str()); // return !isalpha(s[0])||s.find_first_of(L".:()")!=std::wstring::npos; } //----------------------------------------------------------------------------- diff --git a/src/pde.cpp b/src/pde.cpp index c766bfd..36219e1 100644 --- a/src/pde.cpp +++ b/src/pde.cpp @@ -252,7 +252,7 @@ uintptr_t MGL_EXPORT mgl_pde_adv_(uintptr_t* gr, const char *ham, uintptr_t* ini //----------------------------------------------------------------------------- struct mgl_pde_ham { - ddual *a,*hxy,*hxv,*huv,*huy; + dual *a,*hxy,*hxv,*huv,*huy; const char *eqs; long nx,ny; double xx,yy,xs,ys,dx,dy,dq,dp,zz; @@ -315,13 +315,13 @@ HADT MGL_EXPORT mgl_pde_solve_c(HMGL gr, const char *ham, HCDT ini_re, HCDT ini_ { gr->SetWarn(mglWarnDim,"PDE"); return 0; } mglDataC *res=new mglDataC(nz, nx, ny); - ddual *a = new ddual[4*nx*ny], hh0; // Add "damping" area - ddual *hxy = new ddual[4*nx*ny], *hxv = new ddual[4*nx*ny]; - ddual *huy = new ddual[4*nx*ny], *huv = new ddual[4*nx*ny]; - ddual *hx = new ddual[2*nx], *hv = new ddual[2*ny]; - ddual *hy = new ddual[2*ny], *hu = new ddual[2*nx]; + dual *a = new dual[4*nx*ny], hh0; // Add "damping" area + dual *hxy = new dual[4*nx*ny], *hxv = new dual[4*nx*ny]; + dual *huy = new dual[4*nx*ny], *huv = new dual[4*nx*ny]; + dual *hx = new dual[2*nx], *hv = new dual[2*ny]; + dual *hy = new dual[2*ny], *hu = new dual[2*nx]; double *dmp = new double[4*nx*ny]; - memset(a,0,4*nx*ny*sizeof(ddual)); + memset(a,0,4*nx*ny*sizeof(dual)); memset(dmp,0,4*nx*ny*sizeof(double)); #pragma omp parallel for collapse(2) for(long j=0;jstr.size(); for(size_t i=0;ivar[i]; if(ch>='a' && ch<='z') vars[ch-'a']=dual(x[2*i],x[2*i+1]); } @@ -632,11 +632,11 @@ void static mgl_init_ra(long n, int n7, const mreal *r, mgl_ap *ra) // prepare s //----------------------------------------------------------------------------- struct mgl_qo2d_ham { - ddual *hx, *hu, *a, h0; + dual *hx, *hu, *a, h0; double *dmp, dr, dk; mreal *r; mgl_ap *ra; - ddual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par); + mdual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par); void *par; }; //----------------------------------------------------------------------------- @@ -657,10 +657,12 @@ static void *mgl_qo2d_hprep(void *par) mreal x1 = (2*i-nx+1)*f->dr, hh = 1 - ra->t1*x1; hh = sqrt(sqrt(0.041+hh*hh*hh*hh)); mreal tt = (ra->pt + ra->d1*x1)/hh - ra->pt; - f->hx[i] = f->ham(abs(f->a[i]), r[0]+ra->x1*x1, r[1]+ra->y1*x1, r[3]+ra->x0*tt, r[4]+ra->y0*tt, f->par) - f->h0/2.; + dual tmp = f->ham(abs(f->a[i]), r[0]+ra->x1*x1, r[1]+ra->y1*x1, r[3]+ra->x0*tt, r[4]+ra->y0*tt, f->par); + f->hx[i] = tmp - f->h0/2.; // u-y terms x1 = f->dk/2*(ihu[i] = f->ham(0, r[0], r[1], r[3]+ra->x1*x1, r[4]+ra->y1*x1, f->par) - f->h0/2.; + tmp = f->ham(0, r[0], r[1], r[3]+ra->x1*x1, r[4]+ra->y1*x1, f->par); + f->hu[i] = tmp - f->h0/2.; if(imag(f->hx[i])>0) f->hx[i] = f->hx[i].real(); if(imag(f->hu[i])>0) f->hu[i] = f->hu[i].real(); @@ -670,7 +672,7 @@ static void *mgl_qo2d_hprep(void *par) return 0; } //----------------------------------------------------------------------------- -HADT MGL_EXPORT mgl_qo2d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy) +HADT MGL_EXPORT mgl_qo2d_func_c(mdual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy) { const mglData *ray=dynamic_cast(ray_dat); // NOTE: Ray must be mglData! if(!ray) return 0; @@ -678,7 +680,7 @@ HADT MGL_EXPORT mgl_qo2d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal px if(nx<2 || ini_im->GetNx()!=nx || nt<2) return 0; mglDataC *res=new mglDataC(nx,nt,1); - ddual *a=new ddual[2*nx], *hu=new ddual[2*nx], *hx=new ddual[2*nx]; + dual *a=new dual[2*nx], *hu=new dual[2*nx], *hx=new dual[2*nx]; double *dmp=new double[2*nx]; mgl_ap *ra = new mgl_ap[nt]; mgl_init_ra(nt, n7, ray->a, ra); // ray @@ -712,7 +714,7 @@ HADT MGL_EXPORT mgl_qo2d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal px tmp.h0 = ham(0, tmp.r[0], tmp.r[1], tmp.r[3]+ra[k].x0*hh, tmp.r[4]+ra[k].x0*hh, par); mglStartThread(mgl_qo2d_hprep,0,2*nx,0,0,0,0,&tmp); // Step for field - ddual dt = ddual(0, -ra[k].dt*k0); + dual dt = dual(0, -ra[k].dt*k0); for(long i=0;i<2*nx;i++) a[i] *= exp(hx[i]*dt); mgl_fft((double *)a, 1, 2*nx, wtx, wsx, false); for(long i=0;i<2*nx;i++) a[i] *= exp(hu[i]*dt); @@ -746,19 +748,19 @@ HADT MGL_EXPORT mgl_qo2d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal px return res; } //----------------------------------------------------------------------------- -HMDT MGL_EXPORT mgl_qo2d_func(ddual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy) +HMDT MGL_EXPORT mgl_qo2d_func(mdual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy) { HADT res = mgl_qo2d_func_c(ham,par,ini_re,ini_im,ray_dat,r,k0,xx,yy); HMDT out = mgl_datac_abs(res); delete res; return out; } //----------------------------------------------------------------------------- -ddual static mgl_ham2d(mreal u, mreal x, mreal y, mreal px, mreal py, void *par) +mdual static mgl_ham2d(mreal u, mreal x, mreal y, mreal px, mreal py, void *par) { mglFormula *h = (mglFormula *)par; mreal var[MGL_VS]; memset(var,0,MGL_VS*sizeof(mreal)); var['x'-'a'] = x; var['y'-'a'] = y; var['u'-'a'] = u; var['p'-'a'] = px; var['q'-'a'] = py; - return ddual(h->Calc(var), -h->CalcD(var,'i')); + return mdual(h->Calc(var), -h->CalcD(var,'i')); } //----------------------------------------------------------------------------- HADT MGL_EXPORT mgl_qo2d_solve_c(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy) @@ -784,12 +786,12 @@ uintptr_t MGL_EXPORT mgl_qo2d_solve_(const char *ham, uintptr_t* ini_re, uintptr //----------------------------------------------------------------------------- struct mgl_qo3d_ham { - ddual *hxy, *huv, *hxv, *huy, *a; - ddual *hx, *hy, *hu, *hv, h0; + dual *hxy, *huv, *hxv, *huy, *a; + dual *hx, *hy, *hu, *hv, h0; double *dmp, dr, dk; mreal *r; mgl_ap *ra; - ddual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par); + mdual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par); void *par; }; //----------------------------------------------------------------------------- @@ -853,7 +855,7 @@ static void *mgl_qo3d_post(void *par) return 0; } //----------------------------------------------------------------------------- -HADT MGL_EXPORT mgl_qo3d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz) +HADT MGL_EXPORT mgl_qo3d_func_c(mdual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz) { const mglData *ray=dynamic_cast(ray_dat); // NOTE: Ray must be mglData! if(!ray) return 0; @@ -861,8 +863,8 @@ HADT MGL_EXPORT mgl_qo3d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal z, if(nx<2 || ini_re->GetNx()!=nx || ini_im->GetNx()*ini_im->GetNy()!=nx*nx || nt<2) return 0; mglDataC *res=new mglDataC(nx,nx,nt); - ddual *a=new ddual[4*nx*nx], *huv=new ddual[4*nx*nx], *hxy=new ddual[4*nx*nx], *huy=new ddual[4*nx*nx], *hxv=new ddual[4*nx*nx]; - ddual *hu=new ddual[2*nx], *hx=new ddual[2*nx], *hy=new ddual[2*nx], *hv=new ddual[2*nx]; + dual *a=new dual[4*nx*nx], *huv=new dual[4*nx*nx], *hxy=new dual[4*nx*nx], *huy=new dual[4*nx*nx], *hxv=new dual[4*nx*nx]; + dual *hu=new dual[2*nx], *hx=new dual[2*nx], *hy=new dual[2*nx], *hv=new dual[2*nx]; double *dmp=new double[4*nx*nx]; mgl_ap *ra = new mgl_ap[nt]; mgl_init_ra(nt, n7, ray->a, ra); // prepare ray @@ -912,7 +914,7 @@ HADT MGL_EXPORT mgl_qo3d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal z, } mglStartThread(mgl_qo3d_post,0,2*nx,0,0,0,0,&tmp); // Step for field - ddual dt = ddual(0, -ra[k].dt*k0); + dual dt = dual(0, -ra[k].dt*k0); #pragma omp parallel { void *wsx = mgl_fft_alloc_thr(2*nx); @@ -969,19 +971,19 @@ HADT MGL_EXPORT mgl_qo3d_func_c(ddual (*ham)(mreal u, mreal x, mreal y, mreal z, return res; } //----------------------------------------------------------------------------- -HMDT MGL_EXPORT mgl_qo3d_func(ddual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz) +HMDT MGL_EXPORT mgl_qo3d_func(mdual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), void *par, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz) { HADT res = mgl_qo3d_func_c(ham,par,ini_re,ini_im,ray_dat,r,k0,xx,yy,zz); HMDT out = mgl_datac_abs(res); delete res; return out; } //----------------------------------------------------------------------------- -ddual static mgl_ham3d(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par) +mdual static mgl_ham3d(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par) { mglFormula *h = (mglFormula *)par; mreal var[MGL_VS]; memset(var,0,MGL_VS*sizeof(mreal)); var['x'-'a'] = x; var['y'-'a'] = y; var['z'-'a'] = z; var['u'-'a'] = u; var['p'-'a'] = px; var['q'-'a'] = py; var['v'-'a'] = pz; - return ddual(h->Calc(var), -h->CalcD(var,'i')); + return mdual(h->Calc(var), -h->CalcD(var,'i')); } //----------------------------------------------------------------------------- HADT MGL_EXPORT mgl_qo3d_solve_c(const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray_dat, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz) diff --git a/src/pixel.cpp b/src/pixel.cpp index ba0223a..c17aea3 100644 --- a/src/pixel.cpp +++ b/src/pixel.cpp @@ -394,13 +394,47 @@ void mglCanvas::combine(unsigned char *c1, const unsigned char *c2) const } } //----------------------------------------------------------------------------- -bool inline visible(long i, long j, const unsigned char m[8], mreal pw, int a) // Check if pixel visible +// it looks as MSV=4 is optimal for speed-vs-quality +#define MSV 4 +int inline visible(long i, long j, const unsigned char m[8], mreal pw, int a) // Check if pixel visible { float c = mgl_cos[(a+360)%360], s = mgl_cos[(a+450)%360]; -// int ii = int(0.5+(i*c+j*s)/pw)%8, jj = int(0.5+(j*c-i*s)/pw)%8; -// if(ii<0) ii+=8; if(jj<0) jj+=8; - int ii = int(0.5+(i*c+j*s)/pw)&7, jj = int(0.5+(j*c-i*s)/pw)&7; - return m[jj] & (1L<m, pw,ang)) + int ms = (pd==MGL_SOLID_MASK) ? 4 : visible(i,j,d->m, pw,ang); + if(ms!=0) { float xx = (i-x0), yy = (j-y0), s; s = dsx*xx + dsy*yy + (dd+d3.y*xx-d3.x*yy)*(dd+d3.y*xx-d3.x*yy); @@ -470,6 +505,7 @@ void mglCanvas::quad_draw(const mglPnt &p1, const mglPnt &p2, const mglPnt &p3, if(u*(1.f-u)<0.f || v*(1.f-v)<0.f) continue; // second root bad } mglPnt p(pp+d1*u+d2*v+d3*(u*v)); col2int(p,r,oi); + r[3] = ms*r[3]/MSV; if(r[3]) pnt_plot(i,j,p.z,r,oi); } } @@ -515,12 +551,14 @@ void mglCanvas::trig_draw(const mglPnt &p1, const mglPnt &p2, const mglPnt &p3, if(Quality&MGL_DRAW_NORM) for(long j=y1;j<=y2;j++) for(long i=x1;i<=x2;i++) { - if(pd==MGL_SOLID_MASK || visible(i,j,d->m, pw,ang)) + int ms = (pd==MGL_SOLID_MASK) ? 4 : visible(i,j,d->m, pw,ang); + if(ms!=0) { float xx = (i-x0), yy = (j-y0); float u = dxu*xx+dyu*yy, v = dxv*xx+dyv*yy; if(u<0 || v<0 || u+v>1) continue; mglPnt p(pp+d1*u+d2*v); col2int(p,r,oi); + r[3] = ms*r[3]/MSV; if(r[3]) pnt_plot(i,j,p.z+dz,r,oi); } } @@ -528,13 +566,16 @@ void mglCanvas::trig_draw(const mglPnt &p1, const mglPnt &p2, const mglPnt &p3, { col2int(p1,r,oi); float zz = p1.z+dz, dz1=d1.z, dz2=d2.z; - if(r[3]) for(long j=y1;j<=y2;j++) for(long i=x1;i<=x2;i++) + unsigned char ra = r[3]; + if(ra) for(long j=y1;j<=y2;j++) for(long i=x1;i<=x2;i++) { - if(pd==MGL_SOLID_MASK || visible(i,j,d->m, pw,ang)) + int ms = (pd==MGL_SOLID_MASK) ? 4 : visible(i,j,d->m, pw,ang); + if(ms!=0) { float xx = (i-x0), yy = (j-y0); float u = dxu*xx+dyu*yy, v = dxv*xx+dyv*yy; if(u<0 || v<0 || u+v>1) continue; + r[3] = ms*ra/MSV; pnt_plot(i,j,zz+dz1*u+dz2*v,r,oi); } } diff --git a/src/pixel_gen.cpp b/src/pixel_gen.cpp index 8d8aed1..db4fd1b 100644 --- a/src/pixel_gen.cpp +++ b/src/pixel_gen.cpp @@ -319,7 +319,7 @@ void mglCanvas::CalcScr(mglPoint p, int *xs, int *ys) const mglPoint mglCanvas::CalcScr(mglPoint p) const { int x,y; CalcScr(p,&x,&y); return mglPoint(x,y); } //----------------------------------------------------------------------------- -void static mgl_prm_swap(mglPrim &s1,mglPrim &s2,mglPrim *buf) +/*void static mgl_prm_swap(mglPrim &s1,mglPrim &s2,mglPrim *buf) { memcpy(buf, &s1, sizeof(mglPrim)); memcpy(&s1, &s2, sizeof(mglPrim)); @@ -356,7 +356,7 @@ void static sort_prm_c(const size_t l0, const size_t r0, mglStack &s, m if(l>l0+1) sort_prm_c(l0,l-1,s,buf); if(rObjId),d->ObjId); + col2int(p,r,d->ObjId); + if(r[3]) pnt_plot(i,j,p.z,r,d->ObjId); } //----------------------------------------------------------------------------- void mglCanvas::line_pix(long i, long j, const mglPnt &p1, const mglPnt &p2, const mglDrawReg *dr) diff --git a/src/vect.cpp b/src/vect.cpp index 0fc793a..a70a0e0 100644 --- a/src/vect.cpp +++ b/src/vect.cpp @@ -743,6 +743,9 @@ void MGL_EXPORT mgl_flowp_xy(HMGL gr, double x0, double y0, double z0, HCDT x, H long n=ax->GetNx(), m=ax->GetNy(); bool nboth = x->GetNx()*x->GetNy()!=n*m || y->GetNx()*y->GetNy()!=n*m; if(mgl_check_dim2(gr,x,y,ax,ay,"FlowP")) return; + bool forward=true, backward=true; + if(mglchr(sch,'<')) { forward=false; backward=true; } + if(mglchr(sch,'>')) { forward=true; backward=false; } gr->SaveState(opt); static int cgid=1; gr->StartGroup("FlowP",cgid++); @@ -787,7 +790,8 @@ void MGL_EXPORT mgl_flowp_xy(HMGL gr, double x0, double y0, double z0, HCDT x, H v = (j0-(dxu*dy-dx*dyu)/d)/m; } } - flow(gr, z0, u, v, x, y, ax, ay,ss,vv); + if(forward) flow(gr, z0, u, v, x, y, ax, ay,ss,vv); + if(backward) flow(gr, z0,-u,-v, x, y, ax, ay,ss,vv); gr->EndGroup(); } //----------------------------------------------------------------------------- @@ -1110,6 +1114,9 @@ void MGL_EXPORT mgl_flowp_xyz(HMGL gr, double x0, double y0, double z0, HCDT x, gr->SetPenPal("-"); long ss = gr->AddTexture(sch); bool vv = mglchr(sch,'v'), xo = mglchr(sch,'x'), zo = mglchr(sch,'z'); + bool forward=true, backward=true; + if(mglchr(sch,'<')) { forward=false; backward=true; } + if(mglchr(sch,'>')) { forward=true; backward=false; } // find coordinates u, v, w mreal dm=INFINITY; @@ -1156,7 +1163,8 @@ void MGL_EXPORT mgl_flowp_xyz(HMGL gr, double x0, double y0, double z0, HCDT x, w = (i0+(dx*(dyv*dzu-dyu*dzv)+dxu*(dy*dzv-dyv*dz)+dxv*(dyu*dz-dy*dzu))/d)/l; } } - flow(gr, u, v, w, x, y, z, ax, ay, az,ss,vv,xo,zo); + if(forward) flow(gr, u, v, w, x, y, z, ax, ay, az,ss,vv,xo,zo); + if(backward) flow(gr,-u,-v,-w, x, y, z, ax, ay, az,ss,vv,xo,zo); gr->EndGroup(); } //----------------------------------------------------------------------------- diff --git a/src/window.cpp b/src/window.cpp index abe6201..4472e55 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -259,6 +259,59 @@ MGL_EXPORT void *mgl_draw_calc(void *p) return 0; } //----------------------------------------------------------------------------- +void MGL_EXPORT mgl_parse_comments(const wchar_t *text, double &a1, double &a2, double &da, std::vector &anim, std::string &ids, std::vector &par) +{ + a1=0; a2=0; da=1; + const wchar_t *str = wcsstr(text, L"##c"); + if(str) // this is animation loop + { + int res=wscanf(str+3, "%lg%lg%lg", &a1, &a2, &da); + da = res<3?1:da; + if(res>2 && da*(a2-a1)>0) + { + for(double a=a1;da*(a2-a)>=0;a+=da) + { + wchar_t buf[128]; swprintf(buf,128,L"%g",a); + anim.push_back(buf); + } + return; + } + } + str = wcsstr(text, L"##a"); + while(str) + { + str += 3; + while(*str>0 && *str<=' ' && *str!='\n') str++; + if(*str>' ') + { + size_t j=0; while(str[j]>' ') j++; + std::wstring val(str,j); + anim.push_back(val); + } + str = wcsstr(str, L"##a"); + } + str = wcsstr(text, L"##d"); // custom dialog + while(str) + { + str = wcschr(str,'$'); + if(str) + { + char id = str[1]; str += 2; + while(*str>0 && *str<=' ' && *str!='\n') str++; + if(*str>' ') + { + long j=0; while(str[j]!='\n') j++; + while(str[j-1]<=' ') j--; + + ids.push_back(id); + std::wstring val(str,j); + par.push_back(val); + } + } + str = wcsstr(str, L"##d"); + } +} +//----------------------------------------------------------------------------- void MGL_EXPORT mgl_parse_comments(const char *text, double &a1, double &a2, double &da, std::vector &anim, std::string &ids, std::vector &par) { a1=0; a2=0; da=1; @@ -320,3 +373,35 @@ void MGL_EXPORT mgl_parse_animation(const char *text, std::vector & mgl_parse_comments(text, a1, a2, da, anim, ids, par); } //----------------------------------------------------------------------------- +void MGL_EXPORT mgl_parse_animation(const wchar_t *text, std::vector &anim) +{ + std::string ids; + std::vector par; + double a1, a2, da; + mgl_parse_comments(text, a1, a2, da, anim, ids, par); +} +//----------------------------------------------------------------------------- +MGL_EXPORT const char *mgl_hints[] = { + _("You can shift axis range by pressing middle button and moving mouse. Also, you can zoom in/out axis range by using mouse wheel."), + _("You can rotate/shift/zoom whole plot by mouse. Just press 'Rotate' toolbutton, click image and hold a mouse button: left button for rotation, right button for zoom/perspective, middle button for shift."), + _("You may quickly draw the data from file. Just use: mgllab 'filename.dat' in command line."), + _("You can copy the current image to clipboard by pressing Ctrl-Shift-C. Later you can paste it directly into yours document or presentation."), + _("You can export image into a set of format (EPS, SVG, PNG, JPEG) by pressing right mouse button inside image and selecting 'Export as ...'."), + _("You can setup colors for script highlighting in Property dialog. Just select menu item 'Settings/Properties'."), + _("You can save the parameter of animation inside MGL script by using comment started from '##a ' or '##c ' for loops."), + _("New drawing never clears things drawn already. For example, you can make a surface with contour lines by calling commands 'surf' and 'cont' one after another (in any order). "), + _("You can put several plots in the same image by help of commands 'subplot' or 'inplot'."), + _("All indexes (of data arrays, subplots and so on) are always start from 0."), + _("You can edit MGL file in any text editor. Also you can run it in console by help of commands: mglconv, mglview."), + _("You can use command 'once on|off' for marking the block which should be executed only once. For example, this can be the block of large data reading/creating/handling. Press F9 (or menu item 'Graphics/Reload') to re-execute this block."), + _("You can use command 'stop' for terminating script parsing. It is useful if you don't want to execute a part of script."), + _("You can type arbitrary expression as input argument for data or number. In last case (for numbers), the first value of data array is used."), + _("There is powerful calculator with a lot of special functions. You can use buttons or keyboard to type the expression. Also you can use existed variables in the expression."), + _("The calculator can help you to put complex expression in the script. Just type the expression (which may depend on coordinates x,y,z and so on) and put it into the script."), + _("You can easily insert file or folder names, last fitted formula or numerical value of selection by using menu Edit|Insert."), + _("The special dialog (Edit|Insert|New Command) help you select the command, fill its arguments and put it into the script."), + _("You can put several plotting commands in the same line or in separate function, for highlighting all of them simultaneously."), + _("You can concatenation of strings and numbers using `,` with out spaces (for example, `'max(u)=',u.max,' a.u.'` or `'u=',!(1+i2)` for complex numbers). Also you can get n-th symbol of the string using `[]` (for example, `'abc'[1]` will give 'b'), or add a value to the last character of the string using `+` (for example, `'abc'+3` will give 'abf'), or use it all together."), + NULL +}; +//----------------------------------------------------------------------------- diff --git a/texinfo/core_en.texi b/texinfo/core_en.texi index 312cca0..6dad96a 100644 --- a/texinfo/core_en.texi +++ b/texinfo/core_en.texi @@ -550,15 +550,15 @@ Sets the gray-scale mode on/off. @cindex SetMaskAngle @anchor{mask} -@deftypefn {MGL command} {} mask 'id' 'hex' -@deftypefnx {Команда MGL} {} mask 'id' hex +@deftypefn {MGL command} {} mask 'id' 'hex' [angle] +@deftypefnx {Команда MGL} {} mask 'id' hex [angle] @ifclear UDAV @deftypefnx {Method on @code{mglGraph}} @code{void} SetMask (@code{char} id, @code{const char *}hex) @deftypefnx {Method on @code{mglGraph}} @code{void} SetMask (@code{char} id, @code{uint64_t} hex) @deftypefnx {C function} @code{void} mgl_set_mask (@code{HMGL} gr, @code{const char *}hex) @deftypefnx {C function} @code{void} mgl_set_mask_val (@code{HMGL} gr, @code{uint64_t} hex) @end ifclear -Sets new bit matrix @var{hex} of size 8*8 for mask with given @var{id}. This is global setting which influence on any later usage of symbol @var{id}. The predefined masks are (see @ref{Color scheme}): @samp{-} is 000000FF00000000, @samp{+} is 080808FF08080808, @samp{=} is 0000FF00FF000000, @samp{;} is 0000007700000000, @samp{o} is 0000182424180000, @samp{O} is 0000183C3C180000, @samp{s} is 00003C24243C0000, @samp{S} is 00003C3C3C3C0000, @samp{~} is 0000060990600000, @samp{<} is 0060584658600000, @samp{>} is 00061A621A060000, @samp{j} is 0000005F00000000, @samp{d} is 0008142214080000, @samp{D} is 00081C3E1C080000, @samp{*} is 8142241818244281, @samp{^} is 0000001824420000. +Sets new bit matrix @var{hex} of size 8*8 for mask with given @var{id}. This is global setting which influence on any later usage of symbol @var{id}. The predefined masks are (see @ref{Color scheme}): @samp{-} give lines (@code{0x000000FF00000000}), @samp{+} give cross-lines (@code{080808FF08080808}), @samp{=} give double lines (@code{0000FF00FF000000}), @samp{;} give dash lines (@code{0x0000000F00000000}), @samp{o} give circles (@code{0000182424180000}), @samp{O} give filled circles (@code{0000183C3C180000}), @samp{s} give squares (@code{00003C24243C0000}), @samp{S} give solid squares (@code{00003C3C3C3C0000}), @samp{~} give waves (@code{0000060990600000}), @samp{<} give left triangles (@code{0060584658600000}), @samp{>} give right triangles (@code{00061A621A060000}), @samp{j} give dash-dot lines (@code{0000002700000000}), @samp{d} give pluses (@code{0x0008083E08080000}), @samp{D} give tacks (@code{0x0139010010931000}), @samp{*} give dots (@code{0x0000001818000000}), @samp{^} give bricks (@code{0x101010FF010101FF}). Parameter @var{angle} set the rotation angle too. IMPORTANT: the rotation angle will be replaced by a multiple of 45 degrees at export to EPS. @end deftypefn @deftypefn {MGL command} {} mask angle @@ -566,7 +566,7 @@ Sets new bit matrix @var{hex} of size 8*8 for mask with given @var{id}. This is @deftypefnx {Method on @code{mglGraph}} @code{void} SetMaskAngle (@code{int} angle) @deftypefnx {C function} @code{void} mgl_set_mask_angle (@code{HMGL} gr, @code{int} angle) @end ifclear -Sets the default rotation angle (in degrees) for masks. Note, you can use symbols @samp{\}, @samp{/}, @samp{I} in color scheme for setting rotation angles as 45, -45 and 90 degrees correspondingly. +Sets the default rotation angle (in degrees) for masks. Note, you can use symbols @samp{\}, @samp{/}, @samp{I} in color scheme for setting rotation angles as 45, -45 and 90 degrees correspondingly. IMPORTANT: the rotation angle will be replaced by a multiple of 45 degrees at export to EPS. @end deftypefn @@ -921,7 +921,10 @@ Set the ticks step, number of sub-ticks and initial ticks position to be the mos @deftypefn {MGL command} {} xtick @code{val [sub=0 org=nan 'fact'='']} @deftypefnx {MGL command} {} ytick @code{val [sub=0 org=nan 'fact'='']} @deftypefnx {MGL command} {} ztick @code{val [sub=0 org=nan 'fact'='']} -@deftypefnx {MGL command} {} ctick @code{val [sub=0 org=nan 'fact'='']} +@deftypefnx {MGL command} {} xtick @code{val sub ['fact'='']} +@deftypefnx {MGL command} {} ytick @code{val sub ['fact'='']} +@deftypefnx {MGL command} {} ztick @code{val sub ['fact'='']} +@deftypefnx {MGL command} {} ctick @code{val ['fact'='']} @ifclear UDAV @deftypefnx {Method on @code{mglGraph}} @code{void} SetTicks (@code{char} dir, @code{mreal} d=@code{0}, @code{int} ns=@code{0}, @code{mreal} org=@code{NAN}, @code{const char *}fact=@code{""}) @deftypefnx {Method on @code{mglGraph}} @code{void} SetTicks (@code{char} dir, @code{mreal} d, @code{int} ns, @code{mreal} org, @code{const wchar_t *}fact) @@ -935,9 +938,11 @@ Set the ticks step @var{d}, number of sub-ticks @var{ns} (used for positive @var @deftypefn {MGL command} {} xtick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] @deftypefnx {MGL command} {} ytick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] @deftypefnx {MGL command} {} ztick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] +@deftypefnx {MGL command} {} ctick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] @deftypefnx {MGL command} {} xtick vdat 'lbls' [@code{add=off}] @deftypefnx {MGL command} {} ytick vdat 'lbls' [@code{add=off}] @deftypefnx {MGL command} {} ztick vdat 'lbls' [@code{add=off}] +@deftypefnx {MGL command} {} ctick vdat 'lbls' [@code{add=off}] @ifclear UDAV @deftypefnx {Method on @code{mglGraph}} @code{void} SetTicksVal (@code{char} dir, @code{const char *}lbl, @code{bool} add=@code{false}) @deftypefnx {Method on @code{mglGraph}} @code{void} SetTicksVal (@code{char} dir, @code{const wchar_t *}lbl, @code{bool} add=@code{false}) @@ -2164,17 +2169,19 @@ Draws bounding box outside the plotting volume with color @var{col}. If @var{col @anchor{ylabel} @anchor{zlabel} @anchor{tlabel} +@anchor{clabel} @deftypefn {MGL command} {} xlabel 'text' [@code{pos=1}] @deftypefnx {MGL command} {} ylabel 'text' [@code{pos=1}] @deftypefnx {MGL command} {} zlabel 'text' [@code{pos=1}] @deftypefnx {MGL command} {} tlabel 'text' [@code{pos=1}] +@deftypefnx {MGL command} {} clabel 'text' [@code{pos=1}] @ifclear UDAV @deftypefnx {Method on @code{mglGraph}} @code{void} Label (@code{char} dir, @code{const char *}text, @code{mreal} pos=@code{1}, @code{const char *}opt=@code{""}) @deftypefnx {Method on @code{mglGraph}} @code{void} Label (@code{char} dir, @code{const wchar_t *}text, @code{mreal} pos=@code{1}, @code{const char *}opt=@code{""}) @deftypefnx {C function} @code{void} mgl_label (@code{HMGL} gr, @code{char} dir, @code{const char *}text, @code{mreal} pos, @code{const char *}opt) @deftypefnx {C function} @code{void} mgl_labelw (@code{HMGL} gr, @code{char} dir, @code{const wchar_t *}text, @code{mreal} pos, @code{const char *}opt) @end ifclear -Prints the label @var{text} for axis @var{dir}=@samp{x},@samp{y},@samp{z},@samp{t} (here @samp{t} is ``ternary'' axis @math{t=1-x-y}). The position of label is determined by @var{pos} parameter. If @var{pos}=0 then label is printed at the center of axis. If @var{pos}>0 then label is printed at the maximum of axis. If @var{pos}<0 then label is printed at the minimum of axis. Option @code{value} set additional shifting of the label. @xref{Text printing}. +Prints the label @var{text} for axis @var{dir}=@samp{x},@samp{y},@samp{z},@samp{t},@samp{c}, where @samp{t} is ``ternary'' axis @math{t=1-x-y}; @samp{c} is color axis (should be called after @ref{colorbar}). The position of label is determined by @var{pos} parameter. If @var{pos}=0 then label is printed at the center of axis. If @var{pos}>0 then label is printed at the maximum of axis. If @var{pos}<0 then label is printed at the minimum of axis. Option @code{value} set additional shifting of the label. @xref{Text printing}. @end deftypefn @c ################################################################## @@ -3437,7 +3444,7 @@ This is 3D version of the first functions. Here arrays @var{ax}, @var{ay}, @var{ @deftypefnx {C function} @code{void} mgl_flowp_2d (@code{HMGL} gr, @code{mreal} x0, @code{mreal} y0, @code{mreal} z0, @code{HCDT} ax, @code{HCDT} ay, @code{const char *}sch, @code{const char *}opt) @deftypefnx {C function} @code{void} mgl_flowp_xy (@code{HMGL} gr, @code{mreal} x0, @code{mreal} y0, @code{mreal} z0, @code{HCDT} x, @code{HCDT} y, @code{HCDT} ax, @code{HCDT} ay, @code{const char *}sch, @code{const char *}opt) @end ifclear -The same as first one (@ref{flow}) but draws single flow thread starting from point @var{p0}=@{@var{x0},@var{y0},@var{z0}@}. +The same as first one (@ref{flow}) but draws single flow thread starting from point @var{p0}=@{@var{x0},@var{y0},@var{z0}@}. String @var{sch} may also contain: @samp{>} or @samp{<} for drawing in forward or backward direction only (default is both). @end deftypefn @deftypefn {MGL command} {} flow @code{x0 y0 z0} udat vdat wdat ['sch'=''] diff --git a/texinfo/core_ru.texi b/texinfo/core_ru.texi index 7f0e0b0..3c020c9 100644 --- a/texinfo/core_ru.texi +++ b/texinfo/core_ru.texi @@ -548,15 +548,17 @@ MGL не требует создания данного типа объекто @cindex SetMaskAngle @anchor{mask} -@deftypefn {Команда MGL} {} mask 'id' 'hex' -@deftypefnx {Команда MGL} {} mask 'id' hex +@deftypefn {Команда MGL} {} mask 'id' 'hex' [angle] +@deftypefnx {Команда MGL} {} mask 'id' hex [angle] @ifclear UDAV @deftypefnx {Метод класса @code{mglGraph}} @code{void} SetMask (@code{char} id, @code{const char *}hex) @deftypefnx {Метод класса @code{mglGraph}} @code{void} SetMask (@code{char} id, @code{uint64_t} hex) @deftypefnx {Функция С} @code{void} mgl_set_mask (@code{HMGL} gr, @code{const char *}hex) @deftypefnx {Функция С} @code{void} mgl_set_mask_val (@code{HMGL} gr, @code{uint64_t} hex) @end ifclear -Задает новую матрицу @var{hex} размером 8*8 для маски с заданным @var{id}. Изменения действуют глобально для всех последующих использований данного @var{id}. Значения по умолчанию (см. @ref{Color scheme}): @samp{-} -- 000000FF00000000, @samp{+} -- 080808FF08080808, @samp{=} -- 0000FF00FF000000, @samp{;} -- 0000007700000000, @samp{o} -- 0000182424180000, @samp{O} -- 0000183C3C180000, @samp{s} -- 00003C24243C0000, @samp{S} -- 00003C3C3C3C0000, @samp{~} -- 0000060990600000, @samp{<} -- 0060584658600000, @samp{>} -- 00061A621A060000, @samp{j} -- 0000005F00000000, @samp{d} -- 0008142214080000, @samp{D} -- 00081C3E1C080000, @samp{*} -- 8142241818244281, @samp{^} -- 0000001824420000. +Задает новую матрицу @var{hex} размером 8*8 для маски с заданным @var{id}. Изменения действуют глобально для всех последующих использований данного @var{id}. Значения по умолчанию (см. @ref{Color scheme}): @samp{-} -- 000000FF00000000, @samp{+} -- 080808FF08080808, @samp{=} -- 0000FF00FF000000, @samp{;} -- 0000007700000000, @samp{o} -- 0000182424180000, @samp{O} -- 0000183C3C180000, @samp{s} -- 00003C24243C0000, @samp{S} -- 00003C3C3C3C0000, @samp{~} -- 0000060990600000, @samp{<} -- 0060584658600000, @samp{>} -- 00061A621A060000, @samp{j} -- 0000005F00000000, @samp{d} -- 0008142214080000, @samp{D} -- 00081C3E1C080000, @samp{*} -- 8142241818244281, @samp{^} -- 0000001824420000. Параметр @var{angle} позволяет сразу задать и угол поворота маски. ВАЖНО: при экспорте в EPS угол поворота будет приведен к ближайшему кратному 45 градусам. + +Задает новую матрицу @var{hex} размером 8*8 для маски с заданным @var{id}. Изменения действуют глобально для всех последующих использований данного @var{id}. Значения по умолчанию (см. @ref{Color scheme}): @samp{-} -- линии (@code{0x000000FF00000000}), @samp{+} -- клетки (@code{080808FF08080808}), @samp{=} -- двойные линии (@code{0000FF00FF000000}), @samp{;} -- пунктир (@code{0x0000000F00000000}), @samp{o} -- окружкости (@code{0000182424180000}), @samp{O} -- круги (@code{0000183C3C180000}), @samp{s} -- квадраты (@code{00003C24243C0000}), @samp{S} -- закрашенные квадраты (@code{00003C3C3C3C0000}), @samp{~} -- волны (@code{0000060990600000}), @samp{<} -- треугольники влево (@code{0060584658600000}), @samp{>} -- треугольники вправо (@code{00061A621A060000}), @samp{j} пунктир с точками (@code{0000002700000000}), @samp{d} плюсы (@code{0x0008083E08080000}), @samp{D} -- стежки (@code{0x0139010010931000}), @samp{*} -- точки (@code{0x0000001818000000}), @samp{^} -- кирпичи (@code{0x101010FF010101FF}). Параметр @var{angle} позволяет сразу задать и угол поворота маски. ВАЖНО: при экспорте в EPS угол поворота будет приведен к ближайшему кратному 45 градусам. @end deftypefn @deftypefn {Команда MGL} {} mask angle @@ -564,7 +566,7 @@ MGL не требует создания данного типа объекто @deftypefnx {Метод класса @code{mglGraph}} @code{void} SetMaskAngle (@code{int} angle) @deftypefnx {Функция С} @code{void} mgl_set_mask_angle (@code{HMGL} gr, @code{int} angle) @end ifclear -Задает угол поворота маски в градусах. Отмечу, что символы @samp{\}, @samp{/}, @samp{I} в цветовой схеме задают угол поворота в 45, -45 и 90 градусов соответственно. +Задает угол поворота маски в градусах. Отмечу, что символы @samp{\}, @samp{/}, @samp{I} в цветовой схеме задают угол поворота в 45, -45 и 90 градусов соответственно. ВАЖНО: при экспорте в EPS угол поворота будет приведен к ближайшему кратному 45 градусам. @end deftypefn @c ================================================================== @@ -919,7 +921,10 @@ Ternary -- специальный тип графика для 3 зависим @deftypefn {Команда MGL} {} xtick @code{val [sub=0 org=nan 'fact'='']} @deftypefnx {Команда MGL} {} ytick @code{val [sub=0 org=nan 'fact'='']} @deftypefnx {Команда MGL} {} ztick @code{val [sub=0 org=nan 'fact'='']} -@deftypefnx {Команда MGL} {} ctick @code{val [sub=0 org=nan 'fact'='']} +@deftypefnx {Команда MGL} {} xtick @code{val sub ['fact'='']} +@deftypefnx {Команда MGL} {} ytick @code{val sub ['fact'='']} +@deftypefnx {Команда MGL} {} ztick @code{val sub ['fact'='']} +@deftypefnx {Команда MGL} {} ctick @code{val ['fact'='']} @ifclear UDAV @deftypefnx {Метод класса @code{mglGraph}} @code{void} SetTicks (@code{char} dir, @code{mreal} d=@code{0}, @code{int} ns=@code{0}, @code{mreal} org=@code{NAN}, @code{const char *}fact=@code{""}) @deftypefnx {Метод класса @code{mglGraph}} @code{void} SetTicks (@code{char} dir, @code{mreal} d=@code{0}, @code{int} ns=@code{0}, @code{mreal} org=@code{NAN}, @code{const wchar_t *}fact) @@ -933,9 +938,11 @@ Ternary -- специальный тип графика для 3 зависим @deftypefn {Команда MGL} {} xtick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] @deftypefnx {Команда MGL} {} ytick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] @deftypefnx {Команда MGL} {} ztick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] +@deftypefnx {Команда MGL} {} ctick @code{val1} 'lbl1' [@code{val2} 'lbl2' ...] @deftypefnx {Команда MGL} {} xtick vdat 'lbls' [@code{add=off}] @deftypefnx {Команда MGL} {} ytick vdat 'lbls' [@code{add=off}] @deftypefnx {Команда MGL} {} ztick vdat 'lbls' [@code{add=off}] +@deftypefnx {Команда MGL} {} ctick vdat 'lbls' [@code{add=off}] @ifclear UDAV @deftypefnx {Метод класса @code{mglGraph}} @code{void} SetTicksVal (@code{char} dir, @code{const char *}lbl, @code{bool} add=@code{false}) @deftypefnx {Метод класса @code{mglGraph}} @code{void} SetTicksVal (@code{char} dir, @code{const wchar_t *}lbl, @code{bool} add=@code{false}) @@ -2127,17 +2134,19 @@ Draw bitmap (logo) along whole axis range, which can be changed by @ref{Command @anchor{ylabel} @anchor{zlabel} @anchor{tlabel} +@anchor{clabel} @deftypefn {Команда MGL} {} xlabel 'text' [@code{pos=1}] @deftypefnx {Команда MGL} {} ylabel 'text' [@code{pos=1}] @deftypefnx {Команда MGL} {} zlabel 'text' [@code{pos=1}] @deftypefnx {Команда MGL} {} tlabel 'text' [@code{pos=1}] +@deftypefnx {Команда MGL} {} clabel 'text' [@code{pos=1}] @ifclear UDAV @deftypefnx {Метод класса @code{mglGraph}} @code{void} Label (@code{char} dir, @code{const char *}text, @code{mreal} pos=@code{1}, @code{const char *}opt=@code{""}) @deftypefnx {Метод класса @code{mglGraph}} @code{void} Label (@code{char} dir, @code{const wchar_t *}text, @code{mreal} pos=@code{1}, @code{const char *}opt=@code{""}) @deftypefnx {Функция С} @code{void} mgl_label (@code{HMGL} gr, @code{char} dir, @code{const char *}text, @code{mreal} pos, @code{const char *}opt) @deftypefnx {Функция С} @code{void} mgl_labelw (@code{HMGL} gr, @code{char} dir, @code{const wchar_t *}text, @code{mreal} pos, @code{const char *}opt) @end ifclear -Выводит подпись @var{text} для оси @var{dir}=@samp{x},@samp{y},@samp{z},@samp{t} (где @samp{t} -- ``тернарная'' ось @math{t=1-x-y}). Параметр @var{pos} задает положение подписи: при @var{pos}=0 -- по центру оси, при @var{pos}>0 -- около максимальных значений, при @var{pos}<0 -- около минимальных значений. Опция @code{value} задает дополнительный сдвиг текста. @xref{Text printing}. +Выводит подпись @var{text} для оси @var{dir}=@samp{x},@samp{y},@samp{z},@samp{t},@samp{c}, где @samp{t} -- ``тернарная'' ось @math{t=1-x-y}; @samp{c} -- для цвета (следует вызывать после @ref{colorbar}). Параметр @var{pos} задает положение подписи: при @var{pos}=0 -- по центру оси, при @var{pos}>0 -- около максимальных значений, при @var{pos}<0 -- около минимальных значений. Опция @code{value} задает дополнительный сдвиг текста. @xref{Text printing}. @end deftypefn @c ################################################################## @@ -3404,7 +3413,7 @@ Draw bitmap (logo) along whole axis range, which can be changed by @ref{Command @deftypefnx {Функция С} @code{void} mgl_flowp_2d (@code{HMGL} gr, @code{mreal} x0, @code{mreal} y0, @code{mreal} z0, @code{HCDT} ax, @code{HCDT} ay, @code{const char *}sch, @code{const char *}opt) @deftypefnx {Функция С} @code{void} mgl_flowp_xy (@code{HMGL} gr, @code{mreal} x0, @code{mreal} y0, @code{mreal} z0, @code{HCDT} x, @code{HCDT} y, @code{HCDT} ax, @code{HCDT} ay, @code{const char *}sch, @code{const char *}opt) @end ifclear -Аналогично @ref{flow}, но рисует одну нить из точки @var{p0}=@{@var{x0},@var{y0},@var{z0}@}. +Аналогично @ref{flow}, но рисует одну нить из точки @var{p0}=@{@var{x0},@var{y0},@var{z0}@}. Строка @var{sch} также может содержать: @samp{>} или @samp{<} для рисования линии тока только вперед или только назад от заданной точки (по умолчанию, рисует в обе стороны). @end deftypefn @deftypefn {Команда MGL} {} flow @code{x0 y0 z0} udat vdat wdat ['sch'=''] diff --git a/texinfo/data_en.texi b/texinfo/data_en.texi index 236e2ac..b41d891 100644 --- a/texinfo/data_en.texi +++ b/texinfo/data_en.texi @@ -1211,7 +1211,11 @@ Smooths the data on specified direction or directions. String @var{dirs} specifi @item @samp{5} for linear averaging over 5 points, @item -@samp{d1}...@samp{d9} for linear averaging over (2*N+1)-th points. +@samp{d1}...@samp{d9} for linear averaging over (2*N+1)-th points, +@item +@samp{^} for finding upper bound, +@item +@samp{_} for finding lower bound. @end itemize By default quadratic averaging over 5 points is used. @end deftypefn diff --git a/texinfo/data_ru.texi b/texinfo/data_ru.texi index 4383d6e..7965e1e 100644 --- a/texinfo/data_ru.texi +++ b/texinfo/data_ru.texi @@ -1197,7 +1197,11 @@ These functions change the data in some direction like differentiations, integra @item @samp{5} -- линейное усреднение по 5 точкам, @item -@samp{d1}...@samp{d9} -- линейное усреднение по (2*N+1) точкам. +@samp{d1}...@samp{d9} -- линейное усреднение по (2*N+1) точкам, +@item +@samp{^} -- определение верхней границы, +@item +@samp{_} -- определение нижней границы. @end itemize По умолчанию используется квадратичное усреднение по 5 точкам. @end deftypefn diff --git a/texinfo/example_en.texi b/texinfo/example_en.texi index 8e72960..ee5133d 100644 --- a/texinfo/example_en.texi +++ b/texinfo/example_en.texi @@ -101,6 +101,7 @@ Let me consider the aforesaid in more detail. * Drawing in memory:: * Draw and calculate:: * Using QMathGL:: +* OpenGL output:: * MathGL and PyQt:: * MathGL and MPI:: @end menu @@ -476,7 +477,7 @@ int main(int argc,char **argv) @c ------------------------------------------------------------------ @external{} -@node Using QMathGL, MathGL and PyQt, Draw and calculate, Basic usage +@node Using QMathGL, OpenGL output, Draw and calculate, Basic usage @subsection Using QMathGL @nav{} @@ -515,7 +516,88 @@ int main(int argc,char **argv) @c ------------------------------------------------------------------ @external{} -@node MathGL and PyQt, MathGL and MPI, Using QMathGL, Basic usage +@node OpenGL output, MathGL and PyQt, Using QMathGL, Basic usage +@subsection OpenGL output +@nav{} + +MathGL have possibility to draw resulting plot using OpenGL. This produce resulting plot a bit faster, but with some limitations (especially at use of transparency and lighting). Generally, you need to prepare OpenGL window and call MathGL functions to draw it. There is GLUT interface (see @ref{Widget classes}) to do it by simple way. Below I show example of OpenGL usage basing on Qt libraries (i.e. by using @code{QGLWidget} widget). + +First, one need to define widget class derived from @code{QGLWidget} and implement a few methods: @code{resizeGL()} called after each window resize, @code{paintGL()} for displaying the image on the screen, and @code{initializeGL()} for initializing OpenGL. The header file looks as following. +@verbatim +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include + +class MainWindow : public QGLWidget +{ + Q_OBJECT +protected: + mglGraph *gr; // pointer to MathGL core class + void resizeGL(int nWidth, int nHeight); // Method called after each window resize + void paintGL(); // Method to display the image on the screen + void initializeGL(); // Method to initialize OpenGL +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); +}; +#endif // MAINWINDOW_H +@end verbatim + +The class implementation is rather straightforward. One need to recreate the instance of mglGraph at initializing OpenGL, and ask MathGL to use OpenGL output (set argument @code{1} in mglGraph constructor). Of course, the mglGraph object should be deleted at destruction. The method @code{resizeGL()} just pass new sizes to OpenGL and update viewport sizes. All plotting functions are located in the method @code{paintGL()}. At this, one need to add 2 calls: @code{gr->Clf()} at beginning for clearing previous OpenGL primitives; and @code{swapBuffers()} for showing output on the screen. The source file looks as following. +@verbatim +#include "qgl_example.h" +#include +//#include +//----------------------------------------------------------------------------- +MainWindow::MainWindow(QWidget *parent) : QGLWidget(parent) { gr=0; } +//----------------------------------------------------------------------------- +MainWindow::~MainWindow() { if(gr) delete gr; } +//----------------------------------------------------------------------------- +void MainWindow::initializeGL() // recreate instance of MathGL core +{ + if(gr) delete gr; + gr = new mglGraph(1); // use '1' for argument to force OpenGL output in MathGL +} +//----------------------------------------------------------------------------- +void MainWindow::resizeGL(int w, int h) // standard resize replace +{ + QGLWidget::resizeGL(w, h); + glViewport (0, 0, w, h); +} +//----------------------------------------------------------------------------- +void MainWindow::paintGL() // main drawing function +{ + gr->Clf(); // clear previous OpenGL primitives + gr->SubPlot(1,1,0); + gr->Rotate(40,60); + gr->Light(true); + gr->AddLight(0,mglPoint(0,0,10),mglPoint(0,0,-1)); + gr->Axis(); + gr->Box(); + gr->FPlot("sin(pi*x)","i2"); + gr->FPlot("cos(pi*x)","|"); + gr->FSurf("cos(2*pi*(x^2+y^2))"); + gr->Finish(); + swapBuffers(); // show output on the screen +} +//----------------------------------------------------------------------------- +int main(int argc, char *argv[]) // create application +{ + mgl_textdomain(argv?argv[0]:NULL,""); + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} +//----------------------------------------------------------------------------- +@end verbatim + + +@c ------------------------------------------------------------------ +@external{} +@node MathGL and PyQt, MathGL and MPI, OpenGL output, Basic usage @subsection MathGL and PyQt @nav{} diff --git a/texinfo/example_ru.texi b/texinfo/example_ru.texi index e571186..45ab16b 100644 --- a/texinfo/example_ru.texi +++ b/texinfo/example_ru.texi @@ -99,6 +99,7 @@ call mgl_delete_graph(gr); * Drawing in memory:: * Draw and calculate:: * Using QMathGL:: +* OpenGL output:: * MathGL and PyQt:: * MathGL and MPI:: @end menu @@ -475,7 +476,7 @@ int main(int argc,char **argv) @c ------------------------------------------------------------------ @external{} -@node Using QMathGL, MathGL and PyQt, Draw and calculate, Basic usage +@node Using QMathGL, OpenGL output, Draw and calculate, Basic usage @subsection Using QMathGL @nav{} @@ -512,9 +513,92 @@ int main(int argc,char **argv) } @end verbatim + + +@c ------------------------------------------------------------------ +@external{} +@node OpenGL output, MathGL and PyQt, Using QMathGL, Basic usage +@subsection OpenGL output +@nav{} + +MathGL have possibility to draw resulting plot using OpenGL. This produce resulting plot a bit faster, but with some limitations (especially at use of transparency and lighting). Generally, you need to prepare OpenGL window and call MathGL functions to draw it. There is GLUT interface (see @ref{Widget classes}) to do it by simple way. Below I show example of OpenGL usage basing on Qt libraries (i.e. by using @code{QGLWidget} widget). + +First, one need to define widget class derived from @code{QGLWidget} and implement a few methods: @code{resizeGL()} called after each window resize, @code{paintGL()} for displaying the image on the screen, and @code{initializeGL()} for initializing OpenGL. The header file looks as following. +@verbatim +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include + +class MainWindow : public QGLWidget +{ + Q_OBJECT +protected: + mglGraph *gr; // pointer to MathGL core class + void resizeGL(int nWidth, int nHeight); // Method called after each window resize + void paintGL(); // Method to display the image on the screen + void initializeGL(); // Method to initialize OpenGL +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); +}; +#endif // MAINWINDOW_H +@end verbatim + +The class implementation is rather straightforward. One need to recreate the instance of mglGraph at initializing OpenGL, and ask MathGL to use OpenGL output (set argument @code{1} in mglGraph constructor). Of course, the mglGraph object should be deleted at destruction. The method @code{resizeGL()} just pass new sizes to OpenGL and update viewport sizes. All plotting functions are located in the method @code{paintGL()}. At this, one need to add 2 calls: @code{gr->Clf()} at beginning for clearing previous OpenGL primitives; and @code{swapBuffers()} for showing output on the screen. The source file looks as following. +@verbatim +#include "qgl_example.h" +#include +//#include +//----------------------------------------------------------------------------- +MainWindow::MainWindow(QWidget *parent) : QGLWidget(parent) { gr=0; } +//----------------------------------------------------------------------------- +MainWindow::~MainWindow() { if(gr) delete gr; } +//----------------------------------------------------------------------------- +void MainWindow::initializeGL() // recreate instance of MathGL core +{ + if(gr) delete gr; + gr = new mglGraph(1); // use '1' for argument to force OpenGL output in MathGL +} +//----------------------------------------------------------------------------- +void MainWindow::resizeGL(int w, int h) // standard resize replace +{ + QGLWidget::resizeGL(w, h); + glViewport (0, 0, w, h); +} +//----------------------------------------------------------------------------- +void MainWindow::paintGL() // main drawing function +{ + gr->Clf(); // clear previous OpenGL primitives + gr->SubPlot(1,1,0); + gr->Rotate(40,60); + gr->Light(true); + gr->AddLight(0,mglPoint(0,0,10),mglPoint(0,0,-1)); + gr->Axis(); + gr->Box(); + gr->FPlot("sin(pi*x)","i2"); + gr->FPlot("cos(pi*x)","|"); + gr->FSurf("cos(2*pi*(x^2+y^2))"); + gr->Finish(); + swapBuffers(); // show output on the screen +} +//----------------------------------------------------------------------------- +int main(int argc, char *argv[]) // create application +{ + mgl_textdomain(argv?argv[0]:NULL,""); + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} +//----------------------------------------------------------------------------- +@end verbatim + + @c ------------------------------------------------------------------ @external{} -@node MathGL and PyQt, MathGL and MPI, Using QMathGL, Basic usage +@node MathGL and PyQt, MathGL and MPI, OpenGL output, Basic usage @subsection MathGL and PyQt @nav{} diff --git a/texinfo/other_en.texi b/texinfo/other_en.texi index 87d8df7..033ec71 100644 --- a/texinfo/other_en.texi +++ b/texinfo/other_en.texi @@ -384,15 +384,15 @@ protected: inline mreal vthr(long i) const { return use_abs ? abs(a[i]) : arg(a[i]); } inline mreal dvx(long i,long j=0,long k=0) const - { register long i0=i+nx*(j+ny*k); + { long i0=i+nx*(j+ny*k); std::complex res=i>0? (i res=j>0? (j res=k>0? (k res=i>0? (i res=j>0? (j res=k>0? (k} in C++. And need to call @code{c2mdual()} and @code{mdual2c()} in pure C. However @code{mdual} is binary compatible with C @code{_Complex} numbers. +@item Add flag in CMake to manually disable support of C99 complex numbers. +@item Bypass user-specified extension in base font family name. +@item Improve hints in @code{mgllab} and @code{udav}. +@item Add utility @code{mgltask} for making output file with a set of copies of mask-file. It useful for making set of initial conditions with a few parameters varied in specified range. +@item Add example of @ref{OpenGL output}. +@item Bugfix for approximate min and max position. +@item Bugfix for position of SVG output. +@item Compatibility fixes for new versions of CMake, compilers and libraries. + +@strong{INCOMPATIBLE:} +@item Formally pure C interface handle complex numbers by new way due to strict following of C/C++ standards. However, the MathGL library is binary compatible with previous version(s). + +@end itemize + + @item @strong{31 March 2018.} Bugfix version (v.2.4.2.1) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. diff --git a/texinfo/web_ru.texi b/texinfo/web_ru.texi index 0d072c2..4836098 100644 --- a/texinfo/web_ru.texi +++ b/texinfo/web_ru.texi @@ -53,11 +53,8 @@ Generally, MathGL is GPL library. However, you can use LGPL license for MathGL c @strong{Latest news} @itemize -@item @strong{31 March 2018.} -Bugfix version (v.2.4.2.1) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. - -@item @strong{21 March 2018.} -New version (v.2.4.2) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. There area custom dialog for FLTK widgets (see @ref{Special comments}); display of execution @ref{progress}; new plots @ref{contp}, @ref{flow3}; style of plots @ref{cont}, @ref{flow}, @ref{tube}; change drawing for @ref{axis}, @ref{colorbar}; data handling (@ref{coil}) and setup (@ref{scaletext}, @ref{setup}) functions; modulo operation @samp{@code{%}} in formulas; automatic omit points for all curves; new section @ref{All samples} of documentation; speeding up and bugfixes. +@item @strong{14 March 2018.} +New version (v.2.4.3) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. There are new @ref{clabel} command for drawing colorbar labels, EPS output now may have @ref{mask}, compatibility changes for complex numbers, and many other improvements. @item @emph{17 May 2017.} New version (v.2.4) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. There are @code{mgllab} executable, string manipulation in MGL, new functions, plot types and styles, translation to Russian using @code{gettext} and bugfixes, which denoted @ref{News, here}. @@ -80,6 +77,34 @@ Javascript interface was developed with support of @url{http://www.datadvance.ne @itemize +@item @strong{14 March 2019} +New version (v.2.4.3) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. +@itemize @bullet + +@item Add @ref{clabel} command for drawing colorbar labels. Should be used @strong{after} drawing colorbar! +@item Extend @ref{ctick} command. +@item Add subpixel smoothing for @ref{mask}. +@item Boxes around @ref{text} (style @samp{@@}) now use actual height and position of the text. +@item Add mask to EPS export. Note, @ref{mask} angles are reduced to 45*(0,1,...7) degrees for decreasing pattern size in the EPS. +@item Update default masks: @samp{*} become dot, @samp{^} become bricks, @samp{d} become plus, @samp{D} become tacks, @samp{;} and @samp{j} change lengths. Note, you can use @code{brush.ods} to prepare user-defined masks. +@item Add styles @samp{^} and @samp{_} for command @ref{smooth} to find upper/lower bound of the data. +@item Improve @code{FlowP()} to draw both branches (in positive and negative time direction). +@item Improve CGI interface and update website. +@item Introduce struct @code{mdual} as interface for C and C++ complex numbers. It is implicitly converted to @code{std::complex<>} in C++. And need to call @code{c2mdual()} and @code{mdual2c()} in pure C. However @code{mdual} is binary compatible with C @code{_Complex} numbers. +@item Add flag in CMake to manually disable support of C99 complex numbers. +@item Bypass user-specified extension in base font family name. +@item Improve hints in @code{mgllab} and @code{udav}. +@item Add utility @code{mgltask} for making output file with a set of copies of mask-file. It useful for making set of initial conditions with a few parameters varied in specified range. +@item Add example of @ref{OpenGL output}. +@item Bugfix for approximate min and max position. +@item Bugfix for position of SVG output. +@item Compatibility fixes for new versions of CMake, compilers and libraries. + +@strong{INCOMPATIBLE:} +@item Formally pure C interface handle complex numbers by new way due to strict following of C/C++ standards. However, the MathGL library is binary compatible with previous version(s). + +@end itemize + @item @strong{31 March 2018.} Bugfix version (v.2.4.2.1) of @uref{http://sourceforge.net/projects/mathgl, MathGL} is released. diff --git a/todo.txt b/todo.txt index 7a1cd32..34e67b9 100644 --- a/todo.txt +++ b/todo.txt @@ -23,17 +23,18 @@ 11. Parallel drawing in QMathGL (looks to complicated -- FLTK is better!) 12. \overline{\overline{a}} ??? 13. Use arrow_plot_3d ??? +14. Mask in SVG ??? ============= NEW FEATURES ============= 1. Centered curved text (see text2) 2. Quality=3 for mirror+shadows? Couldn't be in bitmap only mode 4. "latex on" option ?!? +5. Add "text3d x y z lx ly lz nx ny nz 'txt' ['stl'='' depth=0.1 depth2=nan]" +6. Flag to determine discontinuous surfaces in 'fsurf' -5. Custom dialog in QMathGL -6. Add "text3d x y z lx ly lz nx ny nz 'txt' ['stl'='' depth=0.1 depth2=nan]" -7. Mask in EPS/SVG -8. Animation in UDAV from ##c, ##a + remove old entries at "Put to script" (the same in mgllab) +7. Add PGM|PPM export (see https://en.wikipedia.org/wiki/Netpbm_format) +8. Check title & rasterize ZZ. Update *.i for new functions {before release!!!} @@ -82,6 +83,7 @@ D. Docs about JS interface * Example of 'progress' 3. Docs about mgllab (overview, dialogs, ...) +4. Example of Evaluate + ".mx" ??? ZZ. Update time.texi {before release!!!} @@ -92,26 +94,31 @@ ZZ. Update time.texi {before release!!!} как настроить (configuration) какие есть примеры использования (examples) + + +Shortly, there are 3 steps: +1. Download binary for the platform you want to use (32bit or 64bit) and unpack it somewhere. Note, if mix 32bit and 64bit binaries in the same executable, when a compiler under Windows will not give warning about it, but yours program will be crushed! +2. Get all requires libraries (probably some of them is installed on your PC). Also you can just use MathgL utilities (like, http://downloads.sourceforge.net/mathgl/mgl_scripts-2.4.2.win64.7z) which contain all required DLLs. +3. Use MathGL libraries. For MinGW (or clang, or GNU gcc, and so on) compiler you just need to provide option -I path_incl, -L path_lib, where path_inc and path_lib are paths to MathGL include/ and lib/ folders. Alternatively, you can copy MathGL binaries to the MinGW folders (include/ to include/, lib/ to lib/ and so on) and do nothing special else. For Visual Studio you need to create the import library first. Finally, add the MathGL library to the project -- in MinGW compiler add option -lmgl (and similar ones if you use MathGL widgets). + +Instead of steps 1-2, you can download sources and build the MathGL libraries with dependencies/features, which you need. Note, that minimal version have no external dependencies but support plot export to BMP, EPS and SVG only, have no special functions, nonlinear fitting and use slow Fourier transform. The build system use CMake and is rather standard. After building binaries, continue from step 3 :-). + ============= mgllab =========== * Manual data changing should be written into script ?!? * Check: "You can shift axis range by pressing middle button and moving mouse. Also, you can zoom in/out axis range by using mouse wheel." * Shift/Zoom/Perspective by mouse!!! -* Hint about string manipulation * 1d view -- over longer size + y-size for current slice only * info about used memory for graphics -* abort saving shouldn't switch off "modified" flag (check!) * "debug" mode?!? or breakpoints?! * something strange with highlighting * collect mouse clicks to draw line(s) and save it into data * select 'bbox' by mouse * dialog to visual construct "custom dialog" + read/add "##d" to the end of file. +* check manual dash/mask -X. Own file-chooser dialog -- separate path and fname fields + add sorting by date|size +X. Own file-chooser dialog -- separate path and fname fields + add sorting by date|size ??? Y. Window with Zoom/Hidden ??? -Z. Flat toolbuttons ??? - - ============= UDAV ============= @@ -130,10 +137,10 @@ Z. Flat toolbuttons ??? 9. Save data from the summary panel 10. Select subdata section (between NAN in curve) by mouse + adding it to script ?!! 11. Zoom in a region by middle mouse (if not in rotation mode) -12. Extend 'ask' by adding multiple questions simultaneously (+ set/get default values from file ???) -13. Substitute correct name for font files in PropDlg * "debug" mode?!? or breakpoints?! * collect mouse clicks to draw line(s) and save it into data +* Animation from ##c, ##a + remove old entries at "Put to script" (the same in mgllab) +* Custom dialog in QMathGL ============= UNSURE =========== diff --git a/udav/hint_dlg.cpp b/udav/hint_dlg.cpp index 2ef75ea..b52ee93 100644 --- a/udav/hint_dlg.cpp +++ b/udav/hint_dlg.cpp @@ -23,6 +23,7 @@ #include #include "hint_dlg.h" #include "mgl2/data_cf.h" +#include "mgl2/wnd.h" //----------------------------------------------------------------------------- // // Hint dialog @@ -30,26 +31,7 @@ //----------------------------------------------------------------------------- HintDialog::HintDialog(QWidget *parent) : QDialog(parent) { - hints.append(_("You can shift axis range by pressing middle button and moving mouse. Also, you can zoom in/out axis range by using mouse wheel.")); - hints.append(_("You can rotate/shift/zoom whole plot by mouse. Just press 'Rotate' toolbutton, click image and hold a mouse button: left button for rotation, right button for zoom/perspective, middle button for shift.")); - hints.append(_("You may quickly draw the data from file. Just use: udav 'filename.dat' in command line.")); - hints.append(_("You can copy the current image to clipboard by pressing Ctrl-Shift-C. Later you can paste it directly into yours document or presentation.")); - hints.append(_("You can export image into a set of format (EPS, SVG, PNG, JPEG) by pressing right mouse button inside image and selecting 'Export as ...'.")); - hints.append(_("You can setup colors for script highlighting in Property dialog. Just select menu item 'Settings/Properties'.")); - hints.append(_("You can save the parameter of animation inside MGL script by using comment started from '##a ' or '##c ' for loops.")); - hints.append(_("New drawing never clears things drawn already. For example, you can make a surface with contour lines by calling commands 'surf' and 'cont' one after another (in any order). ")); - hints.append(_("You can put several plots in the same image by help of commands 'subplot' or 'inplot'.")); - hints.append(_("All indexes (of data arrays, subplots and so on) are always start from 0.")); - hints.append(_("You can edit MGL file in any text editor. Also you can run it in console by help of commands: mglconv, mglview.")); - hints.append(_("You can use command 'once on|off' for marking the block which should be executed only once. For example, this can be the block of large data reading/creating/handling. Press F9 (or menu item 'Graphics/Reload') to re-execute this block.")); - hints.append(_("You can use command 'stop' for terminating script parsing. It is useful if you don't want to execute a part of script.")); - hints.append(_("You can type arbitrary expression as input argument for data or number. In last case (for numbers), the first value of data array is used.")); - hints.append(_("There is powerful calculator with a lot of special functions. You can use buttons or keyboard to type the expression. Also you can use existed variables in the expression.")); - hints.append(_("The calculator can help you to put complex expression in the script. Just type the expression (which may depend on coordinates x,y,z and so on) and put it into the script.")); - hints.append(_("You can easily insert file or folder names, last fitted formula or numerical value of selection by using menu Edit|Insert.")); - hints.append(_("The special dialog (Edit|Insert|New Command) help you select the command, fill its arguments and put it into the script.")); - hints.append(_("You can put several plotting commands in the same line or in separate function, for highlighting all of them simultaneously.")); - + for(int i=0;mgl_hints[i];i++) hints.append(mgl_hints[i]); numHints=hints.size(); cur = int(mgl_rnd()*numHints); setWindowTitle(_("UDAV - Hint")); diff --git a/udav/prop_dlg.cpp b/udav/prop_dlg.cpp index b119340..9e0781d 100644 --- a/udav/prop_dlg.cpp +++ b/udav/prop_dlg.cpp @@ -197,8 +197,8 @@ void PropDialog::getPathF() { QString str = QFileDialog::getOpenFileName(this, _("UDAV - Insert filename"), fnt->lineEdit()->text(), _("Font files (*.vfm)")); -// if(str.contains(".vfm")) str = str.left(str.length()-4); - if(!str.isEmpty()) fnt->lineEdit()->setText(str); + if(!str.isEmpty()) + { str = str.mid(0,str.lastIndexOf(".vfm")); fnt->lineEdit()->setText(str); } } //----------------------------------------------------------------------------- void PropDialog::setC(int k) diff --git a/udav_ico_new.mgl b/udav_ico_new.mgl new file mode 100644 index 0000000..85373bb --- /dev/null +++ b/udav_ico_new.mgl @@ -0,0 +1,21 @@ +setsize 200 200 +zrange 0 2 + +define $s 0.8 +new x 200 '$s*(x+1)/2*sin(2*pi*x)' +new y 200 '$s*(x+1)/2*cos(2*pi*x)' +#new z 200 '$s*(2-(x+1))^2/2+0.1' +new z 200 '$s*(2-(x+1))+0.1' +new r 200 '0.02+0.07*(x+1)' + +subplot 1 1 0 '#' +fsurf 'v*cos(2*pi*u)' 'v*sin(2*pi*u)-0.05' 'v/2' 'Yyyww' +#circle 0 -0.25 0 1 'y';alpha 0.5 +light on +rotate 65 80 +tube x y z+0.15 r +define $r 0.13 +fsurf '0+$r*cos(2*pi*u)*cos(2*pi*v)' '0.03+$r*cos(2*pi*u)*sin(2*pi*v)' '2*$s+0.25+$r*sin(2*pi*u)' 'r' +define $r 0.155 +fsurf '$r*cos(2*pi*u)*cos(2*pi*v)' '$s+$r*cos(2*pi*u)*sin(2*pi*v)' '0.25+$r*sin(2*pi*u)' 'b' +write 'udav_new.png' \ No newline at end of file diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 688e1b1..01bd12c 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,5 +1,12 @@ add_executable(make_pas make_pas.cpp) +add_executable(mgltask mgltask.cpp) +install( + TARGETS mgltask + EXPORT MathGLTargets + RUNTIME DESTINATION ${MathGL_INSTALL_BIN_DIR} +) + add_executable(mglconv mglconv.cpp) if(MSVC) set(link_type -static) @@ -14,7 +21,7 @@ install( ) add_executable(mgl.cgi mglcgi.cpp) -target_link_libraries(mgl.cgi mgl${link_type}) +target_link_libraries(mgl.cgi mgl-static) install( TARGETS mgl.cgi EXPORT MathGLTargets diff --git a/utils/mglcgi.cpp b/utils/mglcgi.cpp index 73b44d8..33e7ab4 100644 --- a/utils/mglcgi.cpp +++ b/utils/mglcgi.cpp @@ -63,28 +63,29 @@ int main(int argc, char **argv) char *str, *buf; const char *method = getenv("REQUEST_METHOD"); bool alloc=false; + if(method && strcmp(method,"GET")) { long len=atol(getenv("CONTENT_LENGTH")); - buf = new char[len+1]; - len = fread(buf,len,1,stdin); - buf[len]=0; alloc=true; + buf = new char[len+2]; alloc=true; + fgets(buf, len+1, stdin); } - else buf = getenv("QUERY_STRING"); + else buf = getenv("QUERY_STRING"); if(buf==0) { printf(_("There is no query. Exit.\n")); return 0; } str = new char[strlen(buf)+1]; mgl_get_value(buf,"mgl",str); p.Execute(&gr,str); -/* printf("Content-Type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("MathGL - library for scientific graphics\n\n"); + printf("Content-Type: text/html\n\n"); + printf("\n"); + printf("\n"); + printf("MathGL - library for scientific graphics\n"); +// printf("

MGL script output

\n

The script

\n
%s

give

\n",str); gr.WriteSVG("-"); fflush(stdout); - printf("\n");*/ + printf("\n\n"); - printf("Content-Type: image/png\n\n"); gr.WritePNG("-"); +// printf("Content-Type: image/png\n\n"); gr.WritePNG("-"); if(alloc) delete []buf; return 0; } diff --git a/utils/mglconv.cpp b/utils/mglconv.cpp index ba8d778..651ed77 100644 --- a/utils/mglconv.cpp +++ b/utils/mglconv.cpp @@ -20,6 +20,7 @@ #include #include #include "mgl2/mgl.h" +#include "mgl2/wnd.h" #ifdef _MSC_VER #define mnpos (std::basic_string::size_type)-1 @@ -34,8 +35,8 @@ int main(int argc, char *argv[]) mglGraph gr; mglParse p(true); char buf[2048], iname[256]="", oname[256]=""; - std::vector var; - std::wstring str; + std::vector var; // animation variants + std::wstring str; // script bool none=false; while(1) @@ -61,9 +62,9 @@ int main(int argc, char *argv[]) else if(ch=='g') gr.Gray(atoi(optarg)); else if(ch=='A') { - std::wstring str; - for(size_t i=0;optarg[i];i++) str.push_back(optarg[i]); - var.push_back(str); + std::wstring s; + for(size_t i=0;optarg[i];i++) s.push_back(optarg[i]); + var.push_back(s); } else if(ch=='C') { @@ -115,7 +116,7 @@ int main(int argc, char *argv[]) while(!feof(fp) && size_t(cw=fgetwc(fp))!=WEOF) str.push_back(cw); if(*iname) fclose(fp); - size_t n; +/* size_t n; for(size_t i=0;;) // collect exact values { n = str.find(L"##a ",i); @@ -130,7 +131,8 @@ int main(int argc, char *argv[]) wchar_t ss[64]; for(v=v1;v<=v2;v+=dv) { mglprintf(ss,64,L"%g",v); var.push_back(ss); } - } + }*/ + mgl_parse_animation(str.c_str(), var); bool gif = !strcmp(oname+strlen(oname)-4,".gif"); gr.SetSize(600,400); // specially call for "S" option if(var.size()>1) // there is animation diff --git a/utils/mgltask.cpp b/utils/mgltask.cpp new file mode 100644 index 0000000..c58e103 --- /dev/null +++ b/utils/mgltask.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +//=================================================================== +#define IM1 2147483563 +#define IM2 2147483399 +#define AM (1.0/IM1) +#define IMM1 (IM1-1) +#define IA1 40014 +#define IA2 40692 +#define IQ1 53668 +#define IQ2 52774 +#define IR1 12211 +#define IR2 3791 +#define NTAB 32 +#define NDIV (1+IMM1/NTAB) +#define EPS 1.2e-7 +#define RNMX (1.0-EPS) +#ifndef NULL +#define NULL 0L +#endif +//=================================================================== +double Random() +// Long period (> 2 * 10^18 ) random number generator of L'Ecuyer with +// Bays-Durham shuffle and added safeguards. Returns a uniform random deviate +// between 0.0 and 1.0 (exclusive of the endpoint values). Call with idum a +// negative integer to initialize; thereafter, do not alter idum between +// successive deviates in a sequence. RNMX should approximate the largest +// floating value that is less than 1. +{ + static long idum=0; + int j; + long k; + static long idum2=123456789; + static long iy=0; + static long iv[NTAB]; + double temp; + if(idum==0) + idum = -(long)(time(NULL)); + if (idum <= 0) { // Initialize. + if (-(idum) < 1) idum=1; // Be sure to prevent idum = 0. + else idum = -(idum); + idum2=(idum); + for (j=NTAB+7;j>=0;j--) { // Load the shuffle table (after 8 warm-ups). + k=(idum)/IQ1; + idum=IA1*(idum-k*IQ1)-k*IR1; + if (idum < 0) idum += IM1; + if (j < NTAB) iv[j] = idum; + } + iy=iv[0]; + } + k=(idum)/IQ1; // Start here when not initializing. + idum=IA1*(idum-k*IQ1)-k*IR1; // Compute idum=(IA1*idum) % IM1 without + // over ows by Schrage's method. + if (idum < 0) idum += IM1; + k=idum2/IQ2; + idum2=IA2*(idum2-k*IQ2)-k*IR2; // Compute idum2=(IA2*idum) % IM2 likewise. + if (idum2 < 0) idum2 += IM2; + j=iy/NDIV; // Will be in the range 0..NTAB-1. + iy=iv[j]-idum2; // Here idum is shued, idum and idum2 are + // combined to generate output. + iv[j] = idum; + if (iy < 1) iy += IMM1; + if ((temp=AM*iy) > RNMX) // Because users don't expect endpoint values. + return RNMX; + else return temp; +} +//=================================================================== +int strpos(char *str,char ch) +{ + char *p=strchr(str,ch); + int res; + if(p) res = p-str; + else res = -1; + return res; +} +//=================================================================== +// multi_task empl_7b_tr.ini empl.ini 0:1:2 2:2:6 +int main(int argc, char *argv[]) +{ + bool e[10]; + if(argc<3) // if incorrect number of arguments then print the help + { + printf("mgltask make output file with a set of copies of mask-file with repeatedly replaced $# by loop values. It useful for making set of initial conditions with a few parameters varied in specified range.\n"); + printf("Usage:\tmgltask maskfile outputfile [min1:step1:max1] [min2:step2:max2]\n\n"); + printf("\tmask file -- mask file in which all '$#' will be replaced by counter # value\n"); + printf("\t\tHere # = 0 is random number in [0,1].\n"); + printf("\t\tHere # = 1,2...9 is counter number.\n"); + printf("\toutputfile -- file where result will be saved\n"); + printf("\tmin#:step#:max# -- is minimum, step increment and maximum values of counter #\n"); + printf("\t'e'min#:step#:max# -- the same but in exponential form 10^#\n"); +// system("PAUSE"); + return 0; + } + //char maskname[256],outname[256]; + char str[1024],*buf; + double x1[10],x2[10],dx[10],x[10]; + int k,i,n=argc-3;//=(argc==4) ? 1:2; + FILE *fm,*fo; + + // first place zeros + for(i=0;i<10;i++) + { + x1[i] = x2[i] = 0; + dx[i] = 1; + e[i] = false; + } + printf("mask = %s, out = %s\n",argv[1],argv[2]); + // read parameters of loops + for(i=0;i=0 && k - #include + #include + #include #else #include "mgl2/qt.h" #endif diff --git a/website/accordion.js b/website/accordion.js new file mode 100644 index 0000000..75e85eb --- /dev/null +++ b/website/accordion.js @@ -0,0 +1,84 @@ +var cmn = document.getElementById("myTopnav"); +if(cmn) cmn.innerHTML = 'Главная'+ + ''+ + ''+ + ''+ + 'PocketMK'+ + 'MathGL+JS'+ + 'MGL.CGI'+ + 'Creative Commons License'+ + ''; + + +function showExtMenu() +{ + var x = document.getElementById("myTopnav"); + if (x.className === "topnav") x.className += " responsive"; + else x.className = "topnav"; + var y = document.getElementById("mainTopnav"); + if (y.className === "topnav") y.className += " responsive"; + else y.className = "topnav"; +} + +var acc = document.getElementsByClassName("accordion"); +for (var i = 0; i < acc.length; i++) { + acc[i].addEventListener("click", function() { + /* Toggle between adding and removing the "active" class, + to highlight the button that controls the panel */ + this.classList.toggle("active"); + + /* Toggle between hiding and showing the active panel */ + var panel = this.nextElementSibling; + if (panel.style.display === "block") { + panel.style.display = "none"; + } else { + panel.style.display = "block"; + } + }); +} + +/* Loop through all dropdown buttons to toggle between hiding and showing its dropdown content - This allows the user to have multiple dropdowns without any conflict */ +var dropdown = document.getElementsByClassName("dropdown-btn"); +for (var i = 0; i < dropdown.length; i++) +{ + dropdown[i].addEventListener("click", function() { + this.classList.toggle("active"); + var dropdownContent = this.nextElementSibling; + if (dropdownContent.style.display === "block") + dropdownContent.style.display = "none"; + else dropdownContent.style.display = "block"; + }); +} diff --git a/website/classes.png b/website/classes.png new file mode 100644 index 0000000000000000000000000000000000000000..fbd2ee219f76b5cc2f55fdf70b6c073f0edcf7e4 GIT binary patch literal 138494 zcmd43cT|*1voDMRQ4rZGibztDWF+UH#34)0s7Ou{hMWwDg5;bfXGU^nP(&nWhKxuU zhA=}I(h%lrw(j@rv(`Q9eD}ZGE*HZ*{d8A%S5;U2s)`R9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Bl|6L&Oe@P zHDP-Cf{I=4A1hv{r!$}DEw8By*Zg;f(f`NFUr}L^ZBq@!-%Tj$Ecwj)>|DmzCm)jk z^_;yfV!a}kY4)Z+>`yN>E?MbV#l1%UT9mD&%|ESzY#zC5*=xNMra$Mnc#PZFc}sPX zuTAKl0tXWa!@vP3Vm41JPD0_9t);ZTsD4aJ=C>!aDpplIY|QxbBnPPY!^EW*CvW~3 z^6`+B%WC!OM}m)XzZO_KZ%*&>F7b1Uvmn~$I0H@G4AQ3Ty;!|m7HHBM=Pgx5ozopr02A8Z#{d8T literal 0 HcmV?d00001 diff --git a/website/columns.png b/website/columns.png new file mode 100644 index 0000000000000000000000000000000000000000..bd8b1df571f5e2a30b499fabd8aa901c15cff31b GIT binary patch literal 1503 zcmX|>4K&kx7{~vcS%34=CS(=KsFd!7KG9`8kQr>Bj~mF!F$g|RvN%vKdydI?v7nJmB#DJhr*tQNKg ztvF9ROOiIV@*Ic0$tFS(}Jg zO?aerEFZACLeT7t+ncB7<=8rGIwpasas?xq8fOj++o$D#(T;WGyq`dk7Cumt;evO# zL@XqD@ZL4Vbv+Jwwow>-y4{Y3m5Hnan1V55ey{-OziYc)n?g6Gfvl)WS-xqiT{Eg( z`}pQ*lB{KaphT9xK}M55ftyLmZ|ad_$o{VPfg1V_2;m`CT}ap3g-(Vx*m_6K z4@&(IjjiU^*c2>pVEblqXyEuh3`mgiMfCM!p~!mGXi9R&!dF2#3Kz6*`SJp{H(ghogqzDv^eGASRT<3mdJ7 z@udlErw$@;M3jSrM>DCJ@j%BW_7pC+WA%`Du0*T}I;!%`9=4ED%1qRl*^Jt33|`|N z{|g;Dp)2!*7+=a0{~WdCuV@f>?Ksg~>!|b(ps|$-ZFQt@r+2n{aAjRjYI0zUFmZ_B zWwenRlYIc?P~O{wHtn6pd#2_xweqK?5NNpB?CNM~{he~ArGeC}C(&~gLT zE02!NjU_TZAjlGAEXoyEB#^y!!IRq=V@N-8q^nc=NYW$Lg)jdNkAXtq^w9Konoh_Zmvq+!#e**new9W(&BMUVf26O z#H@AvOQqQ9hMQ}rzC*W)jx0VW`IOCfs;#|O!YiL1%#aq{Tr+tOoBbatwPv1LvV91L z2QAsgVy9nKeyQOj)y3jCap;EsqXBe^>PH>O^sIz}odcF{d-D~sm;JRG>}w;h50$dQ z$LASh1?OuGH8@y5?4_Raq%*Gp%z?vD`H6 DBAk}q literal 0 HcmV?d00001 diff --git a/website/datadvance.png b/website/datadvance.png new file mode 100644 index 0000000000000000000000000000000000000000..72b95be7bc9794ace7816d51472732b1632b3cf8 GIT binary patch literal 7077 zcmZ8mbyO7J+s6V?5ETRoMPNasb7_zgmabj87g)NxM7m2>kdzXZ25FWKk&;+S7Nle8 zmi*24&-XoZ?%aFk%-l22+<89n+(wL4w~5+1-s0yl`VEWsQR5g~!VJOdjrB{dI3 zMpDabb|=%@Kx_4;Z(%)y(sEi-<{6*%`}>kwa{}Flb84}!u4dhuIaXpcm}qP zNK*0chQ2ouQzH=Bu3T1^CFhdCU-~%f;WKU8$3X0?J1Cl|&X??rN7{ zxV8^kX(XJ#qAvqwkrv#q<>bV&Uhi(aa(Bwc!Fkdeym91|lz|a-k14r8f(hWVuZOGE zwA@s&VBT`a*e&qrQE#lMi{pwZPg;TnB_v6~R6ZrK>mqNIneEcy7JiO+}Ugb_z9B(c#Z!F z6iH7NdC-Wu#dM1i46ITl_lHDB^YZ((SkJSOk$4IufOvQ-TsEf64O%{TlFKtAPbkNWv`0>t-sO${Bw<~WpG%JEaLQA< ziyZphIOxCp;O@QaO`4goFUJ1iF|2_)_jU6s5sUgTrK2~~G;PrpZHA2Z`?|1^UyM>i zP$(~7ZPQbI+T|P!Qe;h!zvN&tom0DLuS-s)(q;%>LxU5U8eO_JhSn$0g7)85IFpFbKs{K|+z-4E96vIasG2e@|D>&HoLrB}~1%_4PELfyH1+)v5Udwj1;}?jJ zSEy>^c`)v-r|-dBkJiebw=8O+AKj*&ZTXKooo`qHjHT@^_Cf z=H+Dehl-bqSfp**I%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y@g2Y-k)He9?drb z!cR|64;}&8@45O?fX@0+@Cp!q!1VMIo_pGWhO{-3Roi*BHzs>8ouPWT(iH@R3XqVp zrMzn(SRk-+D=J9Qzn43tk_HH)KGL}h&Rsd{Ew7&jcs@jh8`NkRJ>zmUtDtTj{)d&DMU3X`-UgfQ9 z%0TT4?CPqocgLnaCm>@iD=+uG+)R^*lk(X4@$1(w{=k!15&P+I^eUaPkJ)q;%*$q$ z&y*xWo{B@2Fal87$_fh1OilBPii&^>kGD@sef^uj97%(wP(WWGzuOY)k^pj*qGCUw z8hHY<#|K09iRKeW^d@t^|8sdW-)QgLcF+_V8JQtuoh$BISX1M)KV1!8Z?vBY{I?p# zt6TNMvjc^it9k#w>em}VA|)xw@c6Nq;r~63p@^Zp&M$k-S-p#ID%eiVpo`Dqa@3Tfr&|!be%uw68qv} zF^u9voq2x;kUD{6zhF5=qF`hM$epJEW6U>m(QECvJm(-vK?sOGe}DCa0daY@H&yyB zuk)z$TFJ!5(NV2*G9@J?mX6=a(b3V~9?&%_%F4cPpPrqaHEqs~kGo=@H>a1txTqzi zqz<0<@~w7lW!gtZMLm>D7k4!Wv`qkibbKTT1mf%DE}&PIH8rK0rT53uEeON|nsgL8 zL6w7?NqTmE{;KHd?RR8V1PL7nW%R_vL_q;d^TN`^1kwT%2PjoJ(!PIwmcOsJ8exdH z_nhmTvGMJ!*?%nNWZ3MKQ)1hcWuA98w0&yv?gdwj78kXLkr?T-tdWWeyG$$5ED<&L zpY`0dv8iwx;)iIc8!FojobYA?2$b^-Ff5fuv2H~RP*1Z}ijDnG`n7o)f%QZf0XbrN zUmf^7K>UB-0?ZdsW_^NSFa0|k8_%LSbD?UJNQlvlh}wH<#Z>rpUu@0(xde;ROl-e- ho&HU&c;$Hzj)xsCVO>VvA@B^4vZA^|jl5~-{{eX2kg@;( literal 0 HcmV?d00001 diff --git a/website/fltk.png b/website/fltk.png new file mode 100644 index 0000000000000000000000000000000000000000..3552b27d852e9e0d3087f026a4b86d21cdf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*5<-7!ZU_hp_$=7y!-M3Y`O~V$G z9k2%}cPx7`SNT#4F45|Vt&MPzuQR;>hw3l87-5ln)rV~OxYc23pXQob;3n-2^R$?A zRMkmH1rKjRcJqS((Jvlpzw3@#pIm0rj$vKFRGSYP@7Wg(D2BG50;lKn5-^6BOFPBF z?P=8Ee}uWqU24@;;evwdUp&aHX(wkElI^!WGsf^hyJ}fGrzsn>VV_dqSx&cA=;TJ9 zcNHOd0JYR5+VytDr?jf3!L6J|waU7r&F1jwf``M8>H&ctPfAUC-q~vrzUrs+|vXCOhw3?TFYfWsxbACvY?s&t`|bt2oX+2^7!8< z@ph4{K3(ws{DtT2g0710Uz-6KgoX!Vce@ukn+A4m%_PBglL;tbKlw|MZWs#5n_&Nk zE!`jh*aCk)`}YeWaMk}Ezkd&-tP-$hfFqoLO%M*SMgBcv_~-9|@BMR*|NF=P6K(vb z1OJ_V{7<&=pMm(-vih%$$A9|qKiS5=C*;30FaKvh{@-mlapNXc;z6<-jH1B3;_q_ka#R~`bH0_atJi?l^Wza>01ssa4f%4} H51;=R4SOUN literal 0 HcmV?d00001 diff --git a/website/games/colorex.html b/website/games/colorex.html new file mode 100644 index 0000000..7834a38 --- /dev/null +++ b/website/games/colorex.html @@ -0,0 +1,548 @@ + + + +Colorex + + +
+ +

"Colorex" game

+ +Your browser does not support the HTML5 canvas tag.
+ + + + + diff --git a/website/games/columns.html b/website/games/columns.html new file mode 100644 index 0000000..785e1c1 --- /dev/null +++ b/website/games/columns.html @@ -0,0 +1,439 @@ + + + +Columns + + + +
+ +

"Columns" game

+ +Your browser does not support the HTML5 canvas tag.
+ + + + + diff --git a/website/games/hextris.html b/website/games/hextris.html new file mode 100644 index 0000000..e92ab21 --- /dev/null +++ b/website/games/hextris.html @@ -0,0 +1,549 @@ + + + +Hextris + + +
+ +

"Hextris" game

+ +Your browser does not support the HTML5 canvas tag.
+ + + + + diff --git a/website/games/jumps.html b/website/games/jumps.html new file mode 100644 index 0000000..effcbbd --- /dev/null +++ b/website/games/jumps.html @@ -0,0 +1,230 @@ + + +Jumps + + +
+ +

"Jumps"

+ +

Max result: 0.

+ +Your browser does not support the HTML5 canvas tag.
+ + + + + diff --git a/website/games/mk61.html b/website/games/mk61.html new file mode 100644 index 0000000..584c485 --- /dev/null +++ b/website/games/mk61.html @@ -0,0 +1,368 @@ + + + + +Эмулятор МК-61 + + + +
+ + + + + +

PocketMK – эмулятор калькулятора МК-61

+ +
+ + + +
T:
Z:
Y:
X:
+ +
+ rad + grad + deg
+
+ + + 
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +Your browser does not support the HTML5 canvas tag.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + + + + + +
+ +Ввод программы +
+
+ + + +
+

PocketMK – эмулятор семейства популярнейших советских программируемых калькуляторов БЗ-34...МК-61. Основное отличие эмулятора состоит в использовании незадействованных адресов команд, позволивших добавить еще один регистр F, команды для специальных функций (x!, sinh, cosh, tanh, asinh, acosh, atanh, erf, J0, J1, Y0, Y1), команды добавления к регистру (M+) и команды вывода графики в растровое изображение размером 400×300 точек. Имеется два основных режима работы: режим калькулятора, режим редактирования программы (включается галочкой в панели "Программа").

+

PocketMK использует обратную польскую форму записи. Например, для вычисления выражения 2+3*(6+7) надо выполнить следующие действия: +2 B↑ 3 B↑ 6 B↑ 7 + * + или более просто 6 B↑ 7 + 3 * 2 +. Использование функций аналогично. Например, вычислим синус от угла 37 градусов 30 минут. Сначала превратим минуты в десятичную дробь: 37.5. Переключив PocketMK в режим deg (переключатель находится в верхнем левом углу в режиме калькулятора), вводим это число последовательным нажатием клавиш 3 7 . 5 и берем от него синус, нажав клавиши F sin. На индикаторе читаем значение синуса: 0.6087614290087207. Если нужно ввести большое число, можно воспользоваться командой ввода порядка EE. При этом для отрицательных порядков за ней следует ввести команду ±. Например, +1 . 7 8 EE 5 3 дает 1.78e53, 2 . 5 6 EE ±Â 7 дает 2.56e-7, 3 ±Â EE 6 дает -3e6

+ +

Внешний вид

+

PocketMK имеет два режима работы: режим калькулятора (по умолчанию) и режим ввода программы. В режиме калькулятора PocketMK работает в интерактивном режиме – любая нажатая клавиша сразу же выполняется. Вверху находятся кнопки переключения ввода углов, содержимое стека {X,Y,Z,T} и кнопки управления программой. В средней части располагается клавиатура, вид которой зависит от состояния функциональных клавиш «F» и «K». Внизу находятся кнопки панели инструментов и панель меню.

+

Кнопки переключения ввода углов имеют следующее значение: deg – углы считаются в градусах (период sin(x) равен 360), grad – углы считаются в градах (период sin(x) равен 400), rad – углы считаются в радианах (период sin(x) равен 2π).

+

Окно отображения стека расположено сверху посередине. «Главный» регистр X выделен цветом, поскольку именно с ним выполняются все основные операции – сложение, вычитание, умножение и деление, вычисление функций, запись и считывание регистров, операции условного перехода. Остальные регистры стека являются скорее «дополнительными» и выводятся серым цветом.

+

Кнопки управления выполнением программы позволяют выполнить программу пошагово (Step) и запустить программу на автоматическое выполнение с текущей программной позиции (Run). Для остановки программы (например, в случае зацикливания) служит кнопка Stop, заменяющая кнопку Run при запуске программы.

+

Клавиатура отображается в режиме калькулятора и в режиме редактирования программы. Ее вид зависит от нажатия функциональных клавиш «F» и «K», располагающихся в левой верхней части клавиатуры. Для удобства пользователя цвета кнопок изменяются вместе с изменением их функциональности. Кроме того, графические команды выделены зеленым цветом, а команды обращения к регистрам фиолетовым. +Часть кнопок имеет смысл только при выполнении программы (команды перехода, остановки программы и т.д., выделенные желтым). Действие остальных команд одинаково «полезно» в любом режиме. Отличие состоит в том, что в режиме калькулятора команды выполняются сразу, а в режиме ввода программы они записываются в программную память.

+ +

Регистры, стек и операции

+

PocketMK хранит числа в специальных переменных – регистрах. Каждый регистр памяти имеет свое обозначение в виде цифры или буквы. Шестнадцать из них обозначаются числами от 0 до 9 и начальными буквами латинского алфавита (A, B, C, D, E, F). По сути эти регистры являются обычными переменными, обращение к которым возможно произвольным образом. Еще четыре регистра образуют стек и обозначаются латинскими буквами (X, Y, Z, T). Прямой доступ возможен только к одному регистру из них – регистру X. Остальные регистры участвуют в вычислениях и доступны только с помощью команд работы со стеком. Последний из регистров (называемый B или X1) хранит информацию о предыдущем значении регистра X и может быть только прочитан с помощью команды Bx. Часто в описаниях программ перед регистром ставят букву R (например, RA – регистр А), чтобы отличать регистр от буквы. Регистры X, Y, Z, T отображаются на экране калькулятора. Регистры 0,1,...,F можно посмотреть в панели «Регистры».

+

При вводе в калькулятор число заносится в регистр X. Прочитать число в регистрах 0,1,...,F можно с помощью кнопки MR (от английского «memory read»). Например, команда MRA впишет число из регистра A в регистр Х. Аналогично команда MSA (от английского «memory save») запишет число из регистра Х в регистр А. Команда M+A прибавит число из регистра Х к числу, хранящемуся в регистре А. Команда M+ отсутствовала в МК-61 и была введена для удобства работы и программирования различных статистических приложений.

+

Каждая операция калькулятором выполняется либо над одним числом, находящимся в регистре X (операция одноместная: x2, sin, erf и т.д.), либо над двумя числами, одно из которых находится в регистре X, а другое - в регистре Y. Отличительной особенностью этого калькулятора является то, что операция, которую следует производить с двумя числами, выполняется после ввода двух чисел – используется так называемая польская или постфиксная запись выражений.

+

Числа, над которыми нужно совершить ту или иную арифметическую операцию, должны находиться в двух регистрах – X и Y. В регистр Y можно попасть только из регистра X. Делается это нажатием клавиши B↑. При этом в регистре X остается копия числа. Затем в регистр X записывается второе число, причем первое число стирается. В случае вычитания уменьшаемое должно находиться в Y, а вычитаемое – в X. При делении в Y должно находиться делимое, в X – делитель. После ввода числа в оба регистра, можно нажать клавишу выбранной операции. Результат ее будет помещен в регистр X. То, что было прежде в регистре Y, не сохранится. Здесь следует обратить внимание на то, что если в регистре X находился результат операции, то ввод нового числа в регистр X автоматически передвигает старое содержимое регистра X в регистр Y. Исключением являются операции очистки регистра Cx и операция B↑.

+

Наконец, в таблице приведено состояние стека до и после применения различных операций:

+ + + + + + + + + + + + + +
ОперацияСтек доСтек после
Ввод числа r из регистра или числа πb x y z tb r x y z
Ввод числа n после Сх, B↑b x y z tb n y z t
Ввод числа n после других операцийb x y z tb n x y z
Команда Cxb x y z tb 0 y z t
Команда B↑b x y z tb x x y z
Команда Bxb x y z tb b x y z
Команда b x y z tx y x z t
Команда b x y z tx y z t x
Вычисление функции f(x)b x y z tx f y z t
Двуместная операция gb x y z tx g z t t
Команда B↓b x y z tx y z t t
+ +

Программирование

+

Составим теперь простую программу вычисления площади круга. Формула для вычисления площади круга известна: S=πD2/4, где D – диаметр круга. Константа π уже есть в калькуляторе. Величину D необходимо вручную ввести с клавиатуры (оно будет помещено в регистр X). Пусть D = 3. Для ручного расчета нужно нажать клавиши: x2 F pi * 4 /. На индикаторе читаем результат: 7.0685834705770345. Те же клавиши и в той же последовательности нужно будет нажать, когда мы станем вводить в калькулятор программу для вычисления площади круга.

+

Программа располагается в калькуляторе в виде отдельных команд, каждая из которых занимает свою ячейку программной памяти (некоторые управляющие – две ячейки – команда и адрес). Всего таких ячеек 160. Им присвоены номера, называемые адресами – от #00 до #F9. В силу совместимости с МК-61 нумерация сделана так, что первая цифра шестнадцатеричная, а вторая всего лишь десятичная. Например, адрес #F9 = 0xF*10+9 = 159. Такая вот смесь ☺ !

+ +

Чтобы ввести программу в калькулятор, надо перевести его в состояние, называемое режимом редактирования программы. В режиме редактирования PocketMK нажатие клавиш приводит к вводу команды в программную память вместо ее непосредственного выполнения. Для перехода в режим редактирования программы следует раскрыть панель программа и поставить галочку напротив Ввод программы. Стрелки в этой панели перемещают курсор (текущий адрес), кнопки Ins и Del добавляют и удаляют текущую/последнюю ячейку программы. Адрес первой команды в строке указывается перед двоеточием. Текущая позиция курсора выделена голубым. Курсор не показывается если он находится за последней командой (калькулятор готов к добавлению новой команды).

+

Нажимаем x2 и в программе появляется x2. Ее появление в таблице означает, что команда занесена в программную память. Одновременно прямоугольник сместился вправо – счетчик адресов увеличился на 1. Далее нажимаем F π и в программе появляется π (модификатор F в программе всегда опускается) и т.д. Таким образом вводятся все команды. Для останова работы калькулятора по программе необходимо ввести специальную команду: stop (клавиши F stop).

+

Чтобы проверить работу программы вернемся в режим калькулятора (сняв галочку), введем диаметр круга и запустим программу кнопкой Run. На мгновение мигнет индикатор Stop вместо Run и программа выдаст ответ. Кнопка Stop предназначена для останова программы (например, в бесконечном цикле). Для пошагового исполнения программы (в целях отладки или в качестве одного из способов ввода чисел) можно воспользоваться кнопкой Step. Ее действие полностью аналогично Run, но будет исполнена только текущая команда.

+

Следует отметить, что в отличие от калькулятора MK-61, переход в начало программы осуществляется автоматически, если курсор не виден (ожидается добавление новой команды). Кроме того, программа автоматически останавливается при достижении конца введенных команд (команда stop в конце программы не обязательна).

+ +

Команды перехода

+

Для безусловного перехода на адрес программы используется клавиша go (аналог команды БП – безусловный переход). После команды следует указать адрес перехода. Например, для того, чтобы перейти на адрес 60, надо нажать клавиши: go 6 0. Эта команда работает только в программном режиме и занимает две ячейки памяти: первая ячейка – код команды перехода, вторая – адрес перехода. Отмечу, что для совместимости с программами МК–61 пришлось ввести «странную» систему адресов. Всего ячеек 160 с адресами – от 00 до F9. При этом адрес состоит их двух цифр: первая цифра шестнадцатеричная, а вторая десятичная. Например, адрес #F9 = 0xF*10+9 = 159.

+

Чтобы вызвать подпрограмму, используется команда sub (аналог команды ПП – переход на подпрограмму). Так же, как и в команде безусловного перехода, необходимо указать адрес, с которого начинается подпрограмма. Команда возврата из подпрограммы – ret (аналог команды В/О). Подпрограммы могут вкладываться друг в друга.

+

Также есть специальные команды, которые изменяют порядок выполнения программы в зависимости от содержимого регистра X. Это команды x<0, x≥0, x=0, x≠0. Если условие выполняется, то управление передается на команду, следующую за командой условия (напомним, что команда условия занимает 2 ячейки – команда и адрес), в противном случае – управление передастся на указанный адрес. Например, с адреса 20 мы введем строку: F x<0 25, тогда если содержимое регистра X будет меньше нуля, то программа продолжится с адреса 22, а если ноль и больше, то с адреса 25.

+

Для организации циклов предусмотрены специальные команды L0, L1, L2, L3. После ввода этих команд также необходимо указать адрес перехода. Каждая команда ассоциирована с регистрами от 0 до 3, соответственно. После выполнения команды происходит вычитание единицы из этого регистра и сравнение результата с нулем. Если результат равен нулю, то программа продолжит свое выполнение со следующего адреса. Иначе – перейдет на указанный адрес перехода. Напишем программу вычисления факториала. Сначала перейдем в режим программирования с помощью меню или панели управления. Затем вводим программу: MS0 1 MR0 * L0 02. После ввода программы переходим в режим калькулятора, вводим число вводится с клавиатуры и нажимаем кнопку Run. В результате в регистре X появляется факториал числа. Можно проверить вычисленное значение нажав ↔ K x!.

+
+ + + +
+

Все команды PocketMK имеют уникальный номер в диапазоне 0...255. Полный список команд с указанием их кодов можно найти в таблице. Здесь номер строки дает старший разряд, номер столбца – младший разряд номера команды. Например, команда |x| имеет номер 0x31.

+ + + + + + + + + + + + + + + + + + +
x0x1x2x3x4x5x6x7x8x9xAxBxCxDxExF
x000123456789.±EECxB↑Bx
x10+*/10xexlglnasinacosatansincostanY0
x20πsqrtx21/xxyB↓shchtherfx!asinhacoshatanhY1
x30col|x|signcls[x]{x}maxandorxornotrndpntlinerectarc
x40MS0MS1MS2MS3MS4MS5MS6MS7MS8MS9MSAMSBMSCMSDMSEMSF
x50stopgoretsubnopJ0J1x≠0L2x≥0L3L1x<0L0x=0wait
x60MR0MR1MR2MR3MR4MR5MR6MR7MR8MR9MRAMRBMRCMRDMREMRF
x70Kx≠00Kx≠01Kx≠02Kx≠03Kx≠04Kx≠05Kx≠06Kx≠07Kx≠08Kx≠09Kx≠0AKx≠0BKx≠0CKx≠0DKx≠0EKx≠0F
x80Kgo0Kgo1Kgo2Kgo3Kgo4Kgo5Kgo6Kgo7Kgo8Kgo9KgoAKgoBKgoCKgoDKgoEKgoF
x90Kx≥00Kx≥01Kx≥02Kx≥03Kx≥04Kx≥05Kx≥06Kx≥07Kx≥08Kx≥09Kx≥0AKx≥0BKx≥0CKx≥0DKx≥0EKx≥0F
xA0Ksub0Ksub1Ksub2Ksub3Ksub4Ksub5Ksub6Ksub7Ksub8Ksub9KsubAKsubBKsubCKsubDKsubEKsubF
xB0KMS0KMS1KMS2KMS3KMS4KMS5KMS6KMS7KMS8KMS9KMSAKMSBKMSCKMSDKMSEKMSF
xC0Kx<00Kx<01Kx<02Kx<03Kx<04Kx<05Kx<06Kx<07Kx<08Kx<09Kx<0AKx<0BKx<0CKx<0DKx<0EKx<0F
xD0KMR0KMR1KMR2KMR3KMR4KMR5KMR6KMR7KMR8KMR9KMRAKMRBKMRCKMRDKMREKMRF
xE0Kx=00Kx=01Kx=02Kx=03Kx=04Kx=05Kx=06Kx=07Kx=08Kx=09Kx=0AKx=0BKx=0CKx=0DKx=0EKx=0F
xF0M+0M+1M+2M+3M+4M+5M+6M+7M+8M+9M+AM+BM+CM+DM+EM+F
+

В целом система команд основана на системе команд популярных советских микрокалькуляторов БЗ-34 или МК-61. Так что практически любая программа с МК-61 (не использующая недокументированные возможности) будет работать и на PocketMK. Однако, есть и несколько отличий. PocketMK использует фортрановские символьные обозначения функций: asin для арксинуса, tan вместо tg для тангенса и т.д. Кроме того, имеется различное начертание ряда команд с более устоявшимся англоязычным обозначением:

+ + + + + + + + + + +
PocketMKБЗ-34MK-61
MRИПП→X
MSПХ→П
rndКСЧ
signКЗН
stopС/ПС/П
retВ/ОВ/О
goБПБП
subПППП
+

В PocketMK добавлен ряд команд (выделены цветом в таблице):

    +
  1. графических (pnt, line, rect, arc, col, cls) для рисования точки (х,у), линии в точку (х,у), прямоугольника из текущей до точки (х,у), дуги из текущей до точки (х,у), задания цвета (можно задавать и вручную выбором из палитры) и очистки экрана;
  2. +
  3. спец. функций (erf(x), sinh(x), cosh(x), tanh(x), asinh(x), atanh(x), x! = Г(x+1), j0(x), y0(x), j1(x), y1(x));
  4. +
  5. прибавления регистра Х к числу в указанном регистре (команда М+);
  6. +
  7. удаления числа из стека (команда B↓).

+

Удалены редко использующиеся (по крайней мере автором) команды по преобразованию углов в минуты, секунды и обратно. Операция xy теперь стала настоящей двуместной операцией (содержимое регистра Y не сохраняется).

+

В нормальном виде клавиатура содержит довольно ограниченный набор часто используемых кнопок. Доступ к большинству научных функций и управляющих команд возможен после нажатия клавиш F, K или обоих сразу (для графических команд).

+ +

Ввод числа

+

Ввод числа осуществляется командами 0 1 2 3 4 5 6 7 8 9 . ±Â EE. Команды 0 1 2 3 4 5 6 7 8 9 . вводят непосредственно цифры мантиссы или порядка. Команда ± меняет знак числа в регистре Ð¥, если введена до команды EE или знак порядка, если после. Команда EE указывает, что дальнейший ввод относится к вводу порядка. Нажатие любой другой клавиши (кроме функциональных F или K) прерывает ввод числа. При вводе нового числа предыдущее значение регистра Ð¥ поднимается вверх по стеку, если перед этим не была выполнена одна из команд Cx или B↑.

+

Важно! Команда EE превращает 0 в 1 (при этом в стеке меняется только значение регистра Х, остальные регистры стека сохраняют свои значения). Эта недокументированная особенность советских калькуляторов часто использовалась в программах.

+

Совет! Команда EE изменяет порядок любого числа в регистре Х. Поэтому для быстрого умножения числа на 10n в программе можно воспользоваться кодом EE n, занимающим всего две ячейки памяти при n=1...9.

+ +

Команды работы со стеком

+

К этой группе относятся команды Cx B↑ ↔ Bx ↻ B↓. Напомним, что PocketMK использует стек из 4х регистров (X,Y,Z,T) и регистр B для хранения предыдущего значения Ð¥. Исходное значение стека будем считать равным b x y z t.

+ + + + + + + +
CxОбнуляет регистр Х. Ввод числа после этой команды не изменяет содержимое стека.
B↑Поднимает число Ð¥ вверх. Стек изменяется следующим образом b x x y z. Ввод числа после этой команды не изменяет содержимое стека.
Меняет содержимое регистров X и Y местами. Стек изменяется следующим образом x y x z t.
BxВозвращает значение регистра Вх в Х. Стек изменяется следующим образом b b x y z.
Вращает содержимое стека. Стек изменяется следующим образом x y z t x.
B↓Удаляет содержимое регистра Ð¥ со сдвигом стека вниз. Стек изменяется следующим образом x y z t t.
+ +

Двуместные операции

+

Операции выполняются над числами в регистрах X и Y. При этом содержимое регистра Y теряется, а регистры Z и T смещаются вниз. Значение регистра Ð¥ заносится в регистр В. Стек b x y z t изменяется следующим образом x g z t t, где g – результат операции. Рассмотрим команды подробнее.

+ + + + + + + + + + +
+Сложение чисел X=Y + X.
Разность чисел X=Y – X.
*Умножение чисел X=Y * X.
/Деление чисел X=Y / X.
xyВозведение в степень X=XY.
andПобитовое И. Дробная часть чисел отбрасывается.
orПобитовое ИЛИ. Дробная часть чисел отбрасывается.
xorПобитовое Исключающее ИЛИ. Дробная часть чисел отбрасывается.
maxМаксимальное из чисел X и Y.
+ +

Математические функции

+

Вызов функции относится к одноместным операциям, не затрагивающим содержимое регистров Y, Z, T. Значение аргумента всегда заносится в регистр В. Результат действия функции помещается в регистр Х. Для обратных функций на советских калькуляторах использовались обозначения f(x)-1 (например, sin-1), в PocketMK они заменены на стандартные компьютерные обозначения с добавление буквы a перед именем функции (например, asin).

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
10xВозведение в степень 10x = exp(x*log(10)).
exЭкспонента ex = exp(x), где e = 2.718281828459.
lgДесятичный логарифм lg(x)=ln(x)/ln(10), lg(10x)=x.
lnНатуральный логарифм, ln(exp(x))=x.
sinСинус sin(x), вычисляется в зависимости от выбора deg|grd|rad.
cosКосинус cos(x), вычисляется в зависимости от выбора deg|grd|rad.
tanТангенс tan(x)=sin(x)/cos(x), вычисляется в зависимости от выбора deg|grd|rad.
asinАрксинус asin(sin(x))=x, вычисляется в зависимости от выбора deg|grd|rad.
acosАрккосинус acos(cos(x))=|x|, вычисляется в зависимости от выбора deg|grd|rad.
atanАрктангенс atan(tan(x))=x, вычисляется в зависимости от выбора deg|grd|rad.
shГиперболический синус sh(x) = (ex – e-x)/2.
chГиперболический косинус ch(x)=(ex + e-x)/2.
thГиперболический тангенс th(x)=sh(x)/ch(x).
ashГиперболический арксинус ash(sh(x))=x.
achГиперболический арккосинус ach(ch(x))=|x|.
athГиперболический арктангенс ath(th(x))=x.
xКорень квадратный sqrt(x2) = |x|.
x2Квадрат числа.
1/x
erfИнтеграл вероятности erf(x) = ∫exp(-x2)dx.
x!Факториал x!=Г(x+1), Г(x) – гамма функция.
J0Функция Бесселя J0.
J1Функция Бесселя J1.
Y0Функция Бесселя Y0.
Y1Функция Бесселя Y1.
|x|Абсолютное значение |x| = {x для x≥0; –x для x<0}
signЗнак числа: 1 для x>0, 0 для x=0, -1 для x<0.
[x]Целая часть числа.
{x}Дробная часть числа.
rndСлучайное число. В отличии от МК-61 не зависит от числа X. Из соображений совместимости, случайное число не изменяет стек (как в случае с π).
notПобитовое отрицание. Дробная часть чисел отбрасывается.
+ +

Работа с регистрами

+

+

+

+

Для работы с регистрами предназначены три группы команд. +

    +
  1. Команды MSN записывают значение регистра Х в регистр N. Значение регистра Х не изменяется.
  2. +
  3. Команды M+N прибавляют значение регистра Х к числу в регистре N и записывают результат в регистр N. Значение регистра Х не изменяется.
  4. +
  5. Команды MRN присваивают регистру X значение из регистра N. Стек b x y z t изменяется следующим образом b n x y z, где n – значение в регистре N.
  6. +
  7. Немножко в стороне стоит команда π. Ее действие полностью аналогично командам MRN, но в регистр Ð¥ записывается число π=3.141592653589793.
  8. +
+Каждая из команд присвоения регистру имеет отдельный уникальный номер. Это сделано для совместимости с программами для МК-61.

+

Совет! Ввод небольшого числа данных (до 16 чисел) в программу удобно выполнять с помощью заполнения регистров памяти перед запуском программы.

+

Совет! Ввод данных в программу можно выполнять с помощью кнопки Step. Кусок соответствующей программы будет выглядеть следующим образом: MS1 MS2 MS3 .... Идея состоит в пошаговом исполнении программы, когда число в регистре Х меняется пользователем на каждом шаге.

+

Совет! Часто программы используют константы (или типичные начальные условия). Их можно сохранить вместе с программой если пометить соответствующие регистры при сохранении.

+

Совет! Иногда удобней (особенно в играх) загрузить программу с заполненными регистрами заново, чем вводить цифры вручную.

+ +

Управление программой

+

Эта группа команд осуществляет управление выполнением программы. Как правило, команды из этой группы требуют 2 ячейки памяти: одна ячейка под саму команду, а вторая ячейка на адрес перехода для этой команды.

+ + + + + + + + + + + + + + + +
stopОстанавливает выполнение программы.
waitПриостанавливает выполнение программы на 1 секунду. Удобно использовать в динамических играх.
nopНе выполняет никаких действий.
goБезусловный переход на адрес перехода.
subВызов подпрограммы с адреса перехода.
retВозврат из подпрограммы. При пустом стеке возврата происходит возврат на нулевой адрес (начало программы).
x≠0Если условие X≠0 выполнено, выполняется команда, следующая после адреса перехода, в противном случае производится переход по адресу перехода.
x<0Если условие X<0 выполнено, выполняется команда, следующая после адреса перехода, в противном случае производится переход по адресу перехода.
x=0Если условие X=0 выполнено, выполняется команда, следующая после адреса перехода, в противном случае производится переход по адресу перехода.
x≥0Если условие X≥0 выполнено, выполняется команда, следующая после адреса перехода, в противном случае производится переход по адресу перехода.
L0После выполнения команды происходит вычитание единицы из регистра 0. Если результат R0≤0, то продолжится выполнение со следующего адреса. Иначе – перейдет на указанный адрес перехода.
L1После выполнения команды происходит вычитание единицы из регистра 1. Если результат R1≤0, то продолжится выполнение со следующего адреса. Иначе – перейдет на указанный адрес перехода.
L2После выполнения команды происходит вычитание единицы из регистра 2. Если результат R2≤0, то продолжится выполнение со следующего адреса. Иначе – перейдет на указанный адрес перехода.
L3После выполнения команды происходит вычитание единицы из регистра 3. Если результат R3≤0, то продолжится выполнение со следующего адреса. Иначе – перейдет на указанный адрес перехода.
+

Совет! Для быстрого возврата на нулевой адрес можно использовать команду ret. Это работает, если стек возвратов пустой (не выполняется подпрограмма в данный момент).

+

Совет! Использование команды wait и переключателя deg|grd|rad позволяет создавать динамические программы. Идея состоит в том, что функция cos выдает различные значения в зависимости от положения переключателя. Например, следующий код wait MR9 cos sign будет ожидать реакции пользователя 1 секунду и возвращать -1, 0, 1 для переключателя deg|grd|rad соответственно, если R9=100.

+ +

Косвенная адресация

+

Команды косвенной адресации начинаются с нажатия кнопки K и всегда занимают одну ячейку памяти. После нажатия K вводится одна из команд MS, MR, go, sub, x<0, x≥0, x=0, x≠0 и номер регистра. На клавиатуре команды косвенной адресации выделены фиолетовым цветом. При косвенной адресации (индексации) в командах KMS и KMR запись и считывание числа производится из регистра с номером равным остатку от деления на 16 числа в указанном регистре. Переход по адресу в командах Kgo, Ksub, Kx<0, Kx≥0, Kx=0, Kx≠0 производится по остатку от деления содержимого регистра на 160.

+

Перед выполнением действия значение регистра модифицируется. Если номер регистра 0, 1, 2, 3, то его значение уменьшается на единицу. Если номер регистра равен 4, 5, 6, то значение регистра увеличивается на единицу. Остальные регистры не изменяются.

+

Например, команда KMS0 поместит значение регистра X в регистр, номер которого указан в регистре 0, но меньший на 1. Команда KMR4 поместит в регистр X значение регистра, указанного в регистре 4, но больший на 1. Команда Kgo9 переведет работу программы на адрес, указанный в регистре 9. Аналогично переход на подпрограмму, адрес которой указан в регистре B, выполняется командой KsubB. Команда Kx=0A аналогична команде x=0 XX, но адрес перехода XX указывается в регистре A, и команда занимает одну ячейку памяти.

+

Следует обратить внимание, что если в регистр поместить дробное число, а затем к этому регистру применить команду косвенного вызова, то от помещенного числа будет отброшена дробная часть. Например, поместив число 12.34567 в регистр 9 и выполнив команду KMR9, в регистре 9 останется число 12. Эта «недокументированная» особенность в программах БЗ-34 часто использовалась для отделения целой части числа и была сохранена в PocketMK.

+ +

Графические команды

+

В PocketMK добавлены 6 графических команд: cls, col, pnt, line, rect, arc. Графический вывод производится в растровую картинку размером 400*300 с началом координат в левом нижнем углу. Все точки вне этих границ игнорируются.

+ +

Обработка ошибок

+

В ходе расчетов могут возникать ошибочные ситуации (например, деление на 0, извлечение корня из отрицательно числа и т.д.). В этом случае на экране показывается сообщение NaN или Infinity. Работа программы автоматически останавливается при возникновении ошибочной ситуации.

+ +

Советы

+
    +
  • Команда EE изменяет порядок любого числа в регистре Ð¥. Поэтому для быстрого умножения числа на 10n в программе можно воспользоваться кодом EE n, занимающим всего две ячейки памяти при n=1...9.
  • +
  • Ввод небольшого числа данных (до 16 чисел) в программу удобно выполнять с помощью заполнения регистров памяти перед запуском программы.
  • +
  • Ввод данных в программу можно выполнять с помощью кнопки Step. Кусок соответствующей программы будет выглядеть следующим образом: MS1 MS2 MS3 .... Идея состоит в пошаговом исполнении программы, когда число в регистре Ð¥ меняется пользователем на каждом шаге.
  • +
  • Часто программы используют константы (или типичные начальные условия). Их можно сохранить вместе с программой если пометить соответствующие регистры при сохранении.
  • +
  • Иногда удобней (особенно в играх) загрузить программу с заполненными регистрами заново, чем вводить цифры вручную.
  • +
  • Для быстрого возврата на нулевой адрес можно использовать команду ret. Это работает, если стек возвратов пустой (не выполняется подпрограмма в данный момент).
  • +
  • Использование команды wait и переключателя deg|grd|rad позволяет создавать динамические программы. Идея состоит в том, что функция cos выдает различные значения в зависимости от положения переключателя. Например, следующий код wait MR9 cos sign будет ожидать реакции пользователя 1 секунду и возвращать -1, 0, 1 для переключателя deg|grd|rad соответственно, если R9=100.
  • +
+ +
+ + +
+ + + + diff --git a/website/games/mk61.js b/website/games/mk61.js new file mode 100644 index 0000000..3588342 --- /dev/null +++ b/website/games/mk61.js @@ -0,0 +1,672 @@ +var x=0, y=0, z=0, t=0, b=0; // stack +var reg = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // registers 0...9,A...F + +var ret = []; // return stack +var prog = []; // program to be executed (codes only) +var desc = ""; // program description +var pos = 0; // current execution position +var stop = false; // flag to stop execution +var interval = 0; + +var pressF = 0; // key F is pressed or not +var pressK = 0; // key K is pressed or not +var prgON = false; // we in program mode +var degF = Math.PI/180; // factor of degrees (1, Math.PI/200, Math.PI/180) +var num = ""; // number being typed +var up = false; // need shift up before new number +var x0=0, y0=0; // current graphical coordinates +var ctx = document.getElementById("myCanvas").getContext("2d"); +// var cols = ['#000', '#FFF', '#F00', '#0F0', '#00F', '#0FF', '#F0F', '#FF0', +// '#ccc', '#888', '#F80', '#0F8', '#80F', '#8F0', '#08F', '#F08', +// '#800', '#080', '#008', '#088', '#808', '#880', '#840', '#084', +// '#408', '#480', '#048', '#804']; +var cols = ['#00f', '#08f', '#0ff', '#0f8', '#0f0', '#8f0', + '#ff0', '#f80', '#f00', '#f08', '#f0f', '#80f', + '#00a', '#05a', '#0aa', '#0a5', '#0a0', '#5a0', + '#aa0', '#a50', '#a00', '#a05', '#a0a', '#50a', + '#fff', '#ccc', '#999', '#666', '#333', '#000']; +var ccol = 'black'; // current color + +function setColor(v) +{ + var l=cols.length, c = Math.floor(v)%l; + if(c<0) c+=l; + ccol = cols[c]; +} +function fin() { up=true; num=""; } +function checkUp() +{ if(up) { num=""; t=z; z=y; y=x; up=false; } } +var cmds = [ + {id:"0", exec:function(){ checkUp(); num = num+"0"; x = num*1; }}, // hex = 0 + {id:"1", exec:function(){ checkUp(); num = num+"1"; x = num*1; }}, + {id:"2", exec:function(){ checkUp(); num = num+"2"; x = num*1; }}, + {id:"3", exec:function(){ checkUp(); num = num+"3"; x = num*1; }}, + {id:"4", exec:function(){ checkUp(); num = num+"4"; x = num*1; }}, + {id:"5", exec:function(){ checkUp(); num = num+"5"; x = num*1; }}, + {id:"6", exec:function(){ checkUp(); num = num+"6"; x = num*1; }}, + {id:"7", exec:function(){ checkUp(); num = num+"7"; x = num*1; }}, + {id:"8", exec:function(){ checkUp(); num = num+"8"; x = num*1; }}, + {id:"9", exec:function(){ checkUp(); num = num+"9"; x = num*1; }}, + {id:".", exec:function(){ checkUp(); num = num+"."; x = num*1; }}, + {id:"±", exec:function(){ if(num.indexOf("e+")>0) num = num.replace("e+","e-"); + else if(num.indexOf("e-")>0) num = num.replace("e-","e+"); + else { x = -x; fin(); } }}, + {id:"EE", exec:function(){ if(num=="") num = x.toString(10); + if(num=="0") num = "1"; // This is *feature* of MK-61 + if(num.search('e')<0) num = num+"e+0"; up=false; }}, + {id:"Cx", exec:function(){ up=false; num=""; x=0; }}, + {id:"B↑",exec:function(){ up=false; num=""; t=z; z=y; y=x; }}, + {id:"Bx", exec:function(){ fin(); x=b; }}, + + {id:"+", exec:function(){ fin(); x=y+x; y=z; z=t; }}, // hex = 16 + {id:"−",exec:function(){ fin(); x=y-x; y=z; z=t; }}, + {id:"∗", exec:function(){ fin(); x=y*x; y=z; z=t; }}, + {id:"/", exec:function(){ fin(); x=y/x; y=z; z=t; }}, + {id:"↔",exec:function(){ fin(); var bb=x; x=y; y=bb; }}, + {id:"10x",exec:function(){ fin(); x=Math.pow(10,x);}}, + {id:"ex", exec:function(){ fin(); x=Math.exp(x); }}, + {id:"lg", exec:function(){ fin(); x=Math.log(x)/Math.LN10;}}, + {id:"ln", exec:function(){ fin(); x=Math.log(x); }}, + {id:"asin", exec:function(){ fin(); x=Math.asin(x)/degF; }}, + {id:"acos", exec:function(){ fin(); x=Math.acos(x)/degF; }}, + {id:"atan", exec:function(){ fin(); x=Math.atan(x)/degF; }}, + {id:"sin", exec:function(){ fin(); x=Math.sin(x*degF); }}, + {id:"cos", exec:function(){ fin(); x=Math.cos(x*degF); }}, + {id:"tan", exec:function(){ fin(); x=Math.tan(x*degF); }}, + {id:"Y0", exec:function(){ fin(); x=BesselY0(x); }}, + + {id:"π", exec:function(){ fin(); t=z; z=y; y=x; x=Math.PI; }}, // hex = 32 + {id:"√x", exec:function(){ fin(); x=Math.sqrt(x); }}, + {id:"x2",exec:function(){ fin(); x=x*x; }}, + {id:"1/x", exec:function(){ fin(); x=1/x; }}, + {id:"xy",exec:function(){ fin(); x=Math.pow(x,y); y=z; z=t;}}, + {id:"↻", exec:function(){ fin(); var bb=x; x=y; y=z; z=t; t=bb; }}, + {id:"B↓",exec:function(){ fin(); x=y; y=z; z=t; }}, + {id:"sh", exec:function(){ fin(); x=Math.sinh(x); }}, + {id:"ch", exec:function(){ fin(); x=Math.cosh(x); }}, + {id:"th", exec:function(){ fin(); x=Math.tanh(x); }}, + {id:"erf", exec:function(){ fin(); x=erf(x); }}, + {id:"x!", exec:function(){ fin(); x=fact(x); }}, + {id:"ash", exec:function(){ fin(); x=Math.asinh(x); }}, + {id:"ach", exec:function(){ fin(); x=Math.acosh(x); }}, + {id:"ath", exec:function(){ fin(); x=Math.atanh(x); }}, + {id:"Y1", exec:function(){ fin(); x=BesselY1(x); }}, + + {id:"col", exec:function(){ fin(); setColor(x); }}, // hex = 48 + {id:"|x|", exec:function(){ fin(); x=Math.abs(x); }}, + {id:"sign", exec:function(){ fin(); if(x<0) x=-1; if(x>0) x=1;}}, + {id:"cls", exec:function(){ fin(); ctx.clearRect(0, 0, 400, 300); x0=y0=0; }}, + {id:"[x]", exec:function(){ fin(); x=Math.floor(x); }}, + {id:"{x}", exec:function(){ fin(); x=x-Math.floor(x); }}, + {id:"max", exec:function(){ fin(); x=Math.max(x,y); y=z; z=t; }}, + {id:"and", exec:function(){ fin(); x=x&y; y=z; z=t; }}, + {id:"or", exec:function(){ fin(); x=x|y; y=z; z=t; }}, + {id:"xor", exec:function(){ fin(); x=x^y; y=z; z=t; }}, + {id:"not", exec:function(){ fin(); x=~x; }}, + {id:"rnd", exec:function(){ fin(); x=Math.random(); }}, + {id:"pnt", exec:function(){ fin(); ctx.beginPath(); ctx.fillStyle = ccol; ctx.rect(x,y,1,1); ctx.fill(); x0=x; y0=y; }}, + {id:"line", exec:function(){ fin(); ctx.beginPath(); ctx.strokeStyle=ccol; ctx.moveTo(x0,y0); ctx.lineTo(x,y); ctx.stroke(); x0=x; y0=y; }}, + {id:"rect", exec:function(){ fin(); ctx.beginPath(); ctx.fillStyle = ccol; ctx.rect(x,y,z-x,t-y); ctx.fill(); }}, + {id:"arc", exec:function(){ fin(); ctx.beginPath(); ctx.strokeStyle=ccol; ctx.arc(x0,y0,x,y*degF,z*degF); ctx.stroke(); }}, // x=R. y=angl1, z=angl2 + + {id:"MS0", exec:function(){ fin(); reg[0]=x; }}, // hex = 64 + {id:"MS1", exec:function(){ fin(); reg[1]=x; }}, + {id:"MS2", exec:function(){ fin(); reg[2]=x; }}, + {id:"MS3", exec:function(){ fin(); reg[3]=x; }}, + {id:"MS4", exec:function(){ fin(); reg[4]=x; }}, + {id:"MS5", exec:function(){ fin(); reg[5]=x; }}, + {id:"MS6", exec:function(){ fin(); reg[6]=x; }}, + {id:"MS7", exec:function(){ fin(); reg[7]=x; }}, + {id:"MS8", exec:function(){ fin(); reg[8]=x; }}, + {id:"MS9", exec:function(){ fin(); reg[9]=x; }}, + {id:"MSA", exec:function(){ fin(); reg[10]=x; }}, + {id:"MSB", exec:function(){ fin(); reg[11]=x; }}, + {id:"MSC", exec:function(){ fin(); reg[12]=x; }}, + {id:"MSD", exec:function(){ fin(); reg[13]=x; }}, + {id:"MSE", exec:function(){ fin(); reg[14]=x; }}, + {id:"MSF", exec:function(){ fin(); reg[15]=x; }}, + + {id:"stop", exec:function(){ fin(); stop=true; }}, // hex = 80 + {id:"go", exec:function(opt=-1){ fin(); pos=opt-1; }}, + {id:"ret", exec:function(){ fin(); pos=ret.length>0?ret.pop():0; }}, + {id:"sub", exec:function(opt=-1){ fin(); ret.push(pos+1); pos=opt-1; }}, + {id:"nop", exec:function(){ fin(); }}, + {id:"J0", exec:function(){ fin(); x=BesselJ0(x); }}, + {id:"J1", exec:function(){ fin(); x=BesselJ1(x); }}, + {id:"X≠0",exec:function(opt=-1){ fin(); if(x==0) pos=opt-1; else pos+=1; }}, // !!!NOTE + {id:"L2", exec:function(opt=-1){ fin(); reg[2] -= 1; if(reg[2]>0) pos=opt-1; else pos+=1; }}, + {id:"X≥0",exec:function(opt=-1){ fin(); if(x<0) pos=opt-1; else pos+=1; }}, // !!!NOTE + {id:"L3", exec:function(opt=-1){ fin(); reg[3] -= 1; if(reg[3]>0) pos=opt-1; else pos+=1; }}, + {id:"L1", exec:function(opt=-1){ fin(); reg[1] -= 1; if(reg[1]>0) pos=opt-1; else pos+=1; }}, + {id:"X<0",exec:function(opt=-1){ fin(); if(x>=0) pos=opt-1; else pos+=1; }}, // !!!NOTE + {id:"L0", exec:function(opt=-1){ fin(); reg[0] -= 1; if(reg[0]>0) pos=opt-1; else pos+=1; }}, + {id:"X=0", exec:function(opt=-1){ fin(); if(x!=0) pos=opt-1; else pos+=1; }}, // !!!NOTE + {id:"wait", exec:function(){ fin(); setTimeout(function(){}, 1000); }}, + + {id:"MR0", exec:function(){ fin(); t=z; z=y; y=x; x=reg[0]; }}, // hex = 96 + {id:"MR1", exec:function(){ fin(); t=z; z=y; y=x; x=reg[1]; }}, + {id:"MR2", exec:function(){ fin(); t=z; z=y; y=x; x=reg[2]; }}, + {id:"MR3", exec:function(){ fin(); t=z; z=y; y=x; x=reg[3]; }}, + {id:"MR4", exec:function(){ fin(); t=z; z=y; y=x; x=reg[4]; }}, + {id:"MR5", exec:function(){ fin(); t=z; z=y; y=x; x=reg[5]; }}, + {id:"MR6", exec:function(){ fin(); t=z; z=y; y=x; x=reg[6]; }}, + {id:"MR7", exec:function(){ fin(); t=z; z=y; y=x; x=reg[7]; }}, + {id:"MR8", exec:function(){ fin(); t=z; z=y; y=x; x=reg[8]; }}, + {id:"MR9", exec:function(){ fin(); t=z; z=y; y=x; x=reg[9]; }}, + {id:"MRA", exec:function(){ fin(); t=z; z=y; y=x; x=reg[10]; }}, + {id:"MRB", exec:function(){ fin(); t=z; z=y; y=x; x=reg[11]; }}, + {id:"MRC", exec:function(){ fin(); t=z; z=y; y=x; x=reg[12]; }}, + {id:"MRD", exec:function(){ fin(); t=z; z=y; y=x; x=reg[13]; }}, + {id:"MRE", exec:function(){ fin(); t=z; z=y; y=x; x=reg[14]; }}, + {id:"MRF", exec:function(){ fin(); t=z; z=y; y=x; x=reg[15]; }}, + + {id:"Kx≠00", exec:function(){ fin(); if(x!=0) pos=modifReg(0)-1; }}, // hex = 112 + {id:"Kx≠01", exec:function(){ fin(); if(x!=0) pos=modifReg(1)-1; }}, + {id:"Kx≠02", exec:function(){ fin(); if(x!=0) pos=modifReg(2)-1; }}, + {id:"Kx≠03", exec:function(){ fin(); if(x!=0) pos=modifReg(3)-1; }}, + {id:"Kx≠04", exec:function(){ fin(); if(x!=0) pos=modifReg(4)-1; }}, + {id:"Kx≠05", exec:function(){ fin(); if(x!=0) pos=modifReg(5)-1; }}, + {id:"Kx≠06", exec:function(){ fin(); if(x!=0) pos=modifReg(6)-1; }}, + {id:"Kx≠07", exec:function(){ fin(); if(x!=0) pos=modifReg(7)-1; }}, + {id:"Kx≠08", exec:function(){ fin(); if(x!=0) pos=modifReg(8)-1; }}, + {id:"Kx≠09", exec:function(){ fin(); if(x!=0) pos=modifReg(9)-1; }}, + {id:"Kx≠0A", exec:function(){ fin(); if(x!=0) pos=modifReg(10)-1; }}, + {id:"Kx≠0B", exec:function(){ fin(); if(x!=0) pos=modifReg(11)-1; }}, + {id:"Kx≠0C", exec:function(){ fin(); if(x!=0) pos=modifReg(12)-1; }}, + {id:"Kx≠0D", exec:function(){ fin(); if(x!=0) pos=modifReg(13)-1; }}, + {id:"Kx≠0E", exec:function(){ fin(); if(x!=0) pos=modifReg(14)-1; }}, + {id:"Kx≠0F", exec:function(){ fin(); if(x!=0) pos=modifReg(15)-1; }}, + + {id:"Kgo0", exec:function(){ fin(); pos=modifReg(0)-1; }}, // hex = 128 + {id:"Kgo1", exec:function(){ fin(); pos=modifReg(1)-1; }}, + {id:"Kgo2", exec:function(){ fin(); pos=modifReg(2)-1; }}, + {id:"Kgo3", exec:function(){ fin(); pos=modifReg(3)-1; }}, + {id:"Kgo4", exec:function(){ fin(); pos=modifReg(4)-1; }}, + {id:"Kgo5", exec:function(){ fin(); pos=modifReg(5)-1; }}, + {id:"Kgo6", exec:function(){ fin(); pos=modifReg(6)-1; }}, + {id:"Kgo7", exec:function(){ fin(); pos=modifReg(7)-1; }}, + {id:"Kgo8", exec:function(){ fin(); pos=modifReg(8)-1; }}, + {id:"Kgo9", exec:function(){ fin(); pos=modifReg(9)-1; }}, + {id:"KgoA", exec:function(){ fin(); pos=modifReg(10)-1; }}, + {id:"KgoB", exec:function(){ fin(); pos=modifReg(11)-1; }}, + {id:"KgoC", exec:function(){ fin(); pos=modifReg(12)-1; }}, + {id:"KgoD", exec:function(){ fin(); pos=modifReg(13)-1; }}, + {id:"KgoE", exec:function(){ fin(); pos=modifReg(14)-1; }}, + {id:"KgoF", exec:function(){ fin(); pos=modifReg(15)-1; }}, + + {id:"Kx≥00", exec:function(){ fin(); if(x>=0) pos=modifReg(0)-1; }}, // hex = 144 + {id:"Kx≥01", exec:function(){ fin(); if(x>=0) pos=modifReg(1)-1; }}, + {id:"Kx≥02", exec:function(){ fin(); if(x>=0) pos=modifReg(2)-1; }}, + {id:"Kx≥03", exec:function(){ fin(); if(x>=0) pos=modifReg(3)-1; }}, + {id:"Kx≥04", exec:function(){ fin(); if(x>=0) pos=modifReg(4)-1; }}, + {id:"Kx≥05", exec:function(){ fin(); if(x>=0) pos=modifReg(5)-1; }}, + {id:"Kx≥06", exec:function(){ fin(); if(x>=0) pos=modifReg(6)-1; }}, + {id:"Kx≥07", exec:function(){ fin(); if(x>=0) pos=modifReg(7)-1; }}, + {id:"Kx≥08", exec:function(){ fin(); if(x>=0) pos=modifReg(8)-1; }}, + {id:"Kx≥09", exec:function(){ fin(); if(x>=0) pos=modifReg(9)-1; }}, + {id:"Kx≥0A", exec:function(){ fin(); if(x>=0) pos=modifReg(10)-1; }}, + {id:"Kx≥0B", exec:function(){ fin(); if(x>=0) pos=modifReg(11)-1; }}, + {id:"Kx≥0C", exec:function(){ fin(); if(x>=0) pos=modifReg(12)-1; }}, + {id:"Kx≥0D", exec:function(){ fin(); if(x>=0) pos=modifReg(13)-1; }}, + {id:"Kx≥0E", exec:function(){ fin(); if(x>=0) pos=modifReg(14)-1; }}, + {id:"Kx≥0F", exec:function(){ fin(); if(x>=0) pos=modifReg(15)-1; }}, + + {id:"Ksub0", exec:function(){ fin(); ret.push(pos); pos=modifReg(0)-1; }}, // hex = 160 + {id:"Ksub1", exec:function(){ fin(); ret.push(pos); pos=modifReg(1)-1; }}, + {id:"Ksub2", exec:function(){ fin(); ret.push(pos); pos=modifReg(2)-1; }}, + {id:"Ksub3", exec:function(){ fin(); ret.push(pos); pos=modifReg(3)-1; }}, + {id:"Ksub4", exec:function(){ fin(); ret.push(pos); pos=modifReg(4)-1; }}, + {id:"Ksub5", exec:function(){ fin(); ret.push(pos); pos=modifReg(5)-1; }}, + {id:"Ksub6", exec:function(){ fin(); ret.push(pos); pos=modifReg(6)-1; }}, + {id:"Ksub7", exec:function(){ fin(); ret.push(pos); pos=modifReg(7)-1; }}, + {id:"Ksub8", exec:function(){ fin(); ret.push(pos); pos=modifReg(8)-1; }}, + {id:"Ksub9", exec:function(){ fin(); ret.push(pos); pos=modifReg(9)-1; }}, + {id:"KsubA", exec:function(){ fin(); ret.push(pos); pos=modifReg(10)-1; }}, + {id:"KsubB", exec:function(){ fin(); ret.push(pos); pos=modifReg(11)-1; }}, + {id:"KsubC", exec:function(){ fin(); ret.push(pos); pos=modifReg(12)-1; }}, + {id:"KsubD", exec:function(){ fin(); ret.push(pos); pos=modifReg(13)-1; }}, + {id:"KsubE", exec:function(){ fin(); ret.push(pos); pos=modifReg(14)-1; }}, + {id:"KsubF", exec:function(){ fin(); ret.push(pos); pos=modifReg(15)-1; }}, + + {id:"KMS0", exec:function(){ fin(); var r=modifReg(0)%16; if(r<0) r+=16; reg[r]=x; }}, // hex = 176 + {id:"KMS1", exec:function(){ fin(); var r=modifReg(1)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS2", exec:function(){ fin(); var r=modifReg(2)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS3", exec:function(){ fin(); var r=modifReg(3)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS4", exec:function(){ fin(); var r=modifReg(4)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS5", exec:function(){ fin(); var r=modifReg(5)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS6", exec:function(){ fin(); var r=modifReg(6)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS7", exec:function(){ fin(); var r=modifReg(7)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS8", exec:function(){ fin(); var r=modifReg(8)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMS9", exec:function(){ fin(); var r=modifReg(9)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMSA", exec:function(){ fin(); var r=modifReg(10)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMSB", exec:function(){ fin(); var r=modifReg(11)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMSC", exec:function(){ fin(); var r=modifReg(12)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMSD", exec:function(){ fin(); var r=modifReg(13)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMSE", exec:function(){ fin(); var r=modifReg(14)%16; if(r<0) r+=16; reg[r]=x; }}, + {id:"KMSF", exec:function(){ fin(); var r=modifReg(15)%16; if(r<0) r+=16; reg[r]=x; }}, + + {id:"Kx<00", exec:function(){ fin(); if(x<0) pos=modifReg(0)-1; }}, // hex = 192 + {id:"Kx<01", exec:function(){ fin(); if(x<0) pos=modifReg(1)-1; }}, + {id:"Kx<02", exec:function(){ fin(); if(x<0) pos=modifReg(2)-1; }}, + {id:"Kx<03", exec:function(){ fin(); if(x<0) pos=modifReg(3)-1; }}, + {id:"Kx<04", exec:function(){ fin(); if(x<0) pos=modifReg(4)-1; }}, + {id:"Kx<05", exec:function(){ fin(); if(x<0) pos=modifReg(5)-1; }}, + {id:"Kx<06", exec:function(){ fin(); if(x<0) pos=modifReg(6)-1; }}, + {id:"Kx<07", exec:function(){ fin(); if(x<0) pos=modifReg(7)-1; }}, + {id:"Kx<08", exec:function(){ fin(); if(x<0) pos=modifReg(8)-1; }}, + {id:"Kx<09", exec:function(){ fin(); if(x<0) pos=modifReg(9)-1; }}, + {id:"Kx<0A", exec:function(){ fin(); if(x<0) pos=modifReg(10)-1; }}, + {id:"Kx<0B", exec:function(){ fin(); if(x<0) pos=modifReg(11)-1; }}, + {id:"Kx<0C", exec:function(){ fin(); if(x<0) pos=modifReg(12)-1; }}, + {id:"Kx<0D", exec:function(){ fin(); if(x<0) pos=modifReg(13)-1; }}, + {id:"Kx<0E", exec:function(){ fin(); if(x<0) pos=modifReg(14)-1; }}, + {id:"Kx<0F", exec:function(){ fin(); if(x<0) pos=modifReg(15)-1; }}, + + {id:"KMR0", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(0)%16; if(r<0) r+=16; x=reg[r]; }}, // hex = 208 + {id:"KMR1", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(1)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR2", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(2)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR3", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(3)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR4", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(4)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR5", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(5)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR6", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(6)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR7", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(7)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR8", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(8)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMR9", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(9)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMRA", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(10)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMRB", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(11)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMRC", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(12)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMRD", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(13)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMRE", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(14)%16; if(r<0) r+=16; x=reg[r]; }}, + {id:"KMRF", exec:function(){ fin(); t=z; z=y; y=x; var r=modifReg(15)%16; if(r<0) r+=16; x=reg[r]; }}, + + {id:"Kx=00", exec:function(){ fin(); if(x==0) pos=modifReg(0)-1; }}, // hex = 224 + {id:"Kx=01", exec:function(){ fin(); if(x==0) pos=modifReg(1)-1; }}, + {id:"Kx=02", exec:function(){ fin(); if(x==0) pos=modifReg(2)-1; }}, + {id:"Kx=03", exec:function(){ fin(); if(x==0) pos=modifReg(3)-1; }}, + {id:"Kx=04", exec:function(){ fin(); if(x==0) pos=modifReg(4)-1; }}, + {id:"Kx=05", exec:function(){ fin(); if(x==0) pos=modifReg(5)-1; }}, + {id:"Kx=06", exec:function(){ fin(); if(x==0) pos=modifReg(6)-1; }}, + {id:"Kx=07", exec:function(){ fin(); if(x==0) pos=modifReg(7)-1; }}, + {id:"Kx=08", exec:function(){ fin(); if(x==0) pos=modifReg(8)-1; }}, + {id:"Kx=09", exec:function(){ fin(); if(x==0) pos=modifReg(9)-1; }}, + {id:"Kx=0A", exec:function(){ fin(); if(x==0) pos=modifReg(10)-1; }}, + {id:"Kx=0B", exec:function(){ fin(); if(x==0) pos=modifReg(11)-1; }}, + {id:"Kx=0C", exec:function(){ fin(); if(x==0) pos=modifReg(12)-1; }}, + {id:"Kx=0D", exec:function(){ fin(); if(x==0) pos=modifReg(13)-1; }}, + {id:"Kx=0E", exec:function(){ fin(); if(x==0) pos=modifReg(14)-1; }}, + {id:"Kx=0F", exec:function(){ fin(); if(x==0) pos=modifReg(15)-1; }}, + + {id:"M+0", exec:function(){ fin(); reg[0]+=x; }}, // hex = 240 + {id:"M+1", exec:function(){ fin(); reg[1]+=x; }}, + {id:"M+2", exec:function(){ fin(); reg[2]+=x; }}, + {id:"M+3", exec:function(){ fin(); reg[3]+=x; }}, + {id:"M+4", exec:function(){ fin(); reg[4]+=x; }}, + {id:"M+5", exec:function(){ fin(); reg[5]+=x; }}, + {id:"M+6", exec:function(){ fin(); reg[6]+=x; }}, + {id:"M+7", exec:function(){ fin(); reg[7]+=x; }}, + {id:"M+8", exec:function(){ fin(); reg[8]+=x; }}, + {id:"M+9", exec:function(){ fin(); reg[9]+=x; }}, + {id:"M+A", exec:function(){ fin(); reg[10]+=x; }}, + {id:"M+B", exec:function(){ fin(); reg[11]+=x; }}, + {id:"M+C", exec:function(){ fin(); reg[12]+=x; }}, + {id:"M+D", exec:function(){ fin(); reg[13]+=x; }}, + {id:"M+E", exec:function(){ fin(); reg[14]+=x; }}, + {id:"M+F", exec:function(){ fin(); reg[15]+=x; }}]; + +var keyR = [-3,-3,-3,-3,-3,-3, 0x7,0x8,0x9,0xf,-3,-3, 0x4,0x5,0x6,0xe,-3,-3, 0x1,0x2,0x3,0xd,-3,-3, 0x0,0xa,0xb,0xc,-3,0xff]; +var keyN = [-1,-2,-0x60,-0x40,-0xf0,0x22, 0x07,0x08,0x09,0x11,0x12,0x23, 0x04,0x05,0x06,0x10,0x13,0x24, 0x01,0x02,0x03,0x14,0x0e,0x0f, 0x00,0x0a,0x0b,0x0c,0x26,0x0d]; +var keyF = [-1,-2,0x5d,0x5b,0x58,0x5a, 0x51,0x53,0x5c,0x5e,0x59,0x57, 0x50,0x52,0x37,0x38,0x39,0x3a, 0x1c,0x1d,0x1e,0x16,0x15,0x20, 0x19,0x1a,0x1b,0x18,0x17,0x21]; +var keyK = [-1,-2,-0xd0,-0xb0,0x5f,0x25, -0x80,-0xa0,-0xc0,-0xe0,-0x90,-0x70, 0x35,0x34,0x31,0x55,0x56,0x2a, 0x27,0x28,0x29,0x1f,0x2f,0x2b, 0x2c,0x2d,0x2e,0x32,0x3b,0x36]; +var keyFK = [-1,-2,-3,-3,-3,0x54, -3,-3,-3,-3,-3,-3, -3,-3,-3,-3,-3,-3, -3,-3,-3,-3,-3,-3, 0x3c,0x3d,0x3e,0x3f,0x30,0x33]; + +var keyCur = keyN; +var needR = 0; + +function degree(kind) +{ + if(kind==0) + { document.getElementById("degR").checked=true; document.getElementById("degG").checked=false; document.getElementById("degD").checked=false; degF=1; } + if(kind==1) + { document.getElementById("degR").checked=false; document.getElementById("degG").checked=true; document.getElementById("degD").checked=false; degF=Math.PI/200; } + if(kind==2) + { document.getElementById("degR").checked=false; document.getElementById("degG").checked=false; document.getElementById("degD").checked=true; degF=Math.PI/180; } +} + +function save() +{ + localStorage.setItem("regMK61",reg); + localStorage.setItem("progMK61",prog); + localStorage.setItem("descMK61",desc); +} + +function toArray(str) +{ return str.split(",").map(function(item){return parseInt(item,10);}); } + +function init() +{ + if (localStorage.regMK61) reg = toArray(localStorage.regMK61); + else localStorage.regMK61 = reg; + if (localStorage.progMK61) prog = toArray(localStorage.progMK61); + else localStorage.progMK61 = prog; + if (localStorage.descMK61) desc = localStorage.descMK61; + else localStorage.descMK61 = desc; + + degree(0); updateKeys(); +} + +function updateProg() +{ +// if(prgON) + { + var tbl = ""; + for(var i=0;i<10;i++) tbl += ""+i+""; + tbl += ""; + for(var i=0;i"; + tbl += "#"+Math.floor(prog[i]/10).toString(16)+prog[i]%10+"
]"; + if(i%10==9) tbl += ""; + } + document.getElementById("prog").innerHTML = tbl+""; + } +} + +function updateRegs() +{ + if(num=="") document.getElementById("regX").value = x; + else document.getElementById("regX").value = num; + document.getElementById("regY").value = y; + document.getElementById("regZ").value = z; + document.getElementById("regT").value = t; + + document.getElementById("reg").innerHTML = "

Bx = "+b+"

Registers: "+reg+"

"; + //"

Return stack:"+ret+"

pos = "+pos+"

"; +} + +function updateKeys() +{ + document.getElementById("prg").checked=prgON; + if(needR!=0) + { +// if(needR<0) +// document.getElementById("status").innerHTML = "Enter register"; +// else if(needR>=0x200) +// document.getElementById("status").innerHTML = "Enter first digit of address"; +// else +// document.getElementById("status").innerHTML = "Enter second digit of address"; + keyCur = keyR; + } + else if(pressF==0 && pressK==0) keyCur = keyN; + else if(pressF==1 && pressK==0) keyCur = keyF; + else if(pressF==0 && pressK==1) keyCur = keyK; + else if(pressF==1 && pressK==1) keyCur = keyFK; +// if(needR==0) document.getElementById("status").innerHTML = ""; + + for(var i=0;i<30;i++) + { + var but = document.getElementById("button"+i); + var stl = "color:#000;background:#f9f9f9"; + var key = keyCur[i]; but.disabled = false; + if(key==-3) { but.disabled = true; but.innerHTML=""; } + else if(key==-1) + { but.innerHTML = "F"; stl = pressF>0?"color:#850;background:#fc8":"color:#fa0;background:#f9f9f9"; } + else if(key==-2) + { but.innerHTML = "K"; stl = pressK>0?"color:#008;background:#88f":"color:#00f;background:#f9f9f9"; } + else if(needR!=0) + { + if(key<16) + but.innerHTML = key.toString(16).toUpperCase(); + else + { + stl = "color:#f00;background:#f9f9f9"; + but.innerHTML = "×"; + } + } + else if(key<0) + { + stl = "color:#f0f;background:#f9f9f9"; + but.innerHTML = cmds[-key].id.slice(0,-1); + } + else + { + const grph = [48,60,61,62,63,51]; + const exeC = [81,83,87,88,89,90,91,92,93,94]; + if(grph.includes(key)) stl = "color:#0d0;background:#f9f9f9"; + if(exeC.includes(key)) stl = "color:#880;background:#f9f9f9"; + if(key==0x0d) stl = "color:#F00;background:#f9f9f9"; + but.innerHTML = cmds[key].id; + } + but.style = "width:55px;height:55px;border-radius:10px;font-size:15pt;padding:0px;"+stl; + } + updateRegs(); + updateProg(); +} + +function handleKey(key) +{ + const exeC = [81,83,87,88,89,90,91,92,93,94]; + if(prgON) + { + if(pos<0 || pos>=160) pos = 0; + if(pos>prog.length) pos=prog.length; + prog[pos] = key; pos++; + if(exeC.includes(key)) + { needR = 0x200; updateKeys(); } + } + else if(!prgON) if(!exeC.includes(key)) + { + var bb = x; + cmds[key].exec(); + if(num=="") b = bb; + } + if(pressF!=0 || pressK!=0) + { pressF = pressK = 0; updateKeys(); } + updateRegs(); + updateProg(); +} + +function press(but) +{ + var key = keyCur[but]; + if(key==-3) return; // nothing to do + else if(key==-1) // key F + { pressF = 1-pressF; updateKeys(); } + else if(key==-2) // key K + { pressK = 1-pressK; updateKeys(); } + else if(key<0) // need RegId + { needR = key; updateKeys(); } + else if(needR>0) // input RegId + { + // use "nop" for prev cmd if canceled + if(key>16) { pos--; prog[pos]=84; needR=0; updateKeys(); } + else if(needR>=0x200) { needR+=key-0x100; } + else // NOTE: for compatibility reason the pseudo-hex notation is used!!! + { prog[pos] = 10*(needR%16)+key; pos++; needR=0; updateKeys(); } + } + else if(needR<0) // input RegId + { + if(key<16) key -= needR; + needR=0; updateKeys(); handleKey(key); + } + else handleKey(key); +} + +function stopRun() +{ + document.getElementById("butRun").innerHTML = "Run"; + stop=false; if(interval) clearInterval(interval); interval=0; +} + +function posDec() +{ + pos--; if(pos<0) pos = prog.length-1; + updateProg(); +} + +function posInc() +{ + pos++; if(pos>prog.length) pos = 0; + updateProg(); +} + +function posUp() +{ + pos-=10; if(pos<0) pos = 0; + updateProg(); +} + +function posDwn() +{ + pos+=10; if(pos>prog.length) pos = prog.length-1; + updateProg(); +} + +function posDel() +{ + if(pos>=0 && pos0) prog.pop(); + updateProg(); +} + +function posIns() +{ + if(pos>=0 && pos=prog.length) pos=0; + stop = false; + interval = setInterval(step, 20); + document.getElementById("butRun").innerHTML = "Stop"; +} + +function step() +{ + if(pos<0 || pos>=prog.length || stop || x-x!=0) { stopRun(); return; } + var kod = prog[pos], opt = pos+1=160) pos=0; + updateRegs(); + updateProg(); +} + +function modifReg(rr) +{ + if(rr<8) reg[rr] += (rr<4) ? -1:1; + reg[rr] = Math.floor(reg[rr]); + return reg[rr]; +} + +function fact(x) +{ + var r = Math.exp(lgamma(x+1)); // this is good but approximate result + if(x==Math.floor(x)) r = Math.floor(r+0.5); + return r; +} + +function lgamma(x) +{ + const cof=[76.18009172947146,-86.50532032941677, 24.01409824083091,-1.231739572450155, 0.1208650973866179e-2,-0.5395239384953e-5]; + var tmp = x+5.5 - (x+0.5)*Math.log(x+5.5); + var ser = 1.000000000190015; + for(var j=0;j<=5;j++) ser += cof[j]/(x+j+1); + return Math.log(2.5066282746310005*ser/x) -tmp; +} + +function erf(x) // интеграл вероятности с точностью 1.5*10^-7 !!! +{ + var s=1; + if(x<0) { s = -1; x = -x; } + var t=1/(1+0.32759*x); + var res=0.254829592*t; + res -= 0.284496736*t*t; + res += 1.42413741*t*t*t; + res -= 1.453152027*Math.pow(t,4); + res += 1.061405429*Math.pow(t,5); + res *= Math.exp(-x*x); + return s*(1-res); +} + +function BesselJ0(x) { + var ax,z,xx,y,ans,ans1,ans2; + ax = Math.abs(x); + if (ax < 8.0) { + y = x*x; + ans1 = 57568490574.0+y*(-13362590354.0+y*(651619640.7+y*(-11214424.18+y*(77392.33017+y*(-184.9052456))))); + ans2 = 57568490411.0+y*(1029532985.0+y*(9494680.718+y*(59272.64853+y*(267.8532712+y*1.0)))); + ans = ans1/ans2; + } else { + z = 8.0/ax; + y = z*z; + xx = ax-0.785398164; + ans1 = 1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4+y*(-0.2073370639e-5+y*0.2093887211e-6))); + ans2 = -0.1562499995e-1+y*(0.1430488765e-3+y*(-0.6911147651e-5+y*(0.7621095161e-6 - y*0.934935152e-7))); + ans = Math.sqrt(0.636619772 / ax)*(Math.cos(xx)*ans1 - z*Math.sin(xx)*ans2); + } + return ans; +} + +function BesselJ1(x) { + var ax,z,xx,y,ans,ans1,ans2; + ax = Math.abs(x); + if (ax < 8.0) { + y=x*x; + ans1 = x*(72362614232.0+y*(-7895059235.0+y*(242396853.1+y*(-2972611.439+y*(15704.48260+y*(-30.16036606)))))); + ans2 = 144725228442.0+y*(2300535178.0+y*(18583304.74+y*(99447.43394+y*(376.9991397+y*1.0)))); + ans = ans1/ans2; + } else { + z=8.0/ax; + y=z*z; + xx=ax-2.356194491; + ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4+y*(0.2457520174e-5+y*(-0.240337019e-6)))); + ans2=0.04687499995+y*(-0.2002690873e-3+y*(0.8449199096e-5+y*(-0.88228987e-6+y*0.105787412e-6))); + ans=Math.sqrt(0.636619772/ax)*(Math.cos(xx)*ans1-z*Math.sin(xx)*ans2); + if (x < 0.0) ans = -ans; + } + return ans; +} + +function BesselY0(x) { + var z, xx, y, ans, ans1, ans2; + if (x < 8.0) { + y=x*x; + ans1 = -2957821389.0+y*(7062834065.0+y*(-512359803.6+y*(10879881.29+y*(-86327.92757+y*228.4622733)))); + ans2 = 40076544269.0+y*(745249964.8+y*(7189466.438+y*(47447.26470+y*(226.1030244+y*1.0)))); + ans = (ans1/ans2)+0.636619772*BesselJ0(x)*Math.log(x); + } else { + z=8.0/x; + y=z*z; + xx=x-0.785398164; + ans1 = 1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4+y*(-0.2073370639e-5+y*0.2093887211e-6))); + ans2 = -0.1562499995e-1+y*(0.1430488765e-3+y*(-0.6911147651e-5+y*(0.7621095161e-6+y*(-0.934945152e-7)))); + ans = Math.sqrt(0.636619772/x)*(Math.sin(xx)+ans1+z*Math.cos(xx)*ans2); + } + return ans; +} + +function BesselY1(x) { + var z, xx, y, ans, ans1, ans2; + if (x < 8.0) { + y=x*x + ans1 = x*(-0.4900604943e13+y*(0.1275274390e13+y*(-0.5153438139e11+y*(0.7349264551e9+y*(-0.4237922726e7+y*0.8511937935e4))))); + ans2 = 0.2499580570e14+y*(0.4244419664e12+y*(0.3733650367e10+y*(0.2245904002e8+y*(0.1020426050e6+y*(0.3549632885e3+y))))); + ans = (ans1/ans2)+0.636619772*(BesselJ1(x)*Math.log(x)-1.0/x); + } else { + z=8.0/x; + y=z*z; + xx=x-2.356194491; + ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4+y*(0.2457520174e-5+y*(-0.240337019e-6)))); + ans2=0.04687499995+y*(-0.202690873e-3+y*(0.8449199096e-5+y*(-0.88228987e-6+y*0.10578e-6))); + ans=Math.sqrt(0.636619772/x)*(Math.sin(xx)*ans1+z*Math.cos(xx)*ans2); + } + return ans; +} diff --git a/website/games/pentix.html b/website/games/pentix.html new file mode 100644 index 0000000..abc01bf --- /dev/null +++ b/website/games/pentix.html @@ -0,0 +1,528 @@ + + + +Pentix + + +
+ +

"Pentix" game

+ +Your browser does not support the HTML5 canvas tag.
+ + + + + diff --git a/website/games/shiftix.html b/website/games/shiftix.html new file mode 100644 index 0000000..e5835c4 --- /dev/null +++ b/website/games/shiftix.html @@ -0,0 +1,546 @@ + + + +Shiftix + + +
+ +

"Shiftix" game

+ +Your browser does not support the HTML5 canvas tag.
+ + + + + diff --git a/website/games/tetris.html b/website/games/tetris.html new file mode 100644 index 0000000..8867c78 --- /dev/null +++ b/website/games/tetris.html @@ -0,0 +1,501 @@ + + + +Tetris + + +
+ +

"Tetris" game

+ +Your browser does not support the HTML5 canvas tag.
+ + + + + diff --git a/website/hextris.png b/website/hextris.png new file mode 100644 index 0000000000000000000000000000000000000000..0690c50d4748014f16322549cb29008b67259531 GIT binary patch literal 3879 zcmV+?57_XDP)1E;1P0xAXv>`uBbA(eCC|L&*$@zh&6eHeArmO;|Vrrze>RG{xN)n2oNPe z6hC47gzyo>M}Y2$|HjALZuSWIFtKUm9%d|(fuiHR2+c&8K$s>%j3Yz?LFxz)!$*)E z+a6(By1V8g#aFHMkYDuPM|9E8&;p}nQ4u6ciU=(hQpOXeks$R1iQ^*#z`9kN`O=b~ zdxU&YoX8yJsiR$_J4edM@Dn9Xlr#}qh|)rYlptn2AsPviBtQfWjU(^wB_VauKItm2 z%laUAa?>3SG5`??6Nu1EloU}~h|x-ni-<9aI@(AujU*k^GlP!wVqV_;s23q01aG{x zhBp$QCDwAPte7Q<(MnWY&cCNc8k=B`w%i_e?%Bk3mw(=ikn_Rw2kvl?q4!fsf+Pu1 zFRlj5)kuhOL>TY*dE?{LIX<$-OIhcGmD?X;dUxKX)r%9LPIOUm+oiu3BR~xBxwOW9 zmR|i2EMNc69wFxfRa4n^`kVM-!;bg#8y>|^6h9FHL>zO+nGgy@NTr%NIXvJIa<+J^ z_fEPN#$3lg5ZyD-jwR zDk?H65())DMg;JqBI6eyTYrBPg&Yc_q|+_@=7k?~(S#Z2{29Zc*q_AI|B(~2q3;(2 zQg2o6yUU2s(~~SxQ9<1Bh^QkfDg}JvV{6DL8k(FMy~F2}Jw zajw7o?%J*)p~U;ou00&uPGv;3cUR4bF_CW zE-5N5$Vd}4^|59_Oq0;Z>h#exuCo2~V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7<^{)v9BNr?oW2W|2 zT97Jvc#E#?6Ks3`%FoME&F?G9S<;d23!02EZF{?C-NwP*DX#C8+=ot++}WI$C6Qsx zi_de@{QJ4kF{bMwe>dkz*1g?B4)tB}CHS?JK$?X-Ml#s=>SZkPa{!zwa*YAeWn2EL(??AxNrrLP~0QLLyguD4;~>NAs#$JJVHEpgm{E_ p@Cfk;@!%2S!6U>Y#KSq_{{i^mf?omHO+f$v002ovPDHLkV1mz)a9RKW literal 0 HcmV?d00001 diff --git a/website/index.html b/website/index.html new file mode 100644 index 0000000..9c60693 --- /dev/null +++ b/website/index.html @@ -0,0 +1,98 @@ + + + + +Homepage of MathGL + + + + + + + + + + +
+ +
+ +

MathGL

+

+

+ + + +

+

14 March 2018. +New version (v.2.4.3) of MathGL is released. There are new clabel command for drawing colorbar labels, EPS output now may have mask, compatibility changes for complex numbers, and many other improvements.

+ +

Games

+

+

+ + + + + +

+ +
diff --git a/website/json/json.html b/website/json/json.html new file mode 100644 index 0000000..7d4a767 --- /dev/null +++ b/website/json/json.html @@ -0,0 +1,127 @@ + + + + + Example of dysplaying MathGL plots using JSON + + + + + + + + +
+ +Select sample + + + +

You can use mouse with pressed left button for rotation; with pressed middle button for shift; mouse wheel for zoom in/out. Double click will restore original view.

+
+ +
+ +

+ +
+ + + diff --git a/website/json/mathgl.js b/website/json/mathgl.js new file mode 100644 index 0000000..4a34e2e --- /dev/null +++ b/website/json/mathgl.js @@ -0,0 +1,532 @@ +/*************************************************************************** + * mathgl.js is part of Math Graphic Library + * Copyright (C) 2012 Alexey Balakin * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +var obj; +var ctx; +var cw,ch; +var deg = Math.PI/180; //0.017453293; + +function main() +{ + ctx = document.getElementById("canvas").getContext("2d"); + cw = document.getElementById("canvas").width; + ch = document.getElementById("canvas").height; + ctx.lineCap="round"; // global setting + + mgl_init("alpha.json"); +// mgl_init("alpha.jsonz"); + var t1 = new Date(); + mgl_draw_good(obj, ctx); +// draw_fast(obj, ctx); + var t2 = new Date(); + document.getElementById("time").innerHTML = "Drawing time is "+(t2.getTime()-t1.getTime())+" ms. Number of primitives is "+obj.nprim+". Canvas size is "+obj.width+"*"+obj.height+" points."; +}; + +function mglChange() +{ + var name = document.getElementById("select").value; + mgl_init(name+".json"); + var t1 = new Date(); + ctx.clearRect(0,0,cw,ch); + mgl_draw_good(obj, ctx); +// draw_fast(obj, ctx); + var t2 = new Date(); + document.getElementById("time").innerHTML = "Drawing time is "+(t2.getTime()-t1.getTime())+" ms. Number of primitives is "+obj.nprim; +} + +// mouse handling functions +function mglMouseUp() +{ obj.button = 0; obj.good = 0; + ctx.clearRect(0,0,cw,ch); + mgl_draw_good(obj, ctx); } +function mglMouseDown(event) +{ + obj.good = 1; + obj.mouseX = event.clientX; + obj.mouseY = event.clientY; + obj.button = event.button+1; +} +function mglMouseMove(event) +{ + var x = event.clientX-obj.mouseX; + var y = event.clientY-obj.mouseY; + switch(obj.button) + { + case 1: // rotate + mgl_rotate_down(obj, y*180/ch); + mgl_rotate_left(obj, x*180/cw); break; + case 2: // shift + mgl_shift_down(obj, y/ch); + mgl_shift_right(obj, x/cw); break; + case 3: // zoom + mgl_zoom_in(obj, Math.pow(1.003,x)); break; + } + if(obj.button) + { + obj.mouseX += x; obj.mouseY += y; + mgl_draw(obj, ctx); + } +} +function mglMouseWheel(event) +{ +// var e = window.event; + var d = event.wheelDelta? event.wheelDelta:event.detail*(-120); + mgl_zoom_in(obj, Math.pow(1.002,d)); + mgl_draw(obj, ctx); +} +function mglRestore() +{ + mgl_restore(obj); + ctx.clearRect(0,0,cw,ch); + mgl_draw_good(obj,ctx); +} + +// The function load data and set up rotation/zoom state +function mgl_init(name) +{ + // now obtain JSON data + var req = new XMLHttpRequest(), txt; + req.open( "GET", name, false ); + req.overrideMimeType('text\/plain; charset=x-user-defined'); + req.send(null); + txt = req.responseText; + obj = JSON.parse(txt); + + // copy original data for transformation + obj.pp = new Array(); + for(var i=0;iMath.PI/2) t += Math.PI; + } + else t=0; + var c=Math.cos(t), s=Math.sin(t), d=prim[6]/200; + + var b=[d*c, d*s, d*s, -d*c, obj.pp[n1][0],obj.pp[n1][1]]; + var x=obj.coor[n2][0]*scl/100, y=obj.coor[n2][1]*scl/100, f=prim[8]*scl/1e5; + if(n3&8) + { + if(!(n3&4)) mgl_line_glyph(ctx, x,y, f,1,b); + else mgl_line_glyph(ctx, x,y, f,0,b); + } + else + { + if(!(n3&4)) mgl_fill_glyph(ctx, x,y, f,obj.glfs[n4],b); + else mgl_wire_glyph(ctx, x,y, f,obj.glfs[n4],b); + } + break; + } +} + +// This function change coordinates according current transformations +// Usually this Function is called internally by draw() +function mgl_prepare(obj, skip) +{ + // fill transformation matrix + if(!skip) + { + var dx = 1/Math.abs(obj.z[1]-obj.z[0]); + var dy = 1/Math.abs(obj.z[3]-obj.z[2]); + var cx=Math.cos(obj.tet*deg), sx=Math.sin(obj.tet*deg); // tetx + var cy=Math.cos(obj.phi*deg), sy=Math.sin(obj.phi*deg); // tety + var cz=Math.cos(obj.bet*deg), sz=Math.sin(obj.bet*deg); // tetz + obj.b = [obj.dx*dx*cx*cy, -obj.dx*dx*cy*sx, obj.dx*dx*sy, + obj.dy*dy*(cx*sy*sz+cz*sx), obj.dy*dy*(cx*cz-sx*sy*sz), -obj.dy*dy*cy*sz, + sx*sz-cx*cz*sy, cx*sz+cz*sx*sy, cy*cz, + cw/2*(1+dx-obj.z[1]-obj.z[0])/dx, + ch/2*(1+dy-obj.z[3]-obj.z[2])/dy, obj.depth/2, obj.dx*dx,obj.dy*dy,1]; + } + // now transform points for found transformation matrix + var b = obj.b, i; + for(i=0;i=0) // TODO: check later when mglInPlot will be ready + obj.pp[i] = [b[9] + b[0]*x + b[1]*y + b[2]*z, + b[10] + b[3]*x + b[4]*y + b[5]*z, + b[11] + b[6]*x + b[7]*y + b[8]*z]; + else + obj.pp[i] = [b[9]+b[12]*x,b[10]+b[13]*y,b[11]+b[14]*z]; + } + if(obj.pf) for(var i=0;i=0) // TODO: check later when mglInPlot will be ready + { + obj.pp[i][0] = d*obj.pp[i][0] + (1-d)/2*obj.width; + obj.pp[i][1] = d*obj.pp[i][1] + (1-d)/2*obj.height; + } + } + // fill z-coordinates for primitives + if(!obj.fast) + { + for(i=0;i' + ctx.moveTo(x-s/2,y-s); ctx.lineTo(x-s/2,y+s); + ctx.lineTo(x+s,y); ctx.closePath(); + ctx.stroke(); break; +// case 46: // '.' + default: + ctx.rect(x,y,1,1); ctx.fill(); break; + } +} + +// This function for internal use only!!! +function mgl_fill_glyph(ctx, x,y, f,g,b) +{ + var xx,yy,j; + var np=0; ctx.beginPath(); + for(j=0;j + + + +MGL script preview (SVG) + +
+ +
+

Enter script below

+
+
+

+
+ +
+ +
+ +
+ diff --git a/website/mathgl_emblem.png b/website/mathgl_emblem.png new file mode 100644 index 0000000000000000000000000000000000000000..c4d02b9d819ebf673e229280e259bd02c9ad8ec4 GIT binary patch literal 24603 zcmZsDV{~NS({*gy?AW%Qi6^#gbE1xI+qP{dlVpNPCbpA_Cwlt#U+ew$u3opbx^Lf8 zwX627I_GqhijoX60s#UT7#OmgtfU&~aT0Wx!@+>=N5TUUK@Tvd-()1gzW%!v_En^S z-hp?P)o}v@L&W^=00+y?#RI(w>n^7#1-lPN42OlZ#+)2XkK z_WbqRub^mLU?=D9*ph-=6d+k1L`y*y(#jOiBoZM_Am!j-Be{89L3(xK<6u-=By_9OrG%J>sC69A&%gIU!p`BQ@7Zv3d)u+)cWvL}s$Rk4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v8vw(-qZ?67(T_b_XCF2#b9jOy1FWY^f*JK$pKipSE zmj;o=4VtY}BT>b`aH{&7_QR>36wLl&mBa6v3nr9~0lL7An5m>6F5DVe^e7gudG@G8bfee)yN|8@zE}FIgo2?S~>^ zNvi@_DNn{3I^&IO0d1aUoT1dP%<>Bg2ybV+;M|40(^bjYxg4qm_)CczuasctlC#BP zmEeAzANEu>Hcor8@TT@7f?7s;E(}FMF$KRP)tb#i7JiWe87HJKy~BKoYXASPCJ%Qg zHS&LR_*JcrqCH0>N?z;q9lAACZqZK_uzI=)NIf@L0XZ&yeEsW)rVGJG3L!D$ielwP zcjj~gHEv{fh)_Uw*2XKh+s!RI?rC;3WpNY+rQiC`hw+Cd3?#>_oyVlx{^a)+7HyP( P@js!itgTe0@F4hqmY&T1 literal 0 HcmV?d00001 diff --git a/website/mathgl_en.html b/website/mathgl_en.html new file mode 100644 index 0000000..c4e27a2 --- /dev/null +++ b/website/mathgl_en.html @@ -0,0 +1,21350 @@ + + + + + + +MathGL 2.4.3 + + + + + + + + + + + + + + + +
+

MathGL 2.4.3

+ + + + + +

Table of Contents

+ +
+ + +
+ + + +
+

+Next: , Up: (dir)   [Contents][Index]

+
+ +

MathGL

+ +

This file documents the Mathematical Graphic Library (MathGL), a collection of classes and routines for scientific plotting. It corresponds to release 2.4.3 of the library. Please report any errors in this manual to mathgl.abalakin@gmail.org. More information about MathGL can be found at the project homepage, http://mathgl.sourceforge.net/. +

+

Copyright © 2008-2012 Alexey A. Balakin. +

+
+

Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 +or any later version published by the Free Software Foundation; +with no Invariant Sections, no Front-Cover Texts, and no Back-Cover +Texts. A copy of the license is included in the section entitled “GNU +Free Documentation License.” +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

1 Overview

+ + + + +

MathGL is ... +

    +
  • a library for making high-quality scientific graphics under Linux and Windows; +
  • a library for the fast data plotting and handling of large data arrays; +
  • a library for working in window and console modes and for easy embedding into other programs; +
  • a library with large and growing set of graphics. +
+ + + + + + + + + + + + +
+ +
+

+Next: , Up: Overview   [Contents][Index]

+
+ +

1.1 What is MathGL?

+ + +

A code for making high-quality scientific graphics under Linux and Windows. A code for the fast handling and plotting of large data arrays. A code for working in window and console regimes and for easy including into another program. A code with large and renewal set of graphics. Exactly such a code I tried to put in MathGL library. +

+

At this version (2.4.3) MathGL has more than 50 general types of graphics for 1d, 2d and 3d data arrays. It can export graphics to bitmap and vector (EPS or SVG) files. It has OpenGL interface and can be used from console programs. It has functions for data handling and script MGL language for simplification of data plotting. It also has several types of transparency and smoothed lighting, vector fonts and TeX-like symbol parsing, arbitrary curvilinear coordinate system and many other useful things (see pictures section at homepage). Finally it is platform-independent and free (under GPL v.2.0 or later license). +

+ +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.2 MathGL features

+ + +

MathGL can plot a wide range of graphics. It includes: +

    +
  • one-dimensional (Plot, Area, Bars, Step, Stem, Torus, Chart, Error, Tube, Mark, see 1D plotting); + +
  • two-dimensional plots (Mesh, Surf, Dens, Cont, ContF, Boxs, Axial, Fall, Belt, Tile, see 2D plotting); + +
  • three-dimensional plots (Surf3, Dens3, Cont3, ContF3, Cloud-like, see 3D plotting); + +
  • dual data plots: vector fields Vect, flow threads Flow, mapping chart Map, surfaces and isosurfaces, transparent or colored (i.e. with transparency or color varied) by other data SurfA, SurfC, Surf3A, Surf3C (see Dual plotting); + +
  • and so on. For details see see MathGL core. +
+ +

In fact, I created the functions for drawing of all the types of scientific plots that I know. The list of plots is growing; if you need some special type of a plot then please email me e-mail and it will appear in the new version. +

+

I tried to make plots as nice looking as possible: e.g., a surface can be transparent and highlighted by several (up to 10) light sources. Most of the drawing functions have 2 variants: simple one for the fast plotting of data, complex one for specifying of the exact position of the plot (including parametric representation). Resulting image can be saved in bitmap PNG, JPEG, GIF, TGA, BMP format, or in vector EPS, SVG or TeX format, or in 3D formats OBJ, OFF, STL, or in PRC format which can be converted into U3D. +

+

All texts are drawn by vector fonts, which allows for high scalability and portability. Texts may contain commands for: some of the TeX-like symbols, changing index (upper or lower indexes) and the style of font inside the text string (see Font styles). Texts of ticks are rotated with axis rotation. It is possible to create a legend of plot and put text in an arbitrary position on the plot. Arbitrary text encoding (by the help of function setlocale()) and UTF-16 encoding are supported. +

+

Special class mglData is used for data encapsulation (see Data processing). In addition to a safe creation and deletion of data arrays it includes functions for data processing (smoothing, differentiating, integrating, interpolating and so on) and reading of data files with automatic size determination. Class mglData can handle arrays with up to three dimensions (arrays which depend on up to 3 independent indexes a_{ijk}). Using an array with higher number of dimensions is not meaningful, because I do not know how it can be plotted. Data filling and modification may be done manually or by textual formulas. +

+

There is fast evaluation of a textual mathematical expression (see Textual formulas). It is based on string precompilation to tree-like code at the creation of class instance. At evaluation stage code performs only fast tree-walk and returns the value of the expression. In addition to changing data values, textual formulas are also used for drawing in arbitrary curvilinear coordinates. A set of such curvilinear coordinates is limited only by user’s imagination rather than a fixed list like: polar, parabolic, spherical, and so on. +

+ +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.3 Installation

+ + +

MathGL can be installed in 4 different ways. +

    +
  1. Compile from sources. The cmake build system is useded in the library. To run it, one should execute commands: cmake . twice, after it make and make install with root/sudo rights. Sometimes after installation you may need to update the library list – just execute ldconfig with root/sudo rights. + +

    There are several additional options which are switched off by default. They are: enable-fltk, enable-glut, enable-qt4, enable-qt5 for ebabling FLTK, GLUT and/or Qt windows; enable-jpeg, enable-gif, enable-hdf5 and so on for enabling corresponding file formats; enable-all for enabling all additional features. For using double as base internal data type use option enable-double. For enabling language interfaces use enable-python, enable-octave or enable-all-swig for all languages. You can use WYSIWYG tool (cmake-gui) to view all of them, or type cmake -D enable-all=on -D enable-all-widgets=on -D enable-all-swig=on . in command line for enabling all features. +

    +

    There is known bug for building in MinGW – you need to manually add linker option -fopenmp (i.e. CMAKE_EXE_LINKER_FLAGS:STRING='-fopenmp' and CMAKE_SHARED_LINKER_FLAGS:STRING='-fopenmp') if you enable OpenMP support (i.e. if enable-openmp=ON). +

    +
  2. Use a precompiled binary. There are binaries for MinGW (platform Win32). For a precompiled variant one needs only to unpack the archive to the location of the compiler (i.e. mathgl/lib in mingw/lib, mathgl/include in mingw/include and so on) or in arbitrary other folder and setup paths in compiler. By default, precompiled versions include the support of GSL (www.gsl.org) and PNG. So, one needs to have these libraries installed on system (it can be found, for example, at http://gnuwin32.sourceforge.net/packages.html). + +
  3. Install precompiled versions from standard packages (RPM, deb, DevPak and so on). +
+ +

Note, you can download the latest sources (which can be not stable) from sourceforge.net SVN by command +

svn checkout http://svn.code.sf.net/p/mathgl/code/mathgl-2x mathgl-code
+
+

IMPORTANT! MathGL use a set of defines, which were determined at configure stage and may differ if used with non-default compiler (like using MathGL binaries compiled by MinGW in VisualStudio). There are MGL_SYS_NAN, MGL_HAVE_TYPEOF, MGL_HAVE_PTHREAD, MGL_HAVE_ATTRIBUTE, MGL_HAVE_C99_COMPLEX, MGL_HAVE_RVAL. I specially set them to 0 for Borland and Microsoft compilers due to compatibility reasons. Also default setting are good for GNU (gcc, mingw) and clang compilers. However, for another compiler you may need to manually set this defines to 0 in file include/mgl2/config.h if you are using precompiled binaries. +

+ + +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.4 Quick guide

+ + +

There are 3 steps to prepare the plot in MathGL: (1) prepare data to be plotted, (2) setup plot, (3) plot data. Let me show this on the example of surface plotting. +

+

First we need the data. MathGL use its own class mglData to handle data arrays (see Data processing). This class give ability to handle data arrays by more or less format independent way. So, create it +

    int main()
+    {
+        mglData dat(30,40);	// data to for plotting
+        for(long i=0;i<30;i++)   for(long j=0;j<40;j++)
+            dat.a[i+30*j] = 1/(1+(i-15)*(i-15)/225.+(j-20)*(j-20)/400.);
+

Here I create matrix 30*40 and initialize it by formula. Note, that I use long type for indexes i, j because data arrays can be really large and long type will automatically provide proper indexing. +

+

Next step is setup of the plot. The only setup I need is axis rotation and lighting. +

        mglGraph gr;		// class for plot drawing
+        gr.Rotate(50,60);	// rotate axis
+        gr.Light(true);		// enable lighting
+
+

Everything is ready. And surface can be plotted. +

        gr.Surf(dat);		// plot surface
+

Basically plot is done. But I decide to add yellow (‘y’ color, see Color styles) contour lines on the surface. To do it I can just add: +

        gr.Cont(dat,"y");	// plot yellow contour lines
+

This demonstrate one of base MathGL concept (see, General concepts) – “new drawing never clears things drawn already”. So, you can just consequently call different plotting functions to obtain “combined” plot. For example, if one need to draw axis then he can just call one more plotting function +

        gr.Axis();			// draw axis
+
+

Now picture is ready and we can save it in a file. +

        gr.WriteFrame("sample.png");	// save it
+    }
+
+

To compile your program, you need to specify the linker option -lmgl. +

+

This is enough for a compilation of console program or with external (non-MathGL) window library. If you want to use FLTK or Qt windows provided by MathGL then you need to add the option -lmgl-wnd. +

+

Fortran users also should add C++ library by the option -lstdc++. If library was built with enable-double=ON (this default for v.2.1 and later) then all real numbers must be real*8. You can make it automatic if use option -fdefault-real-8. +

+ +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.5 Changes from v.1.*

+ + +

There are a lot of changes for v.2. Here I denote only main of them. +

    +
  • mglGraph class is single plotter class instead of mglGraphZB, mglGraphPS and so on. +
  • Text style and text color positions are swapped. I.e. text style ‘r:C’ give red centered text, but not roman dark cyan text as for v.1.*. +
  • ColumnPlot() indexing is reverted. +
  • Move most of arguments of plotting functions into the string parameter and/or options. +
  • “Bright” colors (like {b8}) can be used in color schemes and line styles. +
  • Intensively use pthread internally for parallelization of drawing and data processing. +
  • Add tick labels rotation and skipping. Add ticks in time/date format. +
  • New kinds of plots (Tape(), Label(), Cones(), ContV()). Extend existing plots. New primitives (Circle(), Ellipse(), Rhomb(), ...). New plot positioning (MultiPlot(), GridPlot()) +
  • Improve MGL scripts. Add ’ask’ command and allow string concatenation from different lines. +
  • Export to LaTeX and to 3D formats (OBJ, OFF, STL). +
  • Add pipes support in utilities (mglconv, mglview). +
+ + +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.6 Utilities for parsing MGL

+ + +

MathGL library provides several tools for parsing MGL scripts. There is tools saving it to bitmap or vectorial images (mglconv). Tool mglview show MGL script and allow to rotate and setup the image. Another feature of mglview is loading *.mgld files (see ExportMGLD()) for quick viewing 3d pictures. +

+

Both tools have similar set of arguments. They can be name of script file or options. You can use ‘-’ as script name for using standard input (i.e. pipes). Options are: +

    +
  • -1 str +set str as argument $1 for script; +
  • ... +... +
  • -9 str +set str as argument $9 for script; +
  • -L loc +set locale to loc; +
  • -s fname +set MGL script for setting up the plot; +
  • -h +print help message. +
+

Additionally mglconv have following options: +

    +
  • -A val +add val into the list of animation parameters; +
  • -C v1:v2[:dv] +add values from v1 ot v2 with step dv (default is 1) into the list of animation parameters; +
  • -o name +set output file name; +
  • -n +disable default output (script should save results by itself); +
  • -S val +set set scaling factor for setsize; +
  • -q val +set quality for output (val=0...9). +
+ +

Also you can create animated GIF file or a set of JPEG files with names ‘frameNNNN.jpg’ (here ‘NNNN’ is frame index). Values of the parameter $0 for making animation can be specified inside the script by comment ##a val for each value val (one comment for one value) or by option(s) ‘-A val’. Also you can specify a cycle for animation by comment ##c v1 v2 dv or by option -C v1:v2:dv. In the case of found/specified animation parameters, tool will execute script several times – once for each value of $0. +

+ +

MathGL also provide another simple tool mgl.cgi which parse MGL script from CGI request and send back produced PNG file. Usually this program should be placed in /usr/lib/cgi-bin/. But you need to put this program by yourself due to possible security issues and difference of Apache server settings. +

+ +
+ +
+

+Previous: , Up: Overview   [Contents][Index]

+
+ +

1.7 Thanks

+ + +
    +
  • My special thanks to my wife for the patience during the writing of this library and for the help in documentation writing and spelling. +
  • I’m thankful to my coauthors D. Kulagin and M. Vidassov for help in developing MathGL. +
  • I’m thankful to Diego Sejas Viscarra for developing mgltex, contribution to fractal generation and fruitful suggestions. +
  • I’m thankful to D. Eftaxiopoulos, D. Haley, V. Lipatov and S.M. Plis for making binary packages for Linux. +
  • I’m thankful to S. Skobelev, C. Mikhailenko, M. Veysman, A. Prokhorov, A. Korotkevich, V. Onuchin, S.M. Plis, R. Kiselev, A. Ivanov, N. Troickiy and V. Lipatov for fruitful comments. +
  • I’m thankful to sponsors M. Veysman (IHED RAS) and A. Prokhorov (DATADVANCE). +
+ +

Javascript interface was developed with support of DATADVANCE company. +

+ + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

2 MathGL examples

+ + +

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. +

+ + + + + + + + + + + + +
+ +
+

+Next: , Up: Examples   [Contents][Index]

+
+ +

2.1 Basic usage

+ + +

MathGL library can be used by several manners. Each has positive and negative sides: +

    +
  • Using of MathGL library features for creating graphical window (requires FLTK, Qt or GLUT libraries). + +

    Positive side is the possibility to view the plot at once and to modify it (rotate, zoom or switch on transparency or lighting) by hand or by mouse. Negative sides are: the need of X-terminal and limitation consisting in working with the only one set of data at a time. +

    +
  • Direct writing to file in bitmap or vector format without creation of graphical window. + +

    Positive aspects are: batch processing of similar data set (for example, a set of resulting data files for different calculation parameters), running from the console program (including the cluster calculation), fast and automated drawing, saving pictures for further analysis (or demonstration). Negative sides are: the usage of the external program for picture viewing. Also, the data plotting is non-visual. So, you have to imagine the picture (view angles, lighting and so on) before the plotting. I recommend to use graphical window for determining the optimal parameters of plotting on the base of some typical data set. And later use these parameters for batch processing in console program. +

    +
  • Drawing in memory with the following displaying by other graphical program. + +

    In this case the programmer has more freedom in selecting the window libraries (not only FLTK, Qt or GLUT), in positioning and surroundings control and so on. I recommend to use such way for “stand alone” programs. +

    +
  • Using FLTK or Qt widgets provided by MathGL + +

    Here one can use a set of standard widgets which support export to many file formats, copying to clipboard, handle mouse and so on. +

+ +

MathGL drawing can be created not only by object oriented languages (like, C++ or Python), but also by pure C or Fortran-like languages. The usage of last one is mostly identical to usage of classes (except the different function names). But there are some differences. C functions must have argument HMGL (for graphics) and/or HMDT (for data arrays) which specifies the object for drawing or manipulating (changing). Fortran users may regard these variables as integer. So, firstly the user has to create this object by function mgl_create_*() and has to delete it after the using by function mgl_delete_*(). +

+

Let me consider the aforesaid in more detail. +

+ + + + + + + + + + + + + + +
+ +
+

+Next: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.1 Using MathGL window

+ + + + +

The “interactive” way of drawing in MathGL consists in window creation with help of class mglQT, mglFLTK or mglGLUT (see Widget classes) and the following drawing in this window. There is a corresponding code: +

#include <mgl2/qt.h>
+int sample(mglGraph *gr)
+{
+  gr->Rotate(60,40);
+  gr->Box();
+  return 0;
+}
+//-----------------------------------------------------
+int main(int argc,char **argv)
+{
+  mglQT gr(sample,"MathGL examples");
+  return gr.Run();
+}
+

Here callback function sample is defined. This function does all drawing. Other function main is entry point function for console program. For compilation, just execute the command +

gcc test.cpp -lmgl-qt5 -lmgl
+

You can use "-lmgl-qt4" instead of "-lmgl-qt5", if Qt4 is installed. +

+

Alternatively you can create yours own class inherited from mglDraw class and re-implement the function Draw() in it: +

#include <mgl2/qt.h>
+class Foo : public mglDraw
+{
+public:
+  int Draw(mglGraph *gr);
+};
+//-----------------------------------------------------
+int Foo::Draw(mglGraph *gr)
+{
+  gr->Rotate(60,40);
+  gr->Box();
+  return 0;
+}
+//-----------------------------------------------------
+int main(int argc,char **argv)
+{
+  Foo foo;
+  mglQT gr(&foo,"MathGL examples");
+  return gr.Run();
+}
+

Or use pure C-functions: +

#include <mgl2/mgl_cf.h>
+int sample(HMGL gr, void *)
+{
+  mgl_rotate(gr,60,40,0);
+  mgl_box(gr);
+}
+int main(int argc,char **argv)
+{
+  HMGL gr;
+  gr = mgl_create_graph_qt(sample,"MathGL examples",0,0);
+  return mgl_qt_run();
+/* generally I should call mgl_delete_graph() here,
+ * but I omit it in main() function. */
+}
+
+

The similar code can be written for mglGLUT window (function sample() is the same): +

#include <mgl2/glut.h>
+int main(int argc,char **argv)
+{
+  mglGLUT gr(sample,"MathGL examples");
+  return 0;
+}
+
+

The rotation, shift, zooming, switching on/off transparency and lighting can be done with help of tool-buttons (for mglQT, mglFLTK) or by hot-keys: ‘a’, ‘d’, ‘w’, ‘s’ for plot rotation, ‘r’ and ‘f’ switching on/off transparency and lighting. Press ‘x’ for exit (or closing the window). +

+

In this example function sample rotates axes (Rotate(), see Subplots and rotation) and draws the bounding box (Box()). Drawing is placed in separate function since it will be used on demand when window canvas needs to be redrawn. +

+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.2 Drawing to file

+ + +

Another way of using MathGL library is the direct writing of the picture to the file. It is most usable for plot creation during long calculation or for using of small programs (like Matlab or Scilab scripts) for visualizing repetitive sets of data. But the speed of drawing is much higher in comparison with a script language. +

+

The following code produces a bitmap PNG picture: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  gr.Alpha(true);   gr.Light(true);
+  sample(&gr);              // The same drawing function.
+  gr.WritePNG("test.png");  // Don't forget to save the result!
+  return 0;
+}
+

For compilation, you need only libmgl library not the one with widgets +

gcc test.cpp -lmgl
+

This can be important if you create a console program in computer/cluster where X-server (and widgets) is inaccessible. +

+

The only difference from the previous variant (using windows) is manual switching on the transparency Alpha and lightning Light, if you need it. The usage of frames (see Animation) is not advisable since the whole image is prepared each time. If function sample contains frames then only last one will be saved to the file. In principle, one does not need to separate drawing functions in case of direct file writing in consequence of the single calling of this function for each picture. However, one may use the same drawing procedure to create a plot with changeable parameters, to export in different file types, to emphasize the drawing code and so on. So, in future I will put the drawing in the separate function. +

+

The code for export into other formats (for example, into vector EPS file) looks the same: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  gr.Light(true);
+  sample(&gr);              // The same drawing function.
+  gr.WriteEPS("test.eps");  // Don't forget to save the result!
+  return 0;
+}
+

The difference from the previous one is using other function WriteEPS() for EPS format instead of function WritePNG(). Also, there is no switching on of the plot transparency Alpha since EPS format does not support it. +

+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.3 Animation

+ + +

Widget classes (mglWindow, mglGLUT) support a delayed drawing, when all plotting functions are called once at the beginning of writing to memory lists. Further program displays the saved lists faster. Resulting redrawing will be faster but it requires sufficient memory. Several lists (frames) can be displayed one after another (by pressing ‘,’, ‘.’) or run as cinema. To switch these feature on one needs to modify function sample: +

int sample(mglGraph *gr)
+{
+  gr->NewFrame();             // the first frame
+  gr->Rotate(60,40);
+  gr->Box();
+  gr->EndFrame();             // end of the first frame
+  gr->NewFrame();             // the second frame
+  gr->Box();
+  gr->Axis("xy");
+  gr->EndFrame();             // end of the second frame
+  return gr->GetNumFrame();   // returns the frame number
+}
+

First, the function creates a frame by calling NewFrame() for rotated axes and draws the bounding box. The function EndFrame() must be called after the frame drawing! The second frame contains the bounding box and axes Axis("xy") in the initial (unrotated) coordinates. Function sample returns the number of created frames GetNumFrame(). +

+

Note, that animation can be also done as visualization of running calculations (see Draw and calculate). +

+

Pictures with animation can be saved in file(s) as well. You can: export in animated GIF, or save each frame in separate file (usually JPEG) and convert these files into the movie (for example, by help of ImageMagic). Let me show both methods. +

+

The simplest methods is making animated GIF. There are 3 steps: (1) open GIF file by StartGIF() function; (2) create the frames by calling NewFrame() before and EndFrame() after plotting; (3) close GIF by CloseGIF() function. So the simplest code for “running” sinusoid will look like this: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  mglData dat(100);
+  char str[32];
+  gr.StartGIF("sample.gif");
+  for(int i=0;i<40;i++)
+  {
+    gr.NewFrame();     // start frame
+    gr.Box();          // some plotting
+    for(int j=0;j<dat.nx;j++)
+      dat.a[j]=sin(M_PI*j/dat.nx+M_PI*0.05*i);
+    gr.Plot(dat,"b");
+    gr.EndFrame();     // end frame
+  }
+  gr.CloseGIF();
+  return 0;
+}
+
+

The second way is saving each frame in separate file (usually JPEG) and later make the movie from them. MathGL have special function for saving frames – it is WriteFrame(). This function save each frame with automatic name ‘frame0001.jpg, frame0002.jpg’ and so on. Here prefix ‘frame’ is defined by PlotId variable of mglGraph class. So the similar code will look like this: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  mglData dat(100);
+  char str[32];
+  for(int i=0;i<40;i++)
+  {
+    gr.NewFrame();     // start frame
+    gr.Box();          // some plotting
+    for(int j=0;j<dat.nx;j++)
+      dat.a[j]=sin(M_PI*j/dat.nx+M_PI*0.05*i);
+    gr.Plot(dat,"b");
+    gr.EndFrame();     // end frame
+    gr.WriteFrame();   // save frame
+  }
+  return 0;
+}
+
+

Created files can be converted to movie by help of a lot of programs. For example, you can use ImageMagic (command ‘convert frame*.jpg movie.mpg’), MPEG library, GIMP and so on. +

+

Finally, you can use mglconv tool for doing the same with MGL scripts (see Utilities). +

+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.4 Drawing in memory

+ + +

The last way of MathGL using is the drawing in memory. Class mglGraph allows one to create a bitmap picture in memory. Further this picture can be displayed in window by some window libraries (like wxWidgets, FLTK, Windows GDI and so on). For example, the code for drawing in wxWidget library looks like: +

void MyForm::OnPaint(wxPaintEvent& event)
+{
+  int w,h,x,y;
+  GetClientSize(&w,&h);   // size of the picture
+  mglGraph gr(w,h);
+
+  gr.Alpha(true);         // draws something using MathGL
+  gr.Light(true);
+  sample(&gr,NULL);
+
+  wxImage img(w,h,gr.GetRGB(),true);
+  ToolBar->GetSize(&x,&y);    // gets a height of the toolbar if any
+  wxPaintDC dc(this);         // and draws it
+  dc.DrawBitmap(wxBitmap(img),0,y);
+}
+

The drawing in other libraries is most the same. +

+

For example, FLTK code will look like +

void Fl_MyWidget::draw()
+{
+  mglGraph gr(w(),h());
+  gr.Alpha(true);         // draws something using MathGL
+  gr.Light(true);
+  sample(&gr,NULL);
+  fl_draw_image(gr.GetRGB(), x(), y(), gr.GetWidth(), gr.GetHeight(), 3);
+}
+

Qt code will look like +

void MyWidget::paintEvent(QPaintEvent *)
+{
+  mglGraph gr(w(),h());
+
+  gr.Alpha(true);         // draws something using MathGL
+  gr.Light(true);         gr.Light(0,mglPoint(1,0,-1));
+  sample(&gr,NULL);
+
+  // Qt don't support RGB format as is. So, let convert it to BGRN.
+  long w=gr.GetWidth(), h=gr.GetHeight();
+  unsigned char *buf = new uchar[4*w*h];
+  gr.GetBGRN(buf, 4*w*h)
+  QPixmap pic = QPixmap::fromImage(QImage(*buf, w, h, QImage::Format_RGB32));
+
+  QPainter paint;
+  paint.begin(this);  paint.drawPixmap(0,0,pic);  paint.end();
+  delete []buf;
+}
+
+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.5 Draw and calculate

+ + +

MathGL can be used to draw plots in parallel with some external calculations. The simplest way for this is the usage of mglDraw class. At this you should enable pthread for widgets by setting enable-pthr-widget=ON at configure stage (it is set by default). +First, you need to inherit you class from mglDraw class, define virtual members Draw() and Calc() which will draw the plot and proceed calculations. You may want to add the pointer mglWnd *wnd; to window with plot for interacting with them. Finally, you may add any other data or member functions. The sample class is shown below +

class myDraw : public mglDraw
+{
+	mglPoint pnt;	// some variable for changeable data
+	long i;			// another variable to be shown
+	mglWnd *wnd;	// external window for plotting
+public:
+	myDraw(mglWnd *w=0) : mglDraw()	{	wnd=w;	}
+	void SetWnd(mglWnd *w)	{	wnd=w;	}
+	int Draw(mglGraph *gr)
+	{
+		gr->Line(mglPoint(),pnt,"Ar2");
+		char str[16];	snprintf(str,15,"i=%ld",i);
+		gr->Puts(mglPoint(),str);
+		return 0;
+	}
+	void Calc()
+	{
+		for(i=0;;i++)	// do calculation
+		{
+			long_calculations();// which can be very long
+			Check();	// check if need pause
+			pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
+			if(wnd)	wnd->Update();
+		}
+	}
+} dr;
+

There is only one issue here. Sometimes you may want to pause calculations to view result carefully, or save state, or change something. So, you need to provide a mechanism for pausing. Class mglDraw provide function Check(); which check if toolbutton with pause is pressed and wait until it will be released. This function should be called in a "safety" places, where you can pause the calculation (for example, at the end of time step). Also you may add call exit(0); at the end of Calc(); function for closing window and exit after finishing calculations. +Finally, you need to create a window itself and run calculations. +

int main(int argc,char **argv)
+{
+	mglFLTK gr(&dr,"Multi-threading test");	// create window
+	dr.SetWnd(&gr);	// pass window pointer to yours class
+	dr.Run();	// run calculations
+	gr.Run();	// run event loop for window
+	return 0;
+}
+
+

Note, that you can reach the similar functionality without using mglDraw class (i.e. even for pure C code). +

mglFLTK *gr=NULL;	// pointer to window
+void *calc(void *)	// function with calculations
+{
+	mglPoint pnt;	// some data for plot
+	for(long i=0;;i++)		// do calculation
+	{
+		long_calculations();	// which can be very long
+		pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
+		if(gr)
+		{
+			gr->Clf();			// make new drawing
+			// draw something
+			gr->Line(mglPoint(),pnt,"Ar2");
+			char str[16];	snprintf(str,15,"i=%ld",i);
+			gr->Puts(mglPoint(),str);
+			// don't forgot to update window
+			gr->Update();
+		}
+	}
+}
+int main(int argc,char **argv)
+{
+	static pthread_t thr;
+	pthread_create(&thr,0,calc,0);	// create separate thread for calculations
+	pthread_detach(thr);			// and detach it
+	gr = new mglFLTK;	// now create window
+	gr->Run();			// and run event loop
+	return 0;
+}
+

This sample is exactly the same as one with mglDraw class, but it don’t have functionality for pausing calculations. If you need it then you have to create global mutex (like pthread_mutex_t *mutex = pthread_mutex_init(&mutex,NULL);), set it to window (like gr->SetMutex(mutex);) and periodically check it at calculations (like pthread_mutex_lock(&mutex); pthread_mutex_unlock(&mutex);). +

+

Finally, you can put the event-handling loop in separate instead of yours code by using RunThr() function instead of Run() one. Unfortunately, such method work well only for FLTK windows and only if pthread support was enabled. Such limitation come from the Qt requirement to be run in the primary thread only. The sample code will be: +

int main(int argc,char **argv)
+{
+	mglFLTK gr("test");
+	gr.RunThr();	// <-- need MathGL version which use pthread for widgets
+	mglPoint pnt;	// some data
+	for(int i=0;i<10;i++)	// do calculation
+	{
+		long_calculations();// which can be very long
+		pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
+		gr.Clf();			// make new drawing
+		gr.Line(mglPoint(),pnt,"Ar2");
+		char str[10] = "i=0";	str[3] = '0'+i;
+		gr->Puts(mglPoint(),str);
+		gr.Update();		// update window
+	}
+	return 0;	// finish calculations and close the window
+}
+
+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.6 Using QMathGL

+ + +

MathGL have several interface widgets for different widget libraries. There are QMathGL for Qt, Fl_MathGL for FLTK. These classes provide control which display MathGL graphics. Unfortunately there is no uniform interface for widget classes because all libraries have slightly different set of functions, features and so on. However the usage of MathGL widgets is rather simple. Let me show it on the example of QMathGL. +

+

First of all you have to define the drawing function or inherit a class from mglDraw class. After it just create a window and setup QMathGL instance as any other Qt widget: +

#include <QApplication>
+#include <QMainWindow>
+#include <QScrollArea>
+#include <mgl2/qmathgl.h>
+int main(int argc,char **argv)
+{
+  QApplication a(argc,argv);
+  QMainWindow *Wnd = new QMainWindow;
+  Wnd->resize(810,610);  // for fill up the QMGL, menu and toolbars
+  Wnd->setWindowTitle("QMathGL sample");
+  // here I allow to scroll QMathGL -- the case
+  // then user want to prepare huge picture
+  QScrollArea *scroll = new QScrollArea(Wnd);
+
+  // Create and setup QMathGL
+  QMathGL *QMGL = new QMathGL(Wnd);
+//QMGL->setPopup(popup); // if you want to setup popup menu for QMGL
+  QMGL->setDraw(sample);
+  // or use QMGL->setDraw(foo); for instance of class Foo:public mglDraw
+  QMGL->update();
+
+  // continue other setup (menu, toolbar and so on)
+  scroll->setWidget(QMGL);
+  Wnd->setCentralWidget(scroll);
+  Wnd->show();
+  return a.exec();
+}
+
+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.7 OpenGL output

+ + +

MathGL have possibility to draw resulting plot using OpenGL. This produce resulting plot a bit faster, but with some limitations (especially at use of transparency and lighting). Generally, you need to prepare OpenGL window and call MathGL functions to draw it. There is GLUT interface (see Widget classes) to do it by simple way. Below I show example of OpenGL usage basing on Qt libraries (i.e. by using QGLWidget widget). +

+

First, one need to define widget class derived from QGLWidget and implement a few methods: resizeGL() called after each window resize, paintGL() for displaying the image on the screen, and initializeGL() for initializing OpenGL. The header file looks as following. +

#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QGLWidget>
+#include <mgl2/mgl.h>
+
+class MainWindow : public QGLWidget
+{
+  Q_OBJECT
+protected:
+  mglGraph *gr;         // pointer to MathGL core class
+  void resizeGL(int nWidth, int nHeight);   // Method called after each window resize
+  void paintGL();       // Method to display the image on the screen
+  void initializeGL();  // Method to initialize OpenGL
+public:
+  MainWindow(QWidget *parent = 0);
+  ~MainWindow();
+};
+#endif // MAINWINDOW_H
+
+

The class implementation is rather straightforward. One need to recreate the instance of mglGraph at initializing OpenGL, and ask MathGL to use OpenGL output (set argument 1 in mglGraph constructor). Of course, the mglGraph object should be deleted at destruction. The method resizeGL() just pass new sizes to OpenGL and update viewport sizes. All plotting functions are located in the method paintGL(). At this, one need to add 2 calls: gr->Clf() at beginning for clearing previous OpenGL primitives; and swapBuffers() for showing output on the screen. The source file looks as following. +

#include "qgl_example.h"
+#include <QApplication>
+//#include <QtOpenGL>
+//-----------------------------------------------------------------------------
+MainWindow::MainWindow(QWidget *parent) : QGLWidget(parent)	{	gr=0;	}
+//-----------------------------------------------------------------------------
+MainWindow::~MainWindow()	{	if(gr)	delete gr;	}
+//-----------------------------------------------------------------------------
+void MainWindow::initializeGL()	// recreate instance of MathGL core
+{
+	if(gr)	delete gr;
+	gr = new mglGraph(1);	// use '1' for argument to force OpenGL output in MathGL
+}
+//-----------------------------------------------------------------------------
+void MainWindow::resizeGL(int w, int h) // standard resize replace
+{
+	QGLWidget::resizeGL(w, h);
+	glViewport (0, 0, w, h);
+}
+//-----------------------------------------------------------------------------
+void MainWindow::paintGL()	// main drawing function
+{
+	gr->Clf();	// clear previous OpenGL primitives
+	gr->SubPlot(1,1,0);
+	gr->Rotate(40,60);
+	gr->Light(true);
+	gr->AddLight(0,mglPoint(0,0,10),mglPoint(0,0,-1));
+	gr->Axis();
+	gr->Box();
+	gr->FPlot("sin(pi*x)","i2");
+	gr->FPlot("cos(pi*x)","|");
+	gr->FSurf("cos(2*pi*(x^2+y^2))");
+	gr->Finish();
+	swapBuffers();	// show output on the screen
+}
+//-----------------------------------------------------------------------------
+int main(int argc, char *argv[])	// create application
+{
+	mgl_textdomain(argv?argv[0]:NULL,"");
+	QApplication a(argc, argv);
+	MainWindow w;
+	w.show();
+	return a.exec();
+}
+//-----------------------------------------------------------------------------
+
+ + +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.8 MathGL and PyQt

+ + +

Generally SWIG based classes (including the Python one) are the same as C++ classes. However, there are few tips for using MathGL with PyQt. Below I place a very simple python code which demonstrate how MathGL can be used with PyQt. This code is mostly written by Prof. Dr. Heino Falcke. You can just copy it to a file mgl-pyqt-test.py and execute it from python shell by command execfile("mgl-pyqt-test.py") +

+
from PyQt4 import QtGui,QtCore
+from mathgl import *
+import sys
+app = QtGui.QApplication(sys.argv)
+qpointf=QtCore.QPointF()
+
+class hfQtPlot(QtGui.QWidget):
+    def __init__(self, parent=None):
+        QtGui.QWidget.__init__(self, parent)
+        self.img=(QtGui.QImage())
+    def setgraph(self,gr):
+        self.buffer='\t'
+        self.buffer=self.buffer.expandtabs(4*gr.GetWidth()*gr.GetHeight())
+        gr.GetBGRN(self.buffer,len(self.buffer))
+        self.img=QtGui.QImage(self.buffer, gr.GetWidth(),gr.GetHeight(),QtGui.QImage.Format_ARGB32)
+        self.update()
+    def paintEvent(self, event):
+        paint = QtGui.QPainter()
+        paint.begin(self)
+        paint.drawImage(qpointf,self.img)
+        paint.end()
+
+BackgroundColor=[1.0,1.0,1.0]
+size=100
+gr=mglGraph()
+y=mglData(size)
+#y.Modify("((0.7*cos(2*pi*(x+.2)*500)+0.3)*(rnd*0.5+0.5)+362.135+10000.)")
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+x=mglData(size)
+x.Modify("x^2");
+
+def plotpanel(gr,x,y,n):
+    gr.SubPlot(2,2,n)
+    gr.SetXRange(x)
+    gr.SetYRange(y)
+    gr.AdjustTicks()
+    gr.Axis()
+    gr.Box()
+    gr.Label("x","x-Axis",1)
+    gr.Label("y","y-Axis",1)
+    gr.ClearLegend()
+    gr.AddLegend("Legend: "+str(n),"k")
+    gr.Legend()
+    gr.Plot(x,y)
+
+
+gr.Clf(BackgroundColor[0],BackgroundColor[1],BackgroundColor[2])
+gr.SetPlotFactor(1.5)
+plotpanel(gr,x,y,0)
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+plotpanel(gr,x,y,1)
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+plotpanel(gr,x,y,2)
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+plotpanel(gr,x,y,3)
+
+gr.WritePNG("test.png","Test Plot")
+
+qw = hfQtPlot()
+qw.show()
+qw.setgraph(gr)
+qw.raise_()
+
+ + +
+ +
+

+Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.9 MathGL and MPI

+ + +

For using MathGL in MPI program you just need to: (1) plot its own part of data for each running node; (2) collect resulting graphical information in a single program (for example, at node with rank=0); (3) save it. The sample code below demonstrate this for very simple sample of surface drawing. +

+

First you need to initialize MPI +

#include <stdio.h>
+#include <mgl2/mpi.h>
+#include <mpi.h>
+
+int main(int argc, char *argv[])
+{
+  // initialize MPI
+  int rank=0, numproc=1;
+  MPI_Init(&argc, &argv);
+  MPI_Comm_size(MPI_COMM_WORLD,&numproc);
+  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
+  if(rank==0) printf("Use %d processes.\n", numproc);
+
+

Next step is data creation. For simplicity, I create data arrays with the same sizes for all nodes. At this, you have to create mglGraph object too. +

+
  // initialize data similarly for all nodes
+  mglData a(128,256);
+  mglGraphMPI gr;
+
+

Now, data should be filled by numbers. In real case, it should be some kind of calculations. But I just fill it by formula. +

+
  // do the same plot for its own range
+  char buf[64];
+  sprintf(buf,"xrange %g %g",2.*rank/numproc-1,2.*(rank+1)/numproc-1);
+  gr.Fill(a,"sin(2*pi*x)",buf);
+
+

It is time to plot the data. Don’t forget to set proper axis range(s) by using parametric form or by using options (as in the sample). +

+
  // plot data in each node
+  gr.Clf();   // clear image before making the image
+  gr.Rotate(40,60);
+  gr.Surf(a,"",buf);
+
+

Finally, let send graphical information to node with rank=0. +

+
  // collect information
+  if(rank!=0) gr.MPI_Send(0);
+  else for(int i=1;i<numproc;i++)  gr.MPI_Recv(i);
+
+

Now, node with rank=0 have whole image. It is time to save the image to a file. Also, you can add a kind of annotations here – I draw axis and bounding box in the sample. +

+
  if(rank==0)
+  {
+    gr.Box();   gr.Axis();   // some post processing
+    gr.WritePNG("test.png"); // save result
+  }
+
+

In my case the program is done, and I finalize MPI. In real program, you can repeat the loop of data calculation and data plotting as many times as you need. +

+
  MPI_Finalize();
+  return 0;
+}
+
+

You can type ‘mpic++ test.cpp -lmgl-mpi -lmgl && mpirun -np 8 ./a.out’ for compilation and running the sample program on 8 nodes. Note, that you have to set enable-mpi=ON at MathGL configure to use this feature. +

+ + +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.2 Advanced usage

+ + +

Now I show several non-obvious features of MathGL: several subplots in a single picture, curvilinear coordinates, text printing and so on. Generally you may miss this section at first reading. +

+ + + + + + + + + + + + + +
+ + + +

2.2.1 Subplots

+ + +

Let me demonstrate possibilities of plot positioning and rotation. MathGL has a set of functions: subplot, inplot, title, aspect and rotate and so on (see Subplots and rotation). The order of their calling is strictly determined. First, one changes the position of plot in image area (functions subplot, inplot and multiplot). Secondly, you can add the title of plot by title function. After that one may rotate the plot (function rotate). Finally, one may change aspects of axes (function aspect). The following code illustrates the aforesaid it: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Box();
+  gr->Puts(mglPoint(-1,1.1),"Just box",":L");
+  gr->InPlot(0.2,0.5,0.7,1,false);  gr->Box();
+  gr->Puts(mglPoint(0,1.2),"InPlot example");
+  gr->SubPlot(2,2,1); gr->Title("Rotate only");
+  gr->Rotate(50,60);  gr->Box();
+  gr->SubPlot(2,2,2); gr->Title("Rotate and Aspect");
+  gr->Rotate(50,60);  gr->Aspect(1,1,2);  gr->Box();
+  gr->SubPlot(2,2,3); gr->Title("Shear");
+  gr->Box("c"); gr->Shear(0.2,0.1); gr->Box();
+  return 0;
+}
+

Here I used function Puts for printing the text in arbitrary position of picture (see Text printing). Text coordinates and size are connected with axes. However, text coordinates may be everywhere, including the outside the bounding box. I’ll show its features later in Text features. +

+
Example of several subplots on the single picture. +
+

More complicated sample show how to use most of positioning functions: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(3,2,0); gr->Title("StickPlot");
+  gr->StickPlot(3, 0, 20, 30);  gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->StickPlot(3, 1, 20, 30);  gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->StickPlot(3, 2, 20, 30);  gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  gr->SubPlot(3,2,3,"");  gr->Title("ColumnPlot");
+  gr->ColumnPlot(3, 0); gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->ColumnPlot(3, 1); gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->ColumnPlot(3, 2); gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  gr->SubPlot(3,2,4,"");  gr->Title("GridPlot");
+  gr->GridPlot(2, 2, 0);  gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->GridPlot(2, 2, 1);  gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->GridPlot(2, 2, 2);  gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  gr->GridPlot(2, 2, 3);  gr->Box("m"); gr->Puts(mglPoint(0),"3","m");
+  gr->SubPlot(3,2,5,"");  gr->Title("InPlot");  gr->Box();
+  gr->InPlot(0.4, 1, 0.6, 1, true); gr->Box("r");
+  gr->MultiPlot(3,2,1, 2, 1,"");  gr->Title("MultiPlot and ShearPlot"); gr->Box();
+  gr->ShearPlot(3, 0, 0.2, 0.1);  gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->ShearPlot(3, 1, 0.2, 0.1);  gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->ShearPlot(3, 2, 0.2, 0.1);  gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  return 0;
+}
+
+
Example for most of positioning functions. +
+ + +
+ + + +

2.2.2 Axis and ticks

+ + +

MathGL library can draw not only the bounding box but also the axes, grids, labels and so on. The ranges of axes and their origin (the point of intersection) are determined by functions SetRange(), SetRanges(), SetOrigin() (see Ranges (bounding box)). Ticks on axis are specified by function SetTicks, SetTicksVal, SetTicksTime (see Ticks). But usually +

+

Function axis draws axes. Its textual string shows in which directions the axis or axes will be drawn (by default "xyz", function draws axes in all directions). Function grid draws grid perpendicularly to specified directions. Example of axes and grid drawing is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Title("Axis origin, Grid"); gr->SetOrigin(0,0);
+  gr->Axis(); gr->Grid(); gr->FPlot("x^3");
+
+  gr->SubPlot(2,2,1); gr->Title("2 axis");
+  gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1,-1,-1);  // first axis
+  gr->Axis(); gr->Label('y',"axis 1",0);  gr->FPlot("sin(pi*x)");
+  gr->SetRanges(0,1,0,1);   gr->SetOrigin(1,1,1);   // second axis
+  gr->Axis(); gr->Label('y',"axis 2",0);  gr->FPlot("cos(pi*x)");
+
+  gr->SubPlot(2,2,3); gr->Title("More axis");
+  gr->SetOrigin(NAN,NAN); gr->SetRange('x',-1,1);
+  gr->Axis(); gr->Label('x',"x",0); gr->Label('y',"y_1",0);
+  gr->FPlot("x^2","k");
+  gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1.3,-1); // second axis
+  gr->Axis("y","r");  gr->Label('y',"#r{y_2}",0.2);
+  gr->FPlot("x^3","r");
+
+  gr->SubPlot(2,2,2); gr->Title("4 segments, inverted axis");
+  gr->SetOrigin(0,0);
+  gr->InPlot(0.5,1,0.5,1);  gr->SetRanges(0,10,0,2);  gr->Axis();
+  gr->FPlot("sqrt(x/2)");   gr->Label('x',"W",1); gr->Label('y',"U",1);
+  gr->InPlot(0,0.5,0.5,1);  gr->SetRanges(1,0,0,2); gr->Axis("x");
+  gr->FPlot("sqrt(x)+x^3"); gr->Label('x',"\\tau",-1);
+  gr->InPlot(0.5,1,0,0.5);  gr->SetRanges(0,10,4,0);  gr->Axis("y");
+  gr->FPlot("x/4"); gr->Label('y',"L",-1);
+  gr->InPlot(0,0.5,0,0.5);  gr->SetRanges(1,0,4,0); gr->FPlot("4*x^2");
+  return 0;
+}
+
+

Note, that MathGL can draw not only single axis (which is default). But also several axis on the plot (see right plots). The idea is that the change of settings does not influence on the already drawn graphics. So, for 2-axes I setup the first axis and draw everything concerning it. Then I setup the second axis and draw things for the second axis. Generally, the similar idea allows one to draw rather complicated plot of 4 axis with different ranges (see bottom left plot). +

+

At this inverted axis can be created by 2 methods. First one is used in this sample – just specify minimal axis value to be large than maximal one. This method work well for 2D axis, but can wrongly place labels in 3D case. Second method is more general and work in 3D case too – just use aspect function with negative arguments. For example, following code will produce exactly the same result for 2D case, but 2nd variant will look better in 3D. +

// variant 1
+gr->SetRanges(0,10,4,0);  gr->Axis();
+
+// variant 2
+gr->SetRanges(0,10,0,4);  gr->Aspect(1,-1);   gr->Axis();
+
+
Example of axis. +
+

Another MathGL feature is fine ticks tunning. By default (if it is not changed by SetTicks function), MathGL try to adjust ticks positioning, so that they looks most human readable. At this, MathGL try to extract common factor for too large or too small axis ranges, as well as for too narrow ranges. Last one is non-common notation and can be disabled by SetTuneTicks function. +

+

Also, one can specify its own ticks with arbitrary labels by help of SetTicksVal function. Or one can set ticks in time format. In last case MathGL will try to select optimal format for labels with automatic switching between years, months/days, hours/minutes/seconds or microseconds. However, you can specify its own time representation using formats described in http://www.manpagez.com/man/3/strftime/. Most common variants are ‘%X’ for national representation of time, ‘%x’ for national representation of date, ‘%Y’ for year with century. +

+

The sample code, demonstrated ticks feature is +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(3,3,0); gr->Title("Usual axis");  gr->Axis();
+  gr->SubPlot(3,3,1); gr->Title("Too big/small range");
+  gr->SetRanges(-1000,1000,0,0.001);  gr->Axis();
+  gr->SubPlot(3,3,2); gr->Title("LaTeX-like labels");
+  gr->Axis("F!");
+  gr->SubPlot(3,3,3); gr->Title("Too narrow range");
+  gr->SetRanges(100,100.1,10,10.01);  gr->Axis();
+  gr->SubPlot(3,3,4); gr->Title("No tuning, manual '+'");
+  // for version<2.3 you need first call gr->SetTuneTicks(0);
+  gr->Axis("+!");
+  gr->SubPlot(3,3,5); gr->Title("Template for ticks");
+  gr->SetTickTempl('x',"xxx:%g"); gr->SetTickTempl('y',"y:%g");
+  gr->Axis();
+  // now switch it off for other plots
+  gr->SetTickTempl('x',"");   gr->SetTickTempl('y',"");
+  gr->SubPlot(3,3,6); gr->Title("No tuning, higher precision");
+  gr->Axis("!4");
+  gr->SubPlot(3,3,7); gr->Title("Manual ticks");  gr->SetRanges(-M_PI,M_PI, 0, 2);
+  gr->SetTicks('x',M_PI,0,0,"\\pi");  gr->AddTick('x',0.886,"x^*");
+  // alternatively you can use following lines
+  //double val[]={-M_PI, -M_PI/2, 0, 0.886, M_PI/2, M_PI};
+  //gr->SetTicksVal('x', mglData(6,val), "-\\pi\n-\\pi/2\n0\nx^*\n\\pi/2\n\\pi");
+  gr->Axis();  gr->Grid();  gr->FPlot("2*cos(x^2)^2", "r2");
+  gr->SubPlot(3,3,8); gr->Title("Time ticks");  gr->SetRange('x',0,3e5);
+  gr->SetTicksTime('x',0);  gr->Axis();
+}
+
+
Features of axis ticks. +
+

The last sample I want to show in this subsection is Log-axis. From MathGL’s point of view, the log-axis is particular case of general curvilinear coordinates. So, we need first define new coordinates (see also Curvilinear coordinates) by help of SetFunc or SetCoor functions. At this one should wary about proper axis range. So the code looks as following: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"<_");  gr->Title("Semi-log axis");
+  gr->SetRanges(0.01,100,-1,1); gr->SetFunc("lg(x)","");
+  gr->Axis(); gr->Grid("xy","g"); gr->FPlot("sin(1/x)");
+  gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0);
+
+  gr->SubPlot(2,2,1,"<_");  gr->Title("Log-log axis");
+  gr->SetRanges(0.01,100,0.1,100);  gr->SetFunc("lg(x)","lg(y)");
+  gr->Axis(); gr->Grid("!","h=");   gr->Grid();
+  gr->FPlot("sqrt(1+x^2)"); gr->Label('x',"x",0);
+  gr->Label('y', "y = \\sqrt{1+x^2}",0);
+
+  gr->SubPlot(2,2,2,"<_");  gr->Title("Minus-log axis");
+  gr->SetRanges(-100,-0.01,-100,-0.1);  gr->SetFunc("-lg(-x)","-lg(-y)");
+  gr->Axis(); gr->FPlot("-sqrt(1+x^2)");
+  gr->Label('x',"x",0); gr->Label('y', "y = -\\sqrt{1+x^2}",0);
+
+  gr->SubPlot(2,2,3,"<_");  gr->Title("Log-ticks");
+  gr->SetRanges(0.1,100,0,100); gr->SetFunc("sqrt(x)","");
+  gr->Axis(); gr->FPlot("x");
+  gr->Label('x',"x",1); gr->Label('y', "y = x",0);
+  return 0;
+}
+
+
Features of axis ticks. +
+

You can see that MathGL automatically switch to log-ticks as we define log-axis formula (in difference from v.1.*). Moreover, it switch to log-ticks for any formula if axis range will be large enough (see right bottom plot). Another interesting feature is that you not necessary define usual log-axis (i.e. when coordinates are positive), but you can define “minus-log” axis when coordinate is negative (see left bottom plot). +

+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.3 Curvilinear coordinates

+ + +

As I noted in previous subsection, MathGL support curvilinear coordinates. In difference from other plotting programs and libraries, MathGL uses textual formulas for connection of the old (data) and new (output) coordinates. This allows one to plot in arbitrary coordinates. The following code plots the line y=0, z=0 in Cartesian, polar, parabolic and spiral coordinates: +

int sample(mglGraph *gr)
+{
+  gr->SetOrigin(-1,1,-1);
+
+  gr->SubPlot(2,2,0); gr->Title("Cartesian"); gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+
+  gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)",0);
+  gr->SubPlot(2,2,1); gr->Title("Cylindrical"); gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+
+  gr->SetFunc("2*y*x","y*y - x*x",0);
+  gr->SubPlot(2,2,2); gr->Title("Parabolic"); gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+
+  gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)","x+z");
+  gr->SubPlot(2,2,3); gr->Title("Spiral");  gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+  gr->SetFunc(0,0,0); // set to default Cartesian
+  return 0;
+}
+
+
Example of curvilinear coordinates +
+ + +
+ + + +

2.2.4 Colorbars

+ + +

MathGL handle colorbar as special kind of axis. So, most of functions for axis and ticks setup will work for colorbar too. Colorbars can be in log-scale, and generally as arbitrary function scale; common factor of colorbar labels can be separated; and so on. +

+

But of course, there are differences – colorbars usually located out of bounding box. At this, colorbars can be at subplot boundaries (by default), or at bounding box (if symbol ‘I’ is specified). Colorbars can handle sharp colors. And they can be located at arbitrary position too. The sample code, which demonstrate colorbar features is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Title("Colorbar out of box"); gr->Box();
+  gr->Colorbar("<");  gr->Colorbar(">");
+  gr->Colorbar("_");  gr->Colorbar("^");
+
+  gr->SubPlot(2,2,1); gr->Title("Colorbar near box");   gr->Box();
+  gr->Colorbar("<I"); gr->Colorbar(">I");
+  gr->Colorbar("_I"); gr->Colorbar("^I");
+
+  gr->SubPlot(2,2,2); gr->Title("manual colors");
+  mglData a,v;  mgls_prepare2d(&a,0,&v);
+  gr->Box();  gr->ContD(v,a);
+  gr->Colorbar(v,"<");  gr->Colorbar(v,">");
+  gr->Colorbar(v,"_");  gr->Colorbar(v,"^");
+
+  gr->SubPlot(2,2,3);   gr->Title(" ");
+  gr->Puts(mglPoint(-0.5,1.55),"Color positions",":C",-2);
+  gr->Colorbar("bwr>",0.25,0);  gr->Puts(mglPoint(-0.9,1.2),"Default");
+  gr->Colorbar("b{w,0.3}r>",0.5,0); gr->Puts(mglPoint(-0.1,1.2),"Manual");
+
+  gr->Puts(mglPoint(1,1.55),"log-scale",":C",-2);
+  gr->SetRange('c',0.01,1e3);
+  gr->Colorbar(">",0.75,0);  gr->Puts(mglPoint(0.65,1.2),"Normal scale");
+  gr->SetFunc("","","","lg(c)");
+  gr->Colorbar(">");    gr->Puts(mglPoint(1.35,1.2),"Log scale");
+  return 0;
+}
+
+
Example of colorbars +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.5 Bounding box

+ + +

Box around the plot is rather useful thing because it allows one to: see the plot boundaries, and better estimate points position since box contain another set of ticks. MathGL provide special function for drawing such box – box function. By default, it draw black or white box with ticks (color depend on transparency type, see Types of transparency). However, you can change the color of box, or add drawing of rectangles at rear faces of box. Also you can disable ticks drawing, but I don’t know why anybody will want it. The sample code, which demonstrate box features is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Title("Box (default)"); gr->Rotate(50,60);
+  gr->Box();
+  gr->SubPlot(2,2,1); gr->Title("colored");   gr->Rotate(50,60);
+  gr->Box("r");
+  gr->SubPlot(2,2,2); gr->Title("with faces");  gr->Rotate(50,60);
+  gr->Box("@");
+  gr->SubPlot(2,2,3); gr->Title("both");  gr->Rotate(50,60);
+  gr->Box("@cm");
+  return 0;
+}
+
+
Example of Box() +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.6 Ternary axis

+ + +

There are another unusual axis types which are supported by MathGL. These are ternary and quaternary axis. Ternary axis is special axis of 3 coordinates a, b, c which satisfy relation a+b+c=1. Correspondingly, quaternary axis is special axis of 4 coordinates a, b, c, d which satisfy relation a+b+c+d=1. +

+

Generally speaking, only 2 of coordinates (3 for quaternary) are independent. So, MathGL just introduce some special transformation formulas which treat a as ‘x’, b as ‘y’ (and c as ‘z’ for quaternary). As result, all plotting functions (curves, surfaces, contours and so on) work as usual, but in new axis. You should use ternary function for switching to ternary/quaternary coordinates. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(0,1,0,1,0,1);
+  mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+  a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+  x.Modify("0.25*(1+cos(2*pi*x))");
+  y.Modify("0.25*(1+sin(2*pi*x))");
+  rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+  z.Modify("x");
+
+  gr->SubPlot(2,2,0); gr->Title("Ordinary axis 3D");
+  gr->Rotate(50,60);    gr->Light(true);
+  gr->Plot(x,y,z,"r2"); gr->Surf(a,"BbcyrR#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('x',"B",1); gr->Label('y',"C",1); gr->Label('z',"Z",1);
+
+  gr->SubPlot(2,2,1); gr->Title("Ternary axis (x+y+t=1)");
+  gr->Ternary(1);
+  gr->Plot(x,y,"r2"); gr->Plot(rx,ry,"q^ ");  gr->Cont(a,"BbcyrR");
+  gr->Line(mglPoint(0.5,0), mglPoint(0,0.75), "g2");
+  gr->Axis(); gr->Grid("xyz","B;");
+  gr->Label('x',"B"); gr->Label('y',"C"); gr->Label('t',"A");
+
+  gr->SubPlot(2,2,2); gr->Title("Quaternary axis 3D");
+  gr->Rotate(50,60);    gr->Light(true);
+  gr->Ternary(2);
+  gr->Plot(x,y,z,"r2"); gr->Surf(a,"BbcyrR#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('t',"A",1); gr->Label('x',"B",1);
+  gr->Label('y',"C",1); gr->Label('z',"D",1);
+
+  gr->SubPlot(2,2,3); gr->Title("Ternary axis 3D");
+  gr->Rotate(50,60);    gr->Light(true);
+  gr->Ternary(1);
+  gr->Plot(x,y,z,"r2"); gr->Surf(a,"BbcyrR#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('t',"A",1); gr->Label('x',"B",1);
+  gr->Label('y',"C",1); gr->Label('z',"Z",1);
+  return 0;
+}
+
+
Example of colorbars +
+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.7 Text features

+ + +

MathGL prints text by vector font. There are functions for manual specifying of text position (like Puts) and for its automatic selection (like Label, Legend and so on). MathGL prints text always in specified position even if it lies outside the bounding box. The default size of font is specified by functions SetFontSize* (see Font settings). However, the actual size of output string depends on subplot size (depends on functions SubPlot, InPlot). The switching of the font style (italic, bold, wire and so on) can be done for the whole string (by function parameter) or inside the string. By default MathGL parses TeX-like commands for symbols and indexes (see Font styles). +

+

Text can be printed as usual one (from left to right), along some direction (rotated text), or along a curve. Text can be printed on several lines, divided by new line symbol ‘\n’. +

+

Example of MathGL font drawing is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"");
+  gr->Putsw(mglPoint(0,1),L"Text can be in ASCII and in Unicode");
+  gr->Puts(mglPoint(0,0.6),"It can be \\wire{wire}, \\big{big} or #r{colored}");
+  gr->Puts(mglPoint(0,0.2),"One can change style in string: "
+  "\\b{bold}, \\i{italic, \\b{both}}");
+  gr->Puts(mglPoint(0,-0.2),"Easy to \\a{overline} or "
+  "\\u{underline}");
+  gr->Puts(mglPoint(0,-0.6),"Easy to change indexes ^{up} _{down} @{center}");
+  gr->Puts(mglPoint(0,-1),"It parse TeX: \\int \\alpha \\cdot "
+  "\\sqrt3{sin(\\pi x)^2 + \\gamma_{i_k}} dx");
+
+  gr->SubPlot(2,2,1,"");
+  gr->Puts(mglPoint(0,0.5), "\\sqrt{\\frac{\\alpha^{\\gamma^2}+\\overset 1{\\big\\infty}}{\\sqrt3{2+b}}}", "@", -4);
+  gr->Puts(mglPoint(0,-0.5),"Text can be printed\non several lines");
+
+  gr->SubPlot(2,2,2,"");
+  mglData y;  mgls_prepare1d(&y);
+  gr->Box();  gr->Plot(y.SubData(-1,0));
+  gr->Text(y,"This is very very long string drawn along a curve",":k");
+  gr->Text(y,"Another string drawn under a curve","T:r");
+
+  gr->SubPlot(2,2,3,"");
+  gr->Line(mglPoint(-1,-1),mglPoint(1,-1),"rA");
+  gr->Puts(mglPoint(0,-1),mglPoint(1,-1),"Horizontal");
+  gr->Line(mglPoint(-1,-1),mglPoint(1,1),"rA");
+  gr->Puts(mglPoint(0,0),mglPoint(1,1),"At angle","@");
+  gr->Line(mglPoint(-1,-1),mglPoint(-1,1),"rA");
+  gr->Puts(mglPoint(-1,0),mglPoint(-1,1),"Vertical");
+  return 0;
+}
+
+
Example of text printing +
+

You can change font faces by loading font files by function loadfont. Note, that this is long-run procedure. Font faces can be downloaded from MathGL website or from here. The sample code is: +

int sample(mglGraph *gr)
+{
+  double h=1.1, d=0.25;
+  gr->LoadFont("STIX");     gr->Puts(mglPoint(0,h), "default font (STIX)");
+  gr->LoadFont("adventor"); gr->Puts(mglPoint(0,h-d), "adventor font");
+  gr->LoadFont("bonum");    gr->Puts(mglPoint(0,h-2*d), "bonum font");
+  gr->LoadFont("chorus");   gr->Puts(mglPoint(0,h-3*d), "chorus font");
+  gr->LoadFont("cursor");   gr->Puts(mglPoint(0,h-4*d), "cursor font");
+  gr->LoadFont("heros");    gr->Puts(mglPoint(0,h-5*d), "heros font");
+  gr->LoadFont("heroscn");  gr->Puts(mglPoint(0,h-6*d), "heroscn font");
+  gr->LoadFont("pagella");  gr->Puts(mglPoint(0,h-7*d), "pagella font");
+  gr->LoadFont("schola");   gr->Puts(mglPoint(0,h-8*d), "schola font");
+  gr->LoadFont("termes");   gr->Puts(mglPoint(0,h-9*d), "termes font");
+  return 0;
+}
+
+
Example of font faces +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.8 Legend sample

+ + +

Legend is one of standard ways to show plot annotations. Basically you need to connect the plot style (line style, marker and color) with some text. In MathGL, you can do it by 2 methods: manually using addlegend function; or use ‘legend’ option (see Command options), which will use last plot style. In both cases, legend entries will be added into internal accumulator, which later used for legend drawing itself. clearlegend function allow you to remove all saved legend entries. +

+

There are 2 features. If plot style is empty then text will be printed without indent. If you want to plot the text with indent but without plot sample then you need to use space ‘ ’ as plot style. Such style ‘ ’ will draw a plot sample (line with marker(s)) which is invisible line (i.e. nothing) and print the text with indent as usual one. +

+

Function legend draw legend on the plot. The position of the legend can be selected automatic or manually. You can change the size and style of text labels, as well as setup the plot sample. The sample code demonstrating legend features is: +

int sample(mglGraph *gr)
+{
+  gr->AddLegend("sin(\\pi {x^2})","b");
+  gr->AddLegend("sin(\\pi x)","g*");
+  gr->AddLegend("sin(\\pi \\sqrt{x})","rd");
+  gr->AddLegend("just text"," ");
+  gr->AddLegend("no indent for this","");
+
+  gr->SubPlot(2,2,0,""); gr->Title("Legend (default)");
+  gr->Box();  gr->Legend();
+
+  gr->Legend(3,"A#");
+  gr->Puts(mglPoint(0.75,0.65),"Absolute position","A");
+
+  gr->SubPlot(2,2,2,"");  gr->Title("coloring");  gr->Box();
+  gr->Legend(0,"r#"); gr->Legend(1,"Wb#");  gr->Legend(2,"ygr#");
+
+  gr->SubPlot(2,2,3,"");  gr->Title("manual position"); gr->Box();
+  gr->Legend(0.5,1);  gr->Puts(mglPoint(0.5,0.55),"at x=0.5, y=1","a");
+  gr->Legend(1,"#-"); gr->Puts(mglPoint(0.75,0.25),"Horizontal legend","a");
+  return 0;
+}
+
+
Example of legend +
+ +
+ +
+

+Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.9 Cutting sample

+ + +

The last common thing which I want to show in this section is how one can cut off points from plot. There are 4 mechanism for that. +

    +
  • You can set one of coordinate to NAN value. All points with NAN values will be omitted. + +
  • You can enable cutting at edges by SetCut function. As result all points out of bounding box will be omitted. + +
  • You can set cutting box by SetCutBox function. All points inside this box will be omitted. + +
  • You can define cutting formula by SetCutOff function. All points for which the value of formula is nonzero will be omitted. Note, that this is the slowest variant. +
+ +

Below I place the code which demonstrate last 3 possibilities: +

int sample(mglGraph *gr)
+{
+  mglData a,c,v(1); mgls_prepare2d(&a); mgls_prepare3d(&c); v.a[0]=0.5;
+  gr->SubPlot(2,2,0); gr->Title("Cut on (default)");
+  gr->Rotate(50,60);  gr->Light(true);
+  gr->Box();  gr->Surf(a,"","zrange -1 0.5");
+
+  gr->SubPlot(2,2,1); gr->Title("Cut off");   gr->Rotate(50,60);
+  gr->Box();  gr->Surf(a,"","zrange -1 0.5; cut off");
+
+  gr->SubPlot(2,2,2); gr->Title("Cut in box");  gr->Rotate(50,60);
+  gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+  gr->Alpha(true);  gr->Box();  gr->Surf3(c);
+  gr->SetCutBox(mglPoint(0), mglPoint(0));  // switch it off
+
+  gr->SubPlot(2,2,3); gr->Title("Cut by formula");  gr->Rotate(50,60);
+  gr->CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)");
+  gr->Box();  gr->Surf3(c); gr->CutOff(""); // switch it off
+  return 0;
+}
+
+
Example of point cutting +
+ + + +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.3 Data handling

+ + +

Class mglData contains all functions for the data handling in MathGL (see Data processing). There are several matters why I use class mglData but not a single array: it does not depend on type of data (mreal or double), sizes of data arrays are kept with data, memory working is simpler and safer. +

+ + + + + + + +
+ +
+

+Next: , Up: Data handling   [Contents][Index]

+
+ +

2.3.1 Array creation

+ + +

There are many ways in MathGL how data arrays can be created and filled. +

+

One can put the data in mglData instance by several ways. Let us do it for sinus function: +

    +
  • one can create external array, fill it and put to mglData variable +
      double *a = new double[50];
    +  for(int i=0;i<50;i++)   a[i] = sin(M_PI*i/49.);
    +
    +  mglData y;
    +  y.Set(a,50);
    +
    +
  • another way is to create mglData instance of the desired size and then to work directly with data in this variable +
      mglData y(50);
    +  for(int i=0;i<50;i++)   y.a[i] = sin(M_PI*i/49.);
    +
    +
  • next way is to fill the data in mglData instance by textual formula with the help of Modify() function +
      mglData y(50);
    +  y.Modify("sin(pi*x)");
    +
    +
  • or one may fill the array in some interval and modify it later +
      mglData y(50);
    +  y.Fill(0,M_PI);
    +  y.Modify("sin(u)");
    +
    +
  • finally it can be loaded from file +
      FILE *fp=fopen("sin.dat","wt");   // create file first
    +  for(int i=0;i<50;i++)   fprintf(fp,"%g\n",sin(M_PI*i/49.));
    +  fclose(fp);
    +
    +  mglData y("sin.dat");             // load it
    +

    At this you can use textual or HDF files, as well as import values from bitmap image (PNG is supported right now). +

    +
  • at this one can read only part of data +
      FILE *fp-fopen("sin.dat","wt");   // create large file first
    +  for(int i=0;i<70;i++)   fprintf(fp,"%g\n",sin(M_PI*i/49.));
    +  fclose(fp);
    +
    +  mglData y;
    +  y.Read("sin.dat",50);             // load it
    +
+ +

Creation of 2d- and 3d-arrays is mostly the same. But one should keep in mind that class mglData uses flat data representation. For example, matrix 30*40 is presented as flat (1d-) array with length 30*40=1200 (nx=30, ny=40). The element with indexes {i,j} is a[i+nx*j]. So for 2d array we have: +

  mglData z(30,40);
+  for(int i=0;i<30;i++)   for(int j=0;j<40;j++)
+    z.a[i+30*j] = sin(M_PI*i/29.)*sin(M_PI*j/39.);
+

or by using Modify() function +

  mglData z(30,40);
+  z.Modify("sin(pi*x)*cos(pi*y)");
+
+

The only non-obvious thing here is using multidimensional arrays in C/C++, i.e. arrays defined like mreal dat[40][30];. Since, formally these elements dat[i] can address the memory in arbitrary place you should use the proper function to convert such arrays to mglData object. For C++ this is functions like mglData::Set(mreal **dat, int N1, int N2);. For C this is functions like mgl_data_set_mreal2(HMDT d, const mreal **dat, int N1, int N2);. At this, you should keep in mind that nx=N2 and ny=N1 after conversion. +

+ +
+ +
+

+Next: , Previous: , Up: Data handling   [Contents][Index]

+
+ +

2.3.2 Linking array

+ + +

Sometimes the data arrays are so large, that one couldn’t’ copy its values to another array (i.e. into mglData). In this case, he can define its own class derived from mglDataA (see mglDataA class) or can use Link function. +

+

In last case, MathGL just save the link to an external data array, but not copy it. You should provide the existence of this data array for whole time during which MathGL can use it. Another point is that MathGL will automatically create new array if you’ll try to modify data values by any of mglData functions. So, you should use only function with const modifier if you want still using link to the original data array. +

+

Creating the link is rather simple – just the same as using Set function +

  double *a = new double[50];
+  for(int i=0;i<50;i++)   a[i] = sin(M_PI*i/49.);
+
+  mglData y;
+  y.Link(a,50);
+
+ +
+ +
+

+Previous: , Up: Data handling   [Contents][Index]

+
+ +

2.3.3 Change data

+ + +

MathGL has functions for data processing: differentiating, integrating, smoothing and so on (for more detail, see Data processing). Let us consider some examples. The simplest ones are integration and differentiation. The direction in which operation will be performed is specified by textual string, which may contain symbols ‘x’, ‘y’ or ‘z’. For example, the call of Diff("x") will differentiate data along ‘x’ direction; the call of Integral("xy") perform the double integration of data along ‘x’ and ‘y’ directions; the call of Diff2("xyz") will apply 3d Laplace operator to data and so on. Example of this operations on 2d array a=x*y is presented in code: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(0,1,0,1,0,1);
+  mglData a(30,40); a.Modify("x*y");
+  gr->SubPlot(2,2,0); gr->Rotate(60,40);
+  gr->Surf(a);    gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"a(x,y)");
+  gr->SubPlot(2,2,1); gr->Rotate(60,40);
+  a.Diff("x");    gr->Surf(a);  gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"da/dx");
+  gr->SubPlot(2,2,2); gr->Rotate(60,40);
+  a.Integral("xy"); gr->Surf(a);  gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"\\int da/dx dxdy");
+  gr->SubPlot(2,2,3); gr->Rotate(60,40);
+  a.Diff2("y"); gr->Surf(a);  gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"\\int {d^2}a/dxdy dx");
+  return 0;
+}
+
+
Example of data differentiation and integration +
+

Data smoothing (function smooth) is more interesting and important. This function has single argument which define type of smoothing and its direction. Now 3 methods are supported: ‘3’ – linear averaging by 3 points, ‘5’ – linear averaging by 5 points, and default one – quadratic averaging by 5 points. +

+

MathGL also have some amazing functions which is not so important for data processing as useful for data plotting. There are functions for finding envelope (useful for plotting rapidly oscillating data), for data sewing (useful to removing jumps on the phase), for data resizing (interpolation). Let me demonstrate it: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"");  gr->Title("Envelop sample");
+  mglData d1(1000); gr->Fill(d1,"exp(-8*x^2)*sin(10*pi*x)");
+  gr->Axis();     gr->Plot(d1, "b");
+  d1.Envelop('x');  gr->Plot(d1, "r");
+
+  gr->SubPlot(2,2,1,"");  gr->Title("Smooth sample");
+  mglData y0(30),y1,y2,y3;
+  gr->SetRanges(0,1,0,1);
+  gr->Fill(y0, "0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd");
+
+  y1=y0;  y1.Smooth("x3");
+  y2=y0;  y2.Smooth("x5");
+  y3=y0;  y3.Smooth("x");
+
+  gr->Plot(y0,"{m7}:s", "legend 'none'"); //gr->AddLegend("none","k");
+  gr->Plot(y1,"r", "legend ''3' style'");
+  gr->Plot(y2,"g", "legend ''5' style'");
+  gr->Plot(y3,"b", "legend 'default'");
+  gr->Legend();   gr->Box();
+
+  gr->SubPlot(2,2,2);   gr->Title("Sew sample");
+  mglData d2(100, 100); gr->Fill(d2, "mod((y^2-(1-x)^2)/2,0.1)");
+  gr->Rotate(50, 60);   gr->Light(true);  gr->Alpha(true);
+  gr->Box();            gr->Surf(d2, "b");
+  d2.Sew("xy", 0.1);  gr->Surf(d2, "r");
+
+  gr->SubPlot(2,2,3);   gr->Title("Resize sample (interpolation)");
+  mglData x0(10), v0(10), x1, v1;
+  gr->Fill(x0,"rnd");     gr->Fill(v0,"rnd");
+  x1 = x0.Resize(100);    v1 = v0.Resize(100);
+  gr->Plot(x0,v0,"b+ ");  gr->Plot(x1,v1,"r-");
+  gr->Label(x0,v0,"%n");
+  return 0;
+}
+
+
Example of data manipulation +
+

Also one can create new data arrays on base of the existing one: extract slice, row or column of data (subdata), summarize along a direction(s) (sum), find distribution of data elements (hist) and so on. +

+

Another interesting feature of MathGL is interpolation and root-finding. There are several functions for linear and cubic spline interpolation (see Interpolation). Also there is a function evaluate which do interpolation of data array for values of each data element of index data. It look as indirect access to the data elements. +

+

This function have inverse function solve which find array of indexes at which data array is equal to given value (i.e. work as root finding). But solve function have the issue – usually multidimensional data (2d and 3d ones) have an infinite number of indexes which give some value. This is contour lines for 2d data, or isosurface(s) for 3d data. So, solve function will return index only in given direction, assuming that other index(es) are the same as equidistant index(es) of original data. If data have multiple roots then second (and later) branches can be found by consecutive call(s) of solve function. Let me demonstrate this on the following sample. +

+
int sample(mglGraph *gr)
+{
+  gr->SetRange('z',0,1);
+  mglData x(20,30), y(20,30), z(20,30), xx,yy,zz;
+  gr->Fill(x,"(x+2)/3*cos(pi*y)");
+  gr->Fill(y,"(x+2)/3*sin(pi*y)");
+  gr->Fill(z,"exp(-6*x^2-2*sin(pi*y)^2)");
+
+  gr->SubPlot(2,1,0); gr->Title("Cartesian space");   gr->Rotate(30,-40);
+  gr->Axis("xyzU");   gr->Box();  gr->Label('x',"x"); gr->Label('y',"y");
+  gr->SetOrigin(1,1); gr->Grid("xy");
+  gr->Mesh(x,y,z);
+
+  // section along 'x' direction
+  mglData u = x.Solve(0.5,'x');
+  mglData v(u.nx);  v.Fill(0,1);
+  xx = x.Evaluate(u,v);   yy = y.Evaluate(u,v);   zz = z.Evaluate(u,v);
+  gr->Plot(xx,yy,zz,"k2o");
+
+  // 1st section along 'y' direction
+  mglData u1 = x.Solve(-0.5,'y');
+  mglData v1(u1.nx);  v1.Fill(0,1);
+  xx = x.Evaluate(v1,u1); yy = y.Evaluate(v1,u1); zz = z.Evaluate(v1,u1);
+  gr->Plot(xx,yy,zz,"b2^");
+
+  // 2nd section along 'y' direction
+  mglData u2 = x.Solve(-0.5,'y',u1);
+  xx = x.Evaluate(v1,u2); yy = y.Evaluate(v1,u2); zz = z.Evaluate(v1,u2);
+  gr->Plot(xx,yy,zz,"r2v");
+
+  gr->SubPlot(2,1,1); gr->Title("Accompanied space");
+  gr->SetRanges(0,1,0,1); gr->SetOrigin(0,0);
+  gr->Axis(); gr->Box();  gr->Label('x',"i"); gr->Label('y',"j");
+  gr->Grid(z,"h");
+
+  gr->Plot(u,v,"k2o");    gr->Line(mglPoint(0.4,0.5),mglPoint(0.8,0.5),"kA");
+  gr->Plot(v1,u1,"b2^");  gr->Line(mglPoint(0.5,0.15),mglPoint(0.5,0.3),"bA");
+  gr->Plot(v1,u2,"r2v");  gr->Line(mglPoint(0.5,0.7),mglPoint(0.5,0.85),"rA");
+}
+
+
Example of data interpolation and root finding +
+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.4 Data plotting

+ + +

Let me now show how to plot the data. Next section will give much more examples for all plotting functions. Here I just show some basics. MathGL generally has 2 types of plotting functions. Simple variant requires a single data array for plotting, other data (coordinates) are considered uniformly distributed in axis range. Second variant requires data arrays for all coordinates. It allows one to plot rather complex multivalent curves and surfaces (in case of parametric dependencies). Usually each function have one textual argument for plot style and another textual argument for options (see Command options). +

+

Note, that the call of drawing function adds something to picture but does not clear the previous plots (as it does in Matlab). Another difference from Matlab is that all setup (like transparency, lightning, axis borders and so on) must be specified before plotting functions. +

+

Let start for plots for 1D data. Term “1D data” means that data depend on single index (parameter) like curve in parametric form {x(i),y(i),z(i)}, i=1...n. The textual argument allow you specify styles of line and marks (see Line styles). If this parameter is NULL or empty then solid line with color from palette is used (see Palette and colors). +

+

Below I shall show the features of 1D plotting on base of plot function. Let us start from sinus plot: +

int sample(mglGraph *gr)
+{
+  mglData y0(50); 	y0.Modify("sin(pi*(2*x-1))");
+  gr->SubPlot(2,2,0);
+  gr->Plot(y0);   	gr->Box();
+

Style of line is not specified in plot function. So MathGL uses the solid line with first color of palette (this is blue). Next subplot shows array y1 with 2 rows: +

  gr->SubPlot(2,2,1);
+  mglData y1(50,2);
+  y1.Modify("sin(pi*2*x-pi)");
+  y1.Modify("cos(pi*2*x-pi)/2",1);
+  gr->Plot(y1);   	gr->Box();
+

As previously I did not specify the style of lines. As a result, MathGL again uses solid line with next colors in palette (there are green and red). Now let us plot a circle on the same subplot. The circle is parametric curve x=cos(\pi t), y=sin(\pi t). I will set the color of the circle (dark yellow, ‘Y’) and put marks ‘+’ at point position: +

  mglData x(50);  	x.Modify("cos(pi*2*x-pi)");
+  gr->Plot(x,y0,"Y+");
+

Note that solid line is used because I did not specify the type of line. The same picture can be achieved by plot and subdata functions. Let us draw ellipse by orange dash line: +

  gr->Plot(y1.SubData(-1,0),y1.SubData(-1,1),"q|");
+
+

Drawing in 3D space is mostly the same. Let us draw spiral with default line style. Now its color is 4-th color from palette (this is cyan): +

  gr->SubPlot(2,2,2);	gr->Rotate(60,40);
+  mglData z(50);  	z.Modify("2*x-1");
+  gr->Plot(x,y0,z);	gr->Box();
+

Functions plot and subdata make 3D curve plot but for single array. Use it to put circle marks on the previous plot: +

  mglData y2(10,3);	y2.Modify("cos(pi*(2*x-1+y))");
+  y2.Modify("2*x-1",2);
+  gr->Plot(y2.SubData(-1,0),y2.SubData(-1,1),y2.SubData(-1,2),"bo ");
+

Note that line style is empty ‘ ’ here. Usage of other 1D plotting functions looks similar: +

  gr->SubPlot(2,2,3);	gr->Rotate(60,40);
+  gr->Bars(x,y0,z,"r");	gr->Box();
+  return 0;
+}
+
+

Surfaces surf and other 2D plots (see 2D plotting) are drown the same simpler as 1D one. The difference is that the string parameter specifies not the line style but the color scheme of the plot (see Color scheme). Here I draw attention on 4 most interesting color schemes. There is gray scheme where color is changed from black to white (string ‘kw’) or from white to black (string ‘wk’). Another scheme is useful for accentuation of negative (by blue color) and positive (by red color) regions on plot (string ‘"BbwrR"’). Last one is the popular “jet” scheme (string ‘"BbcyrR"’). +

+

Now I shall show the example of a surface drawing. At first let us switch lightning on +

int sample(mglGraph *gr)
+{
+  gr->Light(true);	gr->Light(0,mglPoint(0,0,1));
+

and draw the surface, considering coordinates x,y to be uniformly distributed in axis range +

  mglData a0(50,40);
+  a0.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))");
+  gr->SubPlot(2,2,0);	gr->Rotate(60,40);
+  gr->Surf(a0);		gr->Box();
+

Color scheme was not specified. So previous color scheme is used. In this case it is default color scheme (“jet”) for the first plot. Next example is a sphere. The sphere is parametrically specified surface: +

  mglData x(50,40),y(50,40),z(50,40);
+  x.Modify("0.8*sin(2*pi*x)*sin(pi*y)");
+  y.Modify("0.8*cos(2*pi*x)*sin(pi*y)");
+  z.Modify("0.8*cos(pi*y)");
+  gr->SubPlot(2,2,1);	gr->Rotate(60,40);
+  gr->Surf(x,y,z,"BbwrR");gr->Box();
+

I set color scheme to "BbwrR" that corresponds to red top and blue bottom of the sphere. +

+

Surfaces will be plotted for each of slice of the data if nz>1. Next example draws surfaces for data arrays with nz=3: +

  mglData a1(50,40,3);
+  a1.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))");
+  a1.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*sin(3*pi*(x*y))",1);
+  a1.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))",2);
+  gr->SubPlot(2,2,2);	gr->Rotate(60,40);
+  gr->Alpha(true);
+  gr->Surf(a1);		gr->Box();
+

Note, that it may entail a confusion. However, if one will use density plot then the picture will look better: +

  gr->SubPlot(2,2,3);	gr->Rotate(60,40);
+  gr->Dens(a1);		gr->Box();
+  return 0;
+}
+
+

Drawing of other 2D plots is analogous. The only peculiarity is the usage of flag ‘#’. By default this flag switches on the drawing of a grid on plot (grid or mesh for plots in plain or in volume). However, for isosurfaces (including surfaces of rotation axial) this flag switches the face drawing off and figure becomes wired. The following code gives example of flag ‘#’ using (compare with normal function drawing as in its description): +

int sample(mglGraph *gr)
+{
+  gr->Alpha(true);	gr->Light(true);	gr->Light(0,mglPoint(0,0,1));
+  mglData a(30,20);
+  a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))");
+
+  gr->SubPlot(2,2,0);	gr->Rotate(40,60);
+  gr->Surf(a,"BbcyrR#");		gr->Box();
+  gr->SubPlot(2,2,1);	gr->Rotate(40,60);
+  gr->Dens(a,"BbcyrR#");		gr->Box();
+  gr->SubPlot(2,2,2);	gr->Rotate(40,60);
+  gr->Cont(a,"BbcyrR#");		gr->Box();
+  gr->SubPlot(2,2,3);	gr->Rotate(40,60);
+  gr->Axial(a,"BbcyrR#");		gr->Box();
+  return 0;
+}
+
+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.5 Hints

+ + +

In this section I’ve included some small hints and advices for the improving of the quality of plots and for the demonstration of some non-trivial features of MathGL library. In contrast to previous examples I showed mostly the idea but not the whole drawing function. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

2.5.1 “Compound” graphics

+ + +

As I noted above, MathGL functions (except the special one, like Clf()) do not erase the previous plotting but just add the new one. It allows one to draw “compound” plots easily. For example, popular Matlab command surfc can be emulated in MathGL by 2 calls: +

  Surf(a);
+  Cont(a, "_");     // draw contours at bottom
+

Here a is 2-dimensional data for the plotting, -1 is the value of z-coordinate at which the contour should be plotted (at the bottom in this example). Analogously, one can draw density plot instead of contour lines and so on. +

+

Another nice plot is contour lines plotted directly on the surface: +

  Light(true);       // switch on light for the surface
+  Surf(a, "BbcyrR"); // select 'jet' colormap for the surface
+  Cont(a, "y");      // and yellow color for contours
+

The possible difficulties arise in black&white case, when the color of the surface can be close to the color of a contour line. In that case I may suggest the following code: +

  Light(true);   // switch on light for the surface
+  Surf(a, "kw"); // select 'gray' colormap for the surface
+  CAxis(-1,0);   // first draw for darker surface colors
+  Cont(a, "w");  // white contours
+  CAxis(0,1);    // now draw for brighter surface colors
+  Cont(a, "k");  // black contours
+  CAxis(-1,1);   // return color range to original state
+

The idea is to divide the color range on 2 parts (dark and bright) and to select the contrasting color for contour lines for each of part. +

+

Similarly, one can plot flow thread over density plot of vector field amplitude (this is another amusing plot from Matlab) and so on. The list of compound graphics can be prolonged but I hope that the general idea is clear. +

+

Just for illustration I put here following sample code: +

int sample(mglGraph *gr)
+{
+  mglData a,b,d;  mgls_prepare2v(&a,&b);  d = a;
+  for(int i=0;i<a.nx*a.ny;i++)  d.a[i] = hypot(a.a[i],b.a[i]);
+  mglData c;  mgls_prepare3d(&c);
+  mglData v(10);  v.Fill(-0.5,1);
+
+  gr->SubPlot(2,2,1,"");  gr->Title("Flow + Dens");
+  gr->Flow(a,b,"br"); gr->Dens(d,"BbcyrR"); gr->Box();
+
+  gr->SubPlot(2,2,0); gr->Title("Surf + Cont"); gr->Rotate(50,60);
+  gr->Light(true);  gr->Surf(a);  gr->Cont(a,"y");  gr->Box();
+
+  gr->SubPlot(2,2,2); gr->Title("Mesh + Cont"); gr->Rotate(50,60);
+  gr->Box();  gr->Mesh(a);  gr->Cont(a,"_");
+
+  gr->SubPlot(2,2,3); gr->Title("Surf3 + ContF3");gr->Rotate(50,60);
+  gr->Box();  gr->ContF3(v,c,"z",0);  gr->ContF3(v,c,"x");  gr->ContF3(v,c);
+  gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+  gr->ContF3(v,c,"z",c.nz-1); gr->Surf3(-0.5,c);
+  return 0;
+}
+
+
Example of “combined” plots +
+ +
+ + + +

2.5.2 Transparency and lighting

+ + +

Here I want to show how transparency and lighting both and separately change the look of a surface. So, there is code and picture for that: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->SubPlot(2,2,0); gr->Title("default"); gr->Rotate(50,60);
+  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,1); gr->Title("light on");  gr->Rotate(50,60);
+  gr->Box();  gr->Light(true);  gr->Surf(a);
+
+  gr->SubPlot(2,2,3); gr->Title("alpha on; light on");  gr->Rotate(50,60);
+  gr->Box();  gr->Alpha(true);  gr->Surf(a);
+
+  gr->SubPlot(2,2,2); gr->Title("alpha on");  gr->Rotate(50,60);
+  gr->Box();  gr->Light(false); gr->Surf(a);
+  return 0;
+}
+
+
Example of transparency and lightings +
+ +
+ + + +

2.5.3 Types of transparency

+ + +

MathGL library has advanced features for setting and handling the surface transparency. The simplest way to add transparency is the using of function alpha. As a result, all further surfaces (and isosurfaces, density plots and so on) become transparent. However, their look can be additionally improved. +

+

The value of transparency can be different from surface to surface. To do it just use SetAlphaDef before the drawing of the surface, or use option alpha (see Command options). If its value is close to 0 then the surface becomes more and more transparent. Contrary, if its value is close to 1 then the surface becomes practically non-transparent. +

+

Also you can change the way how the light goes through overlapped surfaces. The function SetTranspType defines it. By default the usual transparency is used (‘0’) – surfaces below is less visible than the upper ones. A “glass-like” transparency (‘1’) has a different look – each surface just decreases the background light (the surfaces are commutable in this case). +

+

A “neon-like” transparency (‘2’) has more interesting look. In this case a surface is the light source (like a lamp on the dark background) and just adds some intensity to the color. At this, the library sets automatically the black color for the background and changes the default line color to white. +

+

As example I shall show several plots for different types of transparency. The code is the same except the values of SetTranspType function: +

int sample(mglGraph *gr)
+{
+  gr->Alpha(true);  gr->Light(true);
+  mglData a;  mgls_prepare2d(&a);
+  gr->SetTranspType(0); gr->Clf();
+  gr->SubPlot(2,2,0); gr->Rotate(50,60);  gr->Surf(a);  gr->Box();
+  gr->SubPlot(2,2,1); gr->Rotate(50,60);  gr->Dens(a);  gr->Box();
+  gr->SubPlot(2,2,2); gr->Rotate(50,60);  gr->Cont(a);  gr->Box();
+  gr->SubPlot(2,2,3); gr->Rotate(50,60);  gr->Axial(a); gr->Box();
+  return 0;
+}
+
+
Example of SetTranspType(0). +
Example of SetTranspType(1). +
Example of SetTranspType(2). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.4 Axis projection

+ + +

You can easily make 3D plot and draw its x-,y-,z-projections (like in CAD) by using ternary function with arguments: 4 for Cartesian, 5 for Ternary and 6 for Quaternary coordinates. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(0,1,0,1,0,1);
+  mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+  a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+  x.Modify("0.25*(1+cos(2*pi*x))");
+  y.Modify("0.25*(1+sin(2*pi*x))");
+  rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+  z.Modify("x");
+
+  gr->Title("Projection sample");
+  gr->Ternary(4);
+  gr->Rotate(50,60);      gr->Light(true);
+  gr->Plot(x,y,z,"r2");   gr->Surf(a,"#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('x',"X",1);   gr->Label('y',"Y",1);   gr->Label('z',"Z",1);
+}
+
+
Example of axis projections +
Example of ternary axis projections +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.5 Adding fog

+ + +

MathGL can add a fog to the image. Its switching on is rather simple – just use fog function. There is the only feature – fog is applied for whole image. Not to particular subplot. The sample code is: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->Title("Fog sample");
+  gr->Light(true);  gr->Rotate(50,60);  gr->Fog(1); gr->Box();
+  gr->Surf(a);  gr->Cont(a,"y");
+  return 0;
+}
+
+
Example of Fog(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.6 Lighting sample

+ + +

In contrast to the most of other programs, MathGL supports several (up to 10) light sources. Moreover, the color each of them can be different: white (this is usual), yellow, red, cyan, green and so on. The use of several light sources may be interesting for the highlighting of some peculiarities of the plot or just to make an amusing picture. Note, each light source can be switched on/off individually. The sample code is: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->Title("Several light sources");
+  gr->Rotate(50,60);  gr->Light(true);
+  gr->AddLight(1,mglPoint(0,1,0),'c');
+  gr->AddLight(2,mglPoint(1,0,0),'y');
+  gr->AddLight(3,mglPoint(0,-1,0),'m');
+  gr->Box();  gr->Surf(a,"h");
+  return 0;
+}
+
+
Example of several light sources. +
+

Additionally, you can use local light sources and set to use diffuse reflection instead of specular one (by default) or both kinds. Note, I use attachlight command to keep light settings relative to subplot. +

int sample(mglGraph *gr)
+{
+  gr->Light(true);  gr->AttachLight(true);
+  gr->SubPlot(2,2,0); gr->Title("Default"); gr->Rotate(50,60);
+  gr->Line(mglPoint(-1,-0.7,1.7),mglPoint(-1,-0.7,0.7),"BA"); gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,1); gr->Title("Local");   gr->Rotate(50,60);
+  gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1));
+  gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,2); gr->Title("no diffuse"); gr->Rotate(50,60);
+  gr->SetDiffuse(0);
+  gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,3); gr->Title("diffusive only");  gr->Rotate(50,60);
+  gr->SetDiffuse(0.5);
+  gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1),'w',0);
+  gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");  gr->Box();  gr->Surf(a);
+}
+
+
Example of different types of lighting. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.7 Using primitives

+ + +

MathGL provide a set of functions for drawing primitives (see Primitives). Primitives are low level object, which used by most of plotting functions. Picture below demonstrate some of commonly used primitives. +

+
Primitives in MathGL. +
+

Generally, you can create arbitrary new kind of plot using primitives. For example, MathGL don’t provide any special functions for drawing molecules. However, you can do it using only one type of primitives drop. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->Alpha(true);  gr->Light(true);
+
+  gr->SubPlot(2,2,0,"");  gr->Title("Methane, CH_4");
+  gr->StartGroup("Methane");
+  gr->Rotate(60,120);
+  gr->Sphere(mglPoint(0,0,0),0.25,"k");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0,0,1),0.35,"h",1,2);
+  gr->Sphere(mglPoint(0,0,0.7),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(-0.94,0,-0.33),0.35,"h",1,2);
+  gr->Sphere(mglPoint(-0.66,0,-0.23),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.47,0.82,-0.33),0.35,"h",1,2);
+  gr->Sphere(mglPoint(0.33,0.57,-0.23),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.47,-0.82,-0.33),0.35,"h",1,2);
+  gr->Sphere(mglPoint(0.33,-0.57,-0.23),0.25,"g");
+  gr->EndGroup();
+
+  gr->SubPlot(2,2,1,"");  gr->Title("Water, H_{2}O");
+  gr->StartGroup("Water");
+  gr->Rotate(60,100);
+  gr->StartGroup("Water_O");
+  gr->Sphere(mglPoint(0,0,0),0.25,"r");
+  gr->EndGroup();
+  gr->StartGroup("Water_Bond_1");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.3,0.5,0),0.3,"m",1,2);
+  gr->EndGroup();
+  gr->StartGroup("Water_H_1");
+  gr->Sphere(mglPoint(0.3,0.5,0),0.25,"g");
+  gr->EndGroup();
+  gr->StartGroup("Water_Bond_2");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.3,-0.5,0),0.3,"m",1,2);
+  gr->EndGroup();
+  gr->StartGroup("Water_H_2");
+  gr->Sphere(mglPoint(0.3,-0.5,0),0.25,"g");
+  gr->EndGroup();
+  gr->EndGroup();
+
+  gr->SubPlot(2,2,2,"");  gr->Title("Oxygen, O_2");
+  gr->StartGroup("Oxygen");
+  gr->Rotate(60,120);
+  gr->Drop(mglPoint(0,0.5,0),mglPoint(0,-0.3,0),0.3,"m",1,2);
+  gr->Sphere(mglPoint(0,0.5,0),0.25,"r");
+  gr->Drop(mglPoint(0,-0.5,0),mglPoint(0,0.3,0),0.3,"m",1,2);
+  gr->Sphere(mglPoint(0,-0.5,0),0.25,"r");
+  gr->EndGroup();
+
+  gr->SubPlot(2,2,3,"");  gr->Title("Ammonia, NH_3");
+  gr->StartGroup("Ammonia");
+  gr->Rotate(60,120);
+  gr->Sphere(mglPoint(0,0,0),0.25,"b");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.33,0.57,0),0.32,"n",1,2);
+  gr->Sphere(mglPoint(0.33,0.57,0),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.33,-0.57,0),0.32,"n",1,2);
+  gr->Sphere(mglPoint(0.33,-0.57,0),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(-0.65,0,0),0.32,"n",1,2);
+  gr->Sphere(mglPoint(-0.65,0,0),0.25,"g");
+  gr->EndGroup();
+  return 0;
+}
+
+
Example of molecules drawing. +
+

Moreover, some of special plots can be more easily produced by primitives rather than by specialized function. For example, Venn diagram can be produced by Error plot: +

int sample(mglGraph *gr)
+{
+  double xx[3]={-0.3,0,0.3}, yy[3]={0.3,-0.3,0.3}, ee[3]={0.7,0.7,0.7};
+  mglData x(3,xx), y(3,yy), e(3,ee);
+  gr->Title("Venn-like diagram"); gr->Alpha(true);
+  gr->Error(x,y,e,e,"!rgb@#o");
+  return 0;
+}
+

You see that you have to specify and fill 3 data arrays. The same picture can be produced by just 3 calls of circle function: +

int sample(mglGraph *gr)
+{
+  gr->Title("Venn-like diagram"); gr->Alpha(true);
+  gr->Circle(mglPoint(-0.3,0.3),0.7,"rr@");
+  gr->Circle(mglPoint(0,-0.3),0.7,"gg@");
+  gr->Circle(mglPoint( 0.3,0.3),0.7,"bb@");
+  return 0;
+}
+

Of course, the first variant is more suitable if you need to plot a lot of circles. But for few ones the usage of primitives looks easy. +

+
Example of Venn diagram. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.8 STFA sample

+ + +

Short-time Fourier Analysis (stfa) is one of informative method for analyzing long rapidly oscillating 1D data arrays. It is used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. +

+

MathGL can find and draw STFA result. Just to show this feature I give following sample. Initial data arrays is 1D arrays with step-like frequency. Exactly this you can see at bottom on the STFA plot. The sample code is: +

int sample(mglGraph *gr)
+{
+  mglData a(2000), b(2000);
+  gr->Fill(a,"cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+  cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)");
+  gr->SubPlot(1, 2, 0,"<_");  gr->Title("Initial signal");
+  gr->Plot(a);
+  gr->Axis();
+  gr->Label('x', "\\i t");
+
+  gr->SubPlot(1, 2, 1,"<_");  gr->Title("STFA plot");
+  gr->STFA(a, b, 64);
+  gr->Axis();
+  gr->Label('x', "\\i t");
+  gr->Label('y', "\\omega", 0);
+  return 0;
+}
+
+
Example of STFA(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.9 Mapping visualization

+ + +

Sometime ago I worked with mapping and have a question about its visualization. Let me remember you that mapping is some transformation rule for one set of number to another one. The 1d mapping is just an ordinary function – it takes a number and transforms it to another one. The 2d mapping (which I used) is a pair of functions which take 2 numbers and transform them to another 2 ones. Except general plots (like surfc, surfa) there is a special plot – Arnold diagram. It shows the area which is the result of mapping of some initial area (usually square). +

+

I tried to make such plot in map. It shows the set of points or set of faces, which final position is the result of mapping. At this, the color gives information about their initial position and the height describes Jacobian value of the transformation. Unfortunately, it looks good only for the simplest mapping but for the real multivalent quasi-chaotic mapping it produces a confusion. So, use it if you like :). +

+

The sample code for mapping visualization is: +

int sample(mglGraph *gr)
+{
+  mglData a(50, 40), b(50, 40);
+  gr->Puts(mglPoint(0, 0), "\\to", ":C", -1.4);
+  gr->SetRanges(-1,1,-1,1,-2,2);
+
+  gr->SubPlot(2, 1, 0);
+  gr->Fill(a,"x");  gr->Fill(b,"y");
+  gr->Puts(mglPoint(0, 1.1), "\\{x, y\\}", ":C", -2);   gr->Box();
+  gr->Map(a, b, "brgk");
+
+  gr->SubPlot(2, 1, 1);
+  gr->Fill(a,"(x^3+y^3)/2");  gr->Fill(b,"(x-y)/2");
+  gr->Puts(mglPoint(0, 1.1), "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", ":C", -2);
+  gr->Box();
+  gr->Map(a, b, "brgk");
+  return 0;
+}
+
+
Example of Map(). +
+ + + +
+ + + +

2.5.10 Data interpolation

+ + +

There are many functions to get interpolated values of a data array. Basically all of them can be divided by 3 categories: +

    +
  1. functions which return single value at given point (see Interpolation and mglGSpline() in Global functions); +
  2. functions subdata and evaluate for indirect access to data elements; +
  3. functions refill, gspline and datagrid which fill regular (rectangular) data array by interpolated values. +
+ +

The usage of first category is rather straightforward and don’t need any special comments. +

+

There is difference in indirect access functions. Function subdata use use step-like interpolation to handle correctly single nan values in the data array. Contrary, function evaluate use local spline interpolation, which give smoother output but spread nan values. So, subdata should be used for specific data elements (for example, for given column), and evaluate should be used for distributed elements (i.e. consider data array as some field). Following sample illustrates this difference: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(1,1,0,"");  gr->Title("SubData vs Evaluate");
+  mglData in(9), arg(99), e, s;
+  gr->Fill(in,"x^3/1.1"); gr->Fill(arg,"4*x+4");
+  gr->Plot(in,"ko ");     gr->Box();
+  e = in.Evaluate(arg,false); gr->Plot(e,"b.","legend 'Evaluate'");
+  s = in.SubData(arg);    gr->Plot(s,"r.","legend 'SubData'");
+  gr->Legend(2);
+}
+
+
Example of indirect data access. +
+

Example of datagrid usage is done in Making regular data. Here I want to show the peculiarities of refill and gspline functions. Both functions require argument(s) which provide coordinates of the data values, and return rectangular data array which equidistantly distributed in axis range. So, in opposite to evaluate function, refill and gspline can interpolate non-equidistantly distributed data. At this both functions refill and gspline provide continuity of 2nd derivatives along coordinate(s). However, refill is slower but give better (from human point of view) result than global spline gspline due to more advanced algorithm. Following sample illustrates this difference: +

int sample(mglGraph *gr)
+{
+  mglData x(10), y(10), r(100);
+  x.Modify("0.5+rnd");  x.CumSum("x");  x.Norm(-1,1);
+  y.Modify("sin(pi*v)/1.5",x);
+  gr->SubPlot(2,2,0,"<_");  gr->Title("Refill sample");
+  gr->Axis();  gr->Box(); gr->Plot(x,y,"o ");
+  gr->Refill(r,x,y);  // or you can use r.Refill(x,y,-1,1);
+  gr->Plot(r,"r");  gr->FPlot("sin(pi*x)/1.5","B:");
+  gr->SubPlot(2,2,1,"<_");gr->Title("Global spline");
+  gr->Axis();  gr->Box(); gr->Plot(x,y,"o ");
+  r.RefillGS(x,y,-1,1);   gr->Plot(r,"r");
+  gr->FPlot("sin(pi*x)/1.5","B:");
+
+  gr->Alpha(true);  gr->Light(true);
+  mglData z(10,10), xx(10,10), yy(10,10), rr(100,100);
+  y.Modify("0.5+rnd");  y.CumSum("x");  y.Norm(-1,1);
+  for(int i=0;i<10;i++) for(int j=0;j<10;j++)
+    z.a[i+10*j] = sin(M_PI*x.a[i]*y.a[j])/1.5;
+  gr->SubPlot(2,2,2); gr->Title("2d regular");  gr->Rotate(40,60);
+  gr->Axis();  gr->Box(); gr->Mesh(x,y,z,"k");
+  gr->Refill(rr,x,y,z); gr->Surf(rr);
+
+  gr->Fill(xx,"(x+1)/2*cos(y*pi/2-1)");
+  gr->Fill(yy,"(x+1)/2*sin(y*pi/2-1)");
+  for(int i=0;i<10*10;i++)
+    z.a[i] = sin(M_PI*xx.a[i]*yy.a[i])/1.5;
+  gr->SubPlot(2,2,3); gr->Title("2d non-regular");  gr->Rotate(40,60);
+  gr->Axis();  gr->Box();  gr->Plot(xx,yy,z,"ko ");
+  gr->Refill(rr,xx,yy,z);  gr->Surf(rr);
+}
+
+
Example of non-equidistant data interpolation. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.11 Making regular data

+ + +

Sometimes, one have only unregular data, like as data on triangular grids, or experimental results and so on. Such kind of data cannot be used as simple as regular data (like matrices). Only few functions, like dots, can handle unregular data as is. +

+

However, one can use built in triangulation functions for interpolating unregular data points to a regular data grids. There are 2 ways. First way, one can use triangulation function to obtain list of vertexes for triangles. Later this list can be used in functions like triplot or tricont. Second way consist in usage of datagrid function, which fill regular data grid by interpolated values, assuming that coordinates of the data grid is equidistantly distributed in axis range. Note, you can use options (see Command options) to change default axis range as well as in other plotting functions. +

int sample(mglGraph *gr)
+{
+  mglData x(100), y(100), z(100);
+  gr->Fill(x,"2*rnd-1"); gr->Fill(y,"2*rnd-1"); gr->Fill(z,"v^2-w^2",x,y);
+  // first way - plot triangular surface for points
+  mglData d = mglTriangulation(x,y);
+  gr->Title("Triangulation");
+  gr->Rotate(40,60);	gr->Box();	gr->Light(true);
+  gr->TriPlot(d,x,y,z);	gr->TriPlot(d,x,y,z,"#k");
+  // second way - make regular data and plot it
+  mglData g(30,30);
+  gr->DataGrid(g,x,y,z);	gr->Mesh(g,"m");
+}
+
+
Example of triangulation. +
+ +
+ + + +

2.5.12 Making histogram

+ + +

Using the hist function(s) for making regular distributions is one of useful fast methods to process and plot irregular data. Hist can be used to find some momentum of set of points by specifying weight function. It is possible to create not only 1D distributions but also 2D and 3D ones. Below I place the simplest sample code which demonstrate hist usage: +

int sample(mglGraph *gr)
+{
+  mglData x(10000), y(10000), z(10000);  gr->Fill(x,"2*rnd-1");
+  gr->Fill(y,"2*rnd-1"); gr->Fill(z,"exp(-6*(v^2+w^2))",x,y);
+  mglData xx=gr->Hist(x,z), yy=gr->Hist(y,z);	xx.Norm(0,1);
+  yy.Norm(0,1);
+  gr->MultiPlot(3,3,3,2,2,"");   gr->SetRanges(-1,1,-1,1,0,1);
+  gr->Box();  gr->Dots(x,y,z,"wyrRk");
+  gr->MultiPlot(3,3,0,2,1,"");   gr->SetRanges(-1,1,0,1);
+  gr->Box();  gr->Bars(xx);
+  gr->MultiPlot(3,3,5,1,2,"");   gr->SetRanges(0,1,-1,1);
+  gr->Box();  gr->Barh(yy);
+  gr->SubPlot(3,3,2);
+  gr->Puts(mglPoint(0.5,0.5),"Hist and\nMultiPlot\nsample","a",-6);
+  return 0;
+}
+
+
Example of Hist(). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.13 Nonlinear fitting hints

+ + +

Nonlinear fitting is rather simple. All that you need is the data to fit, the approximation formula and the list of coefficients to fit (better with its initial guess values). Let me demonstrate it on the following simple example. First, let us use sin function with some random noise: +

  mglData dat(100), in(100); //data to be fitted and ideal data
+  gr->Fill(dat,"0.4*rnd+0.1+sin(2*pi*x)");
+  gr->Fill(in,"0.3+sin(2*pi*x)");
+

and plot it to see that data we will fit +

  gr->Title("Fitting sample");
+  gr->SetRange('y',-2,2); gr->Box();  gr->Plot(dat, "k. ");
+  gr->Axis(); gr->Plot(in, "b");
+  gr->Puts(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "b");
+
+

The next step is the fitting itself. For that let me specify an initial values ini for coefficients ‘abc’ and do the fitting for approximation formula ‘a+b*sin(c*x)’ +

  mreal ini[3] = {1,1,3};
+  mglData Ini(3,ini);
+  mglData res = gr->Fit(dat, "a+b*sin(c*x)", "abc", Ini);
+

Now display it +

  gr->Plot(res, "r");
+  gr->Puts(mglPoint(-0.9, -1.3), "fitted:", "r:L");
+  gr->PutsFit(mglPoint(0, -1.8), "y = ", "r");
+
+

NOTE! the fitting results may have strong dependence on initial values for coefficients due to algorithm features. The problem is that in general case there are several local "optimums" for coefficients and the program returns only first found one! There are no guaranties that it will be the best. Try for example to set ini[3] = {0, 0, 0} in the code above. +

+

The full sample code for nonlinear fitting is: +

int sample(mglGraph *gr)
+{
+  mglData dat(100), in(100);
+  gr->Fill(dat,"0.4*rnd+0.1+sin(2*pi*x)");
+  gr->Fill(in,"0.3+sin(2*pi*x)");
+  mreal ini[3] = {1,1,3};
+  mglData Ini(3,ini);
+
+  mglData res = gr->Fit(dat, "a+b*sin(c*x)", "abc", Ini);
+
+  gr->Title("Fitting sample");
+  gr->SetRange('y',-2,2); gr->Box();  gr->Plot(dat, "k. ");
+  gr->Axis();   gr->Plot(res, "r"); gr->Plot(in, "b");
+  gr->Puts(mglPoint(-0.9, -1.3), "fitted:", "r:L");
+  gr->PutsFit(mglPoint(0, -1.8), "y = ", "r");
+  gr->Puts(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "b");
+  return 0;
+}
+
+
Example of nonlinear fitting. +
+ +
+ + + +

2.5.14 PDE solving hints

+ + +

Solving of Partial Differential Equations (PDE, including beam tracing) and ray tracing (or finding particle trajectory) are more or less common task. So, MathGL have several functions for that. There are ray for ray tracing, pde for PDE solving, qo2d for beam tracing in 2D case (see Global functions). Note, that these functions take “Hamiltonian” or equations as string values. And I don’t plan now to allow one to use user-defined functions. There are 2 reasons: the complexity of corresponding interface; and the basic nature of used methods which are good for samples but may not good for serious scientific calculations. +

+

The ray tracing can be done by ray function. Really ray tracing equation is Hamiltonian equation for 3D space. So, the function can be also used for finding a particle trajectory (i.e. solve Hamiltonian ODE) for 1D, 2D or 3D cases. The function have a set of arguments. First of all, it is Hamiltonian which defined the media (or the equation) you are planning to use. The Hamiltonian is defined by string which may depend on coordinates ‘x’, ‘y’, ‘z’, time ‘t’ (for particle dynamics) and momentums ‘p’=p_x, ‘q’=p_y, ‘v’=p_z. Next, you have to define the initial conditions for coordinates and momentums at ‘t’=0 and set the integrations step (default is 0.1) and its duration (default is 10). The Runge-Kutta method of 4-th order is used for integration. +

  const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+  mglData r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+

This example calculate the reflection from linear layer (media with Hamiltonian ‘p^2+q^2-x-1’=p_x^2+p_y^2-x-1). This is parabolic curve. The resulting array have 7 columns which contain data for {x,y,z,p,q,v,t}. +

+

The solution of PDE is a bit more complicated. As previous you have to specify the equation as pseudo-differential operator \hat H(x, \nabla) which is called sometime as “Hamiltonian” (for example, in beam tracing). As previously, it is defined by string which may depend on coordinates ‘x’, ‘y’, ‘z’ (but not time!), momentums ‘p’=(d/dx)/i k_0, ‘q’=(d/dy)/i k_0 and field amplitude ‘u’=|u|. The evolutionary coordinate is ‘z’ in all cases. So that, the equation look like du/dz = ik_0 H(x,y,\hat p, \hat q, |u|)[u]. Dependence on field amplitude ‘u’=|u| allows one to solve nonlinear problems too. For example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". Also you may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)" or ham = "p^2 + i1*x*(x>0)". +

+

Next step is specifying the initial conditions at ‘z’ equal to minimal z-axis value. The function need 2 arrays for real and for imaginary part. Note, that coordinates x,y,z are supposed to be in specified axis range. So, the data arrays should have corresponding scales. Finally, you may set the integration step and parameter k0=k_0. Also keep in mind, that internally the 2 times large box is used (for suppressing numerical reflection from boundaries) and the equation should well defined even in this extended range. +

+

Final comment is concerning the possible form of pseudo-differential operator H. At this moment, simplified form of operator H is supported – all “mixed” terms (like ‘x*p’->x*d/dx) are excluded. For example, in 2D case this operator is effectively H = f(p,z) + g(x,z,u). However commutable combinations (like ‘x*q’->x*d/dy) are allowed for 3D case. +

+

So, for example let solve the equation for beam deflected from linear layer and absorbed later. The operator will have the form ‘"p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)"’ that correspond to equation 1/ik_0 * du/dz + d^2 u/dx^2 + d^2 u/dy^2 + x * u + i (x+z)/2 * u = 0. This is typical equation for Electron Cyclotron (EC) absorption in magnetized plasmas. For initial conditions let me select the beam with plane phase front exp(-48*(x+0.7)^2). The corresponding code looks like this: +

int sample(mglGraph *gr)
+{
+  mglData a,re(128),im(128);
+  gr->Fill(re,"exp(-48*(x+0.7)^2)");
+  a = gr->PDE("p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, 0.01, 30);
+  a.Transpose("yxz");
+  gr->SubPlot(1,1,0,"<_"); gr->Title("PDE solver");
+  gr->SetRange('c',0,1);  gr->Dens(a,"wyrRk");
+  gr->Axis(); gr->Label('x', "\\i x");  gr->Label('y', "\\i z");
+  gr->FPlot("-x", "k|");
+  gr->Puts(mglPoint(0, 0.85), "absorption: (x+z)/2 for x+z>0");
+  gr->Puts(mglPoint(0,1.1),"Equation: ik_0\\partial_zu + \\Delta u + x\\cdot u + i \\frac{x+z}{2}\\cdot u = 0");
+  return 0;
+}
+
+
Example of PDE solving. +
+

The next example is the beam tracing. Beam tracing equation is special kind of PDE equation written in coordinates accompanied to a ray. Generally this is the same parameters and limitation as for PDE solving but the coordinates are defined by the ray and by parameter of grid width w in direction transverse the ray. So, you don’t need to specify the range of coordinates. BUT there is limitation. The accompanied coordinates are well defined only for smooth enough rays, i.e. then the ray curvature K (which is defined as 1/K^2 = (|r''|^2 |r'|^2 - (r'', r'')^2)/|r'|^6) is much large then the grid width: K>>w. So, you may receive incorrect results if this condition will be broken. +

+

You may use following code for obtaining the same solution as in previous example: +

int sample(mglGraph *gr)
+{
+  mglData r, xx, yy, a, im(128), re(128);
+  const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+  r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+  gr->SubPlot(1,1,0,"<_"); gr->Title("Beam and ray tracing");
+  gr->Plot(r.SubData(0), r.SubData(1), "k");
+  gr->Axis(); gr->Label('x', "\\i x");  gr->Label('y', "\\i z");
+
+  // now start beam tracing
+  gr->Fill(re,"exp(-48*x^2)");
+  a = mglQO2d(ham, re, im, r, xx, yy, 1, 30);
+  gr->SetRange('c',0, 1);
+  gr->Dens(xx, yy, a, "wyrRk");
+  gr->FPlot("-x", "k|");
+  gr->Puts(mglPoint(0, 0.85), "absorption: (x+y)/2 for x+y>0");
+  gr->Puts(mglPoint(0.7, -0.05), "central ray");
+  return 0;
+}
+
+
Example of beam tracing. +
+

Note, the pde is fast enough and suitable for many cases routine. However, there is situations then media have both together: strong spatial dispersion and spatial inhomogeneity. In this, case the pde will produce incorrect result and you need to use advanced PDE solver apde. For example, a wave beam, propagated in plasma, described by Hamiltonian exp(-x^2-p^2), will have different solution for using of simplification and advanced PDE solver: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(-1,1,0,2,0,2);
+  mglData ar(256), ai(256);	gr->Fill(ar,"exp(-2*x^2)");
+
+  mglData res1(gr->APDE("exp(-x^2-p^2)",ar,ai,0.01));	res1.Transpose();
+  gr->SubPlot(1,2,0,"_");	gr->Title("Advanced PDE solver");
+  gr->SetRanges(0,2,-1,1);	gr->SetRange('c',res1);
+  gr->Dens(res1);	gr->Axis();	gr->Box();
+  gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+  gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u = exp(-\\i x^2+\\partial_x^2)[\\i u]","y");
+
+  mglData res2(gr->PDE("exp(-x^2-p^2)",ar,ai,0.01));
+  gr->SubPlot(1,2,1,"_");	gr->Title("Simplified PDE solver");
+  gr->Dens(res2);	gr->Axis();	gr->Box();
+  gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+  gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u \\approx\\ exp(-\\i x^2)\\i u+exp(\\partial_x^2)[\\i u]","y");
+  return 0;
+}
+
+
Comparison of simplified and advanced PDE solvers. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.15 Drawing phase plain

+ + +

Here I want say a few words of plotting phase plains. Phase plain is name for system of coordinates x, x', i.e. a variable and its time derivative. Plot in phase plain is very useful for qualitative analysis of an ODE, because such plot is rude (it topologically the same for a range of ODE parameters). Most often the phase plain {x, x'} is used (due to its simplicity), that allows to analyze up to the 2nd order ODE (i.e. x''+f(x,x')=0). +

+

The simplest way to draw phase plain in MathGL is using flow function(s), which automatically select several points and draw flow threads. If the ODE have an integral of motion (like Hamiltonian H(x,x')=const for dissipation-free case) then you can use cont function for plotting isolines (contours). In fact. isolines are the same as flow threads, but without arrows on it. Finally, you can directly solve ODE using ode function and plot its numerical solution. +

+

Let demonstrate this for ODE equation x''-x+3*x^2=0. This is nonlinear oscillator with square nonlinearity. It has integral H=y^2+2*x^3-x^2=Const. Also it have 2 typical stationary points: saddle at {x=0, y=0} and center at {x=1/3, y=0}. Motion at vicinity of center is just simple oscillations, and is stable to small variation of parameters. In opposite, motion around saddle point is non-stable to small variation of parameters, and is very slow. So, calculation around saddle points are more difficult, but more important. Saddle points are responsible for solitons, stochasticity and so on. +

+

So, let draw this phase plain by 3 different methods. First, draw isolines for H=y^2+2*x^3-x^2=Const – this is simplest for ODE without dissipation. Next, draw flow threads – this is straightforward way, but the automatic choice of starting points is not always optimal. Finally, use ode to check the above plots. At this we need to run ode in both direction of time (in future and in the past) to draw whole plain. Alternatively, one can put starting points far from (or at the bounding box as done in flow) the plot, but this is a more complicated. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"<_");  gr->Title("Cont");  gr->Box();
+  gr->Axis();  gr->Label('x',"x");  gr->Label('y',"\\dot{x}");
+  mglData f(100,100);   gr->Fill(f,"y^2+2*x^3-x^2-0.5");
+  gr->Cont(f);
+  gr->SubPlot(2,2,1,"<_");  gr->Title("Flow");  gr->Box();
+  gr->Axis();  gr->Label('x',"x");  gr->Label('y',"\\dot{x}");
+  mglData fx(100,100), fy(100,100);
+  gr->Fill(fx,"x-3*x^2");  gr->Fill(fy,"y");
+  gr->Flow(fy,fx,"v","value 7");
+  gr->SubPlot(2,2,2,"<_");  gr->Title("ODE");   gr->Box();
+  gr->Axis();  gr->Label('x',"x");  gr->Label('y',"\\dot{x}");
+  for(double x=-1;x<1;x+=0.1)
+  {
+    mglData in(2), r;   in.a[0]=x;
+    r = mglODE("y;x-3*x^2","xy",in);
+    gr->Plot(r.SubData(0), r.SubData(1));
+    r = mglODE("-y;-x+3*x^2","xy",in);
+    gr->Plot(r.SubData(0), r.SubData(1));
+  }
+}
+
+
Example of ODE solving and phase plain drawing. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.16 Pulse properties

+ + +

There is common task in optics to determine properties of wave pulses or wave beams. MathGL provide special function pulse which return the pulse properties (maximal value, center of mass, width and so on). Its usage is rather simple. Here I just illustrate it on the example of Gaussian pulse, where all parameters are obvious. +

void sample(mglGraph *gr)
+{
+  gr->SubPlot(1,1,0,"<_");  gr->Title("Pulse sample");
+  // first prepare pulse itself
+  mglData a(100); gr->Fill(a,"exp(-6*x^2)");
+  // get pulse parameters
+  mglData b(a.Pulse('x'));
+  // positions and widths are normalized on the number of points. So, set proper axis scale.
+  gr->SetRanges(0, a.nx-1, 0, 1);
+  gr->Axis(); gr->Plot(a);  // draw pulse and axis
+  // now visualize found pulse properties
+  double m = b[0];  // maximal amplitude
+  // approximate position of maximum
+  gr->Line(mglPoint(b[1],0), mglPoint(b[1],m),"r=");
+  // width at half-maximum (so called FWHM)
+  gr->Line(mglPoint(b[1]-b[3]/2,0), mglPoint(b[1]-b[3]/2,m),"m|");
+  gr->Line(mglPoint(b[1]+b[3]/2,0), mglPoint(b[1]+b[3]/2,m),"m|");
+  gr->Line(mglPoint(0,m/2), mglPoint(a.nx-1,m/2),"h");
+  // parabolic approximation near maximum
+  char func[128];	sprintf(func,"%g*(1-((x-%g)/%g)^2)",b[0],b[1],b[2]);
+  gr->FPlot(func,"g");
+}
+
+
Example of determining of pulse properties. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.17 Using MGL parser

+ + +

Sometimes you may prefer to use MGL scripts in yours code. It is simpler (especially in comparison with C/Fortran interfaces) and provide faster way to plot the data with annotations, labels and so on. Class mglParse (see mglParse class parse MGL scripts in C++. It have also the corresponding interface for C/Fortran. +

+

The key function here is mglParse::Parse() (or mgl_parse() for C/Fortran) which execute one command per string. At this the detailed information about the possible errors or warnings is passed as function value. Or you may execute the whole script as long string with lines separated by ‘\n’. Functions mglParse::Execute() and mgl_parse_text() perform it. Also you may set the values of parameters ‘$0’...‘$9’ for the script by functions mglParse::AddParam() or mgl_add_param(), allow/disable picture resizing, check “once” status and so on. The usage is rather straight-forward. +

+

The only non-obvious thing is data transition between script and yours program. There are 2 stages: add or find variable; and set data to variable. In C++ you may use functions mglParse::AddVar() and mglParse::FindVar() which return pointer to mglData. In C/Fortran the corresponding functions are mgl_add_var(), mgl_find_var(). This data pointer is valid until next Parse() or Execute() call. Note, you must not delete or free the data obtained from these functions! +

+

So, some simple example at the end. Here I define a data array, create variable, put data into it and plot it. The C++ code looks like this: +

int sample(mglGraph *gr)
+{
+  gr->Title("MGL parser sample");
+  mreal a[100];   // let a_i = sin(4*pi*x), x=0...1
+  for(int i=0;i<100;i++)a[i]=sin(4*M_PI*i/99);
+  mglParse *parser = new mglParse;
+  mglData *d = parser->AddVar("dat");
+  d->Set(a,100); // set data to variable
+  parser->Execute(gr, "plot dat; xrange 0 1\nbox\naxis");
+  // you may break script at any line do something
+  // and continue after that
+  parser->Execute(gr, "xlabel 'x'\nylabel 'y'\nbox");
+  // also you may use cycles or conditions in script
+  parser->Execute(gr, "for $0 -1 1 0.1\nif $0<0\n"
+    "line 0 0 -1 $0 'r':else:line 0 0 -1 $0 'g'\n"
+    "endif\nnext");
+  delete parser;
+  return 0;
+}
+

The code in C/Fortran looks practically the same: +

int sample(HMGL gr)
+{
+  mgl_title(gr, "MGL parser sample", "", -2);
+  double a[100];   // let a_i = sin(4*pi*x), x=0...1
+  int i;
+  for(i=0;i<100;i++)  a[i]=sin(4*M_PI*i/99);
+  HMPR parser = mgl_create_parser();
+  HMDT d = mgl_parser_add_var(parser, "dat");
+  mgl_data_set_double(d,a,100,1,1);    // set data to variable
+  mgl_parse_text(gr, parser, "plot dat; xrange 0 1\nbox\naxis");
+  // you may break script at any line do something
+  // and continue after that
+  mgl_parse_text(gr, parser, "xlabel 'x'\nylabel 'y'");
+  // also you may use cycles or conditions in script
+  mgl_parse_text(gr, parser, "for $0 -1 1 0.1\nif $0<0\n"
+    "line 0 0 -1 $0 'r':else:line 0 0 -1 $0 'g'\n"
+    "endif\nnext");
+  mgl_write_png(gr, "test.png", "");  // don't forgot to save picture
+  return 0;
+}
+
+
Example of MGL script parsing. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.18 Using options

+ + +

Command options allow the easy setup of the selected plot by changing global settings only for this plot. Often, options are used for specifying the range of automatic variables (coordinates). However, options allows easily change plot transparency, numbers of line or faces to be drawn, or add legend entries. The sample function for options usage is: +

void template(mglGraph *gr)
+{
+  mglData a(31,41);
+  gr->Fill(a,"-pi*x*exp(-(y+1)^2-4*x^2)");
+
+  gr->SubPlot(2,2,0);	gr->Title("Options for coordinates");
+  gr->Alpha(true);	gr->Light(true);
+  gr->Rotate(40,60);    gr->Box();
+  gr->Surf(a,"r","yrange 0 1"); gr->Surf(a,"b","yrange 0 -1");
+  if(mini)	return;
+  gr->SubPlot(2,2,1);   gr->Title("Option 'meshnum'");
+  gr->Rotate(40,60);    gr->Box();
+  gr->Mesh(a,"r","yrange 0 1"); gr->Mesh(a,"b","yrange 0 -1; meshnum 5");
+  gr->SubPlot(2,2,2);   gr->Title("Option 'alpha'");
+  gr->Rotate(40,60);    gr->Box();
+  gr->Surf(a,"r","yrange 0 1; alpha 0.7");
+  gr->Surf(a,"b","yrange 0 -1; alpha 0.3");
+  gr->SubPlot(2,2,3,"<_");  gr->Title("Option 'legend'");
+  gr->FPlot("x^3","r","legend 'y = x^3'");
+  gr->FPlot("cos(pi*x)","b","legend 'y = cos \\pi x'");
+  gr->Box();    gr->Axis(); gr->Legend(2,"");
+}
+
+
Example of options usage. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.19 “Templates”

+ + +

As I have noted before, the change of settings will influence only for the further plotting commands. This allows one to create “template” function which will contain settings and primitive drawing for often used plots. Correspondingly one may call this template-function for drawing simplification. +

+

For example, let one has a set of points (experimental or numerical) and wants to compare it with theoretical law (for example, with exponent law \exp(-x/2), x \in [0, 20]). The template-function for this task is: +

void template(mglGraph *gr)
+{
+  mglData  law(100);      // create the law
+  law.Modify("exp(-10*x)");
+  gr->SetRanges(0,20, 0.0001,1);
+  gr->SetFunc(0,"lg(y)",0);
+  gr->Plot(law,"r2");
+  gr->Puts(mglPoint(10,0.2),"Theoretical law: e^x","r:L");
+  gr->Label('x',"x val."); gr->Label('y',"y val.");
+  gr->Axis(); gr->Grid("xy","g;"); gr->Box();
+}
+

At this, one will only write a few lines for data drawing: +

  template(gr);     // apply settings and default drawing from template
+  mglData dat("fname.dat"); // load the data
+  // and draw it (suppose that data file have 2 columns)
+  gr->Plot(dat.SubData(0),dat.SubData(1),"bx ");
+

A template-function can also contain settings for font, transparency, lightning, color scheme and so on. +

+

I understand that this is obvious thing for any professional programmer, but I several times receive suggestion about “templates” ... So, I decide to point out it here. +

+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.20 Stereo image

+ + +

One can easily create stereo image in MathGL. Stereo image can be produced by making two subplots with slightly different rotation angles. The corresponding code looks like this: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->Light(true);
+
+  gr->SubPlot(2,1,0); gr->Rotate(50,60+1);
+  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,1,1); gr->Rotate(50,60-1);
+  gr->Box();  gr->Surf(a);
+  return 0;
+}
+
+
Example of stereo image. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.21 Reduce memory usage

+ + +

By default MathGL save all primitives in memory, rearrange it and only later draw them on bitmaps. Usually, this speed up drawing, but may require a lot of memory for plots which contain a lot of faces (like cloud, dew). You can use quality function for setting to use direct drawing on bitmap and bypassing keeping any primitives in memory. This function also allow you to decrease the quality of the resulting image but increase the speed of the drawing. +

+

The code for lowest memory usage looks like this: +

int sample(mglGraph *gr)
+{
+  gr->SetQuality(6);   // firstly, set to draw directly on bitmap
+  for(i=0;i<1000;i++)
+    gr->Sphere(mglPoint(mgl_rnd()*2-1,mgl_rnd()*2-1),0.05);
+  return 0;
+}
+
+ + +
+ + + +

2.5.22 Scanning file

+ + +

MathGL have possibilities to write textual information into file with variable values. In MGL script you can use save command for that. However, the usual printf(); is simple in C/C++ code. For example, lets create some textual file +

FILE *fp=fopen("test.txt","w");
+fprintf(fp,"This is test: 0 -> 1 q\n");
+fprintf(fp,"This is test: 1 -> -1 q\n");
+fprintf(fp,"This is test: 2 -> 0 q\n");
+fclose(fp);
+

It contents look like +

This is test: 0 -> 1 q
+This is test: 1 -> -1 q
+This is test: 2 -> 0 q
+
+

Let assume now that you want to read this values (i.e. [[0,1],[1,-1],[2,0]]) from the file. You can use scanfile for that. The desired values was written using template "This is test: %g -> %g q\n". So, just use +

mglData a;
+a.ScanFile("test.txt","This is test: %g -> %g");
+

and plot it to for assurance +

gr->SetRanges(a.SubData(0), a.SubData(1));
+gr->Axis();	gr->Plot(a.SubData(0),a.SubData(1),"o");
+
+

Note, I keep only the leading part of template (i.e. "This is test: %g -> %g" instead of "This is test: %g -> %g q\n"), because there is no important for us information after the second number in the line. +

+ + +
+ +
+

+Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.23 Mixing bitmap and vector output

+ + +

Sometimes output plots contain surfaces with a lot of points, and some vector primitives (like axis, text, curves, etc.). Using vector output formats (like EPS or SVG) will produce huge files with possible loss of smoothed lighting. Contrary, the bitmap output may cause the roughness of text and curves. Hopefully, MathGL have a possibility to combine bitmap output for surfaces and vector one for other primitives in the same EPS file, by using rasterize command. +

+

The idea is to prepare part of picture with surfaces or other "heavy" plots and produce the background image from them by help of rasterize command. Next, we draw everything to be saved in vector form (text, curves, axis and etc.). Note, that you need to clear primitives (use clf command) after rasterize if you want to disable duplication of surfaces in output files (like EPS). Note, that some of output formats (like 3D ones, and TeX) don’t support the background bitmap, and use clf for them will cause the loss of part of picture. +

+

The sample code is: +

// first draw everything to be in bitmap output
+gr->FSurf("x^2+y^2", "#", "value 10");
+
+gr->Rasterize();  // set above plots as bitmap background
+gr->Clf();        // clear primitives, to exclude them from file
+
+// now draw everything to be in vector output
+gr->Axis(); gr->Box();
+
+// and save file
+gr->WriteFrame("fname.eps");
+
+ + +
+ +
+

+Previous: , Up: Examples   [Contents][Index]

+
+ +

2.6 FAQ

+ + +
+
The plot does not appear
+

Check that points of the plot are located inside the bounding box and resize the bounding box using ranges function. Check that the data have correct dimensions for selected type of plot. Be sure that Finish() is called after the plotting functions (or be sure that the plot is saved to a file). Sometimes the light reflection from flat surfaces (like, dens) can look as if the plot were absent. +

+
+
I can not find some special kind of plot.
+

Most “new” types of plots can be created by using the existing drawing functions. For example, the surface of curve rotation can be created by a special function torus, or as a parametrically specified surface by surf. See also, Hints. If you can not find a specific type of plot, please e-mail me and this plot will appear in the next version of MathGL library. +

+
+
Should I know some graphical libraries (like OpenGL) before using the MathGL library?
+

No. The MathGL library is self-contained and does not require the knowledge of external libraries. +

+
+
In which language is the library written? For which languages does it have an interface?
+

The core of the MathGL library is written in C++. But there are interfaces for: pure C, Fortran, Pascal, Forth, and its own command language MGL. Also there is a large set of interpreted languages, which are supported (Python, Java, ALLEGROCL, CHICKEN, Lisp, CFFI, C#, Guile, Lua, Modula 3, Mzscheme, Ocaml, Octave, Perl, PHP, Pike, R, Ruby, Tcl). These interfaces are written using SWIG (both pure C functions and classes) but only the interface for Python and Octave is included in the build system. The reason is that I don’t know any other interpreted languages :(. Note that most other languages can use (link to) the pure C functions. +

+
+
How can I use MathGL with Fortran?
+

You can use MathGL as is with gfortran because it uses by default the AT&T notation for external functions. For other compilers (like Visual Fortran) you have to switch on the AT&T notation manually. The AT&T notation requires that the symbol ‘_’ is added at the end of each function name, function argument(s) is passed by pointers and the string length(s) is passed at the end of the argument list. For example: +

+

C functionvoid mgl_fplot(HMGL graph, const char *fy, const char *stl, int n); +

+

AT&T functionvoid mgl_fplot_(uintptr_t *graph, const char *fy, const char *stl, int *n, int ly, int ls); +

+

Fortran users also should add C++ library by the option -lstdc++. If library was built with enable-double=ON (this default for v.2.1 and later) then all real numbers must be real*8. You can make it automatic if use option -fdefault-real-8. +

+
+
How can I print in Russian/Spanish/Arabic/Japanese, and so on?
+

The standard way is to use Unicode encoding for the text output. But the MathGL library also has interface for 8-bit (char *) strings with internal conversion to Unicode. This conversion depends on the current locale OS. You may change it by setlocale() function. For example, for Russian text in CP1251 encoding you may use setlocale(LC_CTYPE, "ru_RU.cp1251"); (under MS Windows the name of locale may differ – setlocale(LC_CTYPE, "russian_russia.1251")). I strongly recommend not to use the constant LC_ALL in the conversion. Since it also changes the number format, it may lead to mistakes in formula writing and reading of the text in data files. For example, the program will await a ‘,’ as a decimal point but the user will enter ‘.’. +

+
+
How can I exclude a point or a region of plot from the drawing?
+

There are 3 general ways. First, the point with NAN value as one of the coordinates (including color/alpha range) will never be plotted. Second, special functions SetCutBox() and CutOff() define the condition when the points should be omitted (see Cutting). Last, you may change the transparency of a part of the plot by the help of functions surfa, surf3a (see Dual plotting). In last case the transparency is switched on smoothly. +

+
+
I use VisualStudio, CBuilder or some other compiler (not MinGW/gcc). How can I link the MathGL library?
+

In version 2.0, main classes (mglGraph and mglData) contains only inline functions and are acceptable for any compiler with the same binary files. However, if you plan to use widget classes (QMathGL, Fl_MathGL, ...) or to access low-level features (mglBase, mglCanvas, ...) then you have to recompile MathGL by yours compiler. +

+

Note, that you have to make import library(-ies) *.lib for provided binary *.dll. This procedure depend on used compiler – please read documentation for yours compiler. For VisualStudio, it can be done by command lib.exe /DEF:libmgl.def /OUT:libmgl.lib. +

+
+
How make FLTK/GLUT/Qt window which will display result of my calculations?
+
+

You need to put yours calculations or main event-handling loop in the separate thread. For static image you can give NULL as drawing function and call Update() function when you need to redraw it. For more details see Animation. +

+
+
How I can build MathGL under Windows?
+

Generally, it is the same procedure as for Linux or MacOS – see section Installation. The simplest way is using the combination CMake+MinGW. Also you may need some extra libraries like GSL, PNG, JPEG and so on. All of them can be found at http://gnuwin32.sourceforge.net/packages.html. After installing all components, just run cmake-gui configurator and build the MathGL itself. +

+
+
How many people write this library?
+

Most of the library was written by one person. This is a result of nearly a year of work (mostly in the evening and on holidays): I spent half a year to write the kernel and half a year to a year on extending, improving the library and writing documentation. This process continues now :). The build system (cmake files) was written mostly by D.Kulagin, and the export to PRC/PDF was written mostly by M.Vidassov. +

+
+
How can I display a bitmap on the figure?
+

You can import data into a mglData instance by function import and display it by dens function. For example, for black-and-white bitmap you can use the code: mglData bmp; bmp.Import("fname.png","wk"); gr->Dens(bmp,"wk");. +

+
+
How can I use MathGL in Qt, FLTK, wxWidgets etc.?
+

There are special classes (widgets) for these libraries: QMathGL for Qt, Fl_MathGL for FLTK and so on. If you don’t find the appropriate class then you can create your own widget that displays a bitmap using mglCanvas::GetRGB(). +

+
+
How can I create 3D in PDF?
+

Just use WritePRC() method which also create PDF file if enable-pdf=ON at MathGL configure. +

+
+
How can I create TeX figure?
+

Just use WriteTEX() method which create LaTeX files with figure itself ‘fname.tex’, with MathGL colors ‘mglcolors.tex’ and main file ‘mglmain.tex’. Last one can be used for viewing image by command like pdflatex mglmain.tex. +

+
+
Can I use MathGL in JavaScript?
+

Yes, sample JavaScript file is located in texinfo/ folder of sources. You should provide JSON data with 3d image for it (can be created by WriteJSON() method). Script allows basic manipulation with plot: zoom, rotation, shift. Sample of JavaScript pictures can be found in http://mathgl.sf.net/json.html. +

+ + + +
+
How I can change the font family?
+

First, you should download new font files from here or from here. Next, you should load the font files into mglGraph class instance gr by the following command: gr->LoadFont(fontname,path);. Here fontname is the base font name like ‘STIX’ and path sets the location of font files. Use gr->RestoreFont(); to start using the default font. +

+
+
How can I draw tick out of a bounding box?
+

Just set a negative value in ticklen. For example, use gr->SetTickLen(-0.1);. +

+
+
How can I prevent text rotation?
+

Just use SetRotatedText(false). Also you can use axis style ‘U’ for disable only tick labels rotation. +

+
+
What is *.so? What is gcc? How I can use make?
+

They are standard GNU tools. There is special FAQ about its usage under Windows – http://www.mingw.org/wiki/FAQ. +

+
+
How can I draw equal axis range even for rectangular image?
+

Just use Aspect(NAN,NAN) for each subplot, or at the beginning of the drawing. +

+
+
How I can set transparent background?
+

Just use code like Clf("r{A5}"); or prepare PNG file and set it as background image by call LoadBackground("fname.png");. +

+
+
How I can reduce "white" edges around bounding box?
+

The simplest way is to use subplot style. However, you should be careful if you plan to add colorbar or rotate plot – part of plot can be invisible if you will use non-default subplot style. +

+
+
Can I combine bitmap and vector output in EPS?
+

Yes. Sometimes you may have huge surface and a small set of curves and/or text on the plot. You can use function rasterize just after making surface plot. This will put all plot to bitmap background. At this later plotting will be in vector format. For example, you can do something like following: +

gr->Surf(x, y, z);
+gr->Rasterize(); // make surface as bitmap
+gr->Axis();
+gr->WriteFrame("fname.eps");
+
+
+
Why I couldn’t use name ‘I’ for variable?
+

MathGL support C99 standard, where ‘I’ is reserved for imaginary unit. If you still need this name, then just use +

#undef I
+

after including MathGL header files. +

+
+
How I can create MPEG video from plots?
+

You can save each frame into JPEG with names like ‘frame0001.jpg’, ‘frame0002.jpg’, ... Later you can use ImageMagic to convert them into MPEG video by command convert frame*.jpg movie.mpg. See also MPEG. +

+
+
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 General concepts

+ + +

The set of MathGL features is rather rich – just the number of basic graphics types +is larger than 50. Also there are functions for data handling, plot setup and so on. In spite of it I tried to keep a similar style in function names and in the order of arguments. Mostly it is +used for different drawing functions. +

+

There are six most general (base) concepts: +

    +
  1. Any picture is created in memory first. The internal (memory) representation can be different: bitmap picture (for SetQuality(MGL_DRAW_LMEM) or quality 6) or the list of vector primitives (default). After that the user may decide what he/she want: save to file, display on the screen, run animation, do additional editing and so on. This approach assures a high portability of the program – the source code will produce exactly the same picture in any OS. Another big positive consequence is the ability to create the picture in the console program (using command line, without creating a window)! +
  2. Every plot settings (style of lines, font, color scheme) are specified by a string. It provides convenience for user/programmer – short string with parameters is more comprehensible than a large set of parameters. Also it provides portability – the strings are the same in any OS so that it is not necessary to think about argument types. +
  3. All functions have “simplified” and “advanced” forms. It is done for user’s convenience. One needs to specify only one data array in the “simplified” form in order to see the result. But one may set parametric dependence of coordinates and produce rather complex curves and surfaces in the “advanced” form. In both cases the order of function arguments is the same: first data arrays, second the string with style, and later string with options for additional plot tuning. +
  4. All data arrays for plotting are encapsulated in mglData(A) class. This reduces the number of errors while working with memory and provides a uniform interface for data of different types (mreal, double and so on) or for formula plotting. +
  5. All plots are vector plots. The MathGL library is intended for handling scientific data which have vector nature (lines, faces, matrices and so on). As a result, vector representation is used in all cases! In addition, the vector representation allows one to scale the plot easily – change the canvas size by a factor of 2, and the picture will be proportionally scaled. +
  6. New drawing never clears things drawn already. This, in some sense, unexpected, idea allows to create a lot of “combined” graphics. For example, to make a surface with contour lines one needs to call the function for surface plotting and the function for contour lines plotting (in any order). Thus the special functions for making this “combined” plots (as it is done in Matlab and some other plotting systems) are superfluous. +
+ +

In addition to the general concepts I want to comment on some non-trivial or less commonly used general ideas – plot positioning, axis specification and curvilinear coordinates, styles for lines, text and color scheme. +

+ + + + + + + + + + + + +
+ + + +

3.1 Coordinate axes

+ + +

Two axis representations are used in MathGL. The first one consists of normalizing coordinates of data points in axis range (see Axis settings). If SetCut() is true then the outlier points are omitted, otherwise they are projected to the bounding box (see Cutting). Also, the point will be omitted if it lies inside the box defined by SetCutBox() or if the value of formula CutOff() is nonzero for its coordinates. After that, transformation formulas defined by SetFunc() or SetCoor() are applied to the data point (see Curved coordinates). Finally, the data point is plotted by one of the functions. +

+

The range of x, y, z-axis can be specified by SetRange() or ranges functions. Its origin is specified by origin function. At this you can you can use NAN values for selecting axis origin automatically. +

+

There is 4-th axis c (color axis or colorbar) in addition to the usual axes x, y, z. It sets the range of values for the surface coloring. Its borders are automatically set to values of z-range during the call of ranges function. Also, one can directly set it by call SetRange('c', ...). Use colorbar function for drawing the colorbar. +

+

The form (appearence) of tick labels is controlled by SetTicks() function (see Ticks). Function SetTuneTicks switches on/off tick enhancing by factoring out acommon multiplier (for small coordinate values, like 0.001 to 0.002, or large, like from 1000 to 2000) or common component (for narrow range, like from 0.999 to 1.000). Finally, you may use functions SetTickTempl() for setting templates for tick labels (it supports TeX symbols). Also, there is a possibility to print arbitrary text as tick labels the by help of SetTicksVal() function. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.2 Color styles

+ + +

Base colors are defined by one of symbol ‘wkrgbcymhRGBCYMHWlenupqLENUPQ’. +

The color types are: ‘k’ – black, ‘r’ – red, ‘R’ – dark red, ‘g’ – green, ‘G’ – dark green, ‘b’ – blue, ‘B’ – dark blue, ‘c’ – cyan, ‘C’ – dark cyan, ‘m’ – magenta, ‘M’ – dark magenta, ‘y’ – yellow, ‘Y’ – dark yellow (gold), ‘h’ – gray, ‘H’ – dark gray, ‘w’ – white, ‘W’ – bright gray, ‘l’ – green-blue, ‘L’ – dark green-blue, ‘e’ – green-yellow, ‘E’ – dark green-yellow, ‘n’ – sky-blue, ‘N’ – dark sky-blue, ‘u’ – blue-violet, ‘U’ – dark blue-violet, ‘p’ – purple, ‘P’ – dark purple, ‘q’ – orange, ‘Q’ – dark orange (brown).

+

+

You can also use “bright” colors. The “bright” color contain 2 symbols in brackets ‘{cN}’: first one is the usual symbol for color id, the second one is a digit for its brightness. The digit can be in range ‘1’...‘9’. Number ‘5’ corresponds to a normal color, ‘1’ is a very dark version of the color (practically black), and ‘9’ is a very bright version of the color (practically white). For example, the colors can be ‘{b2}’ ‘{b7}’ ‘{r7}’ and so on. +

+

Finally, you can specify RGB or RGBA values of a color using format ‘{xRRGGBB}’ or ‘{xRRGGBBAA}’ correspondingly. For example, ‘{xFF9966}’ give you +melone color. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.3 Line styles

+ + + + + + +

The line style is defined by the string which may contain specifications for color (‘wkrgbcymhRGBCYMHWlenupqLENUPQ’), dashing style (‘-|;:ji=’ or space), width (‘123456789’) and marks (‘*o+xsd.^v<>’ and ‘#’ modifier). If one of the type of information is omitted then default values used with next color from palette (see Palette and colors). Note, that internal color counter will be nullified by any change of palette. This includes even hidden change (for example, by box or axis functions). +By default palette contain following colors: dark grayH’, blueb’, greeng’, redr’, cyanc’, magentam’, yellowy’, grayh’, green-bluel’, sky-bluen’, orangeq’, green-yellowe’, blue-violetu’, purplep’. + +

Dashing style has the following meaning: space – no line (usable for plotting only marks), ‘-’ – solid line (■■■■■■■■■■■■■■■■), ‘|’ – long dashed line (■■■■■■■■□□□□□□□□), ‘;’ – dashed line (■■■■□□□□■■■■□□□□), ‘=’ – small dashed line (■■□□■■□□■■□□■■□□), ‘:’ – dotted line (■□□□■□□□■□□□■□□□), ‘j’ – dash-dotted line (■■■■■■■□□□□■□□□□), ‘i’ – small dash-dotted line (■■■□□■□□■■■□□■□□), ‘{dNNNN}’ – manual mask style (for v.2.3 and later, like ‘{df090}’ for (■■■■□□□□■□□■□□□□)).

+

+

Marker types are: ‘o’ – circle, ‘+’ – cross, ‘x’ – skew cross, ‘s’ – square, ‘d’ – rhomb (or diamond), ‘.’ – dot (point), ‘^’ – triangle up, ‘v’ – triangle down, ‘<’ – triangle left, ‘>’ – triangle right, ‘#*’ – Y sign, ‘#+’ – squared cross, ‘#x’ – squared skew cross, ‘#.’ – circled dot. If string contain symbol ‘#’ then the solid versions of markers are used. +

+

You can provide user-defined symbols (see addsymbol) to draw it as marker by using ‘&’ style. In particular, ‘&*’, ‘&o’, ‘&+’, ‘&x’, ‘&s’, ‘&d’, ‘&.’, ‘&^’, ‘&v’, ‘&<’, ‘&>’ will draw user-defined symbol ‘*o+xsd.^v<>’ correspondingly; and +‘&#o’, ‘&#+’, ‘&#x’, ‘&#s’, ‘&#d’, ‘&#.’, ‘&#^’, ‘&#v’, ‘&#<’, ‘&#>’ will draw user-defined symbols ‘YOPXSDCTVLR’ correspondingly. Note, that wired version of user-defined symbols will be drawn if you set negative marker size (see marksize or size in Command options). +

+

One may specify to draw a special symbol (an arrow) at the beginning and at the end of line. This is done if the specification string contains one of the following symbols: ‘A’ – outer arrow, ‘V’ – inner arrow, ‘I’ – transverse hatches, ‘K’ – arrow with hatches, ‘T’ – triangle, ‘S’ – square, ‘D’ – rhombus, ‘O’ – circle, ‘X’ – skew cross, ‘_’ – nothing (the default). The following rule applies: the first symbol specifies the arrow at the end of line, the second specifies the arrow at the beginning of the line. For example, ‘r-A’ defines a red solid line with usual arrow at the end, ‘b|AI’ defines a blue dash line with an arrow at the end and with hatches at the beginning, ‘_O’ defines a line with the current style and with a circle at the beginning. These styles are applicable during the graphics plotting as well (for example, 1D plotting). +

+
Color and line styles. +
+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.4 Color scheme

+ + + + +

The color scheme is used for determining the color of surfaces, isolines, isosurfaces and so on. The color scheme is defined by the string, which may contain several characters that are color id (see Line styles) or characters ‘#:|’. Symbol ‘#’ switches to mesh drawing or to a wire plot. Symbol ‘|’ disables color interpolation in color scheme, which can be useful, for example, for sharp colors during matrix plotting. Symbol ‘:’ terminate the color scheme parsing. Following it, the user may put styles for the text, rotation axis for curves/isocontours, and so on. Color scheme may contain up to 32 color values. +

+

The final color is a linear interpolation of color array. The color array is constructed from the string ids (including “bright” colors, see Color styles). The argument is the amplitude normalized in color range (see Axis settings). For example, string containing 4 characters ‘bcyr’ corresponds to a colorbar from blue (lowest value) through cyan (next value) through yellow (next value) to the red (highest value). String ‘kw’ corresponds to a colorbar from black (lowest value) to white (highest value). String ‘m’ corresponds to a simple magenta color. +

+

The special 2-axis color scheme (like in map plot) can be used if it contain symbol ‘%’. In this case the second direction (alpha channel) is used as second coordinate for colors. At this, up to 4 colors can be specified for corners: {c1,a1}, {c2,a1}, {c1,a2}, {c2,a2}. Here color and alpha ranges are {c1,c2} and {a1,a2} correspondingly. If one specify less than 4 colors then black color is used for corner {c1,a1}. If only 2 colors are specified then the color of their sum is used for corner {c2,a2}. +

+

There are several useful combinations. String ‘kw’ corresponds to the simplest gray color scheme where higher values are brighter. String ‘wk’ presents the inverse gray color scheme where higher value is darker. Strings ‘kRryw’, ‘kGgw’, ‘kBbcw’ present the well-known hot, summer and winter color schemes. Strings ‘BbwrR’ and ‘bBkRr’ allow to view bi-color figure on white or black background, where negative values are blue and positive values are red. String ‘BbcyrR’ gives a color scheme similar to the well-known jet color scheme. +

+

For more precise coloring, you can change default (equidistant) position of colors in color scheme. The format is ‘{CN,pos}’, ‘{CN,pos}’ or ‘{xRRGGBB,pos}’. The position value pos should be in range [0, 1]. Note, that alternative method for fine tuning of the color scheme is using the formula for coloring (see Curved coordinates). +

+
Most popular color schemes. +
+

When coloring by coordinate (used in map), the final color is determined by the position of the point in 3d space and is calculated from formula c=x*c[1] + y*c[2]. Here, c[1], c[2] are the first two elements of color array; x, y are normalized to axis range coordinates of the point. +

+

Additionally, MathGL can apply mask to face filling at bitmap rendering. The kind of mask is specified by one of symbols ‘-+=;oOsS~<>jdD*^’ in color scheme. Mask can be rotated by arbitrary angle by command mask or by three predefined values +45, -45 and 90 degree by symbols ‘\/I’ correspondingly. Examples of predefined masks are shown on the figure below. +

+
Example of masks for face coloring. +
+

However, you can redefine mask for one symbol by specifying new matrix of size 8*8 as second argument for mask command. For example, the right-down subplot on the figure above is produced by code
+gr->SetMask('+', "ff00182424f800"); gr->Dens(a,"3+");
+or just use manual mask style (for v.2.3 and later)
+gr->Dens(a,"3{s00ff00182424f800}"); +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.5 Font styles

+ + + + +

Text style is specified by the string which may contain: color id characters ‘wkrgbcymhRGBCYMHW’ (see Color styles), and font style (‘ribwou’) and/or alignment (‘LRC’) specifications. At this, font style and alignment begin after the separator ‘:’. For example, ‘r:iCb’ sets the bold (‘b’) italic (‘i’) font text aligned at the center (‘C’) and with red color (‘r’). Starting from MathGL v.2.3, you can set not single color for whole text, but use color gradient for printed text (see Color scheme). +

+

The font styles are: ‘r’ – roman (or regular) font, ‘i’ – italic style, ‘b’ – bold style. By default roman roman font is used. The align types are: ‘L’ – align left (default), ‘C’ – align center, ‘R’ – align right, ‘T’ – align under, ‘V’ – align center vertical. Additional font effects are: ‘w’ – wired, ‘o’ – over-lined, ‘u’ – underlined. +

+

Also a parsing of the LaTeX-like syntax is provided. There are commands for the font style changing inside the string (for example, use \b for bold font): \a or \overline – over-lined, \b or \textbf – bold, \i or \textit – italic, \r or \textrm – roman (disable bold and italic attributes), \u or \underline – underlined, \w or \wire – wired, \big – bigger size, @ – smaller size. The lower and upper indexes are specified by ‘_’ and ‘^’ symbols. At this the changed font style is applied only on next symbol or symbols in braces {}. The text in braces {} are treated as single symbol that allow one to print the index of index. For example, compare the strings ‘sin (x^{2^3})’ and ‘sin (x^2^3)’. You may also change text color inside string by command #? or by \color? where ‘?’ is symbolic id of the color (see Color styles). For example, words ‘blue’ and ‘red’ will be colored in the string ‘#b{blue} and \colorr{red} text’. The most of functions understand the newline symbol ‘\n’ and allows to print multi-line text. Finally, you can use arbitrary (if it was defined in font-face) UTF codes by command \utf0x????. For example, \utf0x3b1 will produce + α symbol. +

+

The most of commands for special TeX or AMSTeX symbols, the commands for font style changing (\textrm, \textbf, \textit, \textsc, \overline, \underline), accents (\hat, \tilde, \dot, \ddot, \acute, \check, \grave, \bar, \breve) and roots (\sqrt, \sqrt3, \sqrt4) are recognized. The full list contain approximately 2000 commands. Note that first space symbol after the command is ignored, but second one is printed as normal symbol (space). For example, the following strings produce the same result \tilde a: ‘\tilde{a}’; ‘\tilde a’; ‘\tilde{}a’. +

+In particular, the Greek letters are recognizable special symbols: α – \alpha, β – \beta, γ – \gamma, δ – \delta, ε – \epsilon, η – \eta, ι – \iota, χ – \chi, κ – \kappa, λ – \lambda, μ – \mu, ν – \nu, o – \o, ω – \omega, ϕ – \phi, π – \pi, ψ – \psi, ρ – \rho, σ – \sigma, θ – \theta, τ – \tau, υ – \upsilon, ξ – \xi, ζ – \zeta, ς – \varsigma, ɛ – \varepsilon, ϑ – \vartheta, φ – \varphi, ϰ – \varkappa; A – \Alpha, B – \Beta, Γ – \Gamma, Δ – \Delta, E – \Epsilon, H – \Eta, I – \Iota, C – \Chi, K – \Kappa, Λ – \Lambda, M – \Mu, N – \Nu, O – \O, Ω – \Omega, Φ – \Phi, Π – \Pi, Ψ – \Psi, R – \Rho, Σ – \Sigma, Θ – \Theta, T – \Tau, Υ – \Upsilon, Ξ – \Xi, Z – \Zeta. + +

The small part of most common special TeX symbols are: ∠ – \angle, ⋅ – \cdot, ♣ – \clubsuit, ✓ – \checkmark, ∪ – \cup, ∩ – \cap, ♢ – \diamondsuit, ◇ – \diamond, ÷ + – \div, +↓ – \downarrow, † – \dag, ‡ – \ddag, ≡ – \equiv, ∃ – \exists, ⌢ – \frown, ♭ – \flat, ≥ – \ge, ≥ – \geq, ≧ – \geqq, ← – \gets, ♡ – \heartsuit, ∞ – \infty, ∫ – \int, \Int, ℑ – \Im, ♢ – \lozenge, ⟨ – \langle, ≤ – \le, ≤ – \leq, ≦ – \leqq, ← – \leftarrow, ∓ – \mp, ∇ – \nabla, ≠ – \ne, ≠ – \neq, ♮ – \natural, ∮ – \oint, ⊙ – \odot, ⊕ – \oplus, ∂ – \partial, ∥ – \parallel, ⊥ –\perp, ± – \pm, ∝ – \propto, ∏ – \prod, ℜ – \Re, → – \rightarrow, ⟩ – \rangle, ♠ – \spadesuit, ~ – \sim, ⌣ – \smile, ⊂ – \subset, ⊃ – \supset, √ – \sqrt or \surd, § – \S, ♯ – \sharp, ∑ – \sum, × – \times, → – \to, ∴ – \therefore, ↑ – \uparrow, ℘ – \wp.

+ +

The font size can be defined explicitly (if size>0) or relatively to a base font size as |size|*FontSize (if size<0). The value size=0 specifies that the string will not be printed. The base font size is measured in internal “MathGL” units. Special functions SetFontSizePT(), SetFontSizeCM(), SetFontSizeIN() (see Font settings) allow one to set it in more “common” variables for a given dpi value of the picture. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.6 Textual formulas

+ + + + +

MathGL have the fast variant of textual formula evaluation +(see Evaluate expression) +. There are a lot of functions and operators available. The operators are: ‘+’ – addition, ‘-’ – subtraction, ‘*’ – multiplication, ‘/’ – division, ‘%’ – modulo, ‘^’ – integer power. Also there are logical “operators”: ‘<’ – true if x<y, ‘>’ – true if x>y, ‘=’ – true if x=y, ‘&’ – true if x and y both nonzero, ‘|’ – true if x or y nonzero. These logical operators have lowest priority and return 1 if true or 0 if false. +

+

The basic functions are: ‘sqrt(x)’ – square root of x, ‘pow(x,y)’ – power x in y, ‘ln(x)’ – natural logarithm of x, ‘lg(x)’ – decimal logarithm of x, ‘log(a,x)’ – logarithm base a of x, ‘abs(x)’ – absolute value of x, ‘sign(x)’ – sign of x, ‘mod(x,y)’ – x modulo y, ‘step(x)’ – step function, ‘int(x)’ – integer part of x, ‘rnd’ – random number, ‘random(x)’ – random data of size as in x, ‘hypot(x,y)’=sqrt(x^2+y^2) – hypotenuse, ‘cmplx(x,y)’=x+i*y – complex number, ‘pi’ – number +π = 3.1415926…, inf=∞ +

+

Functions for complex numbers ‘real(x)’, ‘imag(x)’, ‘abs(x)’, ‘arg(x)’, ‘conj(x)’. +

+

Trigonometric functions are: ‘sin(x)’, ‘cos(x)’, ‘tan(x)’ (or ‘tg(x)’). Inverse trigonometric functions are: ‘asin(x)’, ‘acos(x)’, ‘atan(x)’. Hyperbolic functions are: ‘sinh(x)’ (or ‘sh(x)’), ‘cosh(x)’ (or ‘ch(x)’), ‘tanh(x)’ (or ‘th(x)’). Inverse hyperbolic functions are: ‘asinh(x)’, ‘acosh(x)’, ‘atanh(x)’. +

+

There are a set of special functions: ‘gamma(x)’ – Gamma function Γ(x) = ∫0 tx-1 exp(-t) dt, ‘gamma_inc(x,y)’ – incomplete Gamma function Γ(x,y) = ∫y tx-1 exp(-t) dt, ‘psi(x)’ – digamma function ψ(x) = Γ′(x)/Γ(x) for x≠0, ‘ai(x)’ – Airy function Ai(x), ‘bi(x)’ – Airy function Bi(x), ‘cl(x)’ – Clausen function, ‘li2(x)’ (or ‘dilog(x)’) – dilogarithm Li2(x) = -ℜ∫0xds log(1-s)/s, ‘sinc(x)’ – compute sinc(x) = sin(πx)/(πx) for any value of x, ‘zeta(x)’ – Riemann zeta function ζ(s) = ∑k=1k-s for arbitrary s≠1, ‘eta(x)’ – eta function η(s) = (1 - 21-s)ζ(s) for arbitrary s, ‘lp(l,x)’ – Legendre polynomial Pl(x), (|x|≤1, l≥0), ‘w0(x)’ – principal branch of the Lambert W function, ‘w1(x)’ – principal branch of the Lambert W function. Function W(x) is defined to be solution of the equation: W exp(W) = x.

+ +

The exponent integrals are: ‘ci(x)’ – Cosine integral Ci(x) = ∫0xdt cos(t)/t, ‘si(x)’ – Sine integral Si(x) = ∫0xdt sin(t)/t, ‘erf(x)’ – error function erf(x) = (2/√π) ∫0xdt exp(-t2) , ‘ei(x)’ – exponential integral Ei(x) = -PV(∫-xdt exp(-t)/t) (where PV denotes the principal value of the integral), ‘e1(x)’ – exponential integral E1(x) = ℜ∫1dt exp(-xt)/t, ‘e2(x)’ – exponential integral E2(x) = ℜ∫1∞dt exp(-xt)/t2, ‘ei3(x)’ – exponential integral Ei3(x) = ∫0xdt exp(-t3) for x≥0.

+ +

Bessel functions are: ‘j(nu,x)’ – regular cylindrical Bessel function of fractional order nu, ‘y(nu,x)’ – irregular cylindrical Bessel function of fractional order nu, ‘i(nu,x)’ – regular modified Bessel function of fractional order nu, ‘k(nu,x)’ – irregular modified Bessel function of fractional order nu.

+ +

Elliptic integrals are: ‘ee(k)’ – complete elliptic integral is denoted by E(k) = E(π/2,k), ‘ek(k)’ – complete elliptic integral is denoted by K(k) = F(π/2,k), ‘e(phi,k)’ – elliptic integral E(φ,k) = ∫0φdt √(1 - k2sin2(t)), ‘f(phi,k)’ – elliptic integral F(φ,k) = ∫0φdt 1/√(1 - k2sin2(t))

+ +

Jacobi elliptic functions are: ‘sn(u,m)’, ‘cn(u,m)’, ‘dn(u,m)’, ‘sc(u,m)’, ‘sd(u,m)’, ‘ns(u,m)’, ‘cs(u,m)’, ‘cd(u,m)’, ‘nc(u,m)’, ‘ds(u,m)’, ‘dc(u,m)’, ‘nd(u,m)’. +

+

Note, some of these functions are unavailable if MathGL was compiled without GSL support. +

+

There is no difference between lower or upper case in formulas. If argument value lie outside the range of function definition then function returns NaN. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.7 Command options

+ + +

Command options allow the easy setup of the selected plot by changing global settings only for this plot. Each option start from symbol ‘;’. Options work so that MathGL remember the current settings, change settings as it being set in the option, execute function and return the original settings back. So, the options are most usable for plotting functions. +

+

The most useful options are xrange, yrange, zrange. They sets the boundaries for data change. This boundaries are used for automatically filled variables. So, these options allow one to change the position of some plots. For example, in command Plot(y,"","xrange 0.1 0.9"); or plot y; xrange 0.1 0.9 the x coordinate will be equidistantly distributed in range 0.1 ... 0.9. See Using options, for sample code and picture. +

+

The full list of options are: + + +

+
MGL option: alpha val
+

Sets alpha value (transparency) of the plot. The value should be in range [0, 1]. See also alphadef. +

+ + +
+
MGL option: xrange val1 val2
+

Sets boundaries of x coordinate change for the plot. See also xrange. +

+ +
+
MGL option: yrange val1 val2
+

Sets boundaries of y coordinate change for the plot. See also yrange. +

+ +
+
MGL option: zrange val1 val2
+

Sets boundaries of z coordinate change for the plot. See also zrange. +

+ + +
+
MGL option: cut val
+

Sets whether to cut or to project the plot points lying outside the bounding box. See also cut. +

+ +
+
MGL option: size val
+

Sets the size of text, marks and arrows. See also font, marksize, arrowsize. +

+ +
+
MGL option: meshnum val
+

Work like meshnum command. +

+ + +
+
MGL option: legend 'txt'
+

Adds string ’txt’ to internal legend accumulator. The style of described line and mark is taken from arguments of the last 1D plotting command. See also legend. +

+ +
+
MGL option: value val
+

Set the value to be used as additional numeric parameter in plotting command. +

+ + + + +
+ +
+

+Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.8 Interfaces

+ + + + +

The MathGL library has interfaces for a set of languages. Most of them are based on the C interface via SWIG tool. There are Python, Java, Octave, Lisp, C#, Guile, Lua, Modula 3, Ocaml, Perl, PHP, Pike, R, Ruby, and Tcl interfaces. Also there is a Fortran interface which has a similar set of functions, but slightly different types of arguments (integers instead of pointers). These functions are marked as [C function]. +

+

Some of the languages listed above support classes (like C++ or Python). The name of functions for them is the same as in C++ (see MathGL core and Data processing) and marked like [Method on mglGraph]. +

+

Finally, a special command language MGL (see MGL scripts) was written for a faster access to plotting functions. Corresponding scripts can be executed separately (by UDAV, mglconv, mglview and so on) or from the C/C++/Python/... code (see mglParse class). +

+ + + + + + +
+ +
+

+Next: , Up: Interfaces   [Contents][Index]

+
+ +

3.8.1 C/Fortran interface

+ + +

The C interface is a base for many other interfaces. It contains the pure C functions for most of the methods of MathGL classes. In distinction to C++ classes, C functions must have an argument HMGL (for graphics) and/or HMDT (for data arrays), which specifies the object for drawing or manipulating (changing). So, firstly, the user has to create this object by the function mgl_create_*() and has to delete it after the use by function mgl_delete_*(). +

+

All C functions are described in the header file #include <mgl2/mgl_cf.h> and use variables of the following types: +

    +
  • HMGL — Pointer to class mglGraph (see MathGL core). +
  • HCDT — Pointer to class const mglDataA (see Data processing) — constant data array. +
  • HMDT — Pointer to class mglData (see Data processing) — data array of real numbers. +
  • HADT — Pointer to class mglDataC (see Data processing) — data array of complex numbers. +
  • HMPR — Pointer to class mglParse (see mglParse class) — MGL script parsing. +
  • HMEX — Pointer to class mglExpr (see Evaluate expression) — textual formulas for real numbers. +
  • HMAX — Pointer to class mglExprC (see Evaluate expression) — textual formulas for complex numbers. +
+

These variables contain identifiers for graphics drawing objects and for the data objects. +

+

Fortran functions/subroutines have the same names as C functions. However, there is a difference. Variable of type HMGL, HMDT must be an integer with sufficient size (integer*4 in the 32-bit operating system or integer*8 in the 64-bit operating system). All C functions of type void are subroutines in Fortran, which are called by operator call. The exceptions are functions, which return variables of types HMGL or HMDT. These functions should be declared as integer in Fortran code. Also, one should keep in mind that strings in Fortran are denoted by ' symbol, not the " symbol. +

+ +
+ +
+

+Previous: , Up: Interfaces   [Contents][Index]

+
+ +

3.8.2 C++/Python interface

+ + +

MathGL provides the interface to a set of languages via SWIG library. Some of these languages support classes. The typical example is Python – which is named in this chapter’s title. Exactly the same classes are used for high-level C++ API. Its feature is using only inline member-functions what make high-level API to be independent on compiler even for binary build. +

+

There are 3 main classes in: +

    +
  • mglGraph +– provide most plotting functions (see MathGL core). +
  • mglData +– provide base data processing (see Data processing). It have an additional feature to access data values. You can use a construct like this: dat[i]=sth; or sth=dat[i] where flat representation of data is used (i.e., i can be in range 0...nx*nx*nz-1). You can also import NumPy arrays as input arguments in Python: mgl_dat = mglData(numpy_dat);. +
  • mglParse +– provide functions for parsing MGL scripts (see MGL scripts). +
+ + +

To use Python classes just execute ‘import mathgl’. The simplest example will be: +

import mathgl
+a=mathgl.mglGraph()
+a.Box()
+a.WritePNG("test.png")
+

Alternatively you can import all classes from mathgl module and easily access MathGL classes like this: +

from mathgl import *
+a=mglGraph()
+a.Box()
+a.WritePNG("test.png")
+

This becomes useful if you create many mglData objects, for example. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

4 MathGL core

+ + + + +

The core of MathGL is mglGraph class defined in #include <mgl2/mgl.h>. It contains a lot of plotting functions for 1D, 2D and 3D data. It also encapsulates parameters for axes drawing. Moreover an arbitrary coordinate transformation can be used for each axis. All plotting functions use data encapsulated in mglData class (see Data processing) that allows to check sizes of used arrays easily. Also it have many functions for data handling: modify it by formulas, find momentums and distribution (histogram), apply operator (differentiate, integrate, transpose, Fourier and so on), change data sizes (interpolate, squeeze, crop and so on). Additional information about colors, fonts, formula parsing can be found in General concepts and Other classes. +

+

Some of MathGL features will appear only in novel versions. To test used MathGL version you can use following function. +

+
MGL command: version 'ver'
+
Method on mglGraph: bool CheckVersion (const char *ver) static
+
C function: int mgl_check_version (const char *ver)
+

Return zero if MathGL version is appropriate for required by ver, i.e. if major version is the same and minor version is greater or equal to one in ver. +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: MathGL core   [Contents][Index]

+
+ +

4.1 Create and delete objects

+ + +
+
Constructor on mglGraph: mglGraph (int kind=0, int width=600, int height=400)
+
Constructor on mglGraph: mglGraph (const mglGraph &gr)
+
Constructor on mglGraph: mglGraph (HMGL gr)
+
C function: HMGL mgl_create_graph (int width, int height)
+
C function: HMGL mgl_create_graph_gl ()
+

Creates the instance of class mglGraph with specified sizes width and height. Parameter kind may have following values: ‘0’ – use default plotter, ‘1’ – use OpenGL plotter. +

+ +
+
Destructor on mglGraph: ~mglGraph ()
+
C function: HMGL mgl_delete_graph (HMGL gr)
+

Deletes the instance of class mglGraph. +

+ +
+
Method on mglGraph: HMGL Self ()
+

Returns the pointer to internal object of type HMGL. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.2 Graphics setup

+ + + +

Functions and variables in this group influences on overall graphics appearance. So all of them should be placed before any actual plotting function calls. +

+
+
MGL command: reset
+
Method on mglGraph: void DefaultPlotParam ()
+
C function: void mgl_set_def_param (HMGL gr)
+

Restore initial values for all of parameters and clear the image. +

+ +
+
MGL command: setup val flag
+
Method on mglGraph: void SetFlagAdv (int val, uint32_t flag)
+
C function: void mgl_set_flag (HMGL gr, int val, uint32_t flag)
+

Sets the value of internal binary flag to val. The list of flags can be found at define.h. The current list of flags are: +

#define MGL_ENABLE_CUT		0x00000004 	///< Flag which determines how points outside bounding box are drown.
+#define MGL_ENABLE_RTEXT 	0x00000008 	///< Use text rotation along axis
+#define MGL_AUTO_FACTOR		0x00000010 	///< Enable autochange PlotFactor
+#define MGL_ENABLE_ALPHA 	0x00000020 	///< Flag that Alpha is used
+#define MGL_ENABLE_LIGHT 	0x00000040 	///< Flag of using lightning
+#define MGL_TICKS_ROTATE 	0x00000080 	///< Allow ticks rotation
+#define MGL_TICKS_SKIP		0x00000100 	///< Allow ticks rotation
+#define MGL_DISABLE_SCALE	0x00000200 	///< Temporary flag for disable scaling (used for axis)
+#define MGL_FINISHED 		0x00000400 	///< Flag that final picture (i.e. mglCanvas::G) is ready
+#define MGL_USE_GMTIME		0x00000800 	///< Use gmtime instead of localtime
+#define MGL_SHOW_POS		0x00001000 	///< Switch to show or not mouse click position
+#define MGL_CLF_ON_UPD		0x00002000 	///< Clear plot before Update()
+#define MGL_NOSUBTICKS		0x00004000 	///< Disable subticks drawing (for bounding box)
+#define MGL_LOCAL_LIGHT		0x00008000 	///< Keep light sources for each inplot
+#define MGL_VECT_FRAME		0x00010000 	///< Use DrwDat to remember all data of frames
+#define MGL_REDUCEACC		0x00020000 	///< Reduce accuracy of points (to reduce size of output files)
+#define MGL_PREFERVC 		0x00040000 	///< Prefer vertex color instead of texture if output format supports
+#define MGL_ONESIDED 		0x00080000 	///< Render only front side of surfaces if output format supports (for debugging)
+#define MGL_NO_ORIGIN 		0x00100000 	///< Don't draw tick labels at axis origin
+#define MGL_GRAY_MODE 		0x00200000 	///< Convert all colors to gray ones
+#define MGL_FULL_CURV 		0x00400000 	///< Disable omitting points in straight-line part(s)
+#define MGL_NO_SCALE_REL 	0x00800000 	///< Disable font scaling in relative inplots
+
+ +
+
C function: void mgl_bsize (unsigned bsize)
+

Set buffer size for number of primitives as (1<<bsize)^2. I.e. as 10^12 for bsize=20 or 4*10^9 for bsize=16 (default). NOTE: you set it only once before any plotting. The current value is returned. +

+ + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.1 Transparency

+ + + + + + + +

There are several functions and variables for setup transparency. The general function is alpha which switch on/off the transparency for overall plot. It influence only for graphics which created after alpha call (with one exception, OpenGL). Function alphadef specify the default value of alpha-channel. Finally, function transptype set the kind of transparency. See Transparency and lighting, for sample code and picture. +

+
+
MGL command: alpha [val=on]
+
Method on mglGraph: void Alpha (bool enable)
+
C function: void mgl_set_alpha (HMGL gr, int enable)
+

Sets the transparency on/off and returns previous value of transparency. It is recommended to call this function before any plotting command. Default value is transparency off. +

+ +
+
MGL command: alphadef val
+
Method on mglGraph: void SetAlphaDef (mreal val)
+
C function: void mgl_set_alpha_default (HMGL gr, mreal alpha)
+

Sets default value of alpha channel (transparency) for all plotting functions. Initial value is 0.5. +

+ +
+
MGL command: transptype val
+
Method on mglGraph: void SetTranspType (int type)
+
C function: void mgl_set_transp_type (HMGL gr, int type)
+

Set the type of transparency. Possible values are: +

    +
  • Normal transparency (‘0’) – below things is less visible than upper ones. It does not look well in OpenGL mode (mglGraphGL) for several surfaces. +
  • Glass-like transparency (‘1’) – below and upper things are commutable and just decrease intensity of light by RGB channel. +
  • Lamp-like transparency (‘2’) – below and upper things are commutable and are the source of some additional light. I recommend to set SetAlphaDef(0.3) or less for lamp-like transparency. +
+

See Types of transparency, for sample code and picture.. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.2 Lighting

+ + + + + + + +

There are several functions for setup lighting. The general function is light which switch on/off the lighting for overall plot. It influence only for graphics which created after light call (with one exception, OpenGL). Generally MathGL support up to 10 independent light sources. But in OpenGL mode only 8 of light sources is used due to OpenGL limitations. The position, color, brightness of each light source can be set separately. By default only one light source is active. It is source number 0 with white color, located at top of the plot. See Lighting sample, for sample code and picture. +

+
+
MGL command: light [val=on]
+
Method on mglGraph: bool Light (bool enable)
+
C function: void mgl_set_light (HMGL gr, int enable)
+

Sets the using of light on/off for overall plot. Function returns previous value of lighting. Default value is lightning off. +

+ +
+
MGL command: light num val
+
Method on mglGraph: void Light (int n, bool enable)
+
C function: void mgl_set_light_n (HMGL gr, int n, int enable)
+

Switch on/off n-th light source separately. +

+ +
+
MGL command: light num xdir ydir zdir ['col'='w' br=0.5]
+
MGL command: light num xdir ydir zdir xpos ypos zpos ['col'='w' br=0.5 ap=0]
+
Method on mglGraph: void AddLight (int n, mglPoint d, char c='w', mreal bright=0.5, mreal ap=0)
+
Method on mglGraph: void AddLight (int n, mglPoint r, mglPoint d, char c='w', mreal bright=0.5, mreal ap=0)
+
C function: void mgl_add_light (HMGL gr, int n, mreal dx, mreal dy, mreal dz)
+
C function: void mgl_add_light_ext (HMGL gr, int n, mreal dx, mreal dy, mreal dz, char c, mreal bright, mreal ap)
+
C function: void mgl_add_light_loc (HMGL gr, int n, mreal rx, mreal ry, mreal rz, mreal dx, mreal dy, mreal dz, char c, mreal bright, mreal ap)
+

The function adds a light source with identification n in direction d with color c and with brightness bright (which must be in range [0,1]). If position r is specified and isn’t NAN then light source is supposed to be local otherwise light source is supposed to be placed at infinity. +

+ +
+
MGL command: diffuse val
+
Method on mglGraph: void SetDiffuse (mreal bright)
+
C function: void mgl_set_difbr (HMGL gr, mreal bright)
+

Set brightness of diffusive light (only for local light sources). +

+ +
+
MGL command: ambient val
+
Method on mglGraph: void SetAmbient (mreal bright=0.5)
+
C function: void mgl_set_ambbr (HMGL gr, mreal bright)
+

Sets the brightness of ambient light. The value should be in range [0,1]. +

+ +
+
MGL command: attachlight val
+
Method on mglGraph: void AttachLight (bool val)
+
C function: void mgl_set_attach_light (HMGL gr, int val)
+

Set to attach light settings to inplot/subplot. Note, OpenGL and some output formats don’t support this feature. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.3 Fog

+ + + +
+
MGL command: fog val [dz=0.25]
+
Method on mglGraph: void Fog (mreal d, mreal dz=0.25)
+
C function: void mgl_set_fog (HMGL gr, mreal d, mreal dz)
+

Function imitate a fog in the plot. Fog start from relative distance dz from view point and its density growths exponentially in depth. So that the fog influence is determined by law ~ 1-exp(-d*z). Here z is normalized to 1 depth of the plot. If value d=0 then the fog is absent. Note, that fog was applied at stage of image creation, not at stage of drawing. See Adding fog, for sample code and picture. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.4 Default sizes

+ + + + + + + + + + + +

These variables control the default (initial) values for most graphics parameters including sizes of markers, arrows, line width and so on. As any other settings these ones will influence only on plots created after the settings change. +

+
+
MGL command: barwidth val
+
Method on mglGraph: void SetBarWidth ( mreal val)
+
C function: void mgl_set_bar_width (HMGL gr, mreal val)
+

Sets relative width of rectangles in bars, barh, boxplot, candle, ohlc. Default value is 0.7. +

+ +
+
MGL command: marksize val
+
Method on mglGraph: void SetMarkSize (mreal val)
+
C function: void mgl_set_mark_size (HMGL gr, mreal val)
+

Sets size of marks for 1D plotting. Default value is 1. +

+ +
+
MGL command: arrowsize val
+
Method on mglGraph: void SetArrowSize (mreal val)
+
C function: void mgl_set_arrow_size (HMGL gr, mreal val)
+

Sets size of arrows for 1D plotting, lines and curves (see Primitives). Default value is 1. +

+ +
+
MGL command: meshnum val
+
Method on mglGraph: void SetMeshNum (int val)
+
C function: void mgl_set_meshnum (HMGL gr, int num)
+

Sets approximate number of lines in mesh, fall, grid2, and also the number of hachures in vect, dew, and the number of cells in cloud, and the number of markers in plot, tens, step, mark, textmark. By default (=0) it draws all lines/hachures/cells/markers. +

+ +
+
MGL command: facenum val
+
Method on mglGraph: void SetFaceNum (int val)
+
C function: void mgl_set_facenum (HMGL gr, int num)
+

Sets approximate number of visible faces. Can be used for speeding up drawing by cost of lower quality. By default (=0) it draws all of them. +

+ +
+
MGL command: plotid 'id'
+
Method on mglGraph: void SetPlotId (const char *id)
+
C function: void mgl_set_plotid (HMGL gr, const char *id)
+

Sets default name id as filename for saving (in FLTK window for example). +

+ +
+
Method on mglGraph: const char * GetPlotId ()
+
C function only: const char * mgl_get_plotid (HMGL gr)
+
Fortran subroutine: mgl_get_plotid (long gr, char *out, int len)
+

Gets default name id as filename for saving (in FLTK window for example). +

+ +
+
MGL command: pendelta val
+
Method on mglGraph: void SetPenDelta (double val)
+
C function: void mgl_pen_delta (HMGL gr, double val)
+

Changes the blur around lines and text (default is 1). For val>1 the text and lines are more sharped. For val<1 the text and lines are more blurred. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.5 Cutting

+ + + + + + +

These variables and functions set the condition when the points are excluded (cutted) from the drawing. Note, that a point with NAN value(s) of coordinate or amplitude will be automatically excluded from the drawing. See Cutting sample, for sample code and picture. +

+
+
MGL command: cut val
+
Method on mglGraph: void SetCut (bool val)
+
C function: void mgl_set_cut (HMGL gr, int val)
+

Flag which determines how points outside bounding box are drawn. If it is true then points are excluded from plot (it is default) otherwise the points are projected to edges of bounding box. +

+ +
+
MGL command: cut x1 y1 z1 x2 y2 z2
+
Method on mglGraph: void SetCutBox (mglPoint p1, mglPoint p1)
+
C function: void mgl_set_cut_box (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2)
+

Lower and upper edge of the box in which never points are drawn. If both edges are the same (the variables are equal) then the cutting box is empty. +

+ +
+
MGL command: cut 'cond'
+
Method on mglGraph: void CutOff (const char *cond)
+
C function: void mgl_set_cutoff (HMGL gr, const char *cond)
+

Sets the cutting off condition by formula cond. This condition determine will point be plotted or not. If value of formula is nonzero then point is omitted, otherwise it plotted. Set argument as "" to disable cutting off condition. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.6 Font settings

+ + + + + + + + + + + + + +
+
MGL command: font 'fnt' [val=6]
+

Font style for text and labels (see text). Initial style is ’fnt’=’:rC’ give Roman font with centering. Parameter val sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels. For more detail, see Font styles. +

+ +
+
MGL command: rotatetext val
+
Method on mglGraph: void SetRotatedText (bool val)
+
C function: void mgl_set_rotated_text (HMGL gr, int val)
+

Sets to use or not text rotation. +

+ +
+
MGL command: scaletext val
+
Method on mglGraph: void SetScaleText (bool val)
+
C function: void mgl_set_scale_text (HMGL gr, int val)
+

Sets to scale text in relative inplot (including columnplot, gridplot, stickplot, shearplot) or not. +

+ +
+
MGL command: loadfont ['name'='']
+
Method on mglGraph: void LoadFont (const char *name, const char *path="")
+
C function: void mgl_load_font (HMGL gr, const char *name, const char *path)
+

Load font typeface from path/name. Empty name will load default font. +

+ +
+
Method on mglGraph: void SetFontDef (const char *fnt)
+
C function: void mgl_set_font_def (HMGL gr, const char * val)
+

Sets the font specification (see Text printing). Default is ‘rC’ – Roman font centering. +

+ +
+
Method on mglGraph: void SetFontSize (mreal val)
+
C function: void mgl_set_font_size (HMGL gr, mreal val)
+

Sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels. +

+ +
+
Method on mglGraph: void SetFontSizePT (mreal cm, int dpi=72)
+

Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72). +

+
+
Method on mglGraph: inline void SetFontSizeCM (mreal cm, int dpi=72)
+

Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt). +

+
+
Method on mglGraph: inline void SetFontSizeIN (mreal cm, int dpi=72)
+

Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt). +

+ +
+
Method on mglGraph: void CopyFont (mglGraph * from)
+
C function: void mgl_copy_font (HMGL gr, HMGL gr_from)
+

Copy font data from another mglGraph object. +

+ +
+
Method on mglGraph: void RestoreFont ()
+
C function: void mgl_restore_font (HMGL gr)
+

Restore font data to default typeface. +

+ +
+
Method on mglGraph: void SetDefFont (const char *name, const char *path="") static
+
C function: void mgl_def_font (const char *name, const char *path)
+

Load default font typeface (for all newly created HMGL/mglGraph objects) from path/name. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.7 Palette and colors

+ + + + +
+
MGL command: palette 'colors'
+
Method on mglGraph: void SetPalette (const char *colors)
+
C function: void mgl_set_palette (HMGL gr, const char *colors)
+

Sets the palette as selected colors. Default value is "Hbgrcmyhlnqeup" that corresponds to colors: dark gray ‘H’, blue ‘b’, green ‘g’, red ‘r’, cyan ‘c’, magenta ‘m’, yellow ‘y’, gray ‘h’, blue-green ‘l’, sky-blue ‘n’, orange ‘q’, yellow-green ‘e’, blue-violet ‘u’, purple ‘p’. The palette is used mostly in 1D plots (see 1D plotting) for curves which styles are not specified. Internal color counter will be nullified by any change of palette. This includes even hidden change (for example, by box or axis functions). +

+ +
+
Method on mglGraph: void SetDefScheme (const char *sch)
+
C function: void mgl_set_def_sch (HMGL gr, const char *sch)
+

Sets the sch as default color scheme. Default value is "BbcyrR". +

+ +
+
Method on mglGraph: void SetColor (char id, mreal r, mreal g, mreal b) static
+
C function: void mgl_set_color (char id, mreal r, mreal g, mreal b)
+

Sets RGB values for color with given id. This is global setting which influence on any later usage of symbol id. +

+ + +
+
MGL command: gray [val=on]
+
Method on mglGraph: void Gray (bool enable)
+
C function: void mgl_set_gray (HMGL gr, int enable)
+

Sets the gray-scale mode on/off. +

+ + +
+ + + +

4.2.8 Masks

+ + + + +
+
MGL command: mask 'id' 'hex' [angle]
+
Команда MGL: mask 'id' hex [angle]
+
Method on mglGraph: void SetMask (char id, const char *hex)
+
Method on mglGraph: void SetMask (char id, uint64_t hex)
+
C function: void mgl_set_mask (HMGL gr, const char *hex)
+
C function: void mgl_set_mask_val (HMGL gr, uint64_t hex)
+

Sets new bit matrix hex of size 8*8 for mask with given id. This is global setting which influence on any later usage of symbol id. The predefined masks are (see Color scheme): ‘-’ give lines (0x000000FF00000000), ‘+’ give cross-lines (080808FF08080808), ‘=’ give double lines (0000FF00FF000000), ‘;’ give dash lines (0x0000000F00000000), ‘o’ give circles (0000182424180000), ‘O’ give filled circles (0000183C3C180000), ‘s’ give squares (00003C24243C0000), ‘S’ give solid squares (00003C3C3C3C0000), ‘~’ give waves (0000060990600000), ‘<’ give left triangles (0060584658600000), ‘>’ give right triangles (00061A621A060000), ‘j’ give dash-dot lines (0000002700000000), ‘d’ give pluses (0x0008083E08080000), ‘D’ give tacks (0x0139010010931000), ‘*’ give dots (0x0000001818000000), ‘^’ give bricks (0x101010FF010101FF). Parameter angle set the rotation angle too. IMPORTANT: the rotation angle will be replaced by a multiple of 45 degrees at export to EPS. +

+ +
+
MGL command: mask angle
+
Method on mglGraph: void SetMaskAngle (int angle)
+
C function: void mgl_set_mask_angle (HMGL gr, int angle)
+

Sets the default rotation angle (in degrees) for masks. Note, you can use symbols ‘\’, ‘/’, ‘I’ in color scheme for setting rotation angles as 45, -45 and 90 degrees correspondingly. IMPORTANT: the rotation angle will be replaced by a multiple of 45 degrees at export to EPS. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.9 Error handling

+ + + + + +

Normally user should set it to zero by SetWarn(0); before plotting and check if GetWarn() or Message() return non zero after plotting. Only last warning will be saved. All warnings/errors produced by MathGL is not critical – the plot just will not be drawn. By default, all warnings are printed in stderr. You can disable it by using mgl_suppress_warn(true);. +

+
+
Method on mglGraph: void SetWarn (int code, const char *info="")
+
C function: void mgl_set_warn (HMGL gr, int code, const char *info)
+

Set warning code. Normally you should call this function only for clearing the warning state, i.e. call SetWarn(0);. Text info will be printed as is if code<0. +

+ +
+
Method on mglGraph: const char *Message ()
+
C function only: const char *mgl_get_mess (HMGL gr)
+
Fortran subroutine: mgl_get_mess (long gr, char *out, int len)
+

Return messages about matters why some plot are not drawn. If returned string is empty then there are no messages. +

+ +
+
Method on mglGraph: int GetWarn ()
+
C function: int mgl_get_warn (HMGL gr)
+

Return the numerical ID of warning about the not drawn plot. Possible values are: +

+
mglWarnNone=0
+

Everything OK +

+
mglWarnDim
+

Data dimension(s) is incompatible +

+
mglWarnLow
+

Data dimension(s) is too small +

+
mglWarnNeg
+

Minimal data value is negative +

+
mglWarnFile
+

No file or wrong data dimensions +

+
mglWarnMem
+

Not enough memory +

+
mglWarnZero
+

Data values are zero +

+
mglWarnLeg
+

No legend entries +

+
mglWarnSlc
+

Slice value is out of range +

+
mglWarnCnt
+

Number of contours is zero or negative +

+
mglWarnOpen
+

Couldn’t open file +

+
mglWarnLId
+

Light: ID is out of range +

+
mglWarnSize
+

Setsize: size(s) is zero or negative +

+
mglWarnFmt
+

Format is not supported for that build +

+
mglWarnTern
+

Axis ranges are incompatible +

+
mglWarnNull
+

Pointer is NULL +

+
mglWarnSpc
+

Not enough space for plot +

+
mglScrArg
+

Wrong argument(s) of a command in MGL script +

+
mglScrCmd
+

Wrong command in MGL script +

+
mglScrLong
+

Too long line in MGL script +

+
mglScrStr
+

Unbalanced ’ in MGL script +

+
mglScrTemp
+

Change temporary data in MGL script +

+
+
+ +
+
Method on mglGraph: void SuppressWarn (bool state) static
+
C function: void mgl_suppress_warn (int state)
+

Disable printing warnings to stderr if state is nonzero. +

+ +
+
Method on mglGraph: void SetGlobalWarn (const char *info) static
+
C function: void mgl_set_global_warn (const char *info)
+

Set warning message info for global scope. +

+ +
+
Method on mglGraph: const char * GlobalWarn () static
+
C function: const char * mgl_get_global_warn ()
+

Get warning message(s) for global scope. +

+ + + +
+ +
+

+Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.10 Stop drawing

+ + + + + +
+
Method on mglGraph: void Stop (bool stop=true)
+
C function only: void mgl_ask_stop (HMGL gr, int stop)
+

Ask to stop drawing if stop is non-zero, otherwise reset stop flag. +

+ +
+
Method on mglGraph: bool NeedStop ()
+
C function only: void mgl_need_stop (HMGL gr)
+

Return true if drawing should be terminated. Also it process all events in GUI. User should call this function from time to time inside a long calculation to allow processing events for GUI. +

+ +
+
Method on mglGraph: bool SetEventFunc (void (*func)(void *), void *par=NULL)
+
C function only: void mgl_set_event_func (HMGL gr, void (*func)(void *), void *par)
+

Set callback function which will be called to process events of GUI library. +

+ + + +
+ + + +

4.3 Axis settings

+ + +

These large set of variables and functions control how the axis and ticks will be drawn. Note that there is 3-step transformation of data coordinates are performed. Firstly, coordinates are projected if Cut=true (see Cutting), after it transformation formulas are applied, and finally the data was normalized in bounding box. Note, that MathGL will produce warning if axis range and transformation formulas are not compatible. +

+ + + + + + + +
+ + + +

4.3.1 Ranges (bounding box)

+ + + + + + + + + + + +
+
MGL command: xrange v1 v2 [add=off]
+
MGL command: yrange v1 v2 [add=off]
+
MGL command: zrange v1 v2 [add=off]
+
MGL command: crange v1 v2 [add=off]
+
Method on mglGraph: void SetRange (char dir, mreal v1, mreal v2)
+
Method on mglGraph: void AddRange (char dir, mreal v1, mreal v2)
+
C function: void mgl_set_range_val (HMGL gr, char dir, mreal v1, mreal v2)
+
C function: void mgl_add_range_val (HMGL gr, char dir, mreal v1, mreal v2)
+

Sets or adds the range for ‘x’-,‘y’-,‘z’- coordinate or coloring (‘c’). If one of values is NAN then it is ignored. See also ranges. +

+ + +
+
MGL command: xrange dat [add=off]
+
MGL command: yrange dat [add=off]
+
MGL command: zrange dat [add=off]
+
MGL command: crange dat [add=off]
+
Method on mglGraph: void SetRange (char dir, const mglDataA &dat, bool add=false)
+
C function: void mgl_set_range_dat (HMGL gr, char dir, const HCDT a, int add)
+

Sets the range for ‘x’-,‘y’-,‘z’- coordinate or coloring (‘c’) as minimal and maximal values of data dat. Parameter add=on shows that the new range will be joined to existed one (not replace it). +

+ +
+
MGL command: ranges x1 x2 y1 y2 [z1=0 z2=0]
+
Method on mglGraph: void SetRanges (mglPoint p1, mglPoint p2)
+
Method on mglGraph: void SetRanges (double x1, double x2, double y1, double y2, double z1=0, double z2=0)
+
C function: void mgl_set_ranges (HMGL gr, double x1, double x2, double y1, double y2, double z1, double z2)
+

Sets the ranges of coordinates. If minimal and maximal values of the coordinate are the same then they are ignored. Also it sets the range for coloring (analogous to crange z1 z2). This is default color range for 2d plots. Initial ranges are [-1, 1]. +

+ +
+
MGL command: ranges xx yy [zz cc=zz]
+
Method on mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy)
+
Method on mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz)
+
Method on mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz, const mglDataA &cc)
+

Sets the ranges of ‘x’-,‘y’-,‘z’-,‘c’-coordinates and coloring as minimal and maximal values of data xx, yy, zz, cc correspondingly. +

+ +
+
Method on mglGraph: void SetAutoRanges (mglPoint p1, mglPoint p2)
+
Method on mglGraph: void SetAutoRanges (double x1, double x2, double y1, double y2, double z1=0, double z2=0, double c1=0, double c2=0)
+
C function: void mgl_set_auto_ranges (HMGL gr, double x1, double x2, double y1, double y2, double z1, double z2, double z1, double z2)
+

Sets the ranges for automatic coordinates. If minimal and maximal values of the coordinate are the same then they are ignored. +

+ +
+
MGL command: origin x0 y0 [z0=nan]
+
Method on mglGraph: void SetOrigin (mglPoint p0)
+
Method on mglGraph: void SetOrigin (mreal x0, mreal y0, mreal z0=NAN)
+
C function: void mgl_set_origin (HMGL gr, mreal x0, mreal y0, mreal z0)
+

Sets center of axis cross section. If one of values is NAN then MathGL try to select optimal axis position. +

+ +
+
MGL command: zoomaxis x1 x2
+
MGL command: zoomaxis x1 y1 x2 y2
+
MGL command: zoomaxis x1 y1 z1 x2 y2 z2
+
MGL command: zoomaxis x1 y1 z1 c1 x2 y2 z2 c2
+
Method on mglGraph: void ZoomAxis (mglPoint p1, mglPoint p2)
+
C function: void mgl_zoom_axis (HMGL gr, mreal x1, mreal y1, mreal z1, mreal c1, mreal x2, mreal y2, mreal z2, mreal c2)
+

Additionally extend axis range for any settings made by SetRange or SetRanges functions according the formula min += (max-min)*p1 and max += (max-min)*p1 (or min *= (max/min)^p1 and max *= (max/min)^p1 for log-axis range when inf>max/min>100 or 0<max/min<0.01). Initial ranges are [0, 1]. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam(). +

+ + + +
+ +
+

+Next: , Previous: , Up: Axis settings   [Contents][Index]

+
+ +

4.3.2 Curved coordinates

+ + + + + + +
+
MGL command: axis 'fx' 'fy' 'fz' ['fa'='']
+
Method on mglGraph: void SetFunc (const char *EqX, const char *EqY, const char *EqZ="", const char *EqA="")
+
C function: void mgl_set_func (HMGL gr, const char *EqX, const char *EqY, const char *EqZ, const char *EqA)
+

Sets transformation formulas for curvilinear coordinate. Each string should contain mathematical expression for real coordinate depending on internal coordinates ‘x’, ‘y’, ‘z’ and ‘a’ or ‘c’ for colorbar. For example, the cylindrical coordinates are introduced as SetFunc("x*cos(y)", "x*sin(y)", "z");. For removing of formulas the corresponding parameter should be empty or NULL. Using transformation formulas will slightly slowing the program. Parameter EqA set the similar transformation formula for color scheme. See Textual formulas. +

+ +
+
MGL command: axis how
+
Method on mglGraph: void SetCoor (int how)
+
C function: void mgl_set_coor (HMGL gr, int how)
+

Sets one of the predefined transformation formulas for curvilinear coordinate. Parameter how define the coordinates: +

+
mglCartesian=0
+

Cartesian coordinates (no transformation, {x,y,z}); +

+
mglPolar=1
+

Polar coordinates: {x*cos(y), x*sin(y), z}; +

+
mglSpherical=2
+

Sperical coordinates: {x*sin(y)*cos(z), x*sin(y)*sin(z), x*cos(y)}; +

+
mglParabolic=3
+

Parabolic coordinates: {x*y, (x*x-y*y)/2, z} +

+
mglParaboloidal=4
+

Paraboloidal coordinates: {(x*x-y*y)*cos(z)/2, (x*x-y*y)*sin(z)/2, x*y}; +

+
mglOblate=5
+

Oblate coordinates: {cosh(x)*cos(y)*cos(z), cosh(x)*cos(y)*sin(z), sinh(x)*sin(y)}; +

+
mglProlate=6
+

Prolate coordinates: {sinh(x)*sin(y)*cos(z), sinh(x)*sin(y)*sin(z), cosh(x)*cos(y)}; +

+
mglElliptic=7
+

Elliptic coordinates: {cosh(x)*cos(y), sinh(x)*sin(y), z}; +

+
mglToroidal=8
+

Toroidal coordinates: {sinh(x)*cos(z)/(cosh(x)-cos(y)), sinh(x)*sin(z)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y))}; +

+
mglBispherical=9
+

Bispherical coordinates: {sin(y)*cos(z)/(cosh(x)-cos(y)), sin(y)*sin(z)/(cosh(x)-cos(y)), sinh(x)/(cosh(x)-cos(y))}; +

+
mglBipolar=10
+

Bipolar coordinates: {sinh(x)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y)), z}; +

+
mglLogLog=11
+

Log-log coordinates: {lg(x), lg(y), lg(z)}; +

+
mglLogX=12
+

Log-x coordinates: {lg(x), y, z}; +

+
mglLogY=13
+

Log-y coordinates: {x, lg(y), z}. +

+
+
+ +
+
MGL command: ternary val
+
Method on mglGraph: void Ternary (int tern)
+
C function: void mgl_set_ternary (HMGL gr, int tern)
+

The function sets to draws Ternary (tern=1), Quaternary (tern=2) plot or projections (tern=4,5,6). +

+

Ternary plot is special plot for 3 dependent coordinates (components) a, b, c so that a+b+c=1. MathGL uses only 2 independent coordinates a=x and b=y since it is enough to plot everything. At this third coordinate z act as another parameter to produce contour lines, surfaces and so on. +

+

Correspondingly, Quaternary plot is plot for 4 dependent coordinates a, b, c and d so that a+b+c+d=1. MathGL uses only 3 independent coordinates a=x, b=y and d=z since it is enough to plot everything. +

+

Projections can be obtained by adding value 4 to tern argument. So, that tern=4 will draw projections in Cartesian coordinates, tern=5 will draw projections in Ternary coordinates, tern=6 will draw projections in Quaternary coordinates. If you add 8 instead of 4 then all text labels will not be printed on projections. +

+

Use Ternary(0) for returning to usual axis. See Ternary axis, for sample code and picture. See Axis projection, for sample code and picture. +

+ + +
+ +
+

+Previous: , Up: Axis settings   [Contents][Index]

+
+ +

4.3.3 Ticks

+ + + + + + + + + + + + + + + + + + + + +
+
MGL command: adjust ['dir'='xyzc']
+
Method on mglGraph: void Adjust (const char *dir="xyzc")
+
C function: void mgl_adjust_ticks (HMGL gr, const char *dir)
+

Set the ticks step, number of sub-ticks and initial ticks position to be the most human readable for the axis along direction(s) dir. Also set SetTuneTicks(true). Usually you don’t need to call this function except the case of returning to default settings. +

+ +
+
MGL command: xtick val [sub=0 org=nan 'fact'='']
+
MGL command: ytick val [sub=0 org=nan 'fact'='']
+
MGL command: ztick val [sub=0 org=nan 'fact'='']
+
MGL command: xtick val sub ['fact'='']
+
MGL command: ytick val sub ['fact'='']
+
MGL command: ztick val sub ['fact'='']
+
MGL command: ctick val ['fact'='']
+
Method on mglGraph: void SetTicks (char dir, mreal d=0, int ns=0, mreal org=NAN, const char *fact="")
+
Method on mglGraph: void SetTicks (char dir, mreal d, int ns, mreal org, const wchar_t *fact)
+
C function: void mgl_set_ticks (HMGL gr, char dir, mreal d, int ns, mreal org)
+
C function: void mgl_set_ticks_fact (HMGL gr, char dir, mreal d, int ns, mreal org, const char *fact)
+
C function: void mgl_set_ticks_factw (HMGL gr, char dir, mreal d, int ns, mreal org, const wchar_t *fact)
+

Set the ticks step d, number of sub-ticks ns (used for positive d) and initial ticks position org for the axis along direction dir (use ’c’ for colorbar ticks). Variable d set step for axis ticks (if positive) or it’s number on the axis range (if negative). Zero value set automatic ticks. If org value is NAN then axis origin is used. Parameter fact set text which will be printed after tick label (like "\pi" for d=M_PI). +

+ +
+
MGL command: xtick val1 'lbl1' [val2 'lbl2' ...]
+
MGL command: ytick val1 'lbl1' [val2 'lbl2' ...]
+
MGL command: ztick val1 'lbl1' [val2 'lbl2' ...]
+
MGL command: ctick val1 'lbl1' [val2 'lbl2' ...]
+
MGL command: xtick vdat 'lbls' [add=off]
+
MGL command: ytick vdat 'lbls' [add=off]
+
MGL command: ztick vdat 'lbls' [add=off]
+
MGL command: ctick vdat 'lbls' [add=off]
+
Method on mglGraph: void SetTicksVal (char dir, const char *lbl, bool add=false)
+
Method on mglGraph: void SetTicksVal (char dir, const wchar_t *lbl, bool add=false)
+
Method on mglGraph: void SetTicksVal (char dir, const mglDataA &val, const char *lbl, bool add=false)
+
Method on mglGraph: void SetTicksVal (char dir, const mglDataA &val, const wchar_t *lbl, bool add=false)
+
C function: void mgl_set_ticks_str (HMGL gr, char dir, const char *lbl, bool add)
+
C function: void mgl_set_ticks_wcs (HMGL gr, char dir, const wchar_t *lbl, bool add)
+
C function: void mgl_set_ticks_val (HMGL gr, char dir, HCDT val, const char *lbl, bool add)
+
C function: void mgl_set_ticks_valw (HMGL gr, char dir, HCDT val, const wchar_t *lbl, bool add)
+

Set the manual positions val and its labels lbl for ticks along axis dir. If array val is absent then values equidistantly distributed in x-axis range are used. Labels are separated by ‘\n’ symbol. If only one value is specified in MGL command then the label will be add to the current ones. Use SetTicks() to restore automatic ticks. +

+ +
+
Method on mglGraph: void AddTick (char dir, double val, const char *lbl)
+
Method on mglGraph: void AddTick (char dir, double val, const wchar_t *lbl)
+
C function: void mgl_add_tick (HMGL gr, char dir, double val, const char *lbl)
+
C function: void mgl_set_tickw (HMGL gr, char dir, double val, const wchar_t *lbl)
+

The same as previous but add single tick label lbl at position val to the list of existed ones. +

+ +
+
MGL command: xtick 'templ'
+
MGL command: ytick 'templ'
+
MGL command: ztick 'templ'
+
MGL command: ctick 'templ'
+
Method on mglGraph: void SetTickTempl (char dir, const char *templ)
+
Method on mglGraph: void SetTickTempl (char dir, const wchar_t *templ)
+
C function: void mgl_set_tick_templ (HMGL gr, const char *templ)
+
C function: void mgl_set_tick_templw (HMGL gr, const wchar_t *templ)
+

Set template templ for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. If templ="" then default template is used (in simplest case it is ‘%.2g’). If template start with ‘&’ symbol then long integer value will be passed instead of default type double. Setting on template switch off automatic ticks tuning. +

+ +
+
MGL command: ticktime 'dir' [dv=0 'tmpl'='']
+
Method on mglGraph: void SetTicksTime (char dir, mreal val, const char *templ)
+
C function: void mgl_set_ticks_time (HMGL gr, mreal val, const char *templ)
+

Sets time labels with step val and template templ for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. The format of template templ is the same as described in http://www.manpagez.com/man/3/strftime/. Most common variants are ‘%X’ for national representation of time, ‘%x’ for national representation of date, ‘%Y’ for year with century. If val=0 and/or templ="" then automatic tick step and/or template will be selected. You can use mgl_get_time() function for obtaining number of second for given date/time string. Note, that MS Visual Studio couldn’t handle date before 1970. +

+ +
+
C function: double mgl_get_time (const char*str, const char *templ)
+

Gets number of seconds from 1970 year to specified date/time str. The format of string is specified by templ, which is the same as described in http://www.manpagez.com/man/3/strftime/. Most common variants are ‘%X’ for national representation of time, ‘%x’ for national representation of date, ‘%Y’ for year with century. Note, that MS Visual Studio couldn’t handle date before 1970. +

+ +
+
MGL command: tuneticks val [pos=1.15]
+
Method on mglGraph: void SetTuneTicks (int tune, mreal pos=1.15)
+
C function: void mgl_tune_ticks (HMGL gr, int tune, mreal pos)
+

Switch on/off ticks enhancing by factoring common multiplier (for small, like from 0.001 to 0.002, or large, like from 1000 to 2000, coordinate values – enabled if tune&1 is nonzero) or common component (for narrow range, like from 0.999 to 1.000 – enabled if tune&2 is nonzero). Also set the position pos of common multiplier/component on the axis: =0 at minimal axis value, =1 at maximal axis value. Default value is 1.15. +

+ +
+
MGL command: tickshift dx [dy=0 dz=0 dc=0]
+
Method on mglGraph: void SetTickShift (mglPoint d)
+
C function: void mgl_set_tick_shift (HMGL gr, mreal dx, mreal dy, mreal dz, mreal dc)
+

Set value of additional shift for ticks labels. +

+ + +
+
Method on mglGraph: void SetTickRotate (bool val)
+
C function: void mgl_set_tick_rotate (HMGL gr, bool val)
+

Enable/disable ticks rotation if there are too many ticks or ticks labels are too long. +

+ +
+
Method on mglGraph: void SetTickSkip (bool val)
+
C function: void mgl_set_tick_skip (HMGL gr, bool val)
+

Enable/disable ticks skipping if there are too many ticks or ticks labels are too long. +

+ +
+
Method on mglGraph: void SetTimeUTC (bool val)
+

Enable/disable using UTC time for ticks labels. In C/Fortran you can use mgl_set_flag(gr,val, MGL_USE_GMTIME);. +

+ + +
+
MGL command: origintick val
+
Method on mglGraph: void SetOriginTick (bool val=true)
+

Enable/disable drawing of ticks labels at axis origin. In C/Fortran you can use mgl_set_flag(gr,val, MGL_NO_ORIGIN);. +

+ +
+
MGL command: ticklen val [stt=1]
+
Method on mglGraph: void SetTickLen (mreal val, mreal stt=1)
+
C function: void mgl_set_tick_len (HMGL gr, mreal val, mreal stt)
+

The relative length of axis ticks. Default value is 0.1. Parameter stt>0 set relative length of subticks which is in sqrt(1+stt) times smaller. +

+ +
+
MGL command: axisstl 'stl' ['tck'='' 'sub'='']
+
Method on mglGraph: void SetAxisStl (const char *stl="k", const char *tck=0, const char *sub=0)
+
C function: void mgl_set_axis_stl (HMGL gr, const char *stl, const char *tck, const char *sub)
+

The line style of axis (stl), ticks (tck) and subticks (sub). If stl is empty then default style is used (‘k’ or ‘w’ depending on transparency type). If tck or sub is empty then axis style is used (i.e. stl). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.4 Subplots and rotation

+ + + + + + + + + + + + + + + +

These functions control how and where further plotting will be placed. There is a certain calling order of these functions for the better plot appearance. First one should be subplot, multiplot or inplot for specifying the place. Second one can be title for adding title for the subplot. After it a rotate, shear and aspect. And finally any other plotting functions may be called. Alternatively you can use columnplot, gridplot, stickplot, shearplot or relative inplot for positioning plots in the column (or grid, or stick) one by another without gap between plot axis (bounding boxes). See Subplots, for sample code and picture. +

+
+
MGL command: subplot nx ny m ['stl'='<>_^' dx=0 dy=0]
+
Method on mglGraph: void SubPlot (int nx, int ny, int m, const char *stl="<>_^", mreal dx=0, mreal dy=0)
+
C function: void mgl_subplot (HMGL gr, int nx, int ny, int m, const char *stl)
+
C function: void mgl_subplot_d (HMGL gr, int nx, int ny, int m, const char *stl, mreal dx, mreal dy)
+

Puts further plotting in a m-th cell of nx*ny grid of the whole frame area. The position of the cell can be shifted from its default position by relative size dx, dy. This function set off any aspects or rotations. So it should be used first for creating the subplot. Extra space will be reserved for axis/colorbar if stl contain: +

    +
  • L’ or ‘<’ – at left side, +
  • R’ or ‘>’ – at right side, +
  • A’ or ‘^’ – at top side, +
  • U’ or ‘_’ – at bottom side, +
  • #’ – reserve none space (use whole region for axis range) – axis and tick labels will be invisible by default. +
+

From the aesthetical point of view it is not recommended to use this function with different matrices in the same frame. Note, colorbar can be invisible (be out of image borders) if you set empty style ‘’. +

+ +
+
MGL command: multiplot nx ny m dx dy ['style'='<>_^' sx sy]
+
Method on mglGraph: void MultiPlot (int nx, int ny, int m, int dx, int dy, const char *stl="<>_^")
+
C function: void mgl_multiplot (HMGL gr, int nx, int ny, int m, int dx, int dy, const char *stl)
+

Puts further plotting in a rectangle of dx*dy cells starting from m-th cell of nx*ny grid of the whole frame area. The position of the rectangular area can be shifted from its default position by relative size sx, sy. This function set off any aspects or rotations. So it should be used first for creating subplot. Extra space will be reserved for axis/colorbar if stl contain: +

    +
  • L’ or ‘<’ – at left side, +
  • R’ or ‘>’ – at right side, +
  • A’ or ‘^’ – at top side, +
  • U’ or ‘_’ – at bottom side. +‘#’ – reserve none space (use whole region for axis range) – axis and tick labels will be invisible by default. +
+
+ +
+
MGL command: inplot x1 x2 y1 y2 [rel=on]
+
Method on mglGraph: void InPlot (mreal x1, mreal x2, mreal y1, mreal y2, bool rel=true)
+
C function: void mgl_inplot (HMGL gr, mreal x1, mreal x2, mreal y1, mreal y2)
+
C function: void mgl_relplot (HMGL gr, mreal x1, mreal x2, mreal y1, mreal y2)
+

Puts further plotting in some region of the whole frame surface. This function allows one to create a plot in arbitrary place of the screen. The position is defined by rectangular coordinates [x1, x2]*[y1, y2]. The coordinates x1, x2, y1, y2 are normalized to interval [0, 1]. If parameter rel=true then the relative position to current subplot (or inplot with rel=false) is used. This function set off any aspects or rotations. So it should be used first for creating subplot. +

+ +
+
MGL command: columnplot num ind [d=0]
+
Method on mglGraph: void ColumnPlot (int num, int ind, mreal d=0)
+
C function: void mgl_columnplot (HMGL gr, int num, int ind)
+
C function: void mgl_columnplot_d (HMGL gr, int num, int ind, mreal d)
+

Puts further plotting in ind-th cell of column with num cells. The position is relative to previous subplot (or inplot with rel=false). Parameter d set extra gap between cells. +

+ +
+
MGL command: gridplot nx ny ind [d=0]
+
Method on mglGraph: void GridPlot (int nx, int ny, int ind, mreal d=0)
+
C function: void mgl_gridplot (HMGL gr, int nx, int ny, int ind)
+
C function: void mgl_gridplot_d (HMGL gr, int nx, int ny, int ind, mreal d)
+

Puts further plotting in ind-th cell of nx*ny grid. The position is relative to previous subplot (or inplot with rel=false). Parameter d set extra gap between cells. +

+ +
+
MGL command: stickplot num ind tet phi
+
Method on mglGraph: void StickPlot (int num, int ind, mreal tet, mreal phi)
+
C function: void mgl_stickplot (HMGL gr, int num, int ind, mreal tet, mreal phi)
+

Puts further plotting in ind-th cell of stick with num cells. At this, stick is rotated on angles tet, phi. The position is relative to previous subplot (or inplot with rel=false). +

+ +
+
MGL command: shearplot num ind sx sy [xd yd]
+
Method on mglGraph: void ShearPlot (int num, int ind, mreal sx, mreal sy, mreal xd=1, mreal yd=0)
+
C function: void mgl_shearplot (HMGL gr, int num, int ind, mreal sx, mreal sy, mreal xd, mreal yd)
+

Puts further plotting in ind-th cell of stick with num cells. At this, cell is sheared on values sx, sy. Stick direction is specified be xd and yd. The position is relative to previous subplot (or inplot with rel=false). +

+ + +
+
MGL command: title 'title' ['stl'='' size=-2]
+
Method on mglGraph: void Title (const char *txt, const char *stl="", mreal size=-2)
+
Method on mglGraph: void Title (const wchar_t *txt, const char *stl="", mreal size=-2)
+
C function: void mgl_title (HMGL gr, const char *txt, const char *stl, mreal size)
+
C function: void mgl_titlew (HMGL gr, const wchar_t *txt, const char *stl, mreal size)
+

Add text title for current subplot/inplot. Parameter stl can contain: +

    +
  • font style (see, Font styles); +
  • #’ for box around the title. +
+

Parameter size set font size. This function set off any aspects or rotations. So it should be used just after creating subplot. +

+ +
+
MGL command: rotate tetx tetz [tety=0]
+
Method on mglGraph: void Rotate (mreal TetX, mreal TetZ, mreal TetY=0)
+
C function: void mgl_rotate (HMGL gr, mreal TetX, mreal TetZ, mreal TetY)
+

Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TetX, TetZ, TetY. +

+ +
+
MGL command: rotate tet x y z
+
Method on mglGraph: void RotateN (mreal Tet, mreal x, mreal y, mreal z)
+
C function: void mgl_rotate_vector (HMGL gr, mreal Tet, mreal x, mreal y, mreal z)
+

Rotates a further plotting around vector {x, y, z} on angle Tet. +

+ +
+
MGL command: shear sx sy
+
Method on mglGraph: void Shear (mreal sx, mreal sy)
+
C function: void mgl_shear (HMGL gr, mreal sx, mreal sy)
+

Shears a further plotting on values sx, sy. +

+ +
+
MGL command: aspect ax ay [az=1]
+
Method on mglGraph: void Aspect (mreal Ax, mreal Ay, mreal Az=1)
+
C function: void mgl_aspect (HMGL gr, mreal Ax, mreal Ay, mreal Az)
+

Defines aspect ratio for the plot. The viewable axes will be related one to another as the ratio Ax:Ay:Az. For the best effect it should be used after rotate function. If Ax is NAN then function try to select optimal aspect ratio to keep equal ranges for x-y axis. At this, Ay will specify proportionality factor, or set to use automatic one if Ay=NAN. +

+ + +
+
Method on mglGraph: void Push ()
+
C function: void mgl_mat_push (HMGL gr)
+

Push transformation matrix into stack. Later you can restore its current state by Pop() function. +

+ +
+
Method on mglGraph: void Pop ()
+
C function: void mgl_mat_pop (HMGL gr)
+

Pop (restore last ’pushed’) transformation matrix into stack. +

+ +
+
Method on mglGraph: void SetPlotFactor (mreal val)
+
C function: void mgl_set_plotfactor (HMGL gr, mreal val)
+

Sets the factor of plot size. It is not recommended to set it lower then 1.5. This is some analogue of function Zoom() but applied not to overall image but for each InPlot. Use negative value or zero to enable automatic selection. +

+ + +

There are 3 functions View(), Zoom() and Perspective() which transform whole image. I.e. they act as secondary transformation matrix. They were introduced for rotating/zooming the whole plot by mouse. It is not recommended to call them for picture drawing. +

+
+
MGL command: perspective val
+
Method on mglGraph: void Perspective (mreal a)
+
C function: void mgl_perspective (HMGL gr, mreal a)
+

Add (switch on) the perspective to plot. The parameter a = Depth/(Depth+dz) \in [0,1). By default (a=0) the perspective is off. +

+ +
+
MGL command: view tetx tetz [tety=0]
+
Method on mglGraph: void View (mreal TetX, mreal TetZ, mreal TetY=0)
+
C function: void mgl_view (HMGL gr, mreal TetX, mreal TetZ, mreal TetY)
+

Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TetX, TetZ, TetY. Rotation is done independently on rotate. Attention! this settings can not be overwritten by DefaultPlotParam(). Use Zoom(0,0,1,1) to return default view. +

+ +
+
MGL command: zoom x1 y1 x2 y2
+
Method on mglGraph (C++, Python): void Zoom (mreal x1, mreal y1, mreal x2, mreal y2)
+
C function: void mgl_set_zoom (HMGL gr, mreal x1, mreal y1, mreal x2, mreal y2)
+

The function changes the scale of graphics that correspond to zoom in/out of the picture. After function call the current plot will be cleared and further the picture will contain plotting from its part [x1,x2]*[y1,y2]. Here picture coordinates x1, x2, y1, y2 changes from 0 to 1. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam(). Use Zoom(0,0,1,1) to return default view. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.5 Export picture

+ + + +

Functions in this group save or give access to produced picture. So, usually they should be called after plotting is done. +

+
+
MGL command: setsize w h
+
Method on mglGraph: void SetSize (int width, int height, bool clear=true)
+
C function: void mgl_set_size (HMGL gr, int width, int height)
+
C function: void mgl_scale_size (HMGL gr, int width, int height)
+

Sets size of picture in pixels. This function should be called before any other plotting because it completely remove picture contents if clear=true. Function just clear pixels and scale all primitives if clear=false. +

+ +
+
MGL command: setsizescl factor
+
Method on mglGraph: void SetSizeScl (double factor)
+
C function: void mgl_set_size_scl (HMGL gr, double factor)
+

Set factor for width and height in all further calls of setsize. This command is obsolete since v.2.4.2. +

+ +
+
MGL command: quality [val=2]
+
Method on mglGraph: void SetQuality (int val=MGL_DRAW_NORM)
+
C function: void mgl_set_quality (HMGL gr, int val)
+

Sets quality of the plot depending on value val: MGL_DRAW_WIRE=0 – no face drawing (fastest), MGL_DRAW_FAST=1 – no color interpolation (fast), MGL_DRAW_NORM=2 – high quality (normal), MGL_DRAW_HIGH=3 – high quality with 3d primitives (arrows and marks); MGL_DRAW_LMEM=0x4 – direct bitmap drawing (low memory usage); MGL_DRAW_DOTS=0x8 – for dots drawing instead of primitives (extremely fast). +

+ +
+
Method on mglGraph: int GetQuality ()
+
C function: int mgl_get_quality (HMGL gr)
+

Gets quality of the plot: MGL_DRAW_WIRE=0 – no face drawing (fastest), MGL_DRAW_FAST=1 – no color interpolation (fast), MGL_DRAW_NORM=2 – high quality (normal), MGL_DRAW_HIGH=3 – high quality with 3d primitives (arrows and marks); MGL_DRAW_LMEM=0x4 – direct bitmap drawing (low memory usage); MGL_DRAW_DOTS=0x8 – for dots drawing instead of primitives (extremely fast). +

+ +
+
Method on mglGraph: void StartGroup (const char *name)
+
C function: void mgl_start_group (HMGL gr, const char *name)
+

Starts group definition. Groups contain objects and other groups, they are used to select a part of a model to zoom to or to make invisible or to make semitransparent and so on. +

+ +
+
Method on mglGraph: void EndGroup ()
+
C function: void mgl_end_group (HMGL gr)
+

Ends group definition. +

+ + + + + + + + + +
+ + + +

4.5.1 Export to file

+ + + + + + + + + + + + + + + + + +

These functions export current view to a graphic file. The filename fname should have appropriate extension. Parameter descr gives the short description of the picture. Just now the transparency is supported in PNG, SVG, OBJ and PRC files. +

+
+
MGL command: write ['fname'='']
+
Method on mglGraph: void WriteFrame (const char *fname="", const char *descr="")
+
C function: void mgl_write_frame (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to a file fname which type is determined by the extension. Parameter descr adds description to file (can be ""). If fname="" then the file ‘frame####.jpg’ is used, where ‘####’ is current frame id and name ‘frame’ is defined by plotid class property. +

+ +
+
MGL command: bbox x1 y1 [x2=-1 y2=-1]
+
Method on mglGraph: void SetBBox (int x1=0, int y1=0, int x2=-1, int y2=-1)
+
C function: void mgl_set_bbox (HMGL gr, int x1, int y1, int x2, int y2)
+

Set boundary box for export graphics into 2D file formats. If x2<0 (y2<0) then original image width (height) will be used. If x1<0 or y1<0 or x1>=x2|Width or y1>=y2|Height then cropping will be disabled. +

+ + + +
+
Method on mglGraph: void WritePNG (const char *fname, const char *descr="", int compr="", bool alpha=true)
+
C function: void mgl_write_png (HMGL gr, const char *fname, const char *descr)
+
C function: void mgl_write_png_solid (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to PNG file. Parameter fname specifies the file name, descr adds description to file, alpha gives the transparency type. By default there are no description added and semitransparent image used. This function does nothing if HAVE_PNG isn’t defined during compilation of MathGL library. +

+ +
+
Method on mglGraph: void WriteJPEG (const char *fname, const char *descr="")
+
C function: void mgl_write_jpg (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to JPEG file. Parameter fname specifies the file name, descr adds description to file. By default there is no description added. This function does nothing if HAVE_JPEG isn’t defined during compilation of MathGL library. +

+ +
+
Method on mglGraph: void WriteGIF (const char *fname, const char *descr="")
+
C function: void mgl_write_gif (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to GIF file. Parameter fname specifies the file name, descr adds description to file. By default there is no description added. This function does nothing if HAVE_GIF isn’t defined during compilation of MathGL library. +

+ +
+
Method on mglGraph: void WriteBMP (const char *fname, const char *descr="")
+
C function: void mgl_write_bmp (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to BMP file. Parameter fname specifies the file name, descr adds description to file. There is no compression used. +

+ +
+
Method on mglGraph: void WriteTGA (const char *fname, const char *descr="")
+
C function: void mgl_write_tga (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to TGA file. Parameter fname specifies the file name, descr adds description to file. There is no compression used. +

+ +
+
Method on mglGraph: void WriteEPS (const char *fname, const char *descr="")
+
C function: void mgl_write_eps (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to EPS file using vector representation. So it is not recommended for the export of large data plot. It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file. By default there is no description added. If file name is terminated by ‘z’ (for example, ‘fname.eps.gz’) then file will be compressed in gzip format. Note, that EPS format don’t support color interpolation, and the resulting plot will look as you use quality=1 for plotting. +

+ +
+
Method on mglGraph: void WriteBPS (const char *fname, const char *descr="")
+
C function: void mgl_write_eps (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to EPS file using bitmap representation. Parameter fname specifies the file name, descr adds description to file. By default there is no description added. If file name is terminated by ‘z’ (for example, ‘fname.eps.gz’) then file will be compressed in gzip format. +

+ +
+
Method on mglGraph: void WriteSVG (const char *fname, const char *descr="")
+
C function: void mgl_write_svg (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to SVG (Scalable Vector Graphics) file using vector representation. In difference of EPS format, SVG format support transparency that allows to correctly draw semitransparent plot (like surfa, surf3a or cloud). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name). If file name is terminated by ‘z’ (for example, ‘fname.svgz’) then file will be compressed in gzip format. Note, that SVG format don’t support color interpolation, and the resulting plot will look as you use quality=1 for plotting. +

+ +
+
Method on mglGraph: void WriteTEX (const char *fname, const char *descr="")
+
C function: void mgl_write_tex (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to LaTeX (package Tikz/PGF) file using vector representation. Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name). Note, there is no text scaling now (for example, in subplots), what may produce miss-aligned labels. +

+ +
+
Method on mglGraph: void WritePRC (const char *fname, const char *descr="", bool make_pdf=true)
+
C function: void mgl_write_prc (HMGL gr, const char *fname, const char *descr, int make_pdf)
+

Exports current frame to PRC file using vector representation (see http://en.wikipedia.org/wiki/PRC_%28file_format%29). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name). If parameter make_pdf=true and PDF was enabled at MathGL configure then corresponding PDF file with 3D image will be created. +

+ +
+
Method on mglGraph: void WriteOBJ (const char *fname, const char *descr="")
+
C function: void mgl_write_obj (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to OBJ/MTL file using vector representation (see OBJ format for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name). +

+ +
+
Method on mglGraph: void WriteXYZ (const char *fname, const char *descr="")
+
C function: void mgl_write_xyz (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to XYZ/XYZL/XYZF files using vector representation (see XYZ format for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name). +

+ +
+
Method on mglGraph: void WriteSTL (const char *fname, const char *descr="")
+
C function: void mgl_write_stl (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to STL file using vector representation (see STL format for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name. +

+ +
+
Method on mglGraph: void WriteOFF (const char *fname, const char *descr="", bool colored=false)
+
C function: void mgl_write_off (HMGL gr, const char *fname, const char *descr, bool colored)
+

Exports current frame to OFF file using vector representation (see OFF format for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name). +

+ + + + +
+
Method on mglGraph: void ShowImage (const char *viewer, bool nowait=false)
+
C function: void mgl_show_image (const char *viewer, int nowait)
+

Displays the current picture using external program viewer for viewing. The function save the picture to temporary file and call viewer to display it. If nowait=true then the function return immediately (it will not wait while window will be closed). +

+ + +
+
Method on mglGraph: void WriteJSON (const char *fname, const char *descr="")
+
C function: void mgl_write_json (HMGL gr, const char *fname, const char *descr)
+

Exports current frame to textual file using JSON format. Later this file can be used for faster loading and viewing by JavaScript script. Parameter fname specifies the file name, descr adds description to file. +

+ +
+
Method on mglGraph: void ExportMGLD (const char *fname, const char *descr="")
+
C function: void mgl_export_mgld (HMGL gr, const char *fname, const char *descr)
+

Exports points and primitives in file using MGLD format. Later this file can be used for faster loading and viewing by mglview utility. Parameter fname specifies the file name, descr adds description to file (default is file name). +

+ +
+
Method on mglGraph: void ImportMGLD (const char *fname, bool add=false)
+
C function: void mgl_import_mgld (HMGL gr, const char *fname, int add)
+

Imports points and primitives in file using MGLD format. Later this file can be used for faster loading and viewing by mglview utility. Parameter fname specifies the file name, add sets to append or replace primitives to existed ones. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Export picture   [Contents][Index]

+
+ +

4.5.2 Frames/Animation

+ + + + + + + + + + +

These functions provide ability to create several pictures simultaneously. For most of cases it is useless but for widget classes (see Widget classes) they can provide a way to show animation. Also you can write several frames into animated GIF file. +

+
+
Method on mglGraph: void NewFrame ()
+
C function: void mgl_new_frame (HMGL gr)
+

Creates new frame. Function returns current frame id. This is not thread safe function in OpenGL mode! Use direct list creation in multi-threading drawing. The function EndFrame() must be call after the finishing of the frame drawing for each call of this function. +

+ +
+
Method on mglGraph: void EndFrame ()
+
C function: void mgl_end_frame (HMGL gr)
+

Finishes the frame drawing. +

+ +
+
Method on mglGraph: int GetNumFrame ()
+
C function: int mgl_get_num_frame (HMGL gr)
+

Gets the number of created frames. +

+ +
+
Method on mglGraph: void SetFrame (int i)
+
C function: void mgl_set_frame (HMGL gr, int i)
+

Finishes the frame drawing and sets drawing data to frame i, which should be in range [0, GetNumFrame()-1]. This function is similar to EndFrame() but don’t add frame to the GIF image. +

+ +
+
Method on mglGraph: void GetFrame (int i)
+
C function: void mgl_get_frame (HMGL gr, int i)
+

Replaces drawing data by one from frame i. Function work if MGL_VECT_FRAME is set on (by default). +

+ +
+
Method on mglGraph: void ShowFrame (int i)
+
C function: void mgl_show_frame (HMGL gr, int i)
+

Appends drawing data from frame i to current one. Function work if MGL_VECT_FRAME is set on (by default). +

+ +
+
Method on mglGraph: void DelFrame (int i)
+
C function: void mgl_del_frame (HMGL gr, int i)
+

Deletes drawing data for frame i and shift all later frame indexes. Function work if MGL_VECT_FRAME is set on (by default). Do nothing in OpenGL mode. +

+ +
+
Method on mglGraph: void ResetFrames ()
+
C function: void mgl_reset_frames (HMGL gr)
+

Reset frames counter (start it from zero). +

+ +
+
Method on mglGraph: void ClearFrame (int i)
+
C function: void mgl_clear_frame (HMGL gr, int i)
+

Clear list of primitives for current drawing. +

+ +
+
Method on mglGraph: void StartGIF (const char *fname, int ms=100)
+
C function: void mgl_start_gif (HMGL gr, const char *fname, int ms)
+

Start writing frames into animated GIF file fname. Parameter ms set the delay between frames in milliseconds. You should not change the picture size during writing the cinema. Use CloseGIF() to finalize writing. Note, that this function is disabled in OpenGL mode. +

+ +
+
Method on mglGraph: void CloseGIF ()
+
C function: void mgl_close_gif (HMGL gr)
+

Finish writing animated GIF and close connected pointers. +

+ + +
+ + + +

4.5.3 Bitmap in memory

+ + +

These functions return the created picture (bitmap), its width and height. You may display it by yourself in any graphical library (see also, Widget classes) or save in file (see also, Export to file). +

+
+
Method on mglGraph: const unsigned char * GetRGB ()
+
Method on mglGraph: void GetRGB (char *buf, int size)
+
Method on mglGraph: void GetBGRN (char *buf, int size)
+
C function: const unsigned char * mgl_get_rgb (HMGL gr)
+

Gets RGB bitmap of the current state of the image. Format of each element of bits is: {red, green, blue}. Number of elements is Width*Height. Position of element {i,j} is [3*i + 3*Width*j] (or is [4*i + 4*Width*j] for GetBGRN()). You have to provide the proper size of the buffer, buf, i.e. the code for Python should look like +

from mathgl import *
+gr = mglGraph();
+bits='\t';
+bits=bits.expandtabs(4*gr.GetWidth()*gr.GetHeight());
+gr.GetBGRN(bits, len(bits));
+
+ +
+
Method on mglGraph: const unsigned char * GetRGBA ()
+
Method on mglGraph: void GetRGBA (char *buf, int size)
+
C function: const unsigned char * mgl_get_rgba (HMGL gr)
+

Gets RGBA bitmap of the current state of the image. Format of each element of bits is: {red, green, blue, alpha}. Number of elements is Width*Height. Position of element {i,j} is [4*i + 4*Width*j]. +

+ +
+
Method on mglGraph: int GetWidth ()
+
Method on mglGraph: int GetHeight ()
+
C function: int mgl_get_width (HMGL gr)
+
C function: int mgl_get_height (HMGL gr)
+

Gets width and height of the image. +

+ + +
+
Method on mglGraph: mglPoint CalcXYZ (int xs, int ys)
+
C function: void mgl_calc_xyz (HMGL gr, int xs, int ys, mreal *x, mreal *y, mreal *z)
+

Calculate 3D coordinate {x,y,z} for screen point {xs,ys}. At this moment it ignore perspective and transformation formulas (curvilinear coordinates). The calculation are done for the last used InPlot (see Subplots and rotation). +

+ +
+
Method on mglGraph: mglPoint CalcScr (mglPoint p)
+
C function: void mgl_calc_scr (HMGL gr, mreal x, mreal y, mreal z, int *xs, int *ys)
+

Calculate screen point {xs,ys} for 3D coordinate {x,y,z}. The calculation are done for the last used InPlot (see Subplots and rotation). +

+ +
+
Method on mglGraph: void SetObjId (int id)
+
C function: void mgl_set_obj_id (HMGL gr, int id)
+

Set the numeric id for object or subplot/inplot. +

+ +
+
Method on mglGraph: int GetObjId (int xs, int ys)
+
C function: int mgl_get_obj_id (HMGL gr, int xs, int ys)
+

Get the numeric id for most upper object at pixel {xs, ys} of the picture. +

+ +
+
Method on mglGraph: int GetSplId (int xs, int ys)
+
C function: int mgl_get_spl_id (HMGL gr, int xs, int ys)
+

Get the numeric id for most subplot/inplot at pixel {xs, ys} of the picture. +

+ +
+
Method on mglGraph: void Highlight (int id)
+
C function: void mgl_highlight (HMGL gr, int id)
+

Highlight the object with given id. +

+ +
+
Method on mglGraph: long IsActive (int xs, int ys, int d=1)
+
C function: long mgl_is_active (HMGL gr, int xs, int ys, int d)
+

Checks if point {xs, ys} is close to one of active point (i.e. mglBase::Act) with accuracy d and return its index or -1 if not found. Active points are special points which characterize primitives (like edges and so on). This function for advanced users only. +

+ +
+
Method on mglGraph: long SetDrawReg (int nx=1, int ny=1, int m=0)
+
C function: long mgl_set_draw_reg (HMGL gr, int nx, int ny, int m)
+

Limits drawing region by rectangular area of m-th cell of matrix with sizes nx*ny (like in subplot). This function can be used to update only small region of the image for purposes of higher speed. This function for advanced users only. +

+ + + + +
+ +
+

+Previous: , Up: Export picture   [Contents][Index]

+
+ +

4.5.4 Parallelization

+ + + + + + +

Many of things MathGL do in parallel by default (if MathGL was built with pthread). However, there is function which set the number of threads to be used. +

+
+
C function: int mgl_set_num_thr (int n)
+

Set the number of threads to be used by MathGL. If n<1 then the number of threads is set as maximal number of processors (cores). If n=1 then single thread will be used (this is default if pthread was disabled). +

+ +

Another option is combining bitmap image (taking into account Z-ordering) from different instances of mglGraph. This method is most appropriate for computer clusters when the data size is so large that it exceed the memory of single computer node. +

+
+
Method on mglGraph: int Combine (const mglGraph *g)
+
C function: int mgl_combine_gr (HMGL gr, HMGL g)
+

Combine drawing from instance g with gr (or with this) taking into account Z-ordering of pixels. The width and height of both instances must be the same. +

+ +
+
Method on mglGraph: int MPI_Send (int id)
+
C function: int mgl_mpi_send (HMGL gr, int id)
+

Send graphical information from node id using MPI. The width and height in both nodes must be the same. +

+ +
+
Method on mglGraph: int MPI_Recv (int id)
+
C function: int mgl_mpi_send (HMGL gr, int id)
+

Receive graphical information from node id using MPI. The width and height in both nodes must be the same. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.6 Background

+ + + + + +

These functions change background image. +

+
+
MGL command: clf ['col']
+
MGL command: clf r g b
+
Method on mglGraph: void Clf ()
+
Method on mglGraph: void Clf (const char * col)
+
Method on mglGraph: void Clf (char col)
+
Method on mglGraph: void Clf (mreal r, mreal g, mreal b)
+
C function: void mgl_clf (HMGL gr)
+
C function: void mgl_clf_str (HMGL gr, const char * col)
+
C function: void mgl_clf_chr (HMGL gr, char col)
+
C function: void mgl_clf_rgb (HMGL gr, mreal r, mreal g, mreal b)
+

Clear the picture and fill background by specified color. +

+ +
+
MGL command: rasterize
+
Method on mglGraph: void Rasterize ()
+
C function: void mgl_rasterize (HMGL gr)
+

Force drawing the plot and use it as background. After it, function clear the list of primitives, like clf. This function is useful if you want save part of plot as bitmap one (for example, large surfaces, isosurfaces or vector fields) and keep some parts as vector one (like annotation, curves, axis and so on). +

+ +
+
MGL command: background 'fname' [alpha=1]
+
Method on mglGraph: void LoadBackground (const char * fname, double alpha=1)
+
C function: void mgl_load_background (HMGL gr, const char * fname, double alpha)
+

Load PNG or JPEG file fname as background for the plot. Parameter alpha manually set transparency of the background. +

+ + + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.7 Primitives

+ + + + + + + + + + + + + + + + +

These functions draw some simple objects like line, point, sphere, drop, cone and so on. See Using primitives, for sample code and picture. +

+
+
MGL command: ball x y ['col'='r.']
+
MGL command: ball x y z ['col'='r.']
+
Method on mglGraph: void Ball (mglPoint p, char col='r')
+
Method on mglGraph: void Mark (mglPoint p, const char *mark)
+
C function: void mgl_mark (HMGL gr, mreal x, mreal y, mreal z, const char *mark)
+

Draws a mark (point ‘.’ by default) at position p={x, y, z} with color col. +

+ +
+
MGL command: errbox x y ex ey ['stl'='']
+
MGL command: errbox x y z ex ey ez ['stl'='']
+
Method on mglGraph: void Error (mglPoint p, mglPoint e, char *stl="")
+
C function: void mgl_error_box (HMGL gr, mreal x, mreal y, mreal z, mreal ex, mreal ey, mreal ez, char *stl)
+

Draws a 3d error box at position p={x, y, z} with sizes e={ex, ey, ez} and style stl. Use NAN for component of e to reduce number of drawn elements. +

+ +
+
MGL command: line x1 y1 x2 y2 ['stl'='']
+
MGL command: line x1 y1 z1 x2 y2 z2 ['stl'='']
+
Method on mglGraph: void Line (mglPoint p1, mglPoint p2, char *stl="B", int num=2)
+
C function: void mgl_line (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, char *stl, int num)
+

Draws a geodesic line (straight line in Cartesian coordinates) from point p1 to p2 using line style stl. Parameter num define the “quality” of the line. If num=2 then the straight line will be drawn in all coordinate system (independently on transformation formulas (see Curved coordinates). Contrary, for large values (for example, =100) the geodesic line will be drawn in corresponding coordinate system (straight line in Cartesian coordinates, circle in polar coordinates and so on). Line will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: curve x1 y1 dx1 dy1 x2 y2 dx2 dy2 ['stl'='']
+
MGL command: curve x1 y1 z1 dx1 dy1 dz1 x2 y2 z2 dx2 dy2 dz2 ['stl'='']
+
Method on mglGraph: void Curve (mglPoint p1, mglPoint d1, mglPoint p2, mglPoint d2, const char *stl="B", int num=100)
+
C function: void mgl_curve (HMGL gr, mreal x1, mreal y1, mreal z1, mreal dx1, mreal dy1, mreal dz1, mreal x2, mreal y2, mreal z2, mreal dx2, mreal dy2, mreal dz2, const char *stl, int num)
+

Draws Bezier-like curve from point p1 to p2 using line style stl. At this tangent is codirected with d1, d2 and proportional to its amplitude. Parameter num define the “quality” of the curve. If num=2 then the straight line will be drawn in all coordinate system (independently on transformation formulas, see Curved coordinates). Contrary, for large values (for example, =100) the spline like Bezier curve will be drawn in corresponding coordinate system. Curve will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: face x1 y1 x2 y2 x3 y3 x4 y4 ['stl'='']
+
MGL command: face x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 ['stl'='']
+
Method on mglGraph: void Face (mglPoint p1, mglPoint p2, mglPoint p3, mglPoint p4, const char *stl="w")
+
C function: void mgl_face (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal x3, mreal y3, mreal z3, mreal x4, mreal y4, mreal z4, const char *stl)
+

Draws the solid quadrangle (face) with vertexes p1, p2, p3, p4 and with color(s) stl. At this colors can be the same for all vertexes or different if all 4 colors are specified for each vertex. Face will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: rect x1 y1 x2 y2 ['stl'='']
+
MGL command: rect x1 y1 z1 x2 y2 z2 ['stl'='']
+

Draws the solid rectangle (face) with vertexes {x1, y1, z1} and {x2, y2, z2} with color stl. At this colors can be the same for all vertexes or separately if all 4 colors are specified for each vertex. Face will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: facex x0 y0 z0 wy wz ['stl'='' d1=0 d2=0]
+
MGL command: facey x0 y0 z0 wx wz ['stl'='' d1=0 d2=0]
+
MGL command: facez x0 y0 z0 wx wy ['stl'='' d1=0 d2=0]
+
Method on mglGraph: void FaceX (mreal x0, mreal y0, mreal z0, mreal wy, mreal wz, const char *stl="w", mreal d1=0, mreal d2=0)
+
Method on mglGraph: void FaceY (mreal x0, mreal y0, mreal z0, mreal wx, mreal wz, const char *stl="w", mreal d1=0, mreal d2=0)
+
Method on mglGraph: void FaceZ (mreal x0, mreal y0, mreal z0, mreal wx, mreal wy, const char *stl="w", mreal d1=0, mreal d2=0)
+
C function: void mgl_facex (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wy, mreal wz, const char *stl, mreal d1, mreal d2)
+
C function: void mgl_facey (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wx, mreal wz, const char *stl, mreal d1, mreal d2)
+
C function: void mgl_facez (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wx, mreal wy, const char *stl, mreal d1, mreal d2)
+

Draws the solid rectangle (face) perpendicular to [x,y,z]-axis correspondingly at position {x0, y0, z0} with color stl and with widths wx, wy, wz along corresponding directions. At this colors can be the same for all vertexes or separately if all 4 colors are specified for each vertex. Parameters d1!=0, d2!=0 set additional shift of the last vertex (i.e. to draw quadrangle). Face will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: sphere x0 y0 r ['col'='r']
+
MGL command: sphere x0 y0 z0 r ['col'='r']
+
Method on mglGraph: void Sphere (mglPoint p, mreal r, const char *stl="r")
+
C function: void mgl_sphere (HMGL gr, mreal x0, mreal y0, mreal z0, mreal r, const char *stl)
+

Draw the sphere with radius r and center at point p={x0, y0, z0} and color stl. +

+ +
+
MGL command: drop x0 y0 dx dy r ['col'='r' sh=1 asp=1]
+
MGL command: drop x0 y0 z0 dx dy dz r ['col'='r' sh=1 asp=1]
+
Method on mglGraph: void Drop (mglPoint p, mglPoint d, mreal r, const char *col="r", mreal shift=1, mreal ap=1)
+
C function: void mgl_drop (HMGL gr, mreal x0, mreal y0, mreal z0, mreal dx, mreal dy, mreal dz, mreal r, const char *col, mreal shift, mreal ap)
+

Draw the drop with radius r at point p elongated in direction d and with color col. Parameter shift set the degree of drop oblongness: ‘0’ is sphere, ‘1’ is maximally oblongness drop. Parameter ap set relative width of the drop (this is analogue of “ellipticity” for the sphere). +

+ +
+
MGL command: cone x1 y1 z1 x2 y2 z2 r1 [r2=-1 'stl'='']
+
Method on mglGraph: void Cone (mglPoint p1, mglPoint p2, mreal r1, mreal r2=-1, const char *stl="B")
+
C function: void mgl_cone (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r1, mreal r2, const char *stl)
+

Draw tube (or truncated cone if edge=false) between points p1, p2 with radius at the edges r1, r2. If r2<0 then it is supposed that r2=r1. The cone color is defined by string stl. Parameter stl can contain: +

    +
  • @’ for drawing edges; +
  • #’ for wired cones; +
  • t’ for drawing tubes/cylinder instead of cones/prisms; +
  • 4’, ‘6’, ‘8’ for drawing square, hex- or octo-prism instead of cones. +
+
+ +
+
MGL command: circle x0 y0 r ['col'='r']
+
MGL command: circle x0 y0 z0 r ['col'='r']
+
Method on mglGraph: void Circle (mglPoint p, mreal r, const char *stl="r")
+

Draw the circle with radius r and center at point p={x0, y0, z0}. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style ‘@’ is used, black color is used by default); +
  • #’ for wire figure (boundary only); +
  • @’ for filling and boundary. +
+
+ +
+
MGL command: ellipse x1 y1 x2 y2 r ['col'='r']
+
MGL command: ellipse x1 y1 z1 x2 y2 z2 r ['col'='r']
+
Method on mglGraph: void Ellipse (mglPoint p1, mglPoint p2, mreal r, const char *col="r")
+
C function: void mgl_ellipse (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r, const char *col)
+

Draw the ellipse with radius r and focal points p1, p2. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style ‘@’ is used, black color is used by default); +
  • #’ for wire figure (boundary only); +
  • @’ for filling and boundary. +
+
+ +
+
MGL command: rhomb x1 y1 x2 y2 r ['col'='r']
+
MGL command: rhomb x1 y1 z1 x2 y2 z2 r ['col'='r']
+
Method on mglGraph: void Rhomb (mglPoint p1, mglPoint p2, mreal r, const char *col="r")
+
C function: void mgl_rhomb (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r, const char *col)
+

Draw the rhombus with width r and edge points p1, p2. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style ‘@’ is used, black color is used by default); +
  • #’ for wire figure (boundary only); +
  • @’ for filling and boundary. +
+
+ +
+
MGL command: arc x0 y0 x1 y1 a ['col'='r']
+
MGL command: arc x0 y0 z0 x1 y1 a ['col'='r']
+
MGL command: arc x0 y0 z0 xa ya za x1 y1 z1 a ['col'='r']
+
Method on mglGraph: void Arc (mglPoint p0, mglPoint p1, mreal a, const char *col="r")
+
Method on mglGraph: void Arc (mglPoint p0, mglPoint pa, mglPoint p1, mreal a, const char *col="r")
+
C function: void mgl_arc (HMGL gr, mreal x0, mreal y0, mreal x1, mreal y1, mreal a, const char *col)
+
C function: void mgl_arc_ext (HMGL gr, mreal x0, mreal y0, mreal z0, mreal xa, mreal ya, mreal za, mreal x1, mreal y1, mreal z1, mreal a, const char *col)
+

Draw the arc around axis pa (default is z-axis pa={0,0,1}) with center at p0 and starting from point p1. Parameter a set the angle of arc in degree. Parameter col may contain color of the arc and arrow style for arc edges. +

+ +
+
MGL command: polygon x0 y0 x1 y1 num ['col'='r']
+
MGL command: polygon x0 y0 z0 x1 y1 z1 num ['col'='r']
+
Method on mglGraph: void Polygon (mglPoint p0, mglPoint p1, int num, const char *col="r")
+
C function: void mgl_polygon (HMGL gr, mreal x0, mreal y0, mreal z0, mreal x1, mreal y1, mreal z1, int num, const char *col)
+

Draw the polygon with num edges starting from p1. The center of polygon is located in p0. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style ‘@’ is used, black color is used by default); +
  • #’ for wire figure (boundary only); +
  • @’ for filling and boundary. +
+
+ + +
+
MGL command: logo 'fname' [smooth=off]
+
Method on mglGraph: void Logo (const char *fname, bool smooth=false, const char *opt="")
+
Method on mglGraph: void Logo (long w, long h, const unsigned char *rgba, bool smooth=false, const char *opt="")
+
C function only: void mgl_logo (HMGL gr, long w, long h, const unsigned char *rgba, bool smooth, const char *opt)
+
C function: void mgl_logo_file (HMGL gr, const char *fname, bool smooth, const char *opt)
+

Draw bitmap (logo) along whole axis range, which can be changed by Command options. Bitmap can be loaded from file or specified as RGBA values for pixels. Parameter smooth set to draw bitmap without or with color interpolation. +

+ + +
+
MGL command: symbol x y 'id' ['fnt'='' size=-1]
+
MGL command: symbol x y z 'id' ['fnt'='' size=-1]
+
Method on mglGraph: void Symbol (mglPoint p, char id, const char *fnt="", mreal size=-1)
+
C function: void mgl_symbol (HMGL gr, mreal x, mreal y, mreal z, char id, const char *fnt, mreal size)
+

Draws user-defined symbol with name id at position p with style specifying by fnt. The size of font is set by size parameter (default is -1). The string fnt may contain color specification ended by ‘:’ symbol; styles ‘a’, ‘A’ to draw at absolute position {x, y} (supposed to be in range [0,1]) of picture (for ‘A’) or subplot/inplot (for ‘a’); and style ‘w’ to draw wired symbol. +

+ +
+
MGL command: symbol x y dx dy 'id' ['fnt'=':L' size=-1]
+
MGL command: symbol x y z dx dy dz 'id' ['fnt'=':L' size=-1]
+
Method on mglGraph: void Symbol (mglPoint p, mglPoint d, char id, const char *fnt="", mreal size=-1)
+
C function: void mgl_symbol_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const char *text, const char *fnt, mreal size)
+

The same as previous but symbol will be drawn rotated along direction d. +

+ +
+
MGL command: addsymbol 'id' xdat ydat
+
Method on mglGraph: void DefineSymbol (char id, const mglDataA &xdat, const mglDataA &ydat)
+
C function: void mgl_define_symbol (HMGL gr, HCDT xdat, HCDT ydat)
+

Add user-defined symbol with name id and contour {xdat, ydat}. You can use NAN values to set break (jump) of contour curve. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.8 Text printing

+ + + + + + + +

These functions draw the text. There are functions for drawing text in arbitrary place, in arbitrary direction and along arbitrary curve. MathGL can use arbitrary font-faces and parse many TeX commands (for more details see Font styles). All these functions have 2 variant: for printing 8-bit text (char *) and for printing Unicode text (wchar_t *). In first case the conversion into the current locale is used. So sometimes you need to specify it by setlocale() function. The size argument control the size of text: if positive it give the value, if negative it give the value relative to SetFontSize(). The font type (STIX, arial, courier, times and so on) can be selected by function LoadFont(). See Font settings. +

+

The font parameters are described by string. This string may set the text color ‘wkrgbcymhRGBCYMHW’ (see Color styles). Starting from MathGL v.2.3, you can set color gradient for text (see Color scheme). Also, after delimiter symbol ‘:’, it can contain characters of font type (‘rbiwou’) and/or align (‘LRCTV’) specification. The font types are: ‘r’ – roman (or regular) font, ‘i’ – italic style, ‘b’ – bold style, ‘w’ – wired style, ‘o’ – over-lined text, ‘u’ – underlined text. By default roman font is used. The align types are: ‘L’ – align left (default), ‘C’ – align center, ‘R’ – align right, ‘T’ – align under, ‘V’ – align center vertical. For example, string ‘b:iC’ correspond to italic font style for centered text which printed by blue color. +

+

If string contains symbols ‘aA’ then text is printed at absolute position {x, y} (supposed to be in range [0,1]) of picture (for ‘A’) or subplot/inplot (for ‘a’). If string contains symbol ‘@’ then box around text is drawn. +

+

See Text features, for sample code and picture. +

+
+
MGL command: text x y 'text' ['fnt'='' size=-1]
+
MGL command: text x y z 'text' ['fnt'='' size=-1]
+
Method on mglGraph: void Puts (mglPoint p, const char *text, const char *fnt=":C", mreal size=-1)
+
Method on mglGraph: void Putsw (mglPoint p, const wchar_t *text, const char *fnt=":C", mreal size=-1)
+
Method on mglGraph: void Puts (mreal x, mreal y, const char *text, const char *fnt=":AC", mreal size=-1)
+
Method on mglGraph: void Putsw (mreal x, mreal y, const wchar_t *text, const char *fnt=":AC", mreal size=-1)
+
C function: void mgl_puts (HMGL gr, mreal x, mreal y, mreal z, const char *text, const char *fnt, mreal size)
+
C function: void mgl_putsw (HMGL gr, mreal x, mreal y, mreal z, const wchar_t *text, const char *fnt, mreal size)
+

Draws the string text at position p with fonts specifying by the criteria fnt. The size of font is set by size parameter (default is -1). +

+ +
+
MGL command: text x y dx dy 'text' ['fnt'=':L' size=-1]
+
MGL command: text x y z dx dy dz 'text' ['fnt'=':L' size=-1]
+
Method on mglGraph: void Puts (mglPoint p, mglPoint d, const char *text, const char *fnt=":L", mreal size=-1)
+
Method on mglGraph: void Putsw (mglPoint p, mglPoint d, const wchar_t *text, const char *fnt=":L", mreal size=-1)
+
C function: void mgl_puts_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const char *text, const char *fnt, mreal size)
+
C function: void mgl_putsw_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const wchar_t *text, const char *fnt, mreal size)
+

Draws the string text at position p along direction d with specified size. Parameter fnt set text style and text position: under (‘T’) or above (‘t’) the line. +

+ +
+
MGL command: fgets x y 'fname' [n=0 'fnt'='' size=-1.4]
+
MGL command: fgets x y z 'fname' [n=0 'fnt'='' size=-1.4]
+

Draws unrotated n-th line of file fname at position {x,y,z} with specified size. By default parameters from font command are used. +

+ +
+
MGL command: text ydat 'text' ['fnt'='']
+
MGL command: text xdat ydat 'text' ['fnt'='']
+
MGL command: text xdat ydat zdat 'text' ['fnt'='']
+
Method on mglGraph: void Text (const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Text (const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *fnt="", const char *opt="")
+
C function: void mgl_text_y (HMGL gr, HCDT y, const char *text, const char *fnt, const char *opt)
+
C function: void mgl_textw_y (HMGL gr, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
+
C function: void mgl_text_xy (HCDT x, HCDT y, const char *text, const char *fnt, const char *opt)
+
C function: void mgl_textw_xy (HCDT x, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
+
C function: void mgl_text_xyz (HCDT x, HCDT y, HCDT z, const char *text, const char *fnt, const char *opt)
+
C function: void mgl_textw_xyz (HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *fnt, const char *opt)
+

The function draws text along the curve between points {x[i], y[i], z[i]} by font style fnt. The string fnt may contain symbols ‘t’ for printing the text under the curve (default), or ‘T’ for printing the text under the curve. The sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. If array x is not specified then its an automatic array is used with values equidistantly distributed in x-axis range (see Ranges (bounding box)). If array z is not specified then z[i] equal to minimal z-axis value is used. String opt contain command options (see Command options). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.9 Axis and Colorbar

+ + + + + + + +

These functions draw the “things for measuring”, like axis with ticks, colorbar with ticks, grid along axis, bounding box and labels for axis. For more information see Axis settings. +

+
+
MGL command: axis ['dir'='xyz' 'stl'='']
+
Method on mglGraph: void Axis (const char *dir="xyz", const char *stl="", const char *opt="")
+
C function: void mgl_axis (HMGL gr, const char *dir, const char *stl, const char *opt)
+

Draws axes with ticks (see Axis settings). Parameter dir may contain: +

    +
  • xyz’ for drawing axis in corresponding direction; +
  • XYZ’ for drawing axis in corresponding direction but with inverted positions of labels; +
  • ~’ or ‘_’ for disabling tick labels; +
  • U’ for disabling rotation of tick labels; +
  • ^’ for inverting default axis origin; +
  • !’ for disabling ticks tuning (see tuneticks); +
  • AKDTVISO’ for drawing arrow at the end of axis; +
  • a’ for forced adjusting of axis ticks; +
  • :’ for drawing lines through point (0,0,0); +
  • f’ for printing ticks labels in fixed format; +
  • E’ for using ‘E’ instead of ‘e’ in ticks labels; +
  • F’ for printing ticks labels in LaTeX format; +
  • +’ for printing ‘+’ for positive ticks; +
  • -’ for printing usual ‘-’ in ticks labels; +
  • 0123456789’ for precision at printing ticks labels. +
+

Styles of ticks and axis can be overrided by using stl string. Option value set the manual rotation angle for the ticks. See Axis and ticks, for sample code and picture. +

+ +
+
MGL command: colorbar ['sch'='']
+
Method on mglGraph: void Colorbar (const char *sch="")
+
C function: void mgl_colorbar (HMGL gr, const char *sch)
+

Draws colorbar. Parameter sch may contain: +

    +
  • color scheme (see Color scheme); +
  • <>^_’ for positioning at left, at right, at top or at bottom correspondingly; +
  • I’ for positioning near bounding (by default, is positioned at edges of subplot); +
  • A’ for using absolute coordinates; +
  • ~’ for disabling tick labels. +
  • !’ for disabling ticks tuning (see tuneticks); +
  • f’ for printing ticks labels in fixed format; +
  • E’ for using ‘E’ instead of ‘e’ in ticks labels; +
  • F’ for printing ticks labels in LaTeX format; +
  • +’ for printing ‘+’ for positive ticks; +
  • -’ for printing usual ‘-’ in ticks labels; +
  • 0123456789’ for precision at printing ticks labels. +
+

See Colorbars, for sample code and picture. +

+ +
+
MGL command: colorbar vdat ['sch'='']
+
Method on mglGraph: void Colorbar (const mglDataA &v, const char *sch="")
+
C function: void mgl_colorbar_val (HMGL gr, HCDT v, const char *sch)
+

The same as previous but with sharp colors sch (current palette if sch="") for values v. See contd sample, for sample code and picture. +

+ +
+
MGL command: colorbar 'sch' x y [w=1 h=1]
+
Method on mglGraph: void Colorbar (const char *sch, mreal x, mreal y, mreal w=1, mreal h=1)
+
C function: void mgl_colorbar_ext (HMGL gr, const char *sch, mreal x, mreal y, mreal w, mreal h)
+

The same as first one but at arbitrary position of subplot {x, y} (supposed to be in range [0,1]). Parameters w, h set the relative width and height of the colorbar. +

+ +
+
MGL command: colorbar vdat 'sch' x y [w=1 h=1]
+
Method on mglGraph: void Colorbar (const mglDataA &v, const char *sch, mreal x, mreal y, mreal w=1, mreal h=1)
+
C function: void mgl_colorbar_val_ext (HMGL gr, HCDT v, const char *sch, mreal x, mreal y, mreal w, mreal h)
+

The same as previous but with sharp colors sch (current palette if sch="") for values v. See contd sample, for sample code and picture. +

+ +
+
MGL command: grid ['dir'='xyz' 'pen'='B']
+
Method on mglGraph: void Grid (const char *dir="xyz", const char *pen="B", const char *opt="")
+
C function: void mgl_axis_grid (HMGL gr, const char *dir, const char *pen, const char *opt)
+

Draws grid lines perpendicular to direction determined by string parameter dir. If dir contain ‘!’ then grid lines will be drawn at coordinates of subticks also. The step of grid lines is the same as tick step for axis. The style of lines is determined by pen parameter (default value is dark blue solid line ‘B-’). +

+ +
+
MGL command: box ['stl'='k' ticks=on]
+
Method on mglGraph: void Box (const char *col="", bool ticks=true)
+
C function: void mgl_box (HMGL gr)
+
C function: void mgl_box_str (HMGL gr, const char *col, int ticks)
+

Draws bounding box outside the plotting volume with color col. If col contain ‘@’ then filled faces are drawn. At this first color is used for faces (default is light yellow), last one for edges. See Bounding box, for sample code and picture. +

+ +
+
MGL command: xlabel 'text' [pos=1]
+
MGL command: ylabel 'text' [pos=1]
+
MGL command: zlabel 'text' [pos=1]
+
MGL command: tlabel 'text' [pos=1]
+
MGL command: clabel 'text' [pos=1]
+
Method on mglGraph: void Label (char dir, const char *text, mreal pos=1, const char *opt="")
+
Method on mglGraph: void Label (char dir, const wchar_t *text, mreal pos=1, const char *opt="")
+
C function: void mgl_label (HMGL gr, char dir, const char *text, mreal pos, const char *opt)
+
C function: void mgl_labelw (HMGL gr, char dir, const wchar_t *text, mreal pos, const char *opt)
+

Prints the label text for axis dir=‘x’,‘y’,‘z’,‘t’,‘c’, where ‘t’ is “ternary” axis t=1-x-y; ‘c’ is color axis (should be called after colorbar). The position of label is determined by pos parameter. If pos=0 then label is printed at the center of axis. If pos>0 then label is printed at the maximum of axis. If pos<0 then label is printed at the minimum of axis. Option value set additional shifting of the label. See Text printing. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.10 Legend

+ + + + + + + +

These functions draw legend to the graph (useful for 1D plotting). Legend entry is a pair of strings: one for style of the line, another one with description text (with included TeX parsing). The arrays of strings may be used directly or by accumulating first to the internal arrays (by function addlegend) and further plotting it. The position of the legend can be selected automatic or manually (even out of bounding box). Parameters fnt and size specify the font style and size (see Font settings). Option value set the relative width of the line sample and the text indent. If line style string for entry is empty then the corresponding text is printed without indent. Parameter fnt may contain: +

    +
  • font style for legend text; +
  • A’ for positioning in absolute coordinates; +
  • ^’ for positioning outside of specified point; +
  • #’ for drawing box around legend; +
  • -’ for arranging legend entries horizontally; +
  • colors for face (1st one), for border (2nd one) and for text (last one). If less than 3 colors are specified then the color for border is black (for 2 and less colors), and the color for face is white (for 1 or none colors). +
+

See Legend sample, for sample code and picture. +

+
+
MGL command: legend [pos=3 'fnt'='#']
+
Method on mglGraph: void Legend (int pos=0x3, const char *fnt="#", const char *opt="")
+
C function: void mgl_legend (HMGL gr, int pos, const char *fnt, const char *opt)
+

Draws legend of accumulated legend entries by font fnt with size. Parameter pos sets the position of the legend: ‘0’ is bottom left corner, ‘1’ is bottom right corner, ‘2’ is top left corner, ‘3’ is top right corner (is default). Option value set the space between line samples and text (default is 0.1). +

+ +
+
MGL command: legend x y ['fnt'='#']
+
Method on mglGraph: void Legend (mreal x, mreal y, const char *fnt="#", const char *opt="")
+
C function: void mgl_legend_pos (HMGL gr, mreal x, mreal y, const char *fnt, const char *opt)
+

Draws legend of accumulated legend entries by font fnt with size. Position of legend is determined by parameter x, y which supposed to be normalized to interval [0,1]. Option value set the space between line samples and text (default is 0.1). +

+ +
+
MGL command: addlegend 'text' 'stl'
+
Method on mglGraph: void AddLegend (const char *text, const char *style)
+
Method on mglGraph: void AddLegend (const wchar_t *text, const char *style)
+
C function: void mgl_add_legend (HMGL gr, const char *text, const char *style)
+
C function: void mgl_add_legendw (HMGL gr, const wchar_t *text, const char *style)
+

Adds string text to internal legend accumulator. The style of described line and mark is specified in string style (see Line styles). +

+ +
+
MGL command: clearlegend
+
Method on mglGraph: void ClearLegend ()
+
C function: void mgl_clear_legend (HMGL gr)
+

Clears saved legend strings. +

+ +
+
MGL command: legendmarks val
+
Method on mglGraph: void SetLegendMarks (int num)
+
C function: void mgl_set_legend_marks (HMGL gr, int num)
+

Set the number of marks in the legend. By default 1 mark is used. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.11 1D plotting

+ + + + + + + + + + + + + + + + + + + + + + +

These functions perform plotting of 1D data. 1D means that data depended from only 1 parameter like parametric curve {x[i],y[i],z[i]}, i=1...n. By default (if absent) values of x[i] are equidistantly distributed in axis range, and z[i] equal to minimal z-axis value. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. +

+

String pen specifies the color and style of line and marks (see Line styles). By default (pen="") solid line with color from palette is used (see Palette and colors). Symbol ‘!’ set to use new color from palette for each point (not for each curve, as default). String opt contain command options (see Command options). +

+
+
MGL command: plot ydat ['stl'='']
+
MGL command: plot xdat ydat ['stl'='']
+
MGL command: plot xdat ydat zdat ['stl'='']
+
Method on mglGraph: void Plot (const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Plot (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Plot (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_plot (HMGL gr, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_plot_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_plot_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

These functions draw continuous lines between points {x[i], y[i], z[i]}. If pen contain ‘a’ then segments between points outside of axis range are drawn too. If pen contain ‘~’ then number of segments is reduce for quasi-straight curves. See also area, step, stem, tube, mark, error, belt, tens, tape, meshnum. See plot sample, for sample code and picture. +

+ +
+
MGL command: radar adat ['stl'='']
+
Method on mglGraph: void Radar (const mglDataA &a, const char *pen="", const char *opt="")
+
C function: void mgl_radar (HMGL gr, HCDT a, const char *pen, const char *opt)
+

This functions draws radar chart which is continuous lines between points located on an radial lines (like plot in Polar coordinates). Option value set the additional shift of data (i.e. the data a+value is used instead of a). If value<0 then r=max(0, -min(value). If pen containt ‘#’ symbol then "grid" (radial lines and circle for r) is drawn. If pen contain ‘a’ then segments between points outside of axis range are drawn too. See also plot, meshnum. See radar sample, for sample code and picture. +

+ +
+
MGL command: step ydat ['stl'='']
+
MGL command: step xdat ydat ['stl'='']
+
MGL command: step xdat ydat zdat ['stl'='']
+
Method on mglGraph: void Step (const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Step (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Step (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_step (HMGL gr, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_step_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_step_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

These functions draw continuous stairs for points to axis plane. If x.nx>y.nx then x set the edges of bars, rather than its central positions. See also plot, stem, tile, boxs, meshnum. See step sample, for sample code and picture. +

+ +
+
MGL command: tens ydat cdat ['stl'='']
+
MGL command: tens xdat ydat cdat ['stl'='']
+
MGL command: tens xdat ydat zdat cdat ['stl'='']
+
Method on mglGraph: void Tens (const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tens (const mglDataA &x, const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tens (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *pen="", const char *opt="")
+
C function: void mgl_tens (HMGL gr, HCDT y, HCDT c, const char *pen, const char *opt)
+
C function: void mgl_tens_xy (HMGL gr, HCDT x, HCDT y, HCDT c, const char *pen, const char *opt)
+
C function: void mgl_tens_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *pen, const char *opt)
+

These functions draw continuous lines between points {x[i], y[i], z[i]} with color defined by the special array c[i] (look like tension plot). String pen specifies the color scheme (see Color scheme) and style and/or width of line (see Line styles). If pen contain ‘a’ then segments between points outside of axis range are drawn too. If pen contain ‘~’ then number of segments is reduce for quasi-straight curves. See also plot, mesh, fall, meshnum. See tens sample, for sample code and picture. +

+ +
+
MGL command: tape ydat ['stl'='']
+
MGL command: tape xdat ydat ['stl'='']
+
MGL command: tape xdat ydat zdat ['stl'='']
+
Method on mglGraph: void Tape (const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tape (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tape (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_tape (HMGL gr, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_tape_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_tape_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

These functions draw tapes of normals for curve between points {x[i], y[i], z[i]}. Initial tape(s) was selected in x-y plane (for ‘x’ in pen) and/or y-z plane (for ‘x’ in pen). The width of tape is proportional to barwidth and can be changed by option value. See also plot, flow, barwidth. See tape sample, for sample code and picture. +

+ +
+
MGL command: area ydat ['stl'='']
+
MGL command: area xdat ydat ['stl'='']
+
MGL command: area xdat ydat zdat ['stl'='']
+
Method on mglGraph: void Area (const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Area (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Area (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_area (HMGL gr, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_area_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_area_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

These functions draw continuous lines between points and fills it to axis plane. Also you can use gradient filling if number of specified colors is equal to 2*number of curves. If pen contain ‘#’ then wired plot is drawn. If pen contain ‘a’ then segments between points outside of axis range are drawn too. See also plot, bars, stem, region. See area sample, for sample code and picture. +

+ +
+
MGL command: region ydat1 ydat2 ['stl'='']
+
MGL command: region xdat ydat1 ydat2 ['stl'='']
+
MGL command: region xdat1 ydat1 xdat2 ydat2 ['stl'='']
+
MGL command: region xdat1 ydat1 zdat1 xdat2 ydat2 zdat2 ['stl'='']
+
Method on mglGraph: void Region (const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Method on mglGraph: void Region (const mglDataA &x, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Method on mglGraph: void Region (const mglDataA &x1, const mglDataA &y1, const mglDataA &x2, const mglDataA &y2, const char *pen="", const char *opt="")
+
Method on mglGraph: void Region (const mglDataA &x1, const mglDataA &y1, const mglDataA &z1, const mglDataA &x2, const mglDataA &y2, const mglDataA &z2, const char *pen="", const char *opt="")
+
C function: void mgl_region (HMGL gr, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
C function: void mgl_region_xy (HMGL gr, HCDT x, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
C function: void mgl_region_3d (HMGL gr, HCDT x1, HCDT y1, HCDT z1, HCDT x2, HCDT y2, HCDT z2, const char *pen, const char *opt)
+

These functions fill area between 2 curves. Dimensions of arrays y1 and y2 must be equal. Also you can use gradient filling if number of specified colors is equal to 2*number of curves. If for 2D version pen contain symbol ‘i’ then only area with y1<y<y2 will be filled else the area with y2<y<y1 will be filled too. If pen contain ‘#’ then wired plot is drawn. If pen contain ‘a’ then segments between points outside of axis range are drawn too. See also area, bars, stem. See region sample, for sample code and picture. +

+ +
+
MGL command: stem ydat ['stl'='']
+
MGL command: stem xdat ydat ['stl'='']
+
MGL command: stem xdat ydat zdat ['stl'='']
+
Method on mglGraph: void Stem (const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Stem (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Stem (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_stem (HMGL gr, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_stem_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_stem_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

These functions draw vertical lines from points to axis plane. See also area, bars, plot, mark. See stem sample, for sample code and picture. +

+ +
+
MGL command: bars ydat ['stl'='']
+
MGL command: bars xdat ydat ['stl'='']
+
MGL command: bars xdat ydat zdat ['stl'='']
+
Method on mglGraph: void Bars (const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Bars (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Bars (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_bars (HMGL gr, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_bars_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_bars_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

These functions draw vertical bars from points to axis plane. Parameter pen can contain: +

    +
  • a’ for drawing lines one above another (like summation); +
  • f’ for drawing waterfall chart, which show the cumulative effect of sequential positive or negative values; +
  • F’ for using fixed (minimal) width for all bars; +
  • <’, ‘^’ or ‘>’ for aligning boxes left, right or centering them at its x-coordinates. +
+

You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. If x.nx>y.nx then x set the edges of bars, rather than its central positions. See also barh, cones, area, stem, chart, barwidth. See bars sample, for sample code and picture. +

+ +
+
MGL command: barh vdat ['stl'='']
+
MGL command: barh ydat vdat ['stl'='']
+
Method on mglGraph: void Barh (const mglDataA &v, const char *pen="", const char *opt="")
+
Method on mglGraph: void Barh (const mglDataA &y, const mglDataA &v, const char *pen="", const char *opt="")
+
C function: void mgl_barh (HMGL gr, HCDT v, const char *pen, const char *opt)
+
C function: void mgl_barh_xy (HMGL gr, HCDT y, HCDT v, const char *pen, const char *opt)
+

These functions draw horizontal bars from points to axis plane. Parameter pen can contain: +

    +
  • a’ for drawing lines one above another (like summation); +
  • f’ for drawing waterfall chart, which show the cumulative effect of sequential positive or negative values; +
  • F’ for using fixed (minimal) width for all bars; +
  • <’, ‘^’ or ‘>’ for aligning boxes left, right or centering them at its x-coordinates. +
+

You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. If x.nx>y.nx then x set the edges of bars, rather than its central positions. See also bars, barwidth. See barh sample, for sample code and picture. +

+ +
+
MGL command: cones ydat ['stl'='']
+
MGL command: cones xdat ydat ['stl'='']
+
MGL command: cones xdat ydat zdat ['stl'='']
+
Method on mglGraph: void Cones (const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Cones (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Method on mglGraph: void Cones (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_cones (HMGL gr, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_cones_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
C function: void mgl_cones_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

These functions draw cones from points to axis plane. If string contain symbol ‘a’ then cones are drawn one above another (like summation). You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. Parameter pen can contain: +

    +
  • @’ for drawing edges; +
  • #’ for wired cones; +
  • t’ for drawing tubes/cylinders instead of cones/prisms; +
  • 4’, ‘6’, ‘8’ for drawing square, hex- or octo-prism instead of cones; +
  • <’, ‘^’ or ‘>’ for aligning boxes left, right or centering them at its x-coordinates. +
+

See also bars, cone, barwidth. See cones sample, for sample code and picture. +

+ + + +
+
MGL command: chart adat ['col'='']
+
Method on mglGraph: void Chart (const mglDataA &a, const char *col="", const char *opt="")
+
C function: void mgl_chart (HMGL gr, HCDT a, const char *col, const char *opt)
+

The function draws colored stripes (boxes) for data in array a. The number of stripes is equal to the number of rows in a (equal to a.ny). The color of each next stripe is cyclically changed from colors specified in string col or in palette Pal (see Palette and colors). Spaces in colors denote transparent “color” (i.e. corresponding stripe(s) are not drawn). The stripe width is proportional to value of element in a. Chart is plotted only for data with non-negative elements. If string col have symbol ‘#’ then black border lines are drawn. The most nice form the chart have in 3d (after rotation of coordinates) or in cylindrical coordinates (becomes so called Pie chart). See chart sample, for sample code and picture. +

+ +
+
MGL command: boxplot adat ['stl'='']
+
MGL command: boxplot xdat adat ['stl'='']
+
Method on mglGraph: void BoxPlot (const mglDataA &a, const char *pen="", const char *opt="")
+
Method on mglGraph: void BoxPlot (const mglDataA &x, const mglDataA &a, const char *pen="", const char *opt="")
+
C function: void mgl_boxplot (HMGL gr, HCDT a, const char *pen, const char *opt)
+
C function: void mgl_boxplot_xy (HMGL gr, HCDT x, HCDT a, const char *pen, const char *opt)
+

These functions draw boxplot (also known as a box-and-whisker diagram) at points x[i]. This is five-number summaries of data a[i,j] (minimum, lower quartile (Q1), median (Q2), upper quartile (Q3) and maximum) along second (j-th) direction. If pen contain ‘<’, ‘^’ or ‘>’ then boxes will be aligned left, right or centered at its x-coordinates. See also plot, error, bars, barwidth. See boxplot sample, for sample code and picture. +

+ +
+
MGL command: candle vdat1 ['stl'='']
+
MGL command: candle vdat1 vdat2 ['stl'='']
+
MGL command: candle vdat1 ydat1 ydat2 ['stl'='']
+
MGL command: candle vdat1 vdat2 ydat1 ydat2 ['stl'='']
+
MGL command: candle xdat vdat1 vdat2 ydat1 ydat2 ['stl'='']
+
Method on mglGraph: void Candle (const mglDataA &v1, const char *pen="", const char *opt="")
+
Method on mglGraph: void Candle (const mglDataA &v1, const mglDataA &v2, const char *pen="", const char *opt="")
+
Method on mglGraph: void Candle (const mglDataA &v1, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Method on mglGraph: void Candle (const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Method on mglGraph: void Candle (const mglDataA &x, const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
C function: void mgl_candle (HMGL gr, HCDT v1, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
C function: void mgl_candle_yv (HMGL gr, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
C function: void mgl_candle_xyv (HMGL gr, HCDT x, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt)
+

These functions draw candlestick chart at points x[i]. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. Wire (or white) candle correspond to price growth v1[i]<v2[i], opposite case – solid (or dark) candle. You can give different colors for growth and decrease values if number of specified colors is equal to 2. If pen contain ‘#’ then the wire candle will be used even for 2-color scheme. "Shadows" show the minimal y1 and maximal y2 prices. If v2 is absent then it is determined as v2[i]=v1[i+1]. See also plot, bars, ohlc, barwidth. See candle sample, for sample code and picture. +

+ +
+
MGL command: ohlc odat hdat ldat cdat ['stl'='']
+
MGL command: ohlc xdat odat hdat ldat cdat ['stl'='']
+
Method on mglGraph: void OHLC (const mglDataA &o, const mglDataA &h, const mglDataA &l, const mglDataA &c, const char *pen="", const char *opt="")
+
Method on mglGraph: void OHLC (const mglDataA &x, const mglDataA &o, const mglDataA &h, const mglDataA &l, const mglDataA &c, const char *pen="", const char *opt="")
+
C function: void mgl_ohlc (HMGL gr, HCDT o, HCDT h, HCDT l, HCDT c, const char *pen, const char *opt)
+
C function: void mgl_ohlc_x (HMGL gr, HCDT x, HCDT o, HCDT h, HCDT l, HCDT c, const char *pen, const char *opt)
+

These functions draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high h) and minimal(low l) values, as well as horizontal lines before/after vertical line for initial(open o)/final(close c) values of some process (usually price). You can give different colors for up and down values (when closing values higher or not as in previous point) if number of specified colors is equal to 2*number of curves. See also candle, plot, barwidth. See ohlc sample, for sample code and picture. +

+ + +
+
MGL command: error ydat yerr ['stl'='']
+
MGL command: error xdat ydat yerr ['stl'='']
+
MGL command: error xdat ydat xerr yerr ['stl'='']
+
Method on mglGraph: void Error (const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")
+
Method on mglGraph: void Error (const mglDataA &x, const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")
+
Method on mglGraph: void Error (const mglDataA &x, const mglDataA &y, const mglDataA &ex, const mglDataA &ey, const char *pen="", const char *opt="")
+
C function: void mgl_error (HMGL gr, HCDT y, HCDT ey, const char *pen, const char *opt)
+
C function: void mgl_error_xy (HMGL gr, HCDT x, HCDT y, HCDT ey, const char *pen, const char *opt)
+
C function: void mgl_error_exy (HMGL gr, HCDT x, HCDT y, HCDT ex, HCDT ey, const char *pen, const char *opt)
+

These functions draw error boxes {ex[i], ey[i]} at points {x[i], y[i]}. This can be useful, for example, in experimental points, or to show numeric error or some estimations and so on. If string pen contain symbol ‘@’ than large semitransparent mark is used instead of error box. See also plot, mark. See error sample, for sample code and picture. +

+ +
+
MGL command: mark ydat rdat ['stl'='']
+
MGL command: mark xdat ydat rdat ['stl'='']
+
MGL command: mark xdat ydat zdat rdat ['stl'='']
+
Method on mglGraph: void Mark (const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Method on mglGraph: void Mark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Method on mglGraph: void Mark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")
+
C function: void mgl_mark_y (HMGL gr, HCDT y, HCDT r, const char *pen, const char *opt)
+
C function: void mgl_mark_xy (HMGL gr, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt)
+
C function: void mgl_mark_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt)
+

These functions draw marks with size r[i]*marksize at points {x[i], y[i], z[i]}. If you need to draw markers of the same size then you can use plot function with empty line style ‘ ’. For markers with size in axis range use error with style ‘@’. See also plot, textmark, error, stem, meshnum. See mark sample, for sample code and picture. +

+ +
+
MGL command: textmark ydat 'txt' ['stl'='']
+
MGL command: textmark ydat rdat 'txt' ['stl'='']
+
MGL command: textmark xdat ydat rdat 'txt' ['stl'='']
+
MGL command: textmark xdat ydat zdat rdat 'txt' ['stl'='']
+
Method on mglGraph: void TextMark (const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void TextMark (const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void TextMark (const mglDataA &y, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void TextMark (const mglDataA &y, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
+
C function: void mgl_textmark (HMGL gr, HCDT y, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_textmarkw (HMGL gr, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
+
C function: void mgl_textmark_yr (HMGL gr, HCDT y, HCDT r, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_textmarkw_yr (HMGL gr, HCDT y, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
+
C function: void mgl_textmark_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_textmarkw_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
+
C function: void mgl_textmark_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_textmarkw_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
+

These functions draw string txt as marks with size proportional to r[i]*marksize at points {x[i], y[i], z[i]}. By default (if omitted) r[i]=1. See also plot, mark, stem, meshnum. See textmark sample, for sample code and picture. +

+ +
+
MGL command: label ydat 'txt' ['stl'='']
+
MGL command: label xdat ydat 'txt' ['stl'='']
+
MGL command: label xdat ydat zdat 'txt' ['stl'='']
+
Method on mglGraph: void Label (const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Label (const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *txt, const char *fnt="", const char *opt="")
+
C function: void mgl_label (HMGL gr, HCDT y, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_labelw (HMGL gr, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
+
C function: void mgl_label_xy (HMGL gr, HCDT x, HCDT y, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_labelw_xy (HMGL gr, HCDT x, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
+
C function: void mgl_label_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_labelw_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const wchar_t *txt, const char *fnt, const char *opt)
+

These functions draw string txt at points {x[i], y[i], z[i]}. If string txt contain ‘%x’, ‘%y’, ‘%z’ or ‘%n’ then it will be replaced by the value of x-,y-,z-coordinate of the point or its index. String fnt may contain: +

    +
  • font style Font styles; +
  • f’ for fixed format of printed numbers; +
  • E’ for using ‘E’ instead of ‘e’; +
  • F’ for printing in LaTeX format; +
  • +’ for printing ‘+’ for positive numbers; +
  • -’ for printing usual ‘-’; +
  • 0123456789’ for precision at printing numbers. +
+

See also plot, mark, textmark, table. See label sample, for sample code and picture. +

+ +
+
MGL command: table vdat 'txt' ['stl'='#']
+
MGL command: table x y vdat 'txt' ['stl'='#']
+
Method on mglGraph: void Table (const mglDataA &val, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Table (const mglDataA &val, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Table (mreal x, mreal y, const mglDataA &val, const char *txt, const char *fnt="", const char *opt="")
+
Method on mglGraph: void Table (mreal x, mreal y, const mglDataA &val, const wchar_t *txt, const char *fnt="", const char *opt="")
+
C function: void mgl_table (HMGL gr, mreal x, mreal y, HCDT val, const char *txt, const char *fnt, const char *opt)
+
C function: void mgl_tablew (HMGL gr, mreal x, mreal y, HCDT val, const wchar_t *txt, const char *fnt, const char *opt)
+

These functions draw table with values of val and captions from string txt (separated by newline symbol ‘\n’) at points {x, y} (default at {0,0}) related to current subplot. String fnt may contain: +

    +
  • font style Font styles; +
  • #’ for drawing cell borders; +
  • |’ for limiting table widh by subplot one (equal to option ‘value 1’); +
  • =’ for equal width of all cells; +
  • f’ for fixed format of printed numbers; +
  • E’ for using ‘E’ instead of ‘e’; +
  • F’ for printing in LaTeX format; +
  • +’ for printing ‘+’ for positive numbers; +
  • -’ for printing usual ‘-’; +
  • 0123456789’ for precision at printing numbers. +
+

Option value set the width of the table (default is 1). See also plot, label. See table sample, for sample code and picture. +

+ +
+
MGL command: iris dats 'ids' ['stl'='']
+
MGL command: iris dats rngs 'ids' ['stl'='']
+
Method on mglGraph: void Iris (const mglDataA &dats, const char *ids, const char *stl="", const char *opt="")
+
Method on mglGraph: void Iris (const mglDataA &dats, const wchar_t *ids, const char *stl="", const char *opt="")
+
Method on mglGraph: void Iris (const mglDataA &dats, const mglDataA &rngs, const char *ids, const char *stl="", const char *opt="")
+
Method on mglGraph: void Iris (const mglDataA &dats, const mglDataA &rngs, const wchar_t *ids, const char *stl="", const char *opt="")
+
C function: void mgl_iris_1 (HMGL gr, HCDT dats, const char *ids, const char *stl, const char *opt)
+
C function: void mgl_irisw_1 (HMGL gr, HCDT dats, const wchar_t *ids, const char *stl, const char *opt)
+
C function: void mgl_iris (HMGL gr, HCDT dats, HCDT rngs, const char *ids, const char *stl, const char *opt)
+
C function: void mgl_irisw (HMGL gr, HCDT dats, HCDT rngs, const wchar_t *ids, const char *stl, const char *opt)
+

Draws Iris plots for determining cross-dependences of data arrays dats (see http://en.wikipedia.org/wiki/Iris_flower_data_set). Data rngs of size 2*dats.nx provide manual axis ranges for each column. String ids contain column names, separated by ‘;’ symbol. Option value set the text size for column names. You can add another data set to existing Iris plot by providing the same ranges rngs and empty column names ids. See also plot. See iris sample, for sample code and picture. +

+ +
+
MGL command: tube ydat rdat ['stl'='']
+
MGL command: tube ydat rval ['stl'='']
+
MGL command: tube xdat ydat rdat ['stl'='']
+
MGL command: tube xdat ydat rval ['stl'='']
+
MGL command: tube xdat ydat zdat rdat ['stl'='']
+
MGL command: tube xdat ydat zdat rval ['stl'='']
+
Method on mglGraph: void Tube (const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tube (const mglDataA &y, mreal r, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, mreal r, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")
+
Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &z, mreal r, const char *pen="", const char *opt="")
+
C function: void mgl_tube_r (HMGL gr, HCDT y, HCDT r, const char *pen, const char *opt)
+
C function: void mgl_tube (HMGL gr, HCDT y, mreal r, const char *pen, const char *opt)
+
C function: void mgl_tube_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt)
+
C function: void mgl_tube_xy (HMGL gr, HCDT x, HCDT y, mreal r, const char *pen, const char *opt)
+
C function: void mgl_tube_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt)
+
C function: void mgl_tube_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, mreal r, const char *pen, const char *opt)
+

These functions draw the tube with variable radius r[i] along the curve between points {x[i], y[i], z[i]}. Option value set the number of segments at cross-section (default is 25). See also plot. See tube sample, for sample code and picture. +

+ +
+
MGL command: torus rdat zdat ['stl'='']
+
Method on mglGraph: void Torus (const mglDataA &r, const mglDataA &z, const char *pen="", const char *opt="")
+
C function: void mgl_torus (HMGL gr, HCDT r, HCDT z, const char *pen, const char *opt)
+

These functions draw surface which is result of curve {r, z} rotation around axis. If string pen contain symbols ‘x’ or ‘z’ then rotation axis will be set to specified direction (default is ‘y’). If string pen have symbol ‘#’ then wire plot is produced. If string pen have symbol ‘.’ then plot by dots is produced. See also plot, axial. See torus sample, for sample code and picture. +

+ +
+
MGL command: lamerey x0 ydat ['stl'='']
+
MGL command: lamerey x0 'y(x)' ['stl'='']
+
Method on mglGraph: void Lamerey (double x0, const mglDataA &y, const char *stl="", const char *opt="")
+
Method on mglGraph: void Lamerey (double x0, const char *y, const char *stl="", const char *opt="")
+
C function: void mgl_lamerey_dat (HMGL gr, double x0, HCDT y, const char *stl, const char *opt)
+
C function: void mgl_lamerey_str (HMGL gr, double x0, const char *y, const char *stl, const char *opt)
+

These functions draw Lamerey diagram for mapping x_new = y(x_old) starting from point x0. String stl may contain line style, symbol ‘v’ for drawing arrows, symbol ‘~’ for disabling first segment. Option value set the number of segments to be drawn (default is 20). See also plot, fplot, bifurcation, pmap. See lamerey sample, for sample code and picture. +

+ +
+
MGL command: bifurcation dx ydat ['stl'='']
+
MGL command: bifurcation dx 'y(x)' ['stl'='']
+
Method on mglGraph: void Bifurcation (double dx, const mglDataA &y, const char *stl="", const char *opt="")
+
Method on mglGraph: void Bifurcation (double dx, const char *y, const char *stl="", const char *opt="")
+
C function: void mgl_bifurcation_dat (HMGL gr, double dx, HCDT y, const char *stl, const char *opt)
+
C function: void mgl_bifurcation_str (HMGL gr, double dx, const char *y, const char *stl, const char *opt)
+

These functions draw bifurcation diagram for mapping x_new = y(x_old). Parameter dx set the accuracy along x-direction. String stl set color. Option value set the number of stationary points (default is 1024). See also plot, fplot, lamerey. See bifurcation sample, for sample code and picture. +

+ +
+
MGL command: pmap ydat sdat ['stl'='']
+
MGL command: pmap xdat ydat sdat ['stl'='']
+
MGL command: pmap xdat ydat zdat sdat ['stl'='']
+
Method on mglGraph: void Pmap (const mglDataA &y, const mglDataA &s, const char *stl="", const char *opt="")
+
Method on mglGraph: void Pmap (const mglDataA &x, const mglDataA &y, const mglDataA &s, const char *stl="", const char *opt="")
+
Method on mglGraph: void Pmap (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &s, const char *stl="", const char *opt="")
+
C function: void mgl_pmap (HMGL gr, HMDT y, HCDT s, const char *stl, const char *opt)
+
C function: void mgl_pmap_xy (HMGL gr, HCDT x, HMDT y, HCDT s, const char *stl, const char *opt)
+
C function: void mgl_pmap_xyz (HMGL gr, HCDT x, HMDT y, HCDT z, HCDT s, const char *stl, const char *opt)
+

These functions draw Poincare map for curve {x, y, z} at surface s=0. Basically, it show intersections of the curve and the surface. String stl set the style of marks. See also plot, mark, lamerey. See pmap sample, for sample code and picture. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.12 2D plotting

+ + + + + + + + + + + + + + + +

These functions perform plotting of 2D data. 2D means that data depend from 2 independent parameters like matrix f(x_i,y_j), i=1...n, j=1...m. By default (if absent) values of x, y are equidistantly distributed in axis range. The plots are drawn for each z slice of the data. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: surf zdat ['sch'='']
+
MGL command: surf xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Surf (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_surf (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_surf_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]}. If string sch have symbol ‘#’ then grid lines are drawn. If string sch have symbol ‘.’ then plot by dots is produced. See also mesh, dens, belt, tile, boxs, surfc, surfa. See surf sample, for sample code and picture. +

+ +
+
MGL command: mesh zdat ['sch'='']
+
MGL command: mesh xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Mesh (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Mesh (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_mesh (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_mesh_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws mesh lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. See also surf, fall, meshnum, cont, tens. See mesh sample, for sample code and picture. +

+ +
+
MGL command: fall zdat ['sch'='']
+
MGL command: fall xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Fall (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Fall (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_fall (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_fall_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws fall lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. This plot can be used for plotting several curves shifted in depth one from another. If sch contain ‘x’ then lines are drawn along x-direction else (by default) lines are drawn along y-direction. See also belt, mesh, tens, meshnum. See fall sample, for sample code and picture. +

+ +
+
MGL command: belt zdat ['sch'='']
+
MGL command: belt xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Belt (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Belt (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_belt (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_belt_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws belts for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. This plot can be used as 3d generalization of plot). If sch contain ‘x’ then belts are drawn along x-direction else (by default) belts are drawn along y-direction. See also fall, surf, beltc, plot, meshnum. See belt sample, for sample code and picture. +

+ +
+
MGL command: boxs zdat ['sch'='']
+
MGL command: boxs xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Boxs (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Boxs (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_boxs (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_boxs_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws vertical boxes for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Symbol ‘@’ in sch set to draw filled boxes. See also surf, dens, tile, step. See boxs sample, for sample code and picture. +

+ +
+
MGL command: tile zdat ['sch'='']
+
MGL command: tile xdat ydat zdat ['sch'='']
+
MGL command: tile xdat ydat zdat cdat ['sch'='']
+
Method on mglGraph: void Tile (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Tile (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Tile (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_tile (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_tile_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_tile_xyc (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j] (c=z if c is not provided). If string sch contain style ‘x’ or ‘y’ then tiles will be oriented perpendicular to x- or y-axis. Such plot can be used as 3d generalization of step. See also surf, boxs, step, tiles. See tile sample, for sample code and picture. +

+ +
+
MGL command: dens zdat ['sch'='']
+
MGL command: dens xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Dens (const mglDataA &z, const char *sch="", const char *opt="", mreal zVal=NAN)
+
Method on mglGraph: void Dens (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="", mreal zVal=NAN)
+
C function: void mgl_dens (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_dens_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws density plot for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z equal to minimal z-axis value. If string sch have symbol ‘#’ then grid lines are drawn. If string sch have symbol ‘.’ then plot by dots is produced. See also surf, cont, contf, boxs, tile, dens[xyz]. See dens sample, for sample code and picture. +

+ +
+
MGL command: cont vdat zdat ['sch'='']
+
MGL command: cont vdat xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Cont (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Cont (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_cont_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_cont_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k], or at z equal to minimal z-axis value if sch contain symbol ‘_’. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. If string sch have symbol ‘t’ or ‘T’ then contour labels v[k] will be drawn below (or above) the contours. See also dens, contf, contd, axial, cont[xyz]. See cont sample, for sample code and picture. +

+ +
+
MGL command: cont zdat ['sch'='']
+
MGL command: cont xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Cont (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Cont (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_cont (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_cont_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). If string sch contain symbol ‘.’ then only contours at levels with saddle points will be drawn. +

+ +
+
MGL command: contf vdat zdat ['sch'='']
+
MGL command: contf vdat xdat ydat zdat ['sch'='']
+
Method on mglGraph: void ContF (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void ContF (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_contf_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_contf_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k], or at z equal to minimal z-axis value if sch contain symbol ‘_’. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v (must be v.nx>2). See also dens, cont, contd, contf[xyz]. See contf sample, for sample code and picture. +

+ +
+
MGL command: contf zdat ['sch'='']
+
MGL command: contf xdat ydat zdat ['sch'='']
+
Method on mglGraph: void ContF (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void ContF (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_contf (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_contf_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: contd vdat zdat ['sch'='']
+
MGL command: contd vdat xdat ydat zdat ['sch'='']
+
Method on mglGraph: void ContD (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void ContD (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_contd_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_contd_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k] (or at z equal to minimal z-axis value if sch contain symbol ‘_’) with manual colors. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v (must be v.nx>2). String sch sets the contour colors: the color of k-th contour is determined by character sch[k%strlen(sch)]. See also dens, cont, contf. See contd sample, for sample code and picture. +

+ +
+
MGL command: contd zdat ['sch'='']
+
MGL command: contd xdat ydat zdat ['sch'='']
+
Method on mglGraph: void ContD (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void ContD (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_contd (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_contd_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: contp vdat xdat ydat zdat adat ['sch'='']
+
Method on mglGraph: void ContP (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
C function: void mgl_contp_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

The function draws contour lines on surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Contours are plotted for a[i,j]=v[k] where v[k] are values of data array v. If string sch have symbol ‘t’ or ‘T’ then contour labels v[k] will be drawn below (or above) the contours. If string sch have symbol ‘f’ then solid contours will be drawn. See also cont, contf, surfc, cont[xyz].

+ +
+
MGL command: contp xdat ydat zdat adat ['sch'='']
+
Method on mglGraph: void ContP (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
C function: void mgl_contp (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ + +
+
MGL command: contv vdat zdat ['sch'='']
+
MGL command: contv vdat xdat ydat zdat ['sch'='']
+
Method on mglGraph: void ContV (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void ContV (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_contv_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_contv_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws vertical cylinder (tube) at contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k], or at z equal to minimal z-axis value if sch contain symbol ‘_’. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. See also cont, contf. See contv sample, for sample code and picture. +

+ +
+
MGL command: contv zdat ['sch'='']
+
MGL command: contv xdat ydat zdat ['sch'='']
+
Method on mglGraph: void ContV (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void ContV (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_contv (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_contv_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: axial vdat zdat ['sch'='']
+
MGL command: axial vdat xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Axial (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Axial (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_axial_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_axial_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws surface which is result of contour plot rotation for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. If string sch have symbol ‘#’ then wire plot is produced. If string sch have symbol ‘.’ then plot by dots is produced. If string contain symbols ‘x’ or ‘z’ then rotation axis will be set to specified direction (default is ‘y’). See also cont, contf, torus, surf3. See axial sample, for sample code and picture. +

+ +
+
MGL command: axial zdat ['sch'='']
+
MGL command: axial xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Axial (const mglDataA &z, const char *sch="", const char *opt="", int num=3)
+
Method on mglGraph: void Axial (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="", int num=3)
+
C function: void mgl_axial (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_axial_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 3). +

+ +
+
MGL command: grid2 zdat ['sch'='']
+
MGL command: grid2 xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Grid (const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Grid (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_grid (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_grid_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws grid lines for density plot of surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z equal to minimal z-axis value. See also dens, cont, contf, grid3, meshnum. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.13 3D plotting

+ + + + + + + + + +

These functions perform plotting of 3D data. 3D means that data depend from 3 independent parameters like matrix f(x_i,y_j,z_k), i=1...n, j=1...m, k=1...l. By default (if absent) values of x, y, z are equidistantly distributed in axis range. The minor dimensions of arrays x, y, z, a should be equal x.nx=a.nx && y.nx=a.ny && z.nz=a.nz or x.nx=y.nx=z.nx=a.nx && x.ny=y.ny=z.ny=a.ny && x.nz=y.nz=z.nz=a.nz. Arrays x, y and z can be vectors (not matrices as a). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: surf3 adat val ['sch'='']
+
MGL command: surf3 xdat ydat zdat adat val ['sch'='']
+
Method on mglGraph: void Surf3 (mreal val, const mglDataA &a, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3 (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
C function: void mgl_surf3_val (HMGL gr, mreal val, HCDT a, const char *sch, const char *opt)
+
C function: void mgl_surf3_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. If string contain ‘#’ then wire plot is produced. If string sch have symbol ‘.’ then plot by dots is produced. Note, that there is possibility of incorrect plotting due to uncertainty of cross-section defining if there are two or more isosurface intersections inside one cell. See also cloud, dens3, surf3c, surf3a, axial. See surf3 sample, for sample code and picture. +

+ +
+
MGL command: surf3 adat ['sch'='']
+
MGL command: surf3 xdat ydat zdat adat ['sch'='']
+
Method on mglGraph: void Surf3 (const mglDataA &a, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
C function: void mgl_surf3 (HMGL gr, HCDT a, const char *sch, const char *opt)
+
C function: void mgl_surf3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. Here num is equal to parameter value in options opt (default is 3). +

+ +
+
MGL command: cloud adat ['sch'='']
+
MGL command: cloud xdat ydat zdat adat ['sch'='']
+
Method on mglGraph: void Cloud (const mglDataA &a, const char *sch="", const char *opt="")
+
Method on mglGraph: void Cloud (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
C function: void mgl_cloud (HMGL gr, HCDT a, const char *sch, const char *opt)
+
C function: void mgl_cloud_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

The function draws cloud plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). This plot is a set of cubes with color and transparency proportional to value of a. The resulting plot is like cloud – low value is transparent but higher ones are not. The number of plotting cells depend on meshnum. If string sch contain symbol ‘.’ then lower quality plot will produced with much low memory usage. If string sch contain symbol ‘i’ then transparency will be inversed, i.e. higher become transparent and lower become not transparent. See also surf3, meshnum. See cloud sample, for sample code and picture. +

+ +
+
MGL command: dens3 adat ['sch'='' sval=-1]
+
MGL command: dens3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Method on mglGraph: void Dens3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Method on mglGraph: void Dens3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
C function: void mgl_dens3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
C function: void mgl_dens3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

The function draws density plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Density is plotted at slice sVal in direction {‘x’, ‘y’, ‘z’} if sch contain corresponding symbol (by default, ‘y’ direction is used). If string stl have symbol ‘#’ then grid lines are drawn. See also cont3, contf3, dens, grid3. See dens3 sample, for sample code and picture. +

+ +
+
MGL command: cont3 vdat adat ['sch'='' sval=-1]
+
MGL command: cont3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+
Method on mglGraph: void Cont3 (const mglDataA &v, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Method on mglGraph: void Cont3 (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
C function: void mgl_cont3_val (HMGL gr, HCDT v, HCDT a, const char *sch, mreal sVal, const char *opt)
+
C function: void mgl_cont3_xyz_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

The function draws contour plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Contours are plotted for values specified in array v at slice sVal in direction {‘x’, ‘y’, ‘z’} if sch contain corresponding symbol (by default, ‘y’ direction is used). If string sch have symbol ‘#’ then grid lines are drawn. If string sch have symbol ‘t’ or ‘T’ then contour labels will be drawn below (or above) the contours. See also dens3, contf3, cont, grid3. See cont3 sample, for sample code and picture. +

+ +
+
MGL command: cont3 adat ['sch'='' sval=-1]
+
MGL command: cont3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Method on mglGraph: void Cont3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="", const char *opt="")
+
Method on mglGraph: void Cont3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
C function: void mgl_cont3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
C function: void mgl_cont3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: contf3 vdat adat ['sch'='' sval=-1]
+
MGL command: contf3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+
Method on mglGraph: void Contf3 (const mglDataA &v, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Method on mglGraph: void Contf3 (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
C function: void mgl_contf3_val (HMGL gr, HCDT v, HCDT a, const char *sch, mreal sVal, const char *opt)
+
C function: void mgl_contf3_xyz_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

The function draws solid (or filled) contour plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Contours are plotted for values specified in array v at slice sVal in direction {‘x’, ‘y’, ‘z’} if sch contain corresponding symbol (by default, ‘y’ direction is used). If string sch have symbol ‘#’ then grid lines are drawn. See also dens3, cont3, contf, grid3. See contf3 sample, for sample code and picture. +

+ +
+
MGL command: contf3 adat ['sch'='' sval=-1]
+
MGL command: contf3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Method on mglGraph: void Contf3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="", const char *opt="")
+
Method on mglGraph: void Contf3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
C function: void mgl_contf3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
C function: void mgl_contf3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: grid3 adat ['sch'='' sval=-1]
+
MGL command: grid3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Method on mglGraph: void Grid3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Method on mglGraph: void Grid3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
C function: void mgl_grid3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
C function: void mgl_grid3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

The function draws grid for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Grid is plotted at slice sVal in direction {‘x’, ‘y’, ‘z’} if sch contain corresponding symbol (by default, ‘y’ direction is used). See also cont3, contf3, dens3, grid2, meshnum. +

+ +
+
MGL command: beam tr g1 g2 adat rval ['sch'='' flag=0 num=3]
+
Method on mglGraph: void Beam (const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, mreal r, const char *stl="", int flag=0, int num=3)
+
Method on mglGraph: void Beam (mreal val, const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, mreal r, const char *stl="", int flag=0)
+
C function: void mgl_beam (HMGL gr, HCDT tr, HCDT g1, HCDT g2, HCDT a, mreal r, const char *stl, int flag, int num)
+
C function: void mgl_beam_val (HMGL gr, mreal val, HCDT tr, HCDT g1, HCDT g2, HCDT a, mreal r, const char *stl, int flag)
+

Draws the isosurface for 3d array a at constant values of a=val. This is special kind of plot for a specified in accompanied coordinates along curve tr with orts g1, g2 and with transverse scale r. Variable flag is bitwise: ‘0x1’ - draw in accompanied (not laboratory) coordinates; ‘0x2’ - draw projection to \rho-z plane; ‘0x4’ - draw normalized in each slice field. The x-size of data arrays tr, g1, g2 must be nx>2. The y-size of data arrays tr, g1, g2 and z-size of the data array a must be equal. See also surf3. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.14 Dual plotting

+ + + + + + + + + +

These plotting functions draw two matrix simultaneously. There are 5 generally different types of data representations: surface or isosurface colored by other data (SurfC, Surf3C), surface or isosurface transpared by other data (SurfA, Surf3A), tiles with variable size (TileS), mapping diagram (Map), STFA diagram (STFA). By default (if absent) values of x, y, z are equidistantly distributed in axis range. The minor dimensions of arrays x, y, z, c should be equal. Arrays x, y (and z for Surf3C, Surf3A) can be vectors (not matrices as c). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: surfc zdat cdat ['sch'='']
+
MGL command: surfc xdat ydat zdat cdat ['sch'='']
+
Method on mglGraph: void SurfC (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void SurfC (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_surfc (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_surfc_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. If string sch have symbol ‘#’ then grid lines are drawn. If string sch have symbol ‘.’ then plot by dots is produced. All dimensions of arrays z and c must be equal. Surface is plotted for each z slice of the data. See also surf, surfa, surfca, beltc, surf3c. See surfc sample, for sample code and picture. +

+ + +
+
MGL command: beltc zdat cdat ['sch'='']
+
MGL command: beltc xdat ydat zdat cdat ['sch'='']
+
Method on mglGraph: void BeltC (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void BeltC (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_beltc (HMGL gr, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_beltc_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws belts for surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. This plot can be used as 3d generalization of plot). If sch contain ‘x’ then belts are drawn along x-direction else (by default) belts are drawn along y-direction. See also belt, surfc, meshnum.

+ + + +
+
MGL command: surf3c adat cdat val ['sch'='']
+
MGL command: surf3c xdat ydat zdat adat cdat val ['sch'='']
+
Method on mglGraph: void Surf3C (mreal val, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3C (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_surf3c_val (HMGL gr, mreal val, HCDT a, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_surf3c_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as surf3 function but the color of isosurface depends on values of array c. If string sch contain ‘#’ then wire plot is produced. If string sch have symbol ‘.’ then plot by dots is produced. See also surf3, surfc, surf3a, surf3ca. See surf3c sample, for sample code and picture. +

+ +
+
MGL command: surf3c adat cdat ['sch'='']
+
MGL command: surf3c xdat ydat zdat adat cdat ['sch'='']
+
Method on mglGraph: void Surf3C (const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3C (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_surf3c (HMGL gr, HCDT a, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_surf3c_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. Here num is equal to parameter value in options opt (default is 3). +

+ + +
+
MGL command: surfa zdat cdat ['sch'='']
+
MGL command: surfa xdat ydat zdat cdat ['sch'='']
+
Method on mglGraph: void SurfA (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void SurfA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_surfa (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_surfa_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and transparent it by matrix c[i,j]. If string sch have symbol ‘#’ then grid lines are drawn. If string sch have symbol ‘.’ then plot by dots is produced. All dimensions of arrays z and c must be equal. Surface is plotted for each z slice of the data. See also surf, surfc, surfca, surf3a. See surfa sample, for sample code and picture. +

+ +
+
MGL command: surf3a adat cdat val ['sch'='']
+
MGL command: surf3a xdat ydat zdat adat cdat val ['sch'='']
+
Method on mglGraph: void Surf3A (mreal val, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3A (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_surf3a_val (HMGL gr, mreal val, HCDT a, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_surf3a_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as surf3 function but the transparency of isosurface depends on values of array c. If string sch contain ‘#’ then wire plot is produced. If string sch have symbol ‘.’ then plot by dots is produced. See also surf3, surfc, surf3a, surf3ca. See surf3a sample, for sample code and picture. +

+ +
+
MGL command: surf3a adat cdat ['sch'='']
+
MGL command: surf3a xdat ydat zdat adat cdat ['sch'='']
+
Method on mglGraph: void Surf3A (const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3A (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_surf3a (HMGL gr, HCDT a, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_surf3a_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. At this array c can be vector with values of transparency and num=c.nx. In opposite case num is equal to parameter value in options opt (default is 3). +

+ + + +
+
MGL command: surfca zdat cdat adat ['sch'='']
+
MGL command: surfca xdat ydat zdat cdat adat ['sch'='']
+
Method on mglGraph: void SurfCA (const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
+
Method on mglGraph: void SurfCA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
+
C function: void mgl_surfca (HMGL gr, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
+
C function: void mgl_surfca_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]}, color it by matrix c[i,j] and transparent it by matrix a[i,j]. If string sch have symbol ‘#’ then grid lines are drawn. If string sch have symbol ‘.’ then plot by dots is produced. All dimensions of arrays z and c must be equal. Surface is plotted for each z slice of the data. Note, you can use map-like coloring if use ‘%’ in color scheme. See also surf, surfc, surfa, surf3ca. See surfca sample, for sample code and picture. +

+ +
+
MGL command: surf3ca adat cdat bdat val ['sch'='']
+
MGL command: surf3ca xdat ydat zdat adat cdat bdat val ['sch'='']
+
Method on mglGraph: void Surf3CA (mreal val, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3CA (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
C function: void mgl_surf3ca_val (HMGL gr, mreal val, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
+
C function: void mgl_surf3ca_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, HCDT b,const char *sch, const char *opt)
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as surf3 function but the color and the transparency of isosurface depends on values of array c and b correspondingly. If string sch contain ‘#’ then wire plot is produced. If string sch have symbol ‘.’ then plot by dots is produced. Note, you can use map-like coloring if use ‘%’ in color scheme. See also surf3, surfca, surf3c, surf3a. See surf3ca sample, for sample code and picture. +

+ +
+
MGL command: surf3ca adat cdat bdat ['sch'='']
+
MGL command: surf3ca xdat ydat zdat adat cdat bdat ['sch'='']
+
Method on mglGraph: void Surf3CA (const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
Method on mglGraph: void Surf3CA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
C function: void mgl_surf3ca (HMGL gr, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
+
C function: void mgl_surf3ca_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. Here parameter num is equal to parameter value in options opt (default is 3). +

+ +
+
MGL command: tiles zdat rdat ['sch'='']
+
MGL command: tiles xdat ydat zdat rdat ['sch'='']
+
MGL command: tiles xdat ydat zdat rdat cdat ['sch'='']
+
Method on mglGraph: void TileS (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void TileS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *sch="", const char *opt="")
+
Method on mglGraph: void TileS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const mglDataA &c, const char *sch="", const char *opt="")
+
C function: void mgl_tiles (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_tiles_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *sch, const char *opt)
+
C function: void mgl_tiles_xyc (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, HCDT c, const char *sch, const char *opt)
+

The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. It is mostly the same as tile but the size of tiles is determined by r array. If string sch contain style ‘x’ or ‘y’ then tiles will be oriented perpendicular to x- or y-axis. This is some kind of “transparency” useful for exporting to EPS files. Tiles is plotted for each z slice of the data. See also surfa, tile. See tiles sample, for sample code and picture. +

+ +
+
MGL command: map udat vdat ['sch'='']
+
MGL command: map xdat ydat udat vdat ['sch'='']
+
Method on mglGraph: void Map (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Method on mglGraph: void Map (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
C function: void mgl_map (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
C function: void mgl_map_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

The function draws mapping plot for matrices {ax, ay } which parametrically depend on coordinates x, y. The initial position of the cell (point) is marked by color. Height is proportional to Jacobian(ax,ay). This plot is like Arnold diagram ??? If string sch contain symbol ‘.’ then the color ball at matrix knots are drawn otherwise face is drawn. See Mapping visualization, for sample code and picture. +

+ +
+
MGL command: stfa re im dn ['sch'='']
+
MGL command: stfa xdat ydat re im dn ['sch'='']
+
Method on mglGraph: void STFA (const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")
+
Method on mglGraph: void STFA (const mglDataA &x, const mglDataA &y, const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")
+
C function: void mgl_stfa (HMGL gr, HCDT re, HCDT im, int dn, const char *sch, const char *opt)
+
C function: void mgl_stfa_xy (HMGL gr, HCDT x, HCDT y, HCDT re, HCDT im, int dn, const char *sch, const char *opt)
+

Draws spectrogram of complex array re+i*im for Fourier size of dn points at plane z equal to minimal z-axis value. For example in 1D case, result is density plot of data res[i,j]=|\sum_d^dn exp(I*j*d)*(re[i*dn+d]+I*im[i*dn+d])|/dn with size {int(nx/dn), dn, ny}. At this array re, im parametrically depend on coordinates x, y. The size of re and im must be the same. The minor dimensions of arrays x, y, re should be equal. Arrays x, y can be vectors (not matrix as re). See stfa sample, for sample code and picture. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.15 Vector fields

+ + + + + + + + +

These functions perform plotting of 2D and 3D vector fields. There are 5 generally different types of vector fields representations: simple vector field (Vect), vectors along the curve (Traj), vector field by dew-drops (Dew), flow threads (Flow, FlowP), flow pipes (Pipe). By default (if absent) values of x, y, z are equidistantly distributed in axis range. The minor dimensions of arrays x, y, z, ax should be equal. The size of ax, ay and az must be equal. Arrays x, y, z can be vectors (not matrices as ax). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: traj xdat ydat udat vdat ['sch'='']
+
MGL command: traj xdat ydat zdat udat vdat wdat ['sch'='']
+
Method on mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Method on mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
C function: void mgl_traj_xyz (HMGL gr, HCDTx, HCDTy, HCDTz, HCDTax, HCDTay, HCDTaz, const char *sch, const char *opt)
+
C function: void mgl_traj_xy (HMGL gr, HCDTx, HCDTy, HCDTax, HCDTay, const char *sch, const char *opt)
+

The function draws vectors {ax, ay, az} along a curve {x, y, z}. The length of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. String pen specifies the color (see Line styles). By default (pen="") color from palette is used (see Palette and colors). Option value set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if value=0). The minor sizes of all arrays must be equal and large 2. The plots are drawn for each row if one of the data is the matrix. See also vect. See traj sample, for sample code and picture. +

+ +
+
MGL command: vect udat vdat ['sch'='']
+
MGL command: vect xdat ydat udat vdat ['sch'='']
+
Method on mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Method on mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
C function: void mgl_vect_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
C function: void mgl_vect_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

The function draws plane vector field plot for the field {ax, ay} depending parametrically on coordinates x, y at level z equal to minimal z-axis value. The length and color of arrows are proportional to \sqrt{ax^2+ay^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols: +

    +
  • f’ for drawing arrows with fixed lengths, +
  • >’, ‘<’ for drawing arrows to or from the cell point (default is centering), +
  • .’ for drawing hachures with dots instead of arrows, +
  • =’ for enabling color gradient along arrows. +
+

See also flow, dew. See vect sample, for sample code and picture. +

+ +
+
MGL command: vect udat vdat wdat ['sch'='']
+
MGL command: vect xdat ydat zdat udat vdat wdat ['sch'='']
+
Method on mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Method on mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
C function: void mgl_vect_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+
C function: void mgl_vect_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the length and color of arrows is proportional to \sqrt{ax^2+ay^2+az^2}. +

+ +
+
MGL command: vect3 udat vdat wdat ['sch'='' sval]
+
MGL command: vect3 xdat ydat zdat udat vdat wdat ['sch'='' sval]
+
Method on mglGraph: void Vect3 (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
+
Method on mglGraph: void Vect3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
+
C function: void mgl_vect3 (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)
+
C function: void mgl_vect3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)
+

The function draws 3D vector field plot for the field {ax, ay, az} depending parametrically on coordinates x, y, z. Vector field is drawn at slice sVal in direction {‘x’, ‘y’, ‘z’} if sch contain corresponding symbol (by default, ‘y’ direction is used). The length and color of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols: +

    +
  • f’ for drawing arrows with fixed lengths, +
  • >’, ‘<’ for drawing arrows to or from the cell point (default is centering), +
  • .’ for drawing hachures with dots instead of arrows, +
  • =’ for enabling color gradient along arrows. +
+

See also vect, flow, dew. See vect3 sample, for sample code and picture. +

+ +
+
MGL command: dew udat vdat ['sch'='']
+
MGL command: dew xdat ydat udat vdat ['sch'='']
+
Method on mglGraph: void Dew (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Method on mglGraph: void Dew (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
C function: void mgl_dew (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
C function: void mgl_dew_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

The function draws dew-drops for plane vector field {ax, ay} depending parametrically on coordinates x, y at level z equal to minimal z-axis value. Note that this is very expensive plot in memory usage and creation time! The color of drops is proportional to \sqrt{ax^2+ay^2}. The number of drops depend on meshnum. See also vect. See dew sample, for sample code and picture. +

+ +
+
MGL command: flow udat vdat ['sch'='']
+
MGL command: flow xdat ydat udat vdat ['sch'='']
+
Method on mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Method on mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
C function: void mgl_flow_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
C function: void mgl_flow_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

The function draws flow threads for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z equal to minimal z-axis value. Option value set the approximate number of threads (default is 5), or accuracy for stationary points (if style ‘.’ is used) . String sch may contain: +

    +
  • color scheme – up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); +
  • #’ for starting threads from edges only; +
  • .’ for drawing separatrices only (flow threads to/from stationary points). +
  • *’ for starting threads from a 2D array of points inside the data; +
  • v’ for drawing arrows on the threads; +
  • x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. +
+

See also pipe, vect, tape, flow3, barwidth. See flow sample, for sample code and picture. +

+ +
+
MGL command: flow udat vdat wdat ['sch'='']
+
MGL command: flow xdat ydat zdat udat vdat wdat ['sch'='']
+
Method on mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Method on mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
C function: void mgl_flow_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+
C function: void mgl_flow_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}. +

+ +
+
MGL command: flow x0 y0 udat vdat ['sch'='']
+
MGL command: flow x0 y0 xdat ydat udat vdat ['sch'='']
+
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
C function: void mgl_flowp_2d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
C function: void mgl_flowp_xy (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

The same as first one (flow) but draws single flow thread starting from point p0={x0,y0,z0}. String sch may also contain: ‘>’ or ‘<’ for drawing in forward or backward direction only (default is both). +

+ +
+
MGL command: flow x0 y0 z0 udat vdat wdat ['sch'='']
+
MGL command: flow x0 y0 z0 xdat ydat zdat udat vdat wdat ['sch'='']
+
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
C function: void mgl_flowp_3d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+
C function: void mgl_flowp_xyz (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+

This is 3D version of the previous functions. +

+ +
+
MGL command: flow3 udat vdat wdat ['sch'='']
+
MGL command: flow3 xdat ydat zdat udat vdat ['sch'='']
+
Method on mglGraph: void Flow3 (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", double sVal=-1, const char *opt="")
+
Method on mglGraph: void Flow3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", double sVal=-1, const char *opt="")
+
C function: void mgl_flow3 (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, double sVal, const char *opt)
+
C function: void mgl_flow3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, double sVal, const char *opt)
+

The function draws flow threads for the 3D vector field {ax, ay, az} parametrically depending on coordinates x, y, z. Flow threads starts from given plane. Option value set the approximate number of threads (default is 5). String sch may contain: +

    +
  • color scheme – up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); +
  • x’, ‘z’ for normal of starting plane (default is y-direction); +
  • v’ for drawing arrows on the threads; +
  • t’ for drawing tapes of normals in x-y and y-z planes. +
+

See also flow, pipe, vect. See flow3 sample, for sample code and picture. +

+ + +
+
MGL command: grad pdat ['sch'='']
+
MGL command: grad xdat ydat pdat ['sch'='']
+
MGL command: grad xdat ydat zdat pdat ['sch'='']
+
Method on mglGraph: void Grad (const mglDataA &phi, const char *sch="", const char *opt="")
+
Method on mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &phi, const char *sch="", const char *opt="")
+
Method on mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &phi, const char *sch="", const char *opt="")
+
C function: void mgl_grad (HMGL gr, HCDT phi, const char *sch, const char *opt)
+
C function: void mgl_grad_xy (HMGL gr, HCDT x, HCDT y, HCDT phi, const char *sch, const char *opt)
+
C function: void mgl_grad_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT phi, const char *sch, const char *opt)
+

The function draws gradient lines for scalar field phi[i,j] (or phi[i,j,k] in 3d case) specified parametrically {x[i,j,k], y[i,j,k], z[i,j,k]}. Number of lines is proportional to value option (default is 5). See also dens, cont, flow. +

+ +
+
MGL command: pipe udat vdat ['sch'='' r0=0.05]
+
MGL command: pipe xdat ydat udat vdat ['sch'='' r0=0.05]
+
Method on mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
+
Method on mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
+
C function: void mgl_pipe_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)
+
C function: void mgl_pipe_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)
+

The function draws flow pipes for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z equal to minimal z-axis value. Number of pipes is proportional to value option (default is 5). If ‘#’ symbol is specified then pipes start only from edges of axis range. The color of lines is proportional to \sqrt{ax^2+ay^2}. Warm color corresponds to normal flow (like attractor). Cold one corresponds to inverse flow (like source). Parameter r0 set the base pipe radius. If r0<0 or symbol ‘i’ is specified then pipe radius is inverse proportional to amplitude. The vector field is plotted for each z slice of ax, ay. See also flow, vect. See pipe sample, for sample code and picture. +

+ +
+
MGL command: pipe udat vdat wdat ['sch'='' r0=0.05]
+
MGL command: pipe xdat ydat zdat udat vdat wdat ['sch'='' r0=0.05]
+
Method on mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
+
Method on mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
+
C function: void mgl_pipe_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)
+
C function: void mgl_pipe_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)
+

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.16 Other plotting

+ + + + + + + + + + + + +

These functions perform miscellaneous plotting. There is unstructured data points plots (Dots), surface reconstruction (Crust), surfaces on the triangular or quadrangular mesh (TriPlot, TriCont, QuadPlot), textual formula plotting (Plots by formula), data plots at edges (Dens[XYZ], Cont[XYZ], ContF[XYZ]). Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See Color scheme. +

+
+
MGL command: densx dat ['sch'='' sval=nan]
+
MGL command: densy dat ['sch'='' sval=nan]
+
MGL command: densz dat ['sch'='' sval=nan]
+
Method on mglGraph: void DensX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void DensY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void DensZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
C function: void mgl_dens_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_dens_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_dens_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+

These plotting functions draw density plot in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. See also ContXYZ, ContFXYZ, dens, Data manipulation. See dens_xyz sample, for sample code and picture. +

+ +
+
MGL command: contx dat ['sch'='' sval=nan]
+
MGL command: conty dat ['sch'='' sval=nan]
+
MGL command: contz dat ['sch'='' sval=nan]
+
Method on mglGraph: void ContX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
C function: void mgl_cont_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_cont_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_cont_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+

These plotting functions draw contour lines in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. Option value set the number of contours. See also ContFXYZ, DensXYZ, cont, Data manipulation. See cont_xyz sample, for sample code and picture. +

+ +
+
Method on mglGraph: void ContX (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContY (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContZ (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
C function: void mgl_cont_x_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_cont_y_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_cont_z_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+

The same as previous with manual contour levels. +

+ +
+
MGL command: contfx dat ['sch'='' sval=nan]
+
MGL command: contfy dat ['sch'='' sval=nan]
+
MGL command: contfz dat ['sch'='' sval=nan]
+
Method on mglGraph: void ContFX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContFY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContFZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
C function: void mgl_contf_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_contf_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_contf_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+

These plotting functions draw solid contours in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. Option value set the number of contours. See also ContFXYZ, DensXYZ, cont, Data manipulation. See contf_xyz sample, for sample code and picture. +

+ +
+
Method on mglGraph: void ContFX (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContFY (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Method on mglGraph: void ContFZ (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
C function: void mgl_contf_x_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_contf_y_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
C function: void mgl_contf_z_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+

The same as previous with manual contour levels. +

+ +
+
MGL command: fplot 'y(x)' ['pen'='']
+
Method on mglGraph: void FPlot (const char *eqY, const char *pen="", const char *opt="")
+
C function: void mgl_fplot (HMGL gr, const char *eqY, const char *pen, const char *opt)
+

Draws command function ‘y(x)’ at plane z equal to minimal z-axis value, where ‘x’ variable is changed in xrange. You do not need to create the data arrays to plot it. Option value set initial number of points. See also plot. +

+ +
+
MGL command: fplot 'x(t)' 'y(t)' 'z(t)' ['pen'='']
+
Method on mglGraph: void FPlot (const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt="")
+
C function: void mgl_fplot_xyz (HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt)
+

Draws command parametrical curve {‘x(t)’, ‘y(t)’, ‘z(t)’} where ‘t’ variable is changed in range [0, 1]. You do not need to create the data arrays to plot it. Option value set number of points. See also plot. +

+ +
+
MGL command: fsurf 'z(x,y)' ['sch'='']
+
Method on mglGraph: void FSurf (const char *eqZ, const char *sch="", const char *opt="");
+
C function: void mgl_fsurf (HMGL gr, const char *eqZ, const char *sch, const char *opt);
+

Draws command surface for function ‘z(x,y)’ where ‘x’, ‘y’ variable are changed in xrange, yrange. You do not need to create the data arrays to plot it. Option value set number of points. See also surf. +

+ +
+
MGL command: fsurf 'x(u,v)' 'y(u,v)' 'z(u,v)' ['sch'='']
+
Method on mglGraph: void FSurf (const char *eqX, const char *eqY, const char *eqZ, const char *sch="", const char *opt="")
+
C function: void mgl_fsurf_xyz (HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *sch, const char *opt)
+

Draws command parametrical surface {‘x(u,v)’, ‘y(u,v)’, ‘z(u,v)’} where ‘u’, ‘v’ variable are changed in range [0, 1]. You do not need to create the data arrays to plot it. Option value set number of points. See also surf. +

+ +
+
MGL command: triplot idat xdat ydat ['sch'='']
+
MGL command: triplot idat xdat ydat zdat ['sch'='']
+
MGL command: triplot idat xdat ydat zdat cdat ['sch'='']
+
Method on mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")
+
Method on mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_triplot_xy (HMGL gr, HCDT id, HCDT x, HCDT y, const char *sch, const char *opt)
+
C function: void mgl_triplot_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_triplot_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

The function draws the surface of triangles. Triangle vertexes are set by indexes id of data points {x[i], y[i], z[i]}. String sch sets the color scheme. If string contain ‘#’ then wire plot is produced. First dimensions of id must be 3 or greater. Arrays x, y, z must have equal sizes. Parameter c set the colors of triangles (if id.ny=c.nx) or colors of vertexes (if x.nx=c.nx). See also dots, crust, quadplot, triangulation. See triplot sample, for sample code and picture. +

+ +
+
MGL command: tricont vdat idat xdat ydat zdat cdat ['sch'='']
+
MGL command: tricont vdat idat xdat ydat zdat ['sch'='']
+
MGL command: tricont idat xdat ydat zdat ['sch'='']
+
Method on mglGraph: void TriCont (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void TriCont (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void TriContV (const mglDataA &v, const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void TriContV (const mglDataA &v, const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_tricont_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_tricont_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_tricont_xyzcv (HMGL gr, HCDT v, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+
C function: void mgl_tricont_xyzv (HMGL gr, HCDT v, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function draws contour lines for surface of triangles at z=v[k] (or at z equal to minimal z-axis value if sch contain symbol ‘_’). Triangle vertexes are set by indexes id of data points {x[i], y[i], z[i]}. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. If v is absent then arrays of option value elements equidistantly distributed in color range is used. String sch sets the color scheme. Array c (if specified) is used for contour coloring. First dimensions of id must be 3 or greater. Arrays x, y, z must have equal sizes. Parameter c set the colors of triangles (if id.ny=c.nx) or colors of vertexes (if x.nx=c.nx). See also triplot, cont, triangulation. +

+ +
+
MGL command: quadplot idat xdat ydat ['sch'='']
+
MGL command: quadplot idat xdat ydat zdat ['sch'='']
+
MGL command: quadplot idat xdat ydat zdat cdat ['sch'='']
+
Method on mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")
+
Method on mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Method on mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_quadplot_xy (HMGL gr, HCDT id, HCDT x, HCDT y, const char *sch, const char *opt)
+
C function: void mgl_quadplot_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_quadplot_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

The function draws the surface of quadrangles. Quadrangles vertexes are set by indexes id of data points {x[i], y[i], z[i]}. String sch sets the color scheme. If string contain ‘#’ then wire plot is produced. First dimensions of id must be 4 or greater. Arrays x, y, z must have equal sizes. Parameter c set the colors of quadrangles (if id.ny=c.nx) or colors of vertexes (if x.nx=c.nx). See also triplot. See triplot sample, for sample code and picture. +

+ +
+
MGL command: dots xdat ydat zdat ['sch'='']
+
MGL command: dots xdat ydat zdat adat ['sch'='']
+
Method on mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Method on mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
Method on mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
+
C function: void mgl_dots (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
C function: void mgl_dots_a (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+
C function: void mgl_dots_ca (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
+

The function draws the arbitrary placed points {x[i], y[i], z[i]}. String sch sets the color scheme and kind of marks. If arrays c, a are specified then they define colors and transparencies of dots. You can use tens plot with style ‘ .’ to draw non-transparent dots with specified colors. Arrays x, y, z, a must have equal sizes. See also crust, tens, mark, plot. See dots sample, for sample code and picture. +

+ +
+
MGL command: crust xdat ydat zdat ['sch'='']
+
Method on mglGraph: void Crust (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
C function: void mgl_crust (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

The function reconstruct and draws the surface for arbitrary placed points {x[i], y[i], z[i]}. String sch sets the color scheme. If string contain ‘#’ then wire plot is produced. Arrays x, y, z must have equal sizes. See also dots, triplot.

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.17 Nonlinear fitting

+ + + + + + + + +

These functions fit data to formula. Fitting goal is to find formula parameters for the best fit the data points, i.e. to minimize the sum \sum_i (f(x_i, y_i, z_i) - a_i)^2/s_i^2. At this, approximation function ‘f’ can depend only on one argument ‘x’ (1D case), on two arguments ‘x,y’ (2D case) and on three arguments ‘x,y,z’ (3D case). The function ‘f’ also may depend on parameters. Normally the list of fitted parameters is specified by var string (like, ‘abcd’). Usually user should supply initial values for fitted parameters by ini variable. But if he/she don’t supply it then the zeros are used. Parameter print=true switch on printing the found coefficients to Message (see Error handling). +

+

Functions Fit() and FitS() do not draw the obtained data themselves. They fill the data fit by formula ‘f’ with found coefficients and return it. At this, the ‘x,y,z’ coordinates are equidistantly distributed in the axis range. Number of points in fit is defined by option value (default is mglFitPnts=100). Note, that this functions use GSL library and do something only if MathGL was compiled with GSL support. See Nonlinear fitting hints, for sample code and picture. +

+
+
MGL command: fits res adat sdat 'func' 'var' [ini=0]
+
MGL command: fits res xdat adat sdat 'func' 'var' [ini=0]
+
MGL command: fits res xdat ydat adat sdat 'func' 'var' [ini=0]
+
MGL command: fits res xdat ydat zdat adat sdat 'func' 'var' [ini=0]
+
Method on mglGraph: mglData FitS (const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData FitS (const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
C function: HMDT mgl_fit_ys (HMGL gr, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+
C function: HMDT mgl_fit_xys (HMGL gr, HCDT x, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+
C function: HMDT mgl_fit_xyzs (HMGL gr, HCDT x, HCDT y, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+
C function: HMDT mgl_fit_xyzas (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+

Fit data along x-, y- and z-directions for array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) with weight factor s[i,j,k]. +

+ +
+
MGL command: fit res adat 'func' 'var' [ini=0]
+
MGL command: fit res xdat adat 'func' 'var' [ini=0]
+
MGL command: fit res xdat ydat adat 'func' 'var' [ini=0]
+
MGL command: fit res xdat ydat zdat adat 'func' 'var' [ini=0]
+
Method on mglGraph: mglData Fit (const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData Fit (const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
C function: HMDT mgl_fit_y (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
C function: HMDT mgl_fit_xy (HMGL gr, HCDT x, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
C function: HMDT mgl_fit_xyz (HMGL gr, HCDT x, HCDT y, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
C function: HMDT mgl_fit_xyza (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+

Fit data along x-, y- and z-directions for array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) with weight factor 1. +

+ + +
+
Method on mglGraph: mglData Fit2 (const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData Fit2 (mglData &fit, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Method on mglGraph: mglData Fit3 (mglData &fit, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Method on mglGraph: mglData Fit3 (mglData &fit, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
C function: HMDT mgl_fit_2 (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
C function: HMDT mgl_fit_3 (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+

Fit data along all directions for 2d or 3d arrays a with s=1 and x, y, z equidistantly distributed in axis range. +

+ +
+
MGL command: putsfit x y ['pre'='' 'fnt'='' size=-1]
+
Method on mglGraph: void PutsFit (mglPoint p, const char *prefix="", const char *font="", mreal size=-1)
+
C function: void mgl_puts_fit (HMGL gr, mreal x, mreal y, mreal z, const char *prefix, const char *font, mreal size)
+

Print last fitted formula with found coefficients (as numbers) at position p0. The string prefix will be printed before formula. All other parameters are the same as in Text printing. +

+ +
+
Method on mglGraph: const char *GetFit ()
+
C function only: const char * mgl_get_fit (HMGL gr)
+
Fortran subroutine: mgl_get_fit (long gr, char *out, int len)
+

Get last fitted formula with found coefficients (as numbers). +

+ +
+
Method on mglGraph: mreal GetFitChi ()
+
C function: mreal mgl_get_fit_chi ()
+

Get \chi for last fitted formula. +

+ +
+
Method on mglGraph: mreal GetFitCovar ()
+
C function: mreal mgl_get_fit_covar ()
+

Get covariance matrix for last fitted formula. +

+ + + +
+ +
+

+Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.18 Data manipulation

+ + + + + +
+
MGL command: hist RES xdat adat
+
MGL command: hist RES xdat ydat adat
+
MGL command: hist RES xdat ydat zdat adat
+
Method on mglGraph: mglData Hist (const mglDataA &x, const mglDataA &a, const char *opt="")
+
Method on mglGraph: mglData Hist (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *opt="")
+
Method on mglGraph: mglData Hist (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *opt="")
+
C function: HMDT mgl_hist_x (HMGL gr, HCDT x, HCDT a, const char *opt)
+
C function: HMDT mgl_hist_xy (HMGL gr, HCDT x, HCDT y, HCDT a, const char *opt)
+
C function: HMDT mgl_hist_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *opt)
+

These functions make distribution (histogram) of data. They do not draw the obtained data themselves. These functions can be useful if user have data defined for random points (for example, after PIC simulation) and he want to produce a plot which require regular data (defined on grid(s)). The range for grids is always selected as axis range. Arrays x, y, z define the positions (coordinates) of random points. Array a define the data value. Number of points in output array res is defined by option value (default is mglFitPnts=100). +

+ + +
+
MGL command: fill dat 'eq'
+
MGL command: fill dat 'eq' vdat
+
MGL command: fill dat 'eq' vdat wdat
+
Method on mglGraph: void Fill (mglData &u, const char *eq, const char *opt="")
+
Method on mglGraph: void Fill (mglData &u, const char *eq, const mglDataA &v, const char *opt="")
+
Method on mglGraph: void Fill (mglData &u, const char *eq, const mglDataA &v, const mglDataA &w, const char *opt="")
+
C function: void mgl_data_fill_eq (HMGL gr, HMDT u, const char *eq, HCDTv, HCDTw, const char *opt)
+

Fills the value of array ‘u’ according to the formula in string eq. Formula is an arbitrary expression depending on variables ‘x’, ‘y’, ‘z’, ‘u’, ‘v’, ‘w’. Coordinates ‘x’, ‘y’, ‘z’ are supposed to be normalized in axis range. Variable ‘u’ is the original value of the array. Variables ‘v’ and ‘w’ are values of arrays v, w which can be NULL (i.e. can be omitted). +

+ +
+
MGL command: datagrid dat xdat ydat zdat
+
Method on mglGraph: void DataGrid (mglData &u, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *opt="")
+
C function: void mgl_data_grid (HMGL gr, HMDT u, HCDT x, HCDT y, HCDT z, const char *opt)
+

Fills the value of array ‘u’ according to the linear interpolation of triangulated surface, found for arbitrary placed points ‘x’, ‘y’, ‘z’. Interpolation is done at points equidistantly distributed in axis range. NAN value is used for grid points placed outside of triangulated surface. See Making regular data, for sample code and picture. +

+ +
+
MGL command: refill dat xdat vdat [sl=-1]
+
MGL command: refill dat xdat ydat vdat [sl=-1]
+
MGL command: refill dat xdat ydat zdat vdat
+
Method on mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &v, long sl=-1, const char *opt="")
+
Method on mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &y, const mglDataA &v, long sl=-1, const char *opt="")
+
Method on mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &v, const char *opt="")
+
C function: void mgl_data_refill_gr (HMGL gr, HMDT a, HCDT x, HCDT y, HCDT z, HCDT v, long sl, const char *opt)
+

Fills by interpolated values of array v at the point {x, y, z}={X[i], Y[j], Z[k]} (or {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} if x, y, z are not 1d arrays), where X,Y,Z are equidistantly distributed in axis range and have the same sizes as array dat. If parameter sl is 0 or positive then changes will be applied only for slice sl. +

+ + +
+
MGL command: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+
Method on mglGraph: mglData PDE (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
C function: HMDT mgl_pde_solve (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Coordinates ‘x’, ‘y’, ‘z’ are supposed to be normalized in axis range. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. At this moment, simplified form of function ham is supported – all “mixed” terms (like ‘x*p’->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like ‘x*q’->x*d/dy) are allowed. Here variable ‘u’ is used for field amplitude |u|. This allow one solve nonlinear problems – for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)", but only if dependence on variable ‘i’ is linear (i.e. ham = hre+i*him). See PDE solving hints, for sample code and picture. +

+ + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ + +

5 Widget classes

+ + + + + + + + +

There are set of “window” classes for making a window with MathGL graphics: mglWindow, mglFLTK, mglQT and mglGLUT for whole window, Fl_MathGL and QMathGL as widgets. All these classes allow user to show, rotate, export, and change view of the plot using keyboard. Most of them (except mglGLUT) also have toolbar and menu for simplifying plot manipulation. All window classes have mostly the same set of functions derived from mglWnd class. +

+

For drawing you can use: NULL pointer if you’ll update plot manually, global callback function of type int draw(HMGL gr, void *p) or int draw(mglGraph *gr), or instance of class derived from mglDraw class. Basically, this class have 2 main virtual methods: +

class mglDraw
+{
+public:
+    virtual int Draw(mglGraph *) { return 0; };
+    virtual void Reload() {};
+};
+

You should inherit yours class from mglDraw and re-implement one or both functions for drawing. +

+

The window can be constructed using one of following classes (see Using MathGL window for examples). +

+
+
Constructor on mglFLTK: mglFLTK (const char *title="MathGL")
+
Constructor on mglFLTK: mglFLTK (int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, void (*reload)(HMGL gr, void *p)=0)
+
Constructor on mglFLTK: mglFLTK (int (*draw)(mglGraph *gr), const char *title="MathGL")
+
Constructor on mglFLTK: mglFLTK (mglDraw *draw, const char *title="MathGL")
+
C function: HMGL mgl_create_graph_fltk (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
+
+

Creates a FLTK-based window for plotting. Parameter draw sets a pointer to drawing function (this is the name of function) or instance of mglDraw class. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Note, that draw can be NULL for displaying static bitmaps only (no animation or slides). Parameter title sets the title of the window. Parameter par contains pointer to data for the plotting function draw. FLTK-based windows is a bit faster than Qt ones, and provide better support of multi-threading. +

+ +
+
Method on mglFLTK: int RunThr ()
+
C function: int mgl_fltk_thr ()
+

Run main loop for event handling in separate thread. Note, right now it work for FLTK windows only. +

+ + +
+
Constructor on mglQT: mglQT (const char *title="MathGL")
+
Constructor on mglQT: mglQT (int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, void (*reload)(HMGL gr, void *p)=0)
+
Constructor on mglQT: mglQT (int (*draw)(mglGraph *gr), const char *title="MathGL")
+
Constructor on mglQT: mglQT (mglDraw *draw, const char *title="MathGL")
+
C function: HMGL mgl_create_graph_qt (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
+
+

Creates a FLTK-based window for plotting. Parameter draw sets a pointer to drawing function (this is the name of function) or instance of mglDraw class. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Note, that draw can be NULL for displaying static bitmaps only (no animation or slides). Parameter title sets the title of the window. Parameter par contains pointer to data for the plotting function draw. +

+ + +
+
Constructor on mglGLUT: mglGLUT (const char *title="MathGL")
+
Constructor on mglGLUT: mglGLUT (int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, void (*reload)(HMGL gr, void *p)=0)
+
Constructor on mglGLUT: mglGLUT (int (*draw)(mglGraph *gr), const char *title="MathGL")
+
Constructor on mglGLUT: mglGLUT (mglDraw *draw, const char *title="MathGL")
+
C function: HMGL mgl_create_graph_glut (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
+
+

Creates a GLUT-based window for plotting. Parameter draw sets a pointer to drawing function (this is the name of function) or instance of mglDraw class. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Note, that draw can be NULL for displaying static bitmaps only (no animation or slides). Parameter title sets the title of the window. Parameter par contains pointer to data for the plotting function draw. GLUT-based windows are fastest one but there is no toolbar, and plot have some issues due to OpenGL limitations. +

+

There are some keys handles for manipulating by the plot: ’a’, ’d’, ’w’, ’s’ for the rotating; ’,’, ’.’ for viewing of the previous or next frames in the list; ’r’ for the switching of transparency; ’f’ for the switching of lightning; ’x’ for hiding (closing) the window. +

+ + + + + + + + + + + +
+ + + +

5.1 mglWnd class

+ + + + +

This class is abstract class derived from mglGraph class (see MathGL core). It is defined in #include <mgl2/wnd.h> and provide base methods for handling window with MathGL graphics. Inherited classes are exist for QT and FLTK widget libraries: mglQT in #include <mgl2/qt.h>, mglFLTK in #include <mgl2/fltk.h>. +

+ +
+
Method on mglWnd: int Run ()
+
C function: int mgl_qt_run ()
+
C function: int mgl_fltk_run ()
+

Run main loop for event handling. Usually it should be called in a separate thread or as last function call in main(). +

+ +
+
Method on mglWnd: void SetDrawFunc (int (*draw)(HMGL gr, void *p), void *par=NULL, void (*reload)(void *p)=NULL)
+
Method on mglWnd: void SetDrawFunc (int (*draw)(mglGraph *gr))
+
Method on mglWnd: void SetDrawFunc (mglDraw *obj)
+
C function: void mgl_wnd_set_func (HMGL gr, int (*draw)(HMGL gr, void *p), void *par, void (*reload)(void *p))
+

Set callback functions for drawing (draw) and data reloading (reload), or instance obj of a class derived from mglDraw. +

+ +
+
Method on mglWnd: void SetClickFunc (void (*func)(HMGL gr, void *p))
+
C function: void mgl_set_click_func (void (*func)(HMGL gr, void *p))
+

Set callback function func which will be called on mouse click. +

+ +
+
Method on mglWnd: void SetMutex(pthread_mutex_t *mutex)
+
C function: void mgl_wnd_set_mutex(HMGL gr, pthread_mutex_t *mutex)
+

Set external mutex for lock/unlock external calculations by widget. This functions is called automatically at using mglDraw class. +

+ + +
+
Method on mglWnd: void ToggleAlpha ()
+
C function: void mgl_wnd_toggle_alpha (HMGL gr)
+

Switch on/off transparency but do not overwrite switches in user drawing function. +

+
+
Method on mglWnd: void ToggleLight ()
+
C function: void mgl_wnd_toggle_light (HMGL gr)
+

Switch on/off lighting but do not overwrite switches in user drawing function. +

+
+
Method on mglWnd: void ToggleRotate ()
+
C function: void mgl_wnd_toggle_rotate (HMGL gr)
+

Switch on/off rotation by mouse. Usually, left button is used for rotation, middle button for shift, right button for zoom/perspective. +

+
+
Method on mglWnd: void ToggleZoom ()
+
C function: void mgl_wnd_toggle_zoom (HMGL gr)
+

Switch on/off zooming by mouse. Just select rectangular region by mouse and it will be zoomed in. +

+
+
Method on mglWnd: void ToggleNo ()
+
C function: void mgl_wnd_toggle_no (HMGL gr)
+

Switch off all zooming and rotation and restore initial state. +

+
+
Method on mglWnd: void Update ()
+
C function: void mgl_wnd_update (HMGL gr)
+

Update window contents. This is very useful function for manual updating the plot while long calculation was running in parallel thread. +

+
+
Method on mglWnd: void ReLoad ()
+
C function: void mgl_wnd_reload (HMGL gr)
+

Reload user data and update picture. This function also update number of frames which drawing function can create. +

+
+
Method on mglWnd: void Adjust ()
+
C function: void mgl_wnd_adjust (HMGL gr)
+

Adjust size of bitmap to window size. +

+
+
Method on mglWnd: void NextFrame ()
+
C function: void mgl_wnd_next_frame (HMGL gr)
+

Show next frame if one. +

+
+
Method on mglWnd: void PrevFrame ()
+
C function: void mgl_wnd_prev_frame (HMGL gr)
+

Show previous frame if one. +

+
+
Method on mglWnd: void Animation ()
+
C function: void mgl_wnd_animation (HMGL gr)
+

Run/stop slideshow (animation) of frames. +

+ +
+
Method on mglWnd: void SetDelay (double dt)
+
C function: void mgl_wnd_set_delay (HMGL gr, double dt)
+

Sets delay for animation in seconds. Default value is 1 sec. +

+ +
+
Method on mglWnd: double GetDelay ()
+
C function: double mgl_wnd_get_delay (HMGL gr)
+

Gets delay for animation in seconds. +

+ +
+
Method on mglWnd: void Setup (bool clfupd=true, bool showpos=false)
+
C function: void mgl_setup_window (HMGL gr, bool clfupd, bool showpos)
+

Enable/disable flags for: +

    +
  • clearing plot before Update(); +
  • showing the last mouse click position in the widget. +
+
+ +
+
Method on mglWnd: mglPoint LastMousePos ()
+
C function: void mgl_get_last_mouse_pos (HMGL gr, mreal *x, mreal *y, mreal *z)
+

Gets last position of mouse click. +

+ +
+
Method on mglWnd: void * Widget ()
+
C function: void * mgl_fltk_widget (HMGL gr)
+
C function: void * mgl_qt_widget (HMGL gr)
+

Return pointer to widget (Fl_MathGL class or QMathGL class) used for plotting. +

+ + + +
+ +
+

+Next: , Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.2 mglDraw class

+ + + +

This class provide base functionality for callback drawing and running calculation in separate thread. It is defined in #include <mgl2/wnd.h>. You should make inherited class and implement virtual functions if you need it. +

+
+
Virtual method on mglDraw: int Draw (mglGraph *gr)
+

This is callback drawing function, which will be called when any redrawing is required for the window. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. +

+ +
+
Virtual method on mglDraw: void Reload ()
+

This is callback function, which will be called if user press menu or toolbutton to reload data. +

+ +
+
Virtual method on mglDraw: void Click ()
+

This is callback function, which will be called if user click mouse. +

+ +
+
Virtual method on mglDraw: void Calc ()
+

This is callback function, which will be called if user start calculations in separate thread by calling mglDraw::Run() function. It should periodically call mglDraw::Check() function to check if calculations should be paused. +

+ +
+
Method on mglDraw: void Run ()
+

Runs mglDraw::Calc() function in separate thread. It also initialize mglDraw::thr variable and unlock mglDraw::mutex. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Cancel ()
+

Cancels thread with calculations. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Pause ()
+

Pauses thread with calculations by locking mglDraw::mutex. You should call mglDraw::Continue() to continue calculations. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Continue ()
+

Continues calculations by unlocking mglDraw::mutex. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Continue ()
+

Checks if calculations should be paused and pause it. Function is present only if FLTK support for widgets was enabled. +

+ + +
+ +
+

+Next: , Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.3 Fl_MathGL class

+ + + + +

Class is FLTK widget which display MathGL graphics. It is defined in #include <mgl2/Fl_MathGL.h>. +

+
Example of FLTK window with MathGL plot. +
+
+
Method on Fl_MathGL: void set_draw (int (*draw)(HMGL gr, void *p))
+
Method on Fl_MathGL: void set_draw (int (*draw)(mglGraph *gr))
+
Method on Fl_MathGL: void set_draw (mglDraw *draw)
+

Sets drawing function as global function or as one from a class mglDraw. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Parameter par contains pointer to data for the plotting function draw. +

+
+
Method on Fl_MathGL: mglDraw *get_class ()
+

Get pointer to mglDraw class or NULL if absent. +

+ +
+
Method on Fl_MathGL: void update ()
+

Update (redraw) plot. +

+
+
Method on Fl_MathGL: void set_angle (mreal t, mreal p)
+

Set angles for additional plot rotation +

+
+
Method on Fl_MathGL: void set_flag (int f)
+

Set bitwise flags for general state (1-Alpha, 2-Light) +

+
+
Method on Fl_MathGL: void set_state (bool r, bool z)
+

Set flags for handling mouse: +z=true allow zooming, +r=true allow rotation/shifting/perspective and so on. +

+ +
+
Method on Fl_MathGL: void set_zoom (mreal X1, mreal Y1, mreal X2, mreal Y2)
+

Set zoom in/out region +

+
+
Method on Fl_MathGL: void get_zoom (mreal *X1, mreal *Y1, mreal *X2, mreal *Y2)
+

Get zoom in/out region +

+ +
+
Method on Fl_MathGL: void set_popup (const Fl_Menu_Item *pmenu, Fl_Widget *w, void *v)
+

Set popup menu pointer +

+ +
+
Method on Fl_MathGL: void set_graph (HMGL gr)
+
Method on Fl_MathGL: void set_graph (mglGraph *gr)
+

Set new grapher instead of built-in one. Note that Fl_MathGL will automatically delete this object at destruction or at new set_graph() call. +

+
+
Method on Fl_MathGL: HMGL get_graph ()
+

Get pointer to grapher. +

+ +
+
Method on Fl_MathGL: void set_show_warn (bool val)
+

Show window with warnings after script parsing. +

+
+
Method on Fl_MathGL: void stop (bool stop=true)
+

Ask to stop of script parsing. +

+
+
Method on Fl_MathGL: void set_handle_key (bool val)
+

Enable/disable key handling as in mglview (default is false). +

+
+
Method on Fl_MathGL: int get_last_id ()
+

Get id of last clicked object. +

+
+
Method on Fl_MathGL: bool running ()
+

Check if script is parsing now or not. +

+ +
+
Fl_MathGL option of Fl_MathGL: Fl_Valuator * tet_val
+

Pointer to external tet-angle validator. +

+
+
Fl_MathGL option of Fl_MathGL: Fl_Valuator * phi_val
+

Pointer to external phi-angle validator. +

+ + +
+ +
+

+Next: , Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.4 QMathGL class

+ + + + +

Class is Qt widget which display MathGL graphics. It is defined in #include <mgl2/qt.h>. +

+
Example of Qt window with MathGL plot. +
+
+
Method on QMathGL: void setDraw (mglDraw *dr)
+

Sets drawing functions from a class inherited from mglDraw. +

+
+
Method on QMathGL: void setDraw (int (*draw)(mglBase *gr, void *p), void *par=NULL)
+
Method on QMathGL: void setDraw (int (*draw)(mglGraph *gr))
+

Sets the drawing function draw. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Parameter par contains pointer to data for the plotting function draw. +

+ +
+
Method on QMathGL: void setGraph (HMGL gr)
+
Method on QMathGL: void setGraph (mglGraph *gr)
+

Set pointer to external grapher (instead of built-in one). Note that QMathGL will automatically delete this object at destruction or at new setGraph() call. +

+
+
Method on QMathGL: HMGL getGraph ()
+

Get pointer to grapher. +

+ +
+
Method on QMathGL: void setPopup (QMenu *p)
+

Set popup menu pointer. +

+
+
Method on QMathGL: void setSize (int w, int h)
+

Set widget/picture sizes +

+
+
Method on QMathGL: double getRatio ()
+

Return aspect ratio of the picture. +

+ +
+
Method on QMathGL: int getPer ()
+

Get perspective value in percents. +

+
+
Method on QMathGL: int getPhi ()
+

Get Phi-angle value in degrees. +

+
+
Method on QMathGL: int getTet ()
+

Get Theta-angle value in degrees. +

+
+
Method on QMathGL: bool getAlpha ()
+

Get transparency state. +

+
+
Method on QMathGL: bool getLight ()
+

Get lightning state. +

+
+
Method on QMathGL: bool getZoom ()
+

Get mouse zooming state. +

+
+
Method on QMathGL: bool getRotate ()
+

Get mouse rotation state. +

+ + +
+
Slot on QMathGL: void refresh ()
+

Redraw saved bitmap without executing drawing function. +

+
+
Slot on QMathGL: void update ()
+

Update picture by executing drawing function. +

+
+
Slot on QMathGL: void copy ()
+

Copy graphics to clipboard. +

+
+
Slot on QMathGL: void copyClickCoor ()
+

Copy coordinates of click (as text). +

+
+
Slot on QMathGL: void print ()
+

Print current picture. +

+ +
+
Slot on QMathGL: void stop ()
+

Send signal to stop drawing. +

+
+
Slot on QMathGL: void adjust ()
+

Adjust image size to fit whole widget. +

+
+
Slot on QMathGL: void nextSlide ()
+

Show next slide. +

+
+
Slot on QMathGL: void prevSlide ()
+

Show previous slide. +

+
+
Slot on QMathGL: void animation (bool st=true)
+

Start/stop animation. +

+ +
+
Slot on QMathGL: void setPer (int val)
+

Set perspective value. +

+
+
Slot on QMathGL: void setPhi (int val)
+

Set Phi-angle value. +

+
+
Slot on QMathGL: void setTet (int val)
+

Set Theta-angle value. +

+
+
Slot on QMathGL: void setAlpha (bool val)
+

Switch on/off transparency. +

+
+
Slot on QMathGL: void setLight (bool val)
+

Switch on/off lightning. +

+
+
Slot on QMathGL: void setGrid (bool val)
+

Switch on/off drawing of grid for absolute coordinates. +

+
+
Slot on QMathGL: void setZoom (bool val)
+

Switch on/off mouse zooming. +

+
+
Slot on QMathGL: void setRotate (bool val)
+

Switch on/off mouse rotation. +

+
+
Slot on QMathGL: void zoomIn ()
+

Zoom in graphics. +

+
+
Slot on QMathGL: void zoomOut ()
+

Zoom out graphics. +

+
+
Slot on QMathGL: void shiftLeft ()
+

Shift graphics to left direction. +

+
+
Slot on QMathGL: void shiftRight ()
+

Shift graphics to right direction. +

+
+
Slot on QMathGL: void shiftUp ()
+

Shift graphics to up direction. +

+
+
Slot on QMathGL: void shiftDown ()
+

Shift graphics to down direction. +

+
+
Slot on QMathGL: void restore ()
+

Restore zoom and rotation to default values. +

+ +
+
Slot on QMathGL: void exportPNG (QString fname="")
+

Export current picture to PNG file. +

+
+
Slot on QMathGL: void exportPNGs (QString fname="")
+

Export current picture to PNG file (no transparency). +

+
+
Slot on QMathGL: void exportJPG (QString fname="")
+

Export current picture to JPEG file. +

+
+
Slot on QMathGL: void exportBPS (QString fname="")
+

Export current picture to bitmap EPS file. +

+
+
Slot on QMathGL: void exportEPS (QString fname="")
+

Export current picture to vector EPS file. +

+
+
Slot on QMathGL: void exportSVG (QString fname="")
+

Export current picture to SVG file. +

+ +
+
Slot on QMathGL: void exportGIF (QString fname="")
+

Export current picture to GIF file. +

+
+
Slot on QMathGL: void exportTEX (QString fname="")
+

Export current picture to LaTeX/Tikz file. +

+
+
Slot on QMathGL: void exportTGA (QString fname="")
+

Export current picture to TGA file. +

+ +
+
Slot on QMathGL: void exportXYZ (QString fname="")
+

Export current picture to XYZ/XYZL/XYZF file. +

+
+
Slot on QMathGL: void exportOBJ (QString fname="")
+

Export current picture to OBJ/MTL file. +

+
+
Slot on QMathGL: void exportSTL (QString fname="")
+

Export current picture to STL file. +

+
+
Slot on QMathGL: void exportOFF (QString fname="")
+

Export current picture to OFF file. +

+ +
+
Slot on QMathGL: voidsetUsePrimitives (bool use)
+

Enable using list of primitives for frames. This allows frames transformation/zoom but requires much more memory. Default value is true. +

+
+
Slot on QMathGL: void setMGLFont (QString path)
+

Restore (path="") or load font for graphics. +

+ +
+
Slot on QMathGL: void about ()
+

Show about information. +

+
+
Slot on QMathGL: void aboutQt ()
+

Show information about Qt version. +

+ +
+
Signal on QMathGL: void phiChanged (int val)
+

Phi angle changed (by mouse or by toolbar). +

+
+
Signal on QMathGL: void tetChanged (int val)
+

Tet angle changed (by mouse or by toolbar). +

+
+
Signal on QMathGL: void perChanged (int val)
+

Perspective changed (by mouse or by toolbar). +

+
+
Signal on QMathGL: void alphaChanged (bool val)
+

Transparency changed (by toolbar). +

+
+
Signal on QMathGL: void lightChanged (bool val)
+

Lighting changed (by toolbar). +

+
+
Signal on QMathGL: void gridChanged (bool val)
+

Grid drawing changed (by toolbar). +

+
+
Signal on QMathGL: void zoomChanged (bool val)
+

Zooming changed (by toolbar). +

+
+
Signal on QMathGL: void rotateChanged (bool val)
+

Rotation changed (by toolbar). +

+ +
+
Signal on QMathGL: void mouseClick (mreal x, mreal y, mreal z)
+

Mouse click take place at position {x,y,z}. +

+
+
Signal on QMathGL: void frameChanged (int val)
+

Need another frame to show. +

+
+
Signal on QMathGL: void showWarn (QString warn)
+

Need to show warning. +

+
+
Signal on QMathGL: void posChanged (QString pos)
+

Position of mouse click is changed. +

+
+
Signal on QMathGL: void objChanged (int id)
+

Object id is changed (due to mouse click). +

+
+
Signal on QMathGL: void refreshData ()
+

Data can be changed (drawing is finished). +

+ + +
+
QMathGL option of QMathGL: QString appName
+

Application name for message boxes. +

+
+
QMathGL option of QMathGL: bool autoResize
+

Allow auto resizing (default is false). +

+ + +
+ +
+

+Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.5 wxMathGL class

+ + + + +

Class is WX widget which display MathGL graphics. It is defined in #include <mgl2/wx.h>. +

+
+
Method on wxMathGL: void SetDraw (mglDraw *dr)
+

Sets drawing functions from a class inherited from mglDraw. +

+
+
Method on wxMathGL: void SetDraw (int (*draw)(mglBase *gr, void *p), void *par=NULL)
+
Method on wxMathGL: void SetDraw (int (*draw)(mglGraph *gr))
+

Sets the drawing function draw. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. Parameter par contains pointer to data for the plotting function draw. +

+ +
+
Method on wxMathGL: void SetGraph (HMGL gr)
+
Method on wxMathGL: void SetGraph (mglGraph *gr)
+

Set pointer to external grapher (instead of built-in one). Note that wxMathGL will automatically delete this object at destruction or at new setGraph() call. +

+
+
Method on wxMathGL: HMGL GetGraph ()
+

Get pointer to grapher. +

+ +
+
Method on wxMathGL: void SetPopup (wxMenu *p)
+

Set popup menu pointer. +

+
+
Method on wxMathGL: void SetSize (int w, int h)
+

Set widget/picture sizes +

+
+
Method on wxMathGL: double GetRatio ()
+

Return aspect ratio of the picture. +

+ +
+
Method on wxMathGL: int GetPer ()
+

Get perspective value in percents. +

+
+
Method on wxMathGL: int GetPhi ()
+

Get Phi-angle value in degrees. +

+
+
Method on wxMathGL: int GetTet ()
+

Get Theta-angle value in degrees. +

+
+
Method on wxMathGL: bool GetAlpha ()
+

Get transparency state. +

+
+
Method on wxMathGL: bool GetLight ()
+

Get lightning state. +

+
+
Method on wxMathGL: bool GetZoom ()
+

Get mouse zooming state. +

+
+
Method on wxMathGL: bool GetRotate ()
+

Get mouse rotation state. +

+ + +
+
Method on wxMathGL: void Repaint ()
+

Redraw saved bitmap without executing drawing function. +

+
+
Method on wxMathGL: void Update ()
+

Update picture by executing drawing function. +

+
+
Method on wxMathGL: void Copy ()
+

Copy graphics to clipboard. +

+
+
Method on wxMathGL: void Print ()
+

Print current picture. +

+ +
+
Method on wxMathGL: void Adjust ()
+

Adjust image size to fit whole widget. +

+
+
Method on wxMathGL: void NextSlide ()
+

Show next slide. +

+
+
Method on wxMathGL: void PrevSlide ()
+

Show previous slide. +

+
+
Method on wxMathGL: void Animation (bool st=true)
+

Start/stop animation. +

+ +
+
Method on wxMathGL: void SetPer (int val)
+

Set perspective value. +

+
+
Method on wxMathGL: void SetPhi (int val)
+

Set Phi-angle value. +

+
+
Method on wxMathGL: void SetTet (int val)
+

Set Theta-angle value. +

+
+
Method on wxMathGL: void SetAlpha (bool val)
+

Switch on/off transparency. +

+
+
Method on wxMathGL: void SetLight (bool val)
+

Switch on/off lightning. +

+
+
Method on wxMathGL: void SetZoom (bool val)
+

Switch on/off mouse zooming. +

+
+
Method on wxMathGL: void SetRotate (bool val)
+

Switch on/off mouse rotation. +

+
+
Method on wxMathGL: void ZoomIn ()
+

Zoom in graphics. +

+
+
Method on wxMathGL: void ZoomOut ()
+

Zoom out graphics. +

+
+
Method on wxMathGL: void ShiftLeft ()
+

Shift graphics to left direction. +

+
+
Method on wxMathGL: void ShiftRight ()
+

Shift graphics to right direction. +

+
+
Method on wxMathGL: void ShiftUp ()
+

Shift graphics to up direction. +

+
+
Method on wxMathGL: void ShiftDown ()
+

Shift graphics to down direction. +

+
+
Method on wxMathGL: void Restore ()
+

Restore zoom and rotation to default values. +

+ +
+
Method on wxMathGL: void About ()
+

Show about information. +

+ +
+
Method on wxMathGL: void ExportPNG (QString fname="")
+

Export current picture to PNG file. +

+
+
Method on wxMathGL: void ExportPNGs (QString fname="")
+

Export current picture to PNG file (no transparency). +

+
+
Method on wxMathGL: void ExportJPG (QString fname="")
+

Export current picture to JPEG file. +

+
+
Method on wxMathGL: void ExportBPS (QString fname="")
+

Export current picture to bitmap EPS file. +

+
+
Method on wxMathGL: void ExportEPS (QString fname="")
+

Export current picture to vector EPS file. +

+
+
Method on wxMathGL: void ExportSVG (QString fname="")
+

Export current picture to SVG file. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 Data processing

+ + + +

This chapter describe classes mglData and mglDataC for working with data arrays of real and complex numbers. Both classes are derived from abstract class mglDataA, and can be used as arguments of any plotting functions (see MathGL core). These classes are defined in #include <mgl2/data.h> and #include <mgl2/datac.h> correspondingly. The classes have mostly the same set of functions for easy and safe allocation, resizing, loading, saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Classes support data with dimensions up to 3 (like function of 3 variables – x,y,z). The internal representation of numbers is mreal (or dual=std::complex<mreal> for mglDataC), which can be configured as float or double by selecting option --enable-double at the MathGL configuring (see Installation). Float type have smaller size in memory and usually it has enough precision in plotting purposes. However, double type provide high accuracy what can be important for time-axis, for example. Data arrays are denoted by Small Caps (like DAT) if it can be (re-)created by MGL commands. +

+ + + + + + + + + + + + + + + + + +
+ + + +

6.1 Public variables

+ + + +
+
Variable of mglData: mreal * a
+
Variable of mglDataC: dual * a
+

Data array itself. The flat data representation is used. For example, matrix [nx x ny] is presented as flat (1d-) array with length nx*ny. The element with indexes {i, j, k} is a[i+nx*j+nx*ny*k] (indexes are zero based). +

+
+
Variable of mglData: long nx
+
Variable of mglDataC: long nx
+

Number of points in 1st dimensions (’x’ dimension). +

+
+
Variable of mglData: long ny
+
Variable of mglDataC: long ny
+

Number of points in 2nd dimensions (’y’ dimension). +

+
+
Variable of mglData: long nz
+
Variable of mglDataC: long nz
+

Number of points in 3d dimensions (’z’ dimension). +

+
+
Variable of mglData: std::string id
+
Variable of mglDataC: std::string id
+

Names of column (or slice if nz>1) – one character per column. +

+
+
Variable of mglData: bool link
+
Variable of mglDataC: bool link
+

Flag to use external data, i.e. don’t delete it. +

+ +
+
Variable of mglDataA: std::wstring s
+

Name of data. It is used in parsing of MGL scripts. +

+
+
Variable of mglDataA: bool temp
+

Flag of temporary variable, which should be deleted. +

+
+
Variable of mglDataA: void (*)(void *) func
+

Pointer to callback function which will be called at destroying. +

+
+
Variable of mglDataA: void * o
+

Pointer to object for callback function. +

+ + +
+
Method on mglData: mreal GetVal (long i)
+
Method on mglDataC: mreal GetVal (long i)
+
Method on mglData: void SetVal (mreal val, long i)
+
Method on mglDataC: void SetVal (mreal val, long i)
+

Gets or sets the value in by "flat" index i without border checking. Index i should be in range [0, nx*ny*nz-1]. +

+ +
+
Method on mglDataA: long GetNx ()
+
Method on mglDataA: long GetNy ()
+
Method on mglDataA: long GetNz ()
+
C function: long mgl_data_get_nx (HCDT dat)
+
C function: long mgl_data_get_ny (HCDT dat)
+
C function: long mgl_data_get_nz (HCDT dat)
+

Gets the x-, y-, z-size of the data. +

+ +
+
C function: mreal mgl_data_get_value (HCDT dat, int i, int j, int k)
+
C function: dual mgl_datac_get_value (HCDT dat, int i, int j, int k)
+
C function: mreal * mgl_data_value (HMDT dat, int i, int j, int k)
+
C function: dual * mgl_datac_value (HADT dat, int i, int j, int k)
+
C function: void mgl_data_set_value (HMDT dat, mreal v, int i, int j, int k)
+
C function: void mgl_datac_set_value (HADT dat, dual v, int i, int j, int k)
+

Gets or sets the value in specified cell of the data with border checking. +

+
+
C function: const mreal * mgl_data_data (HCDT dat)
+
C function: const dual * mgl_datac_data (HCDT dat)
+

Returns pointer to internal data array. +

+ +
+
C function only: void mgl_data_set_func (mglDataA *dat, void (*func)(void *), void *par)
+

Set pointer to callback function which will be called at destroying. +

+ +
+
C function: void mgl_data_set_name (mglDataA *dat, const char *name)
+
C function: void mgl_data_set_name_w (mglDataA *dat, const wchar_t *name)
+

Set name of data, which used in parsing of MGL scripts. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.2 Data constructor

+ + + + +
+
MGL command: new DAT [nx=1 'eq']
+
MGL command: new DAT nx ny ['eq']
+
MGL command: new DAT nx ny nz ['eq']
+
Constructor on mglData: mglData (int mx=1, int my=1, int mz=1)
+
Constructor on mglDataC: mglDataC (int mx=1, int my=1, int mz=1)
+
C function: HMDT mgl_create_data ()
+
C function: HMDT mgl_create_data_size (int mx, int my, int mz)
+
C function: HADT mgl_create_datac ()
+
C function: HADT mgl_create_datac_size (int mx, int my, int mz)
+

Default constructor. Allocates the memory for data array and initializes it by zero. If string eq is specified then data will be filled by corresponding formula as in fill. +

+ +
+
MGL command: copy DAT dat2 ['eq'='']
+
MGL command: copy DAT val
+
Constructor on mglData: mglData (const mglDataA &dat2)
+
Constructor on mglData: mglData (const mglDataA *dat2)
+
Constructor on mglData: mglData (int size, const float *dat2)
+
Constructor on mglData: mglData (int size, int cols, const float *dat2)
+
Constructor on mglData: mglData (int size, const double *dat2)
+
Constructor on mglData: mglData (int size, int cols, const double *dat2)
+
Constructor on mglData: mglData (const double *dat2, int size)
+
Constructor on mglData: mglData (const double *dat2, int size, int cols)
+
Constructor on mglDataC: mglDataC (const mglDataA &dat2)
+
Constructor on mglDataC: mglDataC (const mglDataA *dat2)
+
Constructor on mglDataC: mglDataC (int size, const float *dat2)
+
Constructor on mglDataC: mglDataC (int size, int cols, const float *dat2)
+
Constructor on mglDataC: mglDataC (int size, const double *dat2)
+
Constructor on mglDataC: mglDataC (int size, int cols, const double *dat2)
+
Constructor on mglDataC: mglDataC (int size, const dual *dat2)
+
Constructor on mglDataC: mglDataC (int size, int cols, const dual *dat2)
+

Copy constructor. Allocates the memory for data array and copy values from other array. At this, if parameter eq or val is specified then the data will be modified by corresponding formula similarly to fill. +

+ +
+
MGL command: copy REDAT IMDAT dat2 ['eq'='']
+

Allocates the memory for data array and copy real and imaginary values from complex array dat2. +

+ +
+
MGL command: copy 'name'
+

Allocates the memory for data array and copy values from other array specified by its name, which can be "invalid" for MGL names (like one read from HDF5 files). +

+ + +
+
MGL command: read DAT 'fname'
+
Constructor on mglData: mglData (const char *fname)
+
Constructor on mglDataC: mglDataC (const char *fname)
+
C function: HMDT mgl_create_data_file (const char *fname)
+
C function: HADT mgl_create_datac_file (const char *fname)
+

Reads data from tab-separated text file with auto determining sizes of the data. +

+ +
+
MGL command: delete dat
+
MGL command: delete 'name'
+
Destructor on mglData: ~mglData ()
+
C function: void mgl_delete_data (HMDT dat)
+
Destructor on mglDataC: ~mglDataC ()
+
C function: void mgl_delete_datac (HADT dat)
+

Deletes the data array from memory. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.3 Data resizing

+ + + + + + + + + + + + + +
+
MGL command: new DAT [nx=1 ny=1 nz=1]
+
Method on mglData: void Create (int mx, int my=1, int mz=1)
+
Method on mglDataC: void Create (int mx, int my=1, int mz=1)
+
C function: void mgl_data_create (HMDT dat, int mx, int my, int mz)
+
C function: void mgl_datac_create (HADT dat, int mx, int my, int mz)
+

Creates or recreates the array with specified size and fills it by zero. This function does nothing if one of parameters mx, my, mz is zero or negative. +

+ +
+
MGL command: rearrange dat mx [my=0 mz=0]
+
Method on mglData: void Rearrange (int mx, int my=0, int mz=0)
+
Method on mglDataC: void Rearrange (int mx, int my=0, int mz=0)
+
C function: void mgl_data_rearrange (HMDT dat, int mx, int my, int mz)
+
C function: void mgl_datac_rearrange (HADT dat, int mx, int my, int mz)
+

Rearrange dimensions without changing data array so that resulting sizes should be mx*my*mz < nx*ny*nz. If some of parameter my or mz are zero then it will be selected to optimal fill of data array. For example, if my=0 then it will be change to my=nx*ny*nz/mx and mz=1. +

+ +
+
MGL command: transpose dat ['dim'='yxz']
+
Method on mglData: void Transpose (const char *dim="yx")
+
Method on mglDataC: void Transpose (const char *dim="yx")
+
C function: void mgl_data_transpose (HMDT dat, const char *dim)
+
C function: void mgl_datac_transpose (HADT dat, const char *dim)
+

Transposes (shift order of) dimensions of the data. New order of dimensions is specified in string dim. This function can be useful also after reading of one-dimensional data. +

+ +
+
MGL command: extend dat n1 [n2=0]
+
Method on mglData: void Extend (int n1, int n2=0)
+
Method on mglDataC: void Extend (int n1, int n2=0)
+
C function: void mgl_data_extend (HMDT dat, int n1, int n2)
+
C function: void mgl_datac_extend (HADT dat, int n1, int n2)
+

Increase the dimensions of the data by inserting new (|n1|+1)-th slices after (for n1>0) or before (for n1<0) of existed one. It is possible to insert 2 dimensions simultaneously for 1d data by using parameter n2. Data to new slices is copy from existed one. For example, for n1>0 new array will be +a_ij^new = a_i^old where j=0...n1. Correspondingly, for n1<0 new array will be a_ij^new = a_j^old where i=0...|n1|. +

+ +
+
MGL command: squeeze dat rx [ry=1 rz=1 sm=off]
+
Method on mglData: void Squeeze (int rx, int ry=1, int rz=1, bool smooth=false)
+
Method on mglDataC: void Squeeze (int rx, int ry=1, int rz=1, bool smooth=false)
+
C function: void mgl_data_squeeze (HMDT dat, int rx, int ry, int rz, int smooth)
+
C function: void mgl_datac_squeeze (HADT dat, int rx, int ry, int rz, int smooth)
+

Reduces the data size by excluding data elements which indexes are not divisible by rx, ry, rz correspondingly. Parameter smooth set to use smoothing +(i.e. out[i]=\sum_{j=i,i+r} a[j]/r) or not (i.e. out[i]=a[j*r]). +

+ +
+
MGL command: crop dat n1 n2 'dir'
+
Method on mglData: void Crop (int n1, int n2, char dir='x')
+
Method on mglDataC: void Crop (int n1, int n2, char dir='x')
+
C function: void mgl_data_crop (HMDT dat, int n1, int n2, char dir)
+
C function: void mgl_datac_crop (HADT dat, int n1, int n2, char dir)
+

Cuts off edges of the data i<n1 and i>n2 if n2>0 or i>n[xyz]-n2 if n2<=0 along direction dir. +

+ +
+
MGL command: crop dat 'how'
+
Method on mglData: void Crop (const char *how="235x")
+
Method on mglDataC: void Crop (const char *how="235x")
+
C function: void mgl_data_crop_opt (HMDT dat, const char *how)
+
C function: void mgl_datac_crop_opt (HADT dat, const char *how)
+

Cuts off far edge of the data to be more optimal for fast Fourier transform. The resulting size will be the closest value of 2^n*3^m*5^l to the original one. The string how may contain: ‘x’, ‘y’, ‘z’ for directions, and ‘2’, ‘3’, ‘5’ for using corresponding bases. +

+ +
+
MGL command: insert dat 'dir' [pos=off num=0]
+
Method on mglData: void Insert (char dir, int pos=0, int num=1)
+
Method on mglDataC: void Insert (char dir, int pos=0, int num=1)
+
C function: void mgl_data_insert (HMDT dat, char dir, int pos, char num)
+
C function: void mgl_datac_insert (HADT dat, char dir, int pos, char num)
+

Insert num slices along dir-direction at position pos and fill it by zeros. +

+ +
+
MGL command: delete dat 'dir' [pos=off num=0]
+
Method on mglData: void Delete (char dir, int pos=0, int num=1)
+
Method on mglDataC: void Delete (char dir, int pos=0, int num=1)
+
C function: void mgl_data_delete (HMDT dat, char dir, int pos, char num)
+
C function: void mgl_datac_delete (HADT dat, char dir, int pos, char num)
+

Delete num slices along dir-direction at position pos. +

+ +
+
MGL command: delete dat
+
MGL command: delete 'name'
+

Deletes the whole data array. +

+ +
+
MGL command: sort dat idx [idy=-1]
+
Method on mglData: void Sort (lond idx, long idy=-1)
+
C function: void mgl_data_sort (HMDT dat, lond idx, long idy)
+

Sort data rows (or slices in 3D case) by values of specified column idx (or cell {idx,idy} for 3D case). Note, this function is not thread safe! +

+ +
+
MGL command: clean dat idx
+
Method on mglData: void Clean (lond idx)
+
C function: void mgl_data_clean (HMDT dat, lond idx)
+

Delete rows which values are equal to next row for given column idx. +

+ +
+
MGL command: join dat vdat [v2dat ...]
+
Method on mglData: void Join (const mglDataA &vdat)
+
Method on mglDataC: void Join (const mglDataA &vdat)
+
C function: void mgl_data_join (HMDT dat, HCDT vdat)
+
C function: void mgl_datac_join (HADT dat, HCDT vdat)
+

Join data cells from vdat to dat. At this, function increase dat sizes according following: z-size for data arrays arrays with equal x-,y-sizes; or y-size for data arrays with equal x-sizes; or x-size otherwise. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.4 Data filling

+ + + + + + + + +
+
MGL command: list DAT v1 ...
+

Creates new variable with name dat and fills it by numeric values of command arguments v1 .... Command can create one-dimensional and two-dimensional arrays with arbitrary values. For creating 2d array the user should use delimiter ‘|’ which means that the following values lie in next row. Array sizes are [maximal of row sizes * number of rows]. For example, command list 1 | 2 3 creates the array [1 0; 2 3]. Note, that the maximal number of arguments is 1000. +

+
+
MGL command: list DAT d1 ...
+

Creates new variable with name dat and fills it by data values of arrays of command arguments d1 .... Command can create two-dimensional or three-dimensional (if arrays in arguments are 2d arrays) arrays with arbitrary values. Minor dimensions of all arrays in arguments should be equal to dimensions of first array d1. In the opposite case the argument will be ignored. Note, that the maximal number of arguments is 1000. +

+ +
+
Method on mglData: void Set (const float *A, int NX, int NY=1, int NZ=1)
+
Method on mglData: void Set (const double *A, int NX, int NY=1, int NZ=1)
+
C function: void mgl_data_set_float (HMDT dat, const mreal *A, int NX, int NY, int NZ)
+
C function: void mgl_data_set_double (HMDT dat, const double *A, int NX, int NY, int NZ)
+
Method on mglDataC: void Set (const float *A, int NX, int NY=1, int NZ=1)
+
Method on mglDataC: void Set (const double *A, int NX, int NY=1, int NZ=1)
+
Method on mglDataC: void Set (const dual *A, int NX, int NY=1, int NZ=1)
+
C function: void mgl_datac_set_float (HADT dat, const mreal *A, int NX, int NY, int NZ)
+
C function: void mgl_datac_set_double (HADT dat, const double *A, int NX, int NY, int NZ)
+
C function: void mgl_datac_set_complex (HADT dat, const dual *A, int NX, int NY, int NZ)
+

Allocates memory and copies the data from the flat float* or double* array. +

+ +
+
Method on mglData: void Set (const float **A, int N1, int N2)
+
Method on mglData: void Set (const double **A, int N1, int N2)
+
C function: void mgl_data_set_mreal2 (HMDT dat, const mreal **A, int N1, int N2)
+
C function: void mgl_data_set_double2 (HMDT dat, const double **A, int N1, int N2)
+

Allocates memory and copies the data from the float** or double** array with dimensions N1, N2, i.e. from array defined as mreal a[N1][N2];. +

+ +
+
Method on mglData: void Set (const float ***A, int N1, int N2)
+
Method on mglData: void Set (const double ***A, int N1, int N2)
+
C function: void mgl_data_set_mreal3 (HMDT dat, const mreal ***A, int N1, int N2)
+
C function: void mgl_data_set_double3 (HMDT dat, const double ***A, int N1, int N2)
+

Allocates memory and copies the data from the float*** or double*** array with dimensions N1, N2, N3, i.e. from array defined as mreal a[N1][N2][N3];. +

+ +
+
Method on mglData: void Set (gsl_vector *v)
+
Method on mglDataC: void Set (gsl_vector *v)
+
C function: void mgl_data_set_vector (HMDT dat, gsl_vector *v)
+
C function: void mgl_datac_set_vector (HADT dat, gsl_vector *v)
+

Allocates memory and copies the data from the gsl_vector * structure. +

+
+
Method on mglData: void Set (gsl_matrix *m)
+
Method on mglDataC: void Set (gsl_matrix *m)
+
C function: void mgl_data_set_matrix (HMDT dat, gsl_matrix *m)
+
C function: void mgl_datac_set_matrix (HADT dat, gsl_matrix *m)
+

Allocates memory and copies the data from the gsl_matrix * structure. +

+ +
+
Method on mglData: void Set (const mglDataA &from)
+
Method on mglData: void Set (HCDT from)
+
C function: void mgl_data_set (HMDT dat, HCDT from)
+
Method on mglDataC: void Set (const mglDataA &from)
+
Method on mglDataC: void Set (HCDT from)
+
C function: void mgl_datac_set (HADT dat, HCDT from)
+

Copies the data from mglData (or mglDataA) instance from. +

+ +
+
Method on mglDataC: void Set (const mglDataA &re, const mglDataA &im)
+
Method on mglDataC: void Set (HCDT re, HCDT im)
+
Method on mglDataC: void SetAmpl (HCDT ampl, const mglDataA &phase)
+
C function: void mgl_datac_set_ri (HADT dat, HCDT re, HCDT im)
+
C function: void mgl_datac_set_ap (HADT dat, HCDT ampl, HCDT phase)
+

Copies the data from mglData instances for real and imaginary parts of complex data arrays. +

+ +
+
Method on mglData: void Set (const std::vector<int> &d)
+
Method on mglDataC: void Set (const std::vector<int> &d)
+
Method on mglData: void Set (const std::vector<float> &d)
+
Method on mglDataC: void Set (const std::vector<float> &d)
+
Method on mglData: void Set (const std::vector<double> &d)
+
Method on mglDataC: void Set (const std::vector<double> &d)
+
Method on mglDataC: void Set (const std::vector<dual> &d)
+

Allocates memory and copies the data from the std::vector<T> array. +

+ +
+
Method on mglData: void Set (const char *str, int NX, int NY=1, int NZ=1)
+
C function: void mgl_data_set_values (const char *str, int NX, int NY, int NZ)
+
Method on mglDataC: void Set (const char *str, int NX, int NY=1, int NZ=1)
+
C function: void mgl_datac_set_values (const char *str, int NX, int NY, int NZ)
+

Allocates memory and scanf the data from the string. +

+ + +
+
Method on mglData: void SetList (long n, ...)
+

Allocate memory and set data from variable argument list of double values. Note, you need to specify decimal point ‘.’ for integer values! For example, the code SetList(2,0.,1.); is correct, but the code SetList(2,0,1); is incorrect. +

+ + + +
+
Method on mglData: void Link (mglData &from)
+
Method on mglData: void Link (mreal *A, int NX, int NY=1, int NZ=1)
+
C function: void mgl_data_link (HMDT dat, mreal *A, int NX, int NY, int NZ)
+
Method on mglDataC: void Link (mglDataC &from)
+
Method on mglDataC: void Link (dual *A, int NX, int NY=1, int NZ=1)
+
C function: void mgl_datac_link (HADT dat, dual *A, int NX, int NY, int NZ)
+

Links external data array, i.e. don’t delete this array at exit. +

+ +
+
MGL command: var DAT num v1 [v2=nan]
+

Creates new variable with name dat for one-dimensional array of size num. Array elements are equidistantly distributed in range [v1, v2]. If v2=nan then v2=v1 is used. +

+ +
+
MGL command: fill dat v1 v2 ['dir'='x']
+
Method on mglData: void Fill (mreal v1, mreal v2, char dir='x')
+
Method on mglDataC: void Fill (dual v1, dual v2, char dir='x')
+
C function: void mgl_data_fill (HMDT dat, mreal v1, mreal v2, char dir)
+
C function: void mgl_datac_fill (HADT dat, dual v1, dual v2, char dir)
+

Equidistantly fills the data values to range [v1, v2] in direction dir={‘x’,‘y’,‘z’}. +

+ +
+
MGL command: fill dat 'eq' [vdat wdat]
+
Method on mglData: void Fill (HMGL gr, const char *eq, const char *opt="")
+
Method on mglData: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const char *opt="")
+
Method on mglData: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const mglDataA &wdat, const char *opt="")
+
Method on mglDataC: void Fill (HMGL gr, const char *eq, const char *opt="")
+
Method on mglDataC: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const char *opt="")
+
Method on mglDataC: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const mglDataA &wdat, const char *opt="")
+
C function: void mgl_data_fill_eq (HMGL gr, HMDT dat, const char *eq, HCDT vdat, HCDT wdat, const char *opt)
+
C function: void mgl_datac_fill_eq (HMGL gr, HADT dat, const char *eq, HCDT vdat, HCDT wdat, const char *opt)
+

Fills the value of array according to the formula in string eq. Formula is an arbitrary expression depending on variables ‘x’, ‘y’, ‘z’, ‘u’, ‘v’, ‘w’. Coordinates ‘x’, ‘y’, ‘z’ are supposed to be normalized in axis range of canvas gr (in difference from Modify functions). Variable ‘u’ is the original value of the array. Variables ‘v’ and ‘w’ are values of vdat, wdat which can be NULL (i.e. can be omitted). +

+ +
+
MGL command: modify dat 'eq' [dim=0]
+
MGL command: modify dat 'eq' vdat [wdat]
+
Method on mglData: void Modify (const char *eq, int dim=0)
+
Method on mglData: void Modify (const char *eq, const mglDataA &v)
+
Method on mglData: void Modify (const char *eq, const mglDataA &v, const mglDataA &w)
+
Method on mglDataC: void Modify (const char *eq, int dim=0)
+
Method on mglDataC: void Modify (const char *eq, const mglDataA &v)
+
Method on mglDataC: void Modify (const char *eq, const mglDataA &v, const mglDataA &w)
+
C function: void mgl_data_modify (HMDT dat, const char *eq, int dim)
+
C function: void mgl_data_modify_vw (HMDT dat, const char *eq, HCDT v, HCDT w)
+
C function: void mgl_datac_modify (HADT dat, const char *eq, int dim)
+
C function: void mgl_datac_modify_vw (HADT dat, const char *eq, HCDT v, HCDT w)
+

The same as previous ones but coordinates ‘x’, ‘y’, ‘z’ are supposed to be normalized in range [0,1]. If dim>0 is specified then modification will be fulfilled only for slices >=dim. +

+ +
+
MGL command: fillsample dat 'how'
+
Method on mglData: void FillSample (const char *how)
+
C function: void mgl_data_fill_sample (HMDT a, const char *how)
+

Fills data by ’x’ or ’k’ samples for Hankel (’h’) or Fourier (’f’) transform. +

+ + +
+
MGL command: datagrid dat xdat ydat zdat
+
Method on mglData: mglData Grid (HMGL gr, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *opt="")
+
Method on mglData: mglData Grid (const mglDataA &x, const mglDataA &y, const mglDataA &z, mglPoint p1, mglPoint p2)
+
C function: void mgl_data_grid (HMGL gr, HMDT u, HCDT x, HCDT y, HCDT z, const char *opt)
+
C function: void mgl_data_grid_xy (HMDT u, HCDT x, HCDT y, HCDT z, mreal x1, mreal x2, mreal y1, mreal y2)
+

Fills the value of array according to the linear interpolation of triangulated surface assuming x-,y-coordinates equidistantly distributed in axis range (or in range [x1,x2]*[y1,y2]). Triangulated surface is found for arbitrary placed points ‘x’, ‘y’, ‘z’. NAN value is used for grid points placed outside of triangulated surface. See Making regular data, for sample code and picture. +

+ + +
+
MGL command: put dat val [i=all j=all k=all]
+
Method on mglData: void Put (mreal val, int i=-1, int j=-1, int k=-1)
+
Method on mglDataC: void Put (dual val, int i=-1, int j=-1, int k=-1)
+
C function: void mgl_data_put_val (HMDT a, mreal val, int i, int j, int k)
+
C function: void mgl_datac_put_val (HADT a, dual val, int i, int j, int k)
+

Sets value(s) of array a[i, j, k] = val. Negative indexes i, j, k=-1 set the value val to whole range in corresponding direction(s). For example, Put(val,-1,0,-1); sets a[i,0,j]=val for i=0...(nx-1), j=0...(nz-1). +

+ +
+
MGL command: put dat vdat [i=all j=all k=all]
+
Method on mglData: void Put (const mglDataA &v, int i=-1, int j=-1, int k=-1)
+
Method on mglDataC: void Put (const mglDataA &v, int i=-1, int j=-1, int k=-1)
+
C function: void mgl_data_put_dat (HMDT a, HCDT v, int i, int j, int k)
+
C function: void mgl_datac_put_dat (HADT a, HCDT v, int i, int j, int k)
+

Copies value(s) from array v to the range of original array. Negative indexes i, j, k=-1 set the range in corresponding direction(s). At this minor dimensions of array v should be large than corresponding dimensions of this array. For example, Put(v,-1,0,-1); sets a[i,0,j]=v.ny>nz ? v[i,j] : v[i], where i=0...(nx-1), j=0...(nz-1) and condition v.nx>=nx is true. +

+ +
+
MGL command: refill dat xdat vdat [sl=-1]
+
MGL command: refill dat xdat ydat vdat [sl=-1]
+
MGL command: refill dat xdat ydat zdat vdat
+
Method on mglData: void Refill (const mglDataA &x, const mglDataA &v, mreal x1, mreal x2, long sl=-1)
+
Method on mglData: void Refill (const mglDataA &x, const mglDataA &v, mglPoint p1, mglPoint p2, long sl=-1)
+
Method on mglData: void Refill (const mglDataA &x, const mglDataA &y, const mglDataA &v, mglPoint p1, mglPoint p2, long sl=-1)
+
Method on mglData: void Refill (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &v, mglPoint p1, mglPoint p2)
+
Method on mglData: void Refill (HMGL gr, const mglDataA &x, const mglDataA &v, long sl=-1, const char *opt="")
+
Method on mglData: void Refill (HMGL gr, const mglDataA &x, const mglDataA &y, const mglDataA &v, long sl=-1, const char *opt="")
+
Method on mglData: void Refill (HMGL gr, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &v, const char *opt="")
+
C function: void mgl_data_refill_x (HMDT a, HCDT x, HCDT v, mreal x1, mreal x2, long sl)
+
C function: void mgl_data_refill_xy (HMDT a, HCDT x, HCDT y, HCDT v, mreal x1, mreal x2, mreal y1, mreal y2, long sl)
+
C function: void mgl_data_refill_xyz (HMDT a, HCDT x, HCDT y, HCDT z, HCDT v, mreal x1, mreal x2, mreal y1, mreal y2, mreal z1, mreal z2)
+
C function: void mgl_data_refill_gr (HMGL gr, HMDT a, HCDT x, HCDT y, HCDT z, HCDT v, long sl, const char *opt)
+

Fills by interpolated values of array v at the point {x, y, z}={X[i], Y[j], Z[k]} (or {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} if x, y, z are not 1d arrays), where X,Y,Z are equidistantly distributed in range [x1,x2]*[y1,y2]*[z1,z2] and have the same sizes as this array. If parameter sl is 0 or positive then changes will be applied only for slice sl. +

+ +
+
MGL command: gspline dat xdat vdat [sl=-1]
+
Method on mglData: void RefillGS (const mglDataA &x, const mglDataA &v, mreal x1, mreal x2, long sl=-1)
+
C function: void mgl_data_refill_gs (HMDT a, HCDT x, HCDT v, mreal x1, mreal x2, long sl)
+

Fills by global cubic spline values of array v at the point x=X[i], where X are equidistantly distributed in range [x1,x2] and have the same sizes as this array. If parameter sl is 0 or positive then changes will be applied only for slice sl. +

+ +
+
MGL command: idset dat 'ids'
+
Method on mglData: void SetColumnId (const char *ids)
+
Method on mglDataC: void SetColumnId (const char *ids)
+
C function: void mgl_data_set_id (HMDT a, const char *ids)
+
C function: void mgl_datac_set_id (HADT a, const char *ids)
+

Sets the symbol ids for data columns. The string should contain one symbol ’a’...’z’ per column. These ids are used in column. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.5 File I/O

+ + + + + + + + + + + +
+
MGL command: read DAT 'fname'
+
MGL command: read REDAT IMDAT 'fname'
+
Method on mglData: bool Read (const char *fname)
+
Method on mglDataC: bool Read (const char *fname)
+
C function: int mgl_data_read (HMDT dat, const char *fname)
+
C function: int mgl_datac_read (HADT dat, const char *fname)
+

Reads data from tab-separated text file with auto determining sizes of the data. Double newline means the beginning of new z-slice. +

+ +
+
MGL command: read DAT 'fname' mx [my=1 mz=1]
+
MGL command: read REDAT IMDAT 'fname' mx [my=1 mz=1]
+
Method on mglData: bool Read (const char *fname, int mx, int my=1, int mz=1)
+
Method on mglDataC: bool Read (const char *fname, int mx, int my=1, int mz=1)
+
C function: int mgl_data_read_dim (HMDT dat, const char *fname, int mx, int my, int mz)
+
C function: int mgl_datac_read_dim (HADT dat, const char *fname, int mx, int my, int mz)
+

Reads data from text file with specified data sizes. This function does nothing if one of parameters mx, my or mz is zero or negative. +

+ +
+
MGL command: readmat DAT 'fname' [dim=2]
+
Method on mglData: bool ReadMat (const char *fname, int dim=2)
+
Method on mglDataC: bool ReadMat (const char *fname, int dim=2)
+
C function: int mgl_data_read_mat (HMDT dat, const char *fname, int dim)
+
C function: int mgl_datac_read_mat (HADT dat, const char *fname, int dim)
+

Read data from text file with size specified at beginning of the file by first dim numbers. At this, variable dim set data dimensions. +

+ +
+
MGL command: readall DAT 'templ' v1 v2 [dv=1 slice=off]
+
Method on mglData: void ReadRange (const char *templ, mreal from, mreal to, mreal step=1, bool as_slice=false)
+
Method on mglDataC: void ReadRange (const char *templ, mreal from, mreal to, mreal step=1, bool as_slice=false)
+
C function: int mgl_data_read_range (HMDT dat, const char *templ, mreal from, mreal to, mreal step, int as_slice)
+
C function: int mgl_datac_read_range (HADT dat, const char *templ, mreal from, mreal to, mreal step, int as_slice)
+

Join data arrays from several text files. The file names are determined by function call sprintf(fname,templ,val);, where val changes from from to to with step step. The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true. +

+ +
+
MGL command: readall DAT 'templ' [slice=off]
+
Method on mglData: void ReadAll (const char *templ, bool as_slice=false)
+
Method on mglDataC: void ReadAll (const char *templ, bool as_slice=false)
+
C function: int mgl_data_read_all (HMDT dat, const char *templ, int as_slice)
+
C function: int mgl_datac_read_all (HADT dat, const char *templ, int as_slice)
+

Join data arrays from several text files which filenames satisfied the template templ (for example, templ="t_*.dat"). The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true. +

+ +
+
MGL command: scanfile DAT 'fname' 'templ'
+
Method on mglData: bool ScanFile (const char *fname, const char *templ)
+
C function: int mgl_data_scan_file (HMDT dat, const char *fname, const char *templ)
+

Read file fname line-by-line and scan each line for numbers according the template templ. The numbers denoted as ‘%g’ in the template. See Saving and scanning file, for sample code and picture. +

+ +
+
MGL command: save dat 'fname'
+
Method on mglDataA: void Save (const char *fname, int ns=-1) const
+
C function: void mgl_data_save (HCDT dat, const char *fname, int ns)
+
C function: void mgl_datac_save (HCDT dat, const char *fname, int ns)
+

Saves the whole data array (for ns=-1) or only ns-th slice to the text file fname. +

+ +
+
MGL command: save 'str' 'fname' ['mode'='a']
+

Saves the string str to the text file fname. For parameter mode=‘a’ will append string to the file (default); for mode=‘w’ will overwrite the file. See Saving and scanning file, for sample code and picture. +

+ + +
+
MGL command: readhdf DAT 'fname' 'dname'
+
Method on mglData: void ReadHDF (const char *fname, const char *dname)
+
Method on mglDataC: void ReadHDF (const char *fname, const char *dname)
+
C function: void mgl_data_read_hdf (HMDT dat, const char *fname, const char *dname)
+
C function: void mgl_datac_read_hdf (HADT dat, const char *fname, const char *dname)
+

Reads data array named dname from HDF5 or HDF4 file. This function does nothing if HDF5|HDF4 was disabled during library compilation. +

+ +
+
MGL command: savehdf dat 'fname' 'dname' [rewrite=off]
+
Method on mglDataA: void SaveHDF (const char *fname, const char *dname, bool rewrite=false) const
+
C function: void mgl_data_save_hdf (HCDT dat, const char *fname, const char *dname, int rewrite)
+
C function: void mgl_datac_save_hdf (HCDT dat, const char *fname, const char *dname, int rewrite)
+

Saves data array named dname to HDF5 file. This function does nothing if HDF5 was disabled during library compilation. +

+ +
+
MGL command: datas 'fname'
+
Method on mglDataA: int DatasHDF (const char *fname, char *buf, long size) static
+
C function: int mgl_datas_hdf (const char *fname, char *buf, long size)
+

Put data names from HDF5 file fname into buf as ’\t’ separated fields. In MGL version the list of data names will be printed as message. This function does nothing if HDF5 was disabled during library compilation. +

+ +
+
MGL command: openhdf 'fname'
+
Method on mglParse: void OpenHDF (const char *fname)
+
C function: void mgl_parser_openhdf (HMPR pr, const char *fname)
+

Reads all data array from HDF5 file fname and create MGL variables with names of data names in HDF file. Complex variables will be created if data name starts with ‘!’. +

+ +
+
C function: const char * const * mgl_datas_hdf_str (HMPR pr, const char *fname)
+

Put HDF data names as list of strings (last one is ""). The result is valid untill next call of the function. +

+ + +
+
MGL command: import DAT 'fname' 'sch' [v1=0 v2=1]
+
Method on mglData: void Import (const char *fname, const char *scheme, mreal v1=0, mreal v2=1)
+
C function: void mgl_data_import (HMDT dat, const char *fname, const char *scheme, mreal v1, mreal v2)
+

Reads data from bitmap file (now support only PNG format). The RGB values of bitmap pixels are transformed to mreal values in range [v1, v2] using color scheme scheme (see Color scheme). +

+ +
+
MGL command: export dat 'fname' 'sch' [v1=0 v2=0]
+
Method on mglDataA: void Export (const char *fname, const char *scheme, mreal v1=0, mreal v2=0, int ns=-1) const
+
C function: void mgl_data_export (HMDT dat, const char *fname, const char *scheme, mreal v1, mreal v2, int ns) const
+

Saves data matrix (or ns-th slice for 3d data) to bitmap file (now support only PNG format). The data values are transformed from range [v1, v2] to RGB pixels of bitmap using color scheme scheme (see Color scheme). If v1>=v2 then the values of v1, v2 are automatically determined as minimal and maximal value of the data array. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.6 Make another data

+ + + + + + + + + + + + + + + + + +
+
MGL command: subdata RES dat xx [yy=all zz=all]
+
Method on mglData: mglData SubData (mreal xx, mreal yy=-1, mreal zz=-1) const
+
Method on mglDataC: mglData SubData (mreal xx, mreal yy=-1, mreal zz=-1) const
+
C function: HMDT mgl_data_subdata (HCDT dat, mreal xx, mreal yy, mreal zz)
+

Extracts sub-array data from the original data array keeping fixed positive index. For example SubData(-1,2) extracts 3d row (indexes are zero based), SubData(4,-1) extracts 5th column, SubData(-1,-1,3) extracts 4th slice and so on. If argument(s) are non-integer then linear interpolation between slices is used. In MGL version this command usually is used as inline one dat(xx,yy,zz). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: subdata RES dat xdat [ydat zdat]
+
Method on mglData: mglData SubData (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz) const
+
Method on mglDataC: mglData SubData (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz) const
+
Method on mglData: mglData SubData (const mglDataA &xx, const mglDataA &yy) const
+
Method on mglDataC: mglData SubData (const mglDataA &xx, const mglDataA &yy) const
+
Method on mglData: mglData SubData (const mglDataA &xx) const
+
Method on mglDataC: mglData SubData (const mglDataA &xx) const
+
C function: HMDT mgl_data_subdata_ext (HCDT dat, HCDT xx, HCDT yy, HCDT zz)
+
C function: HADT mgl_datac_subdata_ext (HCDT dat, HCDT xx, HCDT yy, HCDT zz)
+

Extracts sub-array data from the original data array for indexes specified by arrays xx, yy, zz (indirect access). This function work like previous one for 1D arguments or numbers, and resulting array dimensions are equal dimensions of 1D arrays for corresponding direction. For 2D and 3D arrays in arguments, the resulting array have the same dimensions as input arrays. The dimensions of all argument must be the same (or to be scalar 1*1*1) if they are 2D or 3D arrays. In MGL version this command usually is used as inline one dat(xx,yy,zz). Function return NULL or create empty data if data cannot be created for given arguments. In C function some of xx, yy, zz can be NULL. +

+ +
+
MGL command: column RES dat 'eq'
+
Method on mglData: mglData Column (const char *eq) const
+
Method on mglDataC: mglData Column (const char *eq) const
+
C function: HMDT mgl_data_column (HCDT dat, const char *eq)
+

Get column (or slice) of the data filled by formula eq on column ids. For example, Column("n*w^2/exp(t)");. The column ids must be defined first by idset function or read from files. In MGL version this command usually is used as inline one dat('eq'). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: resize RES dat mx [my=1 mz=1]
+
Method on mglData: mglData Resize (int mx, int my=0, int mz=0, mreal x1=0, mreal x2=1, mreal y1=0, mreal y2=1, mreal z1=0, mreal z2=1) const
+
Method on mglDataC: mglData Resize (int mx, int my=0, int mz=0, mreal x1=0, mreal x2=1, mreal y1=0, mreal y2=1, mreal z1=0, mreal z2=1) const
+
C function: HMDT mgl_data_resize (HCDT dat, int mx, int my, int mz)
+
C function: HMDT mgl_data_resize_box (HCDT dat, int mx, int my, int mz, mreal x1, mreal x2, mreal y1, mreal y2, mreal z1, mreal z2)
+

Resizes the data to new size mx, my, mz from box (part) [x1,x2] x [y1,y2] x [z1,z2] of original array. Initially x,y,z coordinates are supposed to be in [0,1]. If one of sizes mx, my or mz is 0 then initial size is used. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: evaluate RES dat idat [norm=on]
+
MGL command: evaluate RES dat idat jdat [norm=on]
+
MGL command: evaluate RES dat idat jdat kdat [norm=on]
+
Method on mglData: mglData Evaluate (const mglDataA &idat, bool norm=true) const
+
Method on mglData: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, bool norm=true) const
+
Method on mglData: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, const mglDataA &kdat, bool norm=true) const
+
Method on mglDataC: mglData Evaluate (const mglDataA &idat, bool norm=true) const
+
Method on mglDataC: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, bool norm=true) const
+
Method on mglDataC: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, const mglDataA &kdat, bool norm=true) const
+
C function: HMDT mgl_data_evaluate (HCDT dat, HCDT idat, HCDT jdat, HCDT kdat, int norm)
+

Gets array which values is result of interpolation of original array for coordinates from other arrays. All dimensions must be the same for data idat, jdat, kdat. Coordinates from idat, jdat, kdat are supposed to be normalized in range [0,1] (if norm=true) or in ranges [0,nx], [0,ny], [0,nz] correspondingly. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: section RES dat ids ['dir'='y' val=nan]
+
MGL command: section RES dat id ['dir'='y' val=nan]
+
Method on mglData: mglData Section (const mglDataA &ids, const char *dir='y', mreal val=NAN) const
+
Method on mglData: mglData Section (long id, const char *dir='y', mreal val=NAN) const
+
Method on mglDataC: mglData Section (const mglDataA &ids, const char *dir='y', mreal val=NAN) const
+
Method on mglDataC: mglData Section (long id, const char *dir='y', mreal val=NAN) const
+
C function: HMDT mgl_data_section (HCDT dat, HCDT ids, const char *dir, mreal val)
+
C function: HMDT mgl_data_section_val (HCDT dat, long id, const char *dir, mreal val)
+
C function: HADT mgl_datac_section (HCDT dat, HCDT ids, const char *dir, mreal val)
+
C function: HADT mgl_datac_section_val (HCDT dat, long id, const char *dir, mreal val)
+

Gets array which is id-th section (range of slices separated by value val) of original array dat. For id<0 the reverse order is used (i.e. -1 give last section). If several ids are provided then output array will be result of sequential joining of sections. +

+ + +
+
MGL command: solve RES dat val 'dir' [norm=on]
+
MGL command: solve RES dat val 'dir' idat [norm=on]
+
Method on mglData: mglData Solve (mreal val, char dir, bool norm=true) const
+
Method on mglData: mglData Solve (mreal val, char dir, const mglDataA &idat, bool norm=true) const
+
C function: HMDT mgl_data_solve (HCDT dat, mreal val, char dir, HCDT idat, int norm)
+

Gets array which values is indexes (roots) along given direction dir, where interpolated values of data dat are equal to val. Output data will have the sizes of dat in directions transverse to dir. If data idat is provided then its values are used as starting points. This allows to find several branches by consequentive calls. Indexes are supposed to be normalized in range [0,1] (if norm=true) or in ranges [0,nx], [0,ny], [0,nz] correspondingly. Function return NULL or create empty data if data cannot be created for given arguments. See Solve sample, for sample code and picture. +

+ +
+
MGL command: roots RES 'func' ini ['var'='x']
+
MGL command: roots RES 'func' ini ['var'='x']
+
Method on mglData: mglData Roots (const char *func, char var) const
+
C function: HMDT mgl_data_roots (const char *func, HCDT ini, char var)
+
C function: mreal mgl_find_root_txt (const char *func, mreal ini, char var)
+

Find roots of equation ’func’=0 for variable var with initial guess ini. Secant method is used for root finding. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: roots RES 'funcs' 'vars' ini
+
Method on mglData: mglData MultiRoots (const char *funcs, const char *vars) const
+
Method on mglDataC: mglDataC MultiRoots (const char *funcs, const char *vars) const
+
C function: HMDT mgl_find_roots_txt (const char *func, const char *vars, HCDT ini)
+
C function: HADT mgl_find_roots_txt_c (const char *func, const char *vars, HCDT ini)
+

Find roots of system of equations ’funcs’=0 for variables vars with initial guesses ini. Secant method is used for root finding. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: detect RES dat lvl dj [di=0 minlen=0]
+
Method on mglData: mglData Detect (mreal lvl, mreal dj, mreal di=0, mreal minlen=0) const
+
C function: HMDT mgl_data_detect (HCDT dat, mreal lvl, mreal dj, mreal di, mreal minlen)
+

Get curves {x,y}, separated by NAN values, for local maximal values of array dat as function of x-coordinate. Noises below lvl amplitude are ignored. Parameter dj (in range [0,ny]) set the "attraction" y-distance of points to the curve. Similarly, di continue curve in x-direction through gaps smaller than di points. Curves with minimal length smaller than minlen will be ignored. +

+ +
+
MGL command: hist RES dat num v1 v2 [nsub=0]
+
MGL command: hist RES dat wdat num v1 v2 [nsub=0]
+
Method on mglData: mglData Hist (int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
Method on mglData: mglData Hist (const mglDataA &w, int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
Method on mglDataC: mglData Hist (int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
Method on mglDataC: mglData Hist (const mglDataA &w, int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
C function: HMDT mgl_data_hist (HCDT dat, int n, mreal v1, mreal v2, int nsub)
+
C function: HMDT mgl_data_hist_w (HCDT dat, HCDT w, int n, mreal v1, mreal v2, int nsub)
+

Creates n-th points distribution of the data values in range [v1, v2]. Array w specifies weights of the data elements (by default is 1). Parameter nsub define the number of additional interpolated points (for smoothness of histogram). Function return NULL or create empty data if data cannot be created for given arguments. See also Data manipulation +

+ +
+
MGL command: momentum RES dat 'how' ['dir'='z']
+
Method on mglData: mglData Momentum (char dir, const char *how) const
+
Method on mglDataC: mglData Momentum (char dir, const char *how) const
+
C function: HMDT mgl_data_momentum (HCDT dat, char dir, const char *how)
+

Gets momentum (1d-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as +res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij +if dir=‘z’ and so on. Coordinates ‘x’, ‘y’, ‘z’ are data indexes normalized in range [0,1]. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: sum RES dat 'dir'
+
Method on mglData: mglData Sum (const char *dir) const
+
Method on mglDataC: mglData Sum (const char *dir) const
+
C function: HMDT mgl_data_sum (HCDT dat, const char *dir)
+

Gets array which is the result of summation in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: max RES dat 'dir'
+
Method on mglData: mglData Max (const char *dir) const
+
Method on mglDataC: mglData Max (const char *dir) const
+
C function: HMDT mgl_data_max_dir (HCDT dat, const char *dir)
+

Gets array which is the maximal data values in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: min RES dat 'dir'
+
Method on mglData: mglData Min (const char *dir) const
+
Method on mglDataC: mglData Min (const char *dir) const
+
C function: HMDT mgl_data_min_dir (HCDT dat, const char *dir)
+

Gets array which is the maximal data values in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: combine RES adat bdat
+
Method on mglData: mglData Combine (const mglDataA &a) const
+
Method on mglDataC: mglData Combine (const mglDataA &a) const
+
C function: HMDT mgl_data_combine (HCDT dat, HCDT a)
+

Returns direct multiplication of arrays (like, res[i,j] = this[i]*a[j] and so on). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: trace RES dat
+
Method on mglData: mglData Trace () const
+
Method on mglDataC: mglData Trace () const
+
C function: HMDT mgl_data_trace (HCDT dat)
+

Gets array of diagonal elements a[i,i] (for 2D case) or a[i,i,i] (for 3D case) where i=0...nx-1. Function return copy of itself for 1D case. Data array must have dimensions ny,nz >= nx or ny,nz = 1. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: correl RES adat bdat 'dir'
+
Method on mglData: mglData Correl (const mglDataA &b, const char *dir) const
+
Method on mglData: mglData AutoCorrel (const char *dir) const
+
Method on mglDataC: mglDataC Correl (const mglDataA &b, const char *dir) const
+
Method on mglDataC: mglDataC AutoCorrel (const char *dir) const
+
C function: HMDT mgl_data_correl (HCDT a, HCDT b, const char *dir)
+
C function: HADT mgl_datac_correl (HCDT a, HCDT b, const char *dir)
+

Find correlation between data a (or this in C++) and b along directions dir. Fourier transform is used to find the correlation. So, you may want to use functions swap or norm before plotting it. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
Method on mglDataC: mglData Real () const
+
C function: HMDT mgl_datac_real (HCDT dat)
+

Gets array of real parts of the data. +

+
+
Method on mglDataC: mglData Imag () const
+
C function: HMDT mgl_datac_imag (HCDT dat)
+

Gets array of imaginary parts of the data. +

+
+
Method on mglDataC: mglData Abs () const
+
C function: HMDT mgl_datac_abs (HCDT dat)
+

Gets array of absolute values of the data. +

+
+
Method on mglDataC: mglData Arg () const
+
C function: HMDT mgl_datac_arg (HCDT dat)
+

Gets array of arguments of the data. +

+ +
+
MGL command: pulse RES dat 'dir'
+
Method on mglData: mglData Pulse (const char *dir) const
+
C function: HMDT mgl_data_pulse (HCDT dat, const char *dir)
+

Find pulse properties along direction dir: pulse maximum (in column 0) and its position (in column 1), pulse width near maximum (in column 3) and by half height (in column 2), energy in first pulse (in column 4). NAN values are used for widths if maximum is located near the edges. Note, that there is uncertainty for complex data. Usually one should use square of absolute value (i.e. |dat[i]|^2) for them. So, MathGL don’t provide this function for complex data arrays. However, C function will work even in this case but use absolute value (i.e. |dat[i]|). Function return NULL or create empty data if data cannot be created for given arguments. See also max, min, momentum, sum. See Pulse properties, for sample code and picture. +

+ + + +
+ + + +

6.7 Data changing

+ + + + + + + + + + + + + + + + + +

These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain ‘x’, ‘y’ or ‘z’ characters for 1-st, 2-nd and 3-d dimension correspondingly. +

+
+
MGL command: cumsum dat 'dir'
+
Method on mglData: void CumSum (const char *dir)
+
Method on mglDataC: void CumSum (const char *dir)
+
C function: void mgl_data_cumsum (HMDT dat, const char *dir)
+
C function: void mgl_datac_cumsum (HADT dat, const char *dir)
+

Cumulative summation of the data in given direction or directions. +

+ +
+
MGL command: integrate dat 'dir'
+
Method on mglData: void Integral (const char *dir)
+
Method on mglDataC: void Integral (const char *dir)
+
C function: void mgl_data_integral (HMDT dat, const char *dir)
+
C function: void mgl_datac_integral (HADT dat, const char *dir)
+

Integrates (like cumulative summation) the data in given direction or directions. +

+ +
+
MGL command: diff dat 'dir'
+
Method on mglData: void Diff (const char *dir)
+
Method on mglDataC: void Diff (const char *dir)
+
C function: void mgl_data_diff (HMDT dat, const char *dir)
+
C function: void mgl_datac_diff (HADT dat, const char *dir)
+

Differentiates the data in given direction or directions. +

+ +
+
MGL command: diff dat xdat ydat [zdat]
+
Method on mglData: void Diff (const mglDataA &x)
+
Method on mglData: void Diff (const mglDataA &x, const mglDataA &y)
+
Method on mglData: void Diff (const mglDataA &x, const mglDataA &y, const mglDataA &z)
+
Method on mglDataC: void Diff (const mglDataA &x)
+
Method on mglDataC: void Diff (const mglDataA &x, const mglDataA &y)
+
Method on mglDataC: void Diff (const mglDataA &x, const mglDataA &y, const mglDataA &z)
+
C function: void mgl_data_diff_par (HMDT dat, HCDT x, HCDTy, HCDTz)
+
C function: void mgl_datac_diff_par (HADT dat, HCDT x, HCDTy, HCDTz)
+

Differentiates the data specified parametrically in direction x with y, z=constant. Parametrical differentiation uses the formula (for 2D case): da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j) where a_i=da/di, a_j=da/dj denotes usual differentiation along 1st and 2nd dimensions. The similar formula is used for 3D case. Note, that you may change the order of arguments – for example, if you have 2D data a(i,j) which depend on coordinates {x(i,j), y(i,j)} then usual derivative along ‘x’ will be Diff(x,y); and usual derivative along ‘y’ will be Diff(y,x);. +

+ +
+
MGL command: diff2 dat 'dir'
+
Method on mglData: void Diff2 (const char *dir)
+
Method on mglDataC: void Diff2 (const char *dir)
+
C function: void mgl_data_diff2 (HMDT dat, const char *dir)
+
C function: void mgl_datac_diff2 (HADT dat, const char *dir)
+

Double-differentiates (like Laplace operator) the data in given direction. +

+ +
+
MGL command: sinfft dat 'dir'
+
Method on mglData: void SinFFT (const char *dir)
+
C function: void mgl_data_sinfft (HMDT dat, const char *dir)
+

Do Sine transform of the data in given direction or directions. The Sine transform is \sum a_j \sin(k j) (see http://en.wikipedia.org/wiki/Discrete_sine_transform#DST-I). +

+ +
+
MGL command: cosfft dat 'dir'
+
Method on mglData: void CosFFT (const char *dir)
+
C function: void mgl_data_cosfft (HMDT dat, const char *dir)
+

Do Cosine transform of the data in given direction or directions. The Cosine transform is \sum a_j \cos(k j) (see http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-I). +

+ +
+
Method on mglDataC: void FFT (const char *dir)
+
C function: void mgl_datac_fft (HADT dat, const char *dir)
+

Do Fourier transform of the data in given direction or directions. If dir contain ‘i’ then inverse Fourier is used. The Fourier transform is \sum a_j \exp(i k j) (see http://en.wikipedia.org/wiki/Discrete_Fourier_transform). +

+ +
+
MGL command: hankel dat 'dir'
+
Method on mglData: void Hankel (const char *dir)
+
Method on mglDataC: void Hankel (const char *dir)
+
C function: void mgl_data_hankel (HMDT dat, const char *dir)
+
C function: void mgl_datac_hankel (HADT dat, const char *dir)
+

Do Hankel transform of the data in given direction or directions. The Hankel transform is \sum a_j J_0(k j) (see http://en.wikipedia.org/wiki/Hankel_transform). +

+ +
+
MGL command: wavelet dat 'dir' k
+
Method on mglData: void Wavelet (const char *dir, int k)
+
C function: void mgl_data_wavelet (HMDT dat, const char *dir, int k)
+

Apply wavelet transform of the data in given direction or directions. Parameter dir set the kind of wavelet transform: +‘d’ for daubechies, ‘D’ for centered daubechies, ‘h’ for haar, ‘H’ for centered haar, ‘b’ for bspline, ‘B’ for centered bspline. If string dir contain symbol ‘i’ then inverse wavelet transform is applied. Parameter k set the size of wavelet transform. +

+ +
+
MGL command: swap dat 'dir'
+
Method on mglData: void Swap (const char *dir)
+
Method on mglDataC: void Swap (const char *dir)
+
C function: void mgl_data_swap (HMDT dat, const char *dir)
+
C function: void mgl_datac_swap (HADT dat, const char *dir)
+

Swaps the left and right part of the data in given direction (useful for Fourier spectrum). +

+ +
+
MGL command: roll dat 'dir' num
+
Method on mglData: void Roll (char dir, num)
+
Method on mglDataC: void Roll (char dir, num)
+
C function: void mgl_data_roll (HMDT dat, char dir, num)
+
C function: void mgl_datac_roll (HADT dat, char dir, num)
+

Rolls the data along direction dir. Resulting array will be out[i] = ini[(i+num)%nx] if dir='x'. +

+ +
+
MGL command: mirror dat 'dir'
+
Method on mglData: void Mirror (const char *dir)
+
Method on mglDataC: void Mirror (const char *dir)
+
C function: void mgl_data_mirror (HMDT dat, const char *dir)
+
C function: void mgl_datac_mirror (HADT dat, const char *dir)
+

Mirror the left-to-right part of the data in given direction. Looks like change the value index i->n-i. Note, that the similar effect in graphics you can reach by using options (see Command options), for example, surf dat; xrange 1 -1. +

+ +
+
MGL command: sew dat ['dir'='xyz' da=2*pi]
+
Method on mglData: void Sew (const char *dir, mreal da=2*M_PI)
+
C function: void mgl_data_sew (HMDT dat, const char *dir, mreal da)
+

Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction. +

+ +
+
MGL command: smooth data ['dir'='xyz']
+
Method on mglData: void Smooth (const char *dir="xyz", mreal delta=0)
+
Method on mglDataC: void Smooth (const char *dir="xyz", mreal delta=0)
+
C function: void mgl_data_smooth (HMDT dat, const char *dir, mreal delta)
+
C function: void mgl_datac_smooth (HADT dat, const char *dir, mreal delta)
+

Smooths the data on specified direction or directions. String dirs specifies the dimensions which will be smoothed. It may contain characters: +

    +
  • xyz’ for smoothing along x-,y-,z-directions correspondingly, +
  • 0’ does nothing, +
  • 3’ for linear averaging over 3 points, +
  • 5’ for linear averaging over 5 points, +
  • d1’...‘d9’ for linear averaging over (2*N+1)-th points, +
  • ^’ for finding upper bound, +
  • _’ for finding lower bound. +
+

By default quadratic averaging over 5 points is used. +

+ +
+
MGL command: envelop dat ['dir'='x']
+
Method on mglData: void Envelop (char dir='x')
+
C function: void mgl_data_envelop (HMDT dat, char dir)
+

Find envelop for data values along direction dir. +

+ +
+
MGL command: diffract dat 'how' q
+
Method on mglDataC: void Diffraction (const char *how, mreal q)
+
C function: void mgl_datac_diffr (HADT dat, const char *how, mreal q)
+

Calculates one step of diffraction by finite-difference method with parameter q=\delta t/\delta x^2 using method with 3-d order of accuracy. Parameter how may contain: +

    +
  • xyz’ for calculations along x-,y-,z-directions correspondingly; +
  • r’ for using axial symmetric Laplace operator for x-direction; +
  • 0’ for zero boundary conditions; +
  • 1’ for constant boundary conditions; +
  • 2’ for linear boundary conditions; +
  • 3’ for parabolic boundary conditions; +
  • 4’ for exponential boundary conditions; +
  • 5’ for gaussian boundary conditions. +
+
+ +
+
MGL command: norm dat v1 v2 [sym=off dim=0]
+
Method on mglData: void Norm (mreal v1=0, mreal v2=1, bool sym=false, long dim=0)
+
C function: void mgl_data_norm (HMDT dat, mreal v1, mreal v2, int sym, long dim)
+

Normalizes the data to range [v1,v2]. If flag sym=true then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. Modification will be applied only for slices >=dim. +

+ +
+
MGL command: normsl dat v1 v2 ['dir'='z' keep=on sym=off]
+
Method on mglData: void NormSl (mreal v1=0, mreal v2=1, char dir='z', bool keep=true, bool sym=false)
+
C function: void mgl_data_norm_slice (HMDT dat, mreal v1, mreal v2, char dir, int keep, int sym)
+

Normalizes data slice-by-slice along direction dir the data in slices to range [v1,v2]. If flag sym=true then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. If keep is set then maximal value of k-th slice will be limited by +\sqrt{\sum a_ij(k)/\sum a_ij(0)}. +

+ +
+
MGL command: limit dat val
+
Method on mglData: void Limit (mreal val)
+
Method on mglDataC: void Limit (mreal val)
+
C function: void mgl_data_limit (HMDT dat, mreal val)
+
C function: void mgl_datac_limit (HADT dat, mreal val)
+

Limits the data values to be inside the range [-val,val], keeping the original sign of the value (phase for complex numbers). This is equivalent to operation a[i] *= abs(a[i])<val?1.:val/abs(a[i]);. +

+ +
+
MGL command: coil dat v1 v2 [sep=on]
+
Method on mglData: void Coil (mreal v1, mreal v2, bool sep=true)
+
C function: void mgl_data_coil (HMDT dat, mreal v1, mreal v2, int sep)
+

Project the periodical data to range [v1,v2] (like mod() function). Separate branches by NAN if sep=true. +

+ + +
+
MGL command: dilate dat [val=1 step=1]
+
Method on mglData: void Dilate (mreal val=1, long step=1)
+
C function: void mgl_data_dilate (HMDT dat, mreal val, long step)
+

Return dilated by step cells array of 0 or 1 for data values larger val.

+ +
+
MGL command: erode dat [val=1 step=1]
+
Method on mglData: void Erode (mreal val=1, long step=1)
+
C function: void mgl_data_erode (HMDT dat, mreal val, long step)
+

Return eroded by step cells array of 0 or 1 for data values larger val.

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.8 Interpolation

+ + +

MGL scripts can use spline interpolation by evaluate or refill commands. Also you can use resize for obtaining a data array with new sizes. +

+ +

However, there are much special faster functions in other modes (C/C++/Fortran/Python/...). +

+ +
+
Method on mglData: mreal Spline (mreal x, mreal y=0, mreal z=0) const
+
Method on mglDataC: dual Spline (mreal x, mreal y=0, mreal z=0) const
+
C function: mreal mgl_data_spline (HCDT dat, mreal x, mreal y, mreal z)
+
C function: dual mgl_datac_spline (HCDT dat, mreal x, mreal y, mreal z)
+

Interpolates data by cubic spline to the given point x in [0...nx-1], y in [0...ny-1], z in [0...nz-1]. +

+ +
+
Method on mglData: mreal Spline1 (mreal x, mreal y=0, mreal z=0) const
+
Method on mglDataC: dual Spline1 (mreal x, mreal y=0, mreal z=0) const
+

Interpolates data by cubic spline to the given point x, y, z which assumed to be normalized in range [0, 1]. +

+ +
+
Method on mglData: mreal Spline (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
C function: mreal mgl_data_spline_ext (HCDT dat, mreal x, mreal y, mreal z, mreal *dx, mreal *dy, mreal *dz)
+
C function: dual mgl_datac_spline_ext (HCDT dat, mreal x, mreal y, mreal z, dual *dx, dual *dy, dual *dz)
+

Interpolates data by cubic spline to the given point x in [0...nx-1], y in [0...ny-1], z in [0...nz-1]. The values of derivatives at the point are saved in dif. +

+ +
+
Method on mglData: mreal Spline1 (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+

Interpolates data by cubic spline to the given point x, y, z which assumed to be normalized in range [0, 1]. The values of derivatives at the point are saved in dif. +

+ + +
+
Method on mglData: mreal Linear (mreal x, mreal y=0, mreal z=0) const
+
Method on mglDataC: dual Linear (mreal x, mreal y=0, mreal z=0) const
+
C function: mreal mgl_data_linear (HCDT dat, mreal x, mreal y, mreal z)
+
C function: dual mgl_datac_linear (HCDT dat, mreal x, mreal y, mreal z)
+

Interpolates data by linear function to the given point x in [0...nx-1], y in [0...ny-1], z in [0...nz-1]. +

+ +
+
Method on mglData: mreal Linear1 (mreal x, mreal y=0, mreal z=0) const
+
Method on mglDataC: dual Linear1 (mreal x, mreal y=0, mreal z=0) const
+

Interpolates data by linear function to the given point x, y, z which assumed to be normalized in range [0, 1]. +

+ +
+
Method on mglData: mreal Linear (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
Method on mglDataC: dual Linear (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
C function: mreal mgl_data_linear_ext (HCDT dat, mreal x, mreal y, mreal z, mreal *dx, mreal *dy, mreal *dz)
+
C function: dual mgl_datac_linear_ext (HCDT dat, mreal x, mreal y, mreal z, dual *dx, dual *dy, dual *dz)
+

Interpolates data by linear function to the given point x in [0...nx-1], y in [0...ny-1], z in [0...nz-1]. The values of derivatives at the point are saved in dif. +

+ +
+
Method on mglData: mreal Linear1 (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
Method on mglDataC: dual Linear1 (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+

Interpolates data by linear function to the given point x, y, z which assumed to be normalized in range [0, 1]. The values of derivatives at the point are saved in dif. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.9 Data information

+ + +

There are a set of functions for obtaining data properties in MGL language. However most of them can be found using "suffixes". Suffix can get some numerical value of the data array (like its size, maximal or minimal value, the sum of elements and so on) as number. Later it can be used as usual number in command arguments. The suffixes start from point ‘.’ right after (without spaces) variable name or its sub-array. For example, a.nx give the x-size of data a, b(1).max give maximal value of second row of variable b, (c(:,0)^2).sum give the sum of squares of elements in the first column of c and so on. +

+ + +
+
MGL command: info dat
+
Method on mglDataA: const char * PrintInfo () const
+
Method on mglDataA: void PrintInfo (FILE *fp) const
+
C function only: const char * mgl_data_info (HCDT dat)
+
Fortran subroutine: mgl_data_info (long dat, char *out, int len)
+

Gets or prints to file fp or as message (in MGL) information about the data (sizes, maximum/minimum, momentums and so on). +

+ +
+
MGL command: info 'txt'
+

Prints string txt as message. +

+ +
+
MGL command: info val
+

Prints value of number val as message. +

+ +
+
MGL command: print dat
+
MGL command: print 'txt'
+
MGL command: print val
+

The same as info but immediately print to stdout. +

+ +
+
MGL command: echo dat
+

Prints all values of the data array dat as message. +

+ +
+
MGL command: progress val max
+
Method on mglGraph: void Progress (int val, int max)
+
C function: void mgl_progress (int val, int max)
+

Display progress of something as filled horizontal bar with relative length val/max. Note, it work now only in console and in FLTK-based applications, including mgllab and mglview. +

+ + + + + +
+
MGL suffix: (dat) .nx
+
MGL suffix: (dat) .ny
+
MGL suffix: (dat) .nz
+
Method on mglDataA: long GetNx ()
+
Method on mglDataA: long GetNy ()
+
Method on mglDataA: long GetNz ()
+
C function: long mgl_data_get_nx (HCDT dat)
+
C function: long mgl_data_get_ny (HCDT dat)
+
C function: long mgl_data_get_nz (HCDT dat)
+

Gets the x-, y-, z-size of the data. +

+ + + + +
+
MGL suffix: (dat) .max
+
Method on mglDataA: mreal Maximal () const
+
C function: mreal mgl_data_max (HCDT dat)
+

Gets maximal value of the data. +

+ + +
+
MGL suffix: (dat) .min
+
Method on mglDataA: mreal Minimal () const
+
C function: mreal mgl_data_min (HMDT dat) const
+

Gets minimal value of the data. +

+ +
+
Method on mglDataA: mreal Minimal (int &i, int &j, int &k) const
+
C function: mreal mgl_data_min_int (HCDT dat, int *i, int *j, int *k)
+

Gets position of minimum to variables i, j, k and returns the minimal value. +

+
+
Method on mglDataA: mreal Maximal (int &i, int &j, int &k) const
+
C function: mreal mgl_data_max_int (HCDT dat, int *i, int *j, int *k)
+

Gets position of maximum to variables i, j, k and returns the maximal value. +

+
+
Method on mglDataA: mreal Minimal (mreal &x, mreal &y, mreal &z) const
+
C function: mreal mgl_data_min_real (HCDT dat, mreal *x, mreal *y, mreal *z)
+

Gets approximated (interpolated) position of minimum to variables x, y, z and returns the minimal value. +

+ +
+
MGL suffix: (dat) .mx
+
MGL suffix: (dat) .my
+
MGL suffix: (dat) .mz
+
Method on mglDataA: mreal Maximal (mreal &x, mreal &y, mreal &z) const
+
C function: mreal mgl_data_max_real (HCDT dat, mreal *x, mreal *y, mreal *z)
+

Gets approximated (interpolated) position of maximum to variables x, y, z and returns the maximal value. +

+ + +
+
MGL suffix: (dat) .mxf
+
MGL suffix: (dat) .myf
+
MGL suffix: (dat) .mzf
+
MGL suffix: (dat) .mxl
+
MGL suffix: (dat) .myl
+
MGL suffix: (dat) .mzl
+
Method on mglDataA: long Maximal (char dir, long from) const
+
Method on mglDataA: long Maximal (char dir, long from, long &p1, long &p2) const
+
C function: mreal mgl_data_max_firstl (HCDT dat, char dir, long from, long *p1, long *p2)
+

Get first starting from give position (or last one if from<0) maximum along direction dir, and save its orthogonal coordinates in p1, p2. +

+ + + +
+
MGL suffix: (dat) .sum
+
MGL suffix: (dat) .ax
+
MGL suffix: (dat) .ay
+
MGL suffix: (dat) .az
+
MGL suffix: (dat) .aa
+
MGL suffix: (dat) .wx
+
MGL suffix: (dat) .wy
+
MGL suffix: (dat) .wz
+
MGL suffix: (dat) .wa
+
MGL suffix: (dat) .sx
+
MGL suffix: (dat) .sy
+
MGL suffix: (dat) .sz
+
MGL suffix: (dat) .sa
+
MGL suffix: (dat) .kx
+
MGL suffix: (dat) .ky
+
MGL suffix: (dat) .kz
+
MGL suffix: (dat) .ka
+
Method on mglDataA: mreal Momentum (char dir, mreal &a, mreal &w) const
+
Method on mglDataA: mreal Momentum (char dir, mreal &m, mreal &w, mreal &s, mreal &k) const
+
C function: mreal mgl_data_momentum_val (HCDT dat, char dir, mreal *a, mreal *w, mreal *s, mreal *k)
+

Gets zero-momentum (energy, I=\sum dat_i) and write first momentum (median, a = \sum \xi_i dat_i/I), second momentum (width, w^2 = \sum (\xi_i-a)^2 dat_i/I), third momentum (skewness, s = \sum (\xi_i-a)^3 dat_i/ I w^3) and fourth momentum (kurtosis, k = \sum (\xi_i-a)^4 dat_i / 3 I w^4) to variables. Here \xi is corresponding coordinate if dir is ‘'x'’, ‘'y'’ or ‘'z'’. Otherwise median is a = \sum dat_i/N, width is w^2 = \sum (dat_i-a)^2/N and so on. +

+ +
+
MGL suffix: (dat) .fst
+
+
Method on mglDataA: mreal Find (const char *cond, int &i, int &j, int &k) const
+
C function: mreal mgl_data_first (HCDT dat, const char *cond, int *i, int *j, int *k)
+

Find position (after specified in i, j, k) of first nonzero value of formula cond. Function return the data value at found position. +

+ +
+
MGL suffix: (dat) .lst
+
+
Method on mglDataA: mreal Last (const char *cond, int &i, int &j, int &k) const
+
C function: mreal mgl_data_last (HCDT dat, const char *cond, int *i, int *j, int *k)
+

Find position (before specified in i, j, k) of last nonzero value of formula cond. Function return the data value at found position. +

+ +
+
Method on mglDataA: int Find (const char *cond, char dir, int i=0, int j=0, int k=0) const
+
C function: mreal mgl_data_find (HCDT dat, const char *cond, int i, int j, int k)
+

Return position of first in direction dir nonzero value of formula cond. The search is started from point {i,j,k}. +

+ +
+
Method on mglDataA: bool FindAny (const char *cond) const
+
C function: mreal mgl_data_find_any (HCDT dat, const char *cond)
+

Determines if any nonzero value of formula in the data array. +

+ +
+
MGL suffix: (dat) .a
+

Give first (for .a, i.e. dat->a[0]). +

+ + + +
+ + + +

6.10 Operators

+ + +
+
MGL command: copy DAT dat2 ['eq'='']
+
Method on mglData: void operator= (const mglDataA &d)
+

Copies data from other variable. +

+ +
+
MGL command: copy dat val
+
Method on mreal: void operator= (mreal val)
+

Set all data values equal to val. +

+ +
+
MGL command: multo dat dat2
+
MGL command: multo dat val
+
Method on mglData: void operator*= (const mglDataA &d)
+
Method on mglData: void operator*= (mreal d)
+
C function: void mgl_data_mul_dat (HMDT dat, HCDT d)
+
C function: void mgl_data_mul_num (HMDT dat, mreal d)
+

Multiplies data element by the other one or by value. +

+ +
+
MGL command: divto dat dat2
+
MGL command: divto dat val
+
Method on mglData: void operator/= (const mglDataA &d)
+
Method on mglData: void operator/= (mreal d)
+
C function: void mgl_data_div_dat (HMDT dat, HCDT d)
+
C function: void mgl_data_div_num (HMDT dat, mreal d)
+

Divides each data element by the other one or by value. +

+ +
+
MGL command: addto dat dat2
+
MGL command: addto dat val
+
Method on mglData: void operator+= (const mglDataA &d)
+
Method on mglData: void operator+= (mreal d)
+
C function: void mgl_data_add_dat (HMDT dat, HCDT d)
+
C function: void mgl_data_add_num (HMDT dat, mreal d)
+

Adds to each data element the other one or the value. +

+ +
+
MGL command: subto dat dat2
+
MGL command: subto dat val
+
Method on mglData: void operator-= (const mglDataA &d)
+
Method on mglData: void operator-= (mreal d)
+
C function: void mgl_data_sub_dat (HMDT dat, HCDT d)
+
C function: void mgl_data_sub_num (HMDT dat, mreal d)
+

Subtracts from each data element the other one or the value. +

+ +
+
Library Function: mglData operator+ (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator+ (mreal a, const mglDataA &b)
+
Library Function: mglData operator+ (const mglDataA &a, mreal b)
+

Adds the other data or the number. +

+ +
+
Library Function: mglData operator- (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator- (mreal a, const mglDataA &b)
+
Library Function: mglData operator- (const mglDataA &a, mreal b)
+

Subtracts the other data or the number. +

+ +
+
Library Function: mglData operator* (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator* (mreal a, const mglDataA &b)
+
Library Function: mglData operator* (const mglDataA &a, mreal b)
+

Multiplies by the other data or the number. +

+ +
+
Library Function: mglData operator/ (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator/ (const mglDataA &a, mreal b)
+

Divides by the other data or the number. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.11 Global functions

+ + +

These functions are not methods of mglData class. However it provide additional functionality to handle data. So I put it in this chapter. +

+
+
MGL command: transform DAT 'type' real imag
+
Global function: mglData mglTransform (const mglDataA &real, const mglDataA &imag, const char *type)
+
C function: HMDT mgl_transform (HCDT real, HCDT imag, const char *type)
+

Does integral transformation of complex data real, imag on specified direction. The order of transformations is specified in string type: first character for x-dimension, second one for y-dimension, third one for z-dimension. The possible character are: ‘f’ is forward Fourier transformation, ‘i’ is inverse Fourier transformation, ‘s’ is Sine transform, ‘c’ is Cosine transform, ‘h’ is Hankel transform, ‘n’ or ‘ ’ is no transformation. +

+ +
+
MGL command: transforma DAT 'type' ampl phase
+
Global function: mglData mglTransformA const mglDataA &ampl, const mglDataA &phase, const char *type)
+
C function: HMDT mgl_transform_a HCDT ampl, HCDT phase, const char *type)
+

The same as previous but with specified amplitude ampl and phase phase of complex numbers. +

+ +
+
MGL command: fourier reDat imDat 'dir'
+
MGL command: fourier complexDat 'dir'
+
Global function: void mglFourier const mglDataA &re, const mglDataA &im, const char *dir)
+
Method on mglDataC: void FFT (const char *dir)
+
C function: void mgl_data_fourier HCDT re, HCDT im, const char *dir)
+
C function: void mgl_datac_fft (HADT dat, const char *dir)
+

Does Fourier transform of complex data re+i*im in directions dir. Result is placed back into re and im data arrays. If dir contain ‘i’ then inverse Fourier is used. +

+ +
+
MGL command: stfad RES real imag dn ['dir'='x']
+
Global function: mglData mglSTFA (const mglDataA &real, const mglDataA &imag, int dn, char dir='x')
+
C function: HMDT mgl_data_stfa (HCDT real, HCDT imag, int dn, char dir)
+

Short time Fourier transformation for real and imaginary parts. Output is amplitude of partial Fourier of length dn. For example if dir=‘x’, result will have size {int(nx/dn), dn, ny} and it will contain res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn. +

+ +
+
MGL command: triangulate dat xdat ydat
+
Global function: mglData mglTriangulation (const mglDataA &x, const mglDataA &y)
+
C function: void mgl_triangulation_2d (HCDT x, HCDT y)
+

Do Delone triangulation for 2d points and return result suitable for triplot and tricont. See Making regular data, for sample code and picture. +

+ + +
+
MGL command: tridmat RES ADAT BDAT CDAT DDAT 'how'
+
Global function: mglData mglTridMat (const mglDataA &A, const mglDataA &B, const mglDataA &C, const mglDataA &D, const char *how)
+
Global function: mglDataC mglTridMatC (const mglDataA &A, const mglDataA &B, const mglDataA &C, const mglDataA &D, const char *how)
+
C function: HMDT mgl_data_tridmat (HCDT A, HCDT B, HCDT C, HCDT D, const char*how)
+
C function: HADT mgl_datac_tridmat (HCDT A, HCDT B, HCDT C, HCDT D, const char*how)
+

Get array as solution of tridiagonal system of equations A[i]*x[i-1]+B[i]*x[i]+C[i]*x[i+1]=D[i]. String how may contain: +

    +
  • xyz’ for solving along x-,y-,z-directions correspondingly; +
  • h’ for solving along hexagonal direction at x-y plain (require square matrix); +
  • c’ for using periodical boundary conditions; +
  • d’ for for diffraction/diffuse calculation (i.e. for using -A[i]*D[i-1]+(2-B[i])*D[i]-C[i]*D[i+1] at right part instead of D[i]). +
+

Data dimensions of arrays A, B, C should be equal. Also their dimensions need to be equal to all or to minor dimension(s) of array D. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+
Global function: mglData mglPDE (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
Global function: mglDataC mglPDEc (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
C function: HMDT mgl_pde_solve (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+
C function: HADT mgl_pde_solve_c (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters Min, Max set the bounding box for the solution. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. At this moment, simplified form of function ham is supported – all “mixed” terms (like ‘x*p’->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like ‘x*q’->x*d/dy) are allowed. Here variable ‘u’ is used for field amplitude |u|. This allow one solve nonlinear problems – for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)". See also apde, qo2d, qo3d. See PDE solving hints, for sample code and picture. +

+ +
+
MGL command: apde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+
Global function: mglData mglAPDE (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
Global function: mglDataC mglAPDEc (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
C function: HMDT mgl_pde_solve_adv (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+
C function: HADT mgl_pde_solve_adv_c (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters Min, Max set the bounding box for the solution. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. The advanced and rather slow algorithm is used for taking into account both spatial dispersion and inhomogeneities of media [see A.A. Balakin, E.D. Gospodchikov, A.G. Shalashov, JETP letters v.104, p.690-695 (2016)]. Variable ‘u’ is used for field amplitude |u|. This allow one solve nonlinear problems – for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)". See also pde. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: ray RES 'ham' x0 y0 z0 p0 q0 v0 [dt=0.1 tmax=10]
+
Global function: mglData mglRay (const char *ham, mglPoint r0, mglPoint p0, mreal dt=0.1, mreal tmax=10)
+
C function: HMDT mgl_ray_trace (const char *ham, mreal x0, mreal y0, mreal z0, mreal px, mreal py, mreal pz, mreal dt, mreal tmax)
+

Solves GO ray equation like dr/dt = d ham/dp, dp/dt = -d ham/dr. This is Hamiltonian equations for particle trajectory in 3D case. Here ham is Hamiltonian which may depend on coordinates ‘x’, ‘y’, ‘z’, momentums ‘p’=px, ‘q’=py, ‘v’=pz and time ‘t’: ham = H(x,y,z,p,q,v,t). The starting point (at t=0) is defined by variables r0, p0. Parameters dt and tmax specify the integration step and maximal time for ray tracing. Result is array of {x,y,z,p,q,v,t} with dimensions {7 * int(tmax/dt+1) }. +

+ +
+
MGL command: ode RES 'df' 'var' ini [dt=0.1 tmax=10]
+
Global function: mglData mglODE (const char *df, const char *var, const mglDataA &ini, mreal dt=0.1, mreal tmax=10)
+
Global function: mglDataC mglODEc (const char *df, const char *var, const mglDataA &ini, mreal dt=0.1, mreal tmax=10)
+
C function: HMDT mgl_ode_solve_str (const char *df, const char *var, HCDT ini, mreal dt, mreal tmax)
+
C function: HADT mgl_ode_solve_str_c (const char *df, const char *var, HCDT ini, mreal dt, mreal tmax)
+
C function: HMDT mgl_ode_solve (void (*df)(const mreal *x, mreal *dx, void *par), int n, const mreal *ini, mreal dt, mreal tmax)
+
C function: HMDT mgl_ode_solve_ex (void (*df)(const mreal *x, mreal *dx, void *par), int n, const mreal *ini, mreal dt, mreal tmax, void (*bord)(mreal *x, const mreal *xprev, void *par))
+

Solves ODE equations dx/dt = df(x). The functions df can be specified as string of ’;’-separated textual formulas (argument var set the character ids of variables x[i]) or as callback function, which fill dx array for give x’s. Parameters ini, dt, tmax set initial values, time step and maximal time of the calculation. Function stop execution if NAN or INF values appears. Result is data array with dimensions {n * Nt}, where Nt <= int(tmax/dt+1) +

+ +
+
MGL command: qo2d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy]
+
Global function: mglData mglQO2d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100)
+
Global function: mglData mglQO2d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mreal r=1, mreal k0=100)
+
Global function: mglDataC mglQO2dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100)
+
Global function: mglDataC mglQO2dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mreal r=1, mreal k0=100)
+
C function: HMDT mgl_qo2d_solve (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+
C function: HADT mgl_qo2d_solve_c (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+
C function: HMDT mgl_qo2d_func (dual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+
C function: HADT mgl_qo2d_func_c (dual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+

Solves equation du/dt = i*k0*ham(p,q,x,y,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators (see mglPDE() for details). Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters ray set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by ray function. Note, that the reference ray must be smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If xx and yy are non-zero then Cartesian coordinates for each point will be written into them. See also pde, qo3d. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: qo3d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy zz]
+
Global function: mglData mglQO3d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100)
+
Global function: mglData mglQO3d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mglData &zz, mreal r=1, mreal k0=100)
+
Global function: mglDataC mglQO3dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100)
+
Global function: mglDataC mglQO3dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mglData &zz, mreal r=1, mreal k0=100)
+
C function: HMDT mgl_qo3d_solve (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+
C function: HADT mgl_qo3d_solve_c (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+
C function: HMDT mgl_qo3d_func (dual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+
C function: HADT mgl_qo3d_func_c (dual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+

Solves equation du/dt = i*k0*ham(p,q,v,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy, v=-i/k0*d/dz are pseudo-differential operators (see mglPDE() for details). Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters ray set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by ray function. Note, that the reference ray must be smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If xx and yy and zz are non-zero then Cartesian coordinates for each point will be written into them. See also pde, qo2d. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: jacobian RES xdat ydat [zdat]
+
Global function: mglData mglJacobian (const mglDataA &x, const mglDataA &y)
+
Global function: mglData mglJacobian (const mglDataA &x, const mglDataA &y, const mglDataA &z)
+
C function: HMDT mgl_jacobian_2d (HCDT x, HCDT y)
+
C function: HMDT mgl_jacobian_3d (HCDT x, HCDT y, HCDT z)
+

Computes the Jacobian for transformation {i,j,k} to {x,y,z} where initial coordinates {i,j,k} are data indexes normalized in range [0,1]. The Jacobian is determined by formula det||dr_\alpha/d\xi_\beta|| where r={x,y,z} and \xi={i,j,k}. All dimensions must be the same for all data arrays. Data must be 3D if all 3 arrays {x,y,z} are specified or 2D if only 2 arrays {x,y} are specified. +

+ +
+
MGL command: triangulation RES xdat ydat
+
Global function: mglData mglTriangulation (const mglDataA &x, const mglDataA &y)
+
C function: HMDT mgl_triangulation_2d (HCDT x, HCDT y)
+

Computes triangulation for arbitrary placed points with coordinates {x,y} (i.e. finds triangles which connect points). MathGL use s-hull code for triangulation. The sizes of 1st dimension must be equal for all arrays x.nx=y.nx. Resulting array can be used in triplot or tricont functions for visualization of reconstructed surface. See Making regular data, for sample code and picture. +

+ + +
+
Global function: mglData mglGSplineInit (const mglDataA &x, const mglDataA &y)
+
Global function: mglDataC mglGSplineCInit (const mglDataA &x, const mglDataA &y)
+
C function: HMDT mgl_gspline_init (HCDT x, HCDT y)
+
C function: HADT mgl_gsplinec_init (HCDT x, HCDT y)
+

Prepare coefficients for global cubic spline interpolation. +

+ +
+
Global function: mreal mglGSpline (const mglDataA &coef, mreal dx, mreal *d1=0, mreal *d2=0)
+
Global function: dual mglGSplineC (const mglDataA &coef, mreal dx, dual *d1=0, dual *d2=0)
+
C function: mreal mgl_gspline (HCDT coef, mreal dx, mreal *d1, mreal *d2)
+
C function: dual mgl_gsplinec (HCDT coef, mreal dx, dual *d1, dual *d2)
+

Evaluate global cubic spline (and its 1st and 2nd derivatives d1, d2 if they are not NULL) using prepared coefficients coef at point dx+x0 (where x0 is 1st element of data x provided to mglGSpline*Init() function). +

+ + + +
+
MGL command: ifs2d RES dat num [skip=20]
+
Global function: mglData mglIFS2d (const mglDataA &dat, long num, long skip=20)
+
C function: HMDT mgl_data_ifs_2d (HCDT dat, long num, long skip)
+

Computes num points {x[i]=res[0,i], y[i]=res[1,i]} for fractal using iterated function system. Matrix dat is used for generation according the formulas +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[4,i];
+y[i+1] = dat[2,i]*x[i] + dat[3,i]*y[i] + dat[5,i];
+

Value dat[6,i] is used as weight factor for i-th row of matrix dat. At this first skip iterations will be omitted. Data array dat must have x-size greater or equal to 7. See also ifs3d, flame2d. See ifs2d sample, for sample code and picture. +

+ +
+
MGL command: ifs3d RES dat num [skip=20]
+
Global function: mglData mglIFS3d (const mglDataA &dat, long num, long skip=20)
+
C function: HMDT mgl_data_ifs_3d (HCDT dat, long num, long skip)
+

Computes num points {x[i]=res[0,i], y[i]=res[1,i], z[i]=res[2,i]} for fractal using iterated function system. Matrix dat is used for generation according the formulas +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[2,i]*z[i] + dat[9,i];
+y[i+1] = dat[3,i]*x[i] + dat[4,i]*y[i] + dat[5,i]*z[i] + dat[10,i];
+z[i+1] = dat[6,i]*x[i] + dat[7,i]*y[i] + dat[8,i]*z[i] + dat[11,i];
+

Value dat[12,i] is used as weight factor for i-th row of matrix dat. At this first skip iterations will be omitted. Data array dat must have x-size greater or equal to 13. See also ifs2d. See ifs3d sample, for sample code and picture. +

+ +
+
MGL command: ifsfile RES 'fname' 'name' num [skip=20]
+
Global function: mglData mglIFSfile (const char *fname, const char *name, long num, long skip=20)
+
C function: HMDT mgl_data_ifs_file (const char *fname, const char *name, long num, long skip)
+

Reads parameters of IFS fractal named name from file fname and computes num points for this fractal. At this first skip iterations will be omitted. See also ifs2d, ifs3d. +

+

IFS file may contain several records. Each record contain the name of fractal (‘binary’ in the example below) and the body of fractal, which is enclosed in curly braces {}. Symbol ‘;’ start the comment. If the name of fractal contain ‘(3D)’ or ‘(3d)’ then the 3d IFS fractal is specified. The sample below contain two fractals: ‘binary’ – usual 2d fractal, and ‘3dfern (3D)’ – 3d fractal. See also ifs2d, ifs3d. +

+
 binary
+ { ; comment allowed here
+  ; and here
+  .5  .0 .0 .5 -2.563477 -0.000003 .333333   ; also comment allowed here
+  .5  .0 .0 .5  2.436544 -0.000003 .333333
+  .0 -.5 .5 .0  4.873085  7.563492 .333333
+  }
+
+ 3dfern (3D) {
+   .00  .00 0 .0 .18 .0 0  0.0 0.00 0 0.0 0 .01
+   .85  .00 0 .0 .85 .1 0 -0.1 0.85 0 1.6 0 .85
+   .20 -.20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  -.20  .20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  }
+
+ +
+
MGL command: flame2d RES dat func num [skip=20]
+
Global function: mglData mglFlame2d (const mglDataA &dat, const mglDataA &func, long num, long skip=20)
+
C function: HMDT mgl_data_flame_2d (HCDT dat, HCDT func, long num, long skip)
+

Computes num points {x[i]=res[0,i], y[i]=res[1,i]} for "flame" fractal using iterated function system. Array func define "flame" function identificator (func[0,i,j]), its weight (func[0,i,j]) and arguments (func[2 ... 5,i,j]). Matrix dat set linear transformation of coordinates before applying the function. The resulting coordinates are +

xx = dat[0,i]*x[j] + dat[1,j]*y[i] + dat[4,j];
+yy = dat[2,i]*x[j] + dat[3,j]*y[i] + dat[5,j];
+x[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_x(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+y[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_y(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+

The possible function ids are: mglFlame2d_linear=0, mglFlame2d_sinusoidal, mglFlame2d_spherical, mglFlame2d_swirl, mglFlame2d_horseshoe, + mglFlame2d_polar, mglFlame2d_handkerchief,mglFlame2d_heart, mglFlame2d_disc, mglFlame2d_spiral, + mglFlame2d_hyperbolic, mglFlame2d_diamond, mglFlame2d_ex, mglFlame2d_julia, mglFlame2d_bent, + mglFlame2d_waves, mglFlame2d_fisheye, mglFlame2d_popcorn, mglFlame2d_exponential, mglFlame2d_power, + mglFlame2d_cosine, mglFlame2d_rings, mglFlame2d_fan, mglFlame2d_blob, mglFlame2d_pdj, + mglFlame2d_fan2, mglFlame2d_rings2, mglFlame2d_eyefish, mglFlame2d_bubble, mglFlame2d_cylinder, + mglFlame2d_perspective, mglFlame2d_noise, mglFlame2d_juliaN, mglFlame2d_juliaScope, mglFlame2d_blur, + mglFlame2d_gaussian, mglFlame2d_radialBlur, mglFlame2d_pie, mglFlame2d_ngon, mglFlame2d_curl, + mglFlame2d_rectangles, mglFlame2d_arch, mglFlame2d_tangent, mglFlame2d_square, mglFlame2d_blade, + mglFlame2d_secant, mglFlame2d_rays, mglFlame2d_twintrian, mglFlame2d_cross, mglFlame2d_disc2, + mglFlame2d_supershape, mglFlame2d_flower, mglFlame2d_conic, mglFlame2d_parabola, mglFlame2d_bent2, + mglFlame2d_bipolar, mglFlame2d_boarders, mglFlame2d_butterfly, mglFlame2d_cell, mglFlame2d_cpow, + mglFlame2d_curve, mglFlame2d_edisc, mglFlame2d_elliptic, mglFlame2d_escher, mglFlame2d_foci, + mglFlame2d_lazySusan, mglFlame2d_loonie, mglFlame2d_preBlur, mglFlame2d_modulus, mglFlame2d_oscope, + mglFlame2d_polar2, mglFlame2d_popcorn2, mglFlame2d_scry, mglFlame2d_separation, mglFlame2d_split, + mglFlame2d_splits, mglFlame2d_stripes, mglFlame2d_wedge, mglFlame2d_wedgeJulia, mglFlame2d_wedgeSph, + mglFlame2d_whorl, mglFlame2d_waves2, mglFlame2d_exp, mglFlame2d_log, mglFlame2d_sin, + mglFlame2d_cos, mglFlame2d_tan, mglFlame2d_sec, mglFlame2d_csc, mglFlame2d_cot, + mglFlame2d_sinh, mglFlame2d_cosh, mglFlame2d_tanh, mglFlame2d_sech, mglFlame2d_csch, + mglFlame2d_coth, mglFlame2d_auger, mglFlame2d_flux. +Value dat[6,i] is used as weight factor for i-th row of matrix dat. At this first skip iterations will be omitted. Sizes of data arrays must be: dat.nx>=7, func.nx>=2 and func.nz=dat.ny. See also ifs2d, ifs3d. See flame2d sample, for sample code and picture. +

+ + + +
+ + + +

6.12 Evaluate expression

+ + + + + + +

MathGL have a special classes mglExpr and mglExprC for evaluating of formula specified by the string for real and complex numbers correspondingly. These classes are defined in #include <mgl2/data.h> and #include <mgl2/datac.h> correspondingly. It is the fast variant of formula evaluation. At creation it will be recognized and compiled to tree-like internal code. At evaluation stage only fast calculations are performed. There is no difference between lower or upper case in formulas. If argument value lie outside the range of function definition then function returns NaN. See Textual formulas. +

+
+
Constructor on mglExpr: mglExpr (const char *expr)
+
Constructor on mglExprC: mglExprC (const char *expr)
+
C function: HMEX mgl_create_expr (const char *expr)
+
C function: HAEX mgl_create_cexpr (const char *expr)
+

Parses the formula expr and creates formula-tree. Constructor recursively parses the formula and creates a tree-like structure containing functions and operators for fast further evaluating by Calc() or CalcD() functions. +

+ +
+
Destructor on mglExpr: ~mglExpr ()
+
Destructor on mglExprC: ~mglExprC ()
+
C function: void mgl_delete_expr (HMEX ex)
+
C function: void mgl_delete_cexpr (HAEX ex)
+

Deletes the instance of class mglExpr. +

+ +
+
Method on mglExpr: mreal Eval (mreal x, mreal y, mreal z)
+
Method on mglExprC: dual Eval (dual x, dual y, dual z)
+
C function: mreal mgl_expr_eval (HMEX ex, mreal x, mreal y, mreal z)
+
C function: dual mgl_cexpr_eval (HAEX ex, dual x, dual y, dual z)
+

Evaluates the formula for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u. +

+ +
+
Method on mglExpr: mreal Eval (mreal var[26])
+
Method on mglExprC: dual Eval (dual var[26])
+
C function: mreal mgl_expr_eval_v (HMEX ex, mreal *var)
+
C function: dual mgl_expr_eval_v (HAEX ex, dual *var)
+

Evaluates the formula for variables in array var[0,...,’z’-’a’]. +

+ + +
+
Method on mglExpr: mreal Diff (char dir, mreal x, mreal y, mreal z)
+
C function: mreal mgl_expr_diff (HMEX ex, char dir, mreal x, mreal y, mreal z)
+

Evaluates the formula derivation respect to dir for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u. +

+ +
+
Method on mglExpr: mreal Diff (char dir, mreal var[26])
+
C function: mreal mgl_expr_diff_v (HMEX ex, char dir, mreal *var)
+

Evaluates the formula derivation respect to dir for variables in array var[0,...,’z’-’a’]. +

+ + + +
+ + + +

6.13 Special data classes

+ + + + +

This section describe special data classes mglDataV, mglDataF, mglDataT and mglDataR which sometime can noticeable speed up drawing or data handling. These classes are defined in #include <mgl2/data.h>. Note, that all plotting and data handling routines can be done using usual mglData or mglDataC classes. Also these special classes are usable in C++ code only. +

+ +

Class mglDataV

+

represent variable with values equidistantly distributed in given range. +

+
Constructor on mglDataV: mglDataV (const mglDataV & d)
+

Copy constructor. +

+
+
Constructor on mglDataV: mglDataV (long nx=1, long ny=1, long nz=1, mreal v1=0, mreal v2=NaN, char dir='x')
+

Create variable with "sizes" nxxnyxnz which changes from v1 to v2 (or is constant if v2=NaN) along dir direction. +

+
+
Method on mglDataV: void Create (long nx=1, long ny=1, long nz=1)
+

Set "sizes" nxxnyxnz. +

+
+
Method on mglDataV: void Fill (mreal x1, mreal x2=NaN, char dir='x')
+

Set ranges of the variable. +

+
+
Method on mglDataV: void Freq (mreal dp, char dir='x')
+

Set as frequency variable with increment dp. +

+ + +

Class mglDataF

+

represent function which values are evaluated (instead of access to data array as in mglData). +

+
Constructor on mglDataF: mglDataF (const mglDataF & d)
+

Copy constructor. +

+
+
Constructor on mglDataF: mglDataF (long nx=1, long ny=1, long nz=1)
+

Create variable with "sizes" nxxnyxnz with zero function. +

+
+
Method on mglDataF: void Create (long nx=1, long ny=1, long nz=1)
+

Set "sizes" nxxnyxnz. +

+
+
Method on mglDataF: void SetRanges (mglPoint p1, mglPoint p2)
+

Set ranges for internal x,y,z variables. +

+
+
Method on mglDataF: void SetFormula (const char *func)
+

Set string which will be evaluated at function calls. Note this variant is about 10 times slower than SetFunc() one. +

+
+
Method on mglDataF: void SetFunc (mreal (*f)(mreal x,mreal y,mreal z,void *p), void *p=NULL)
+

Set pointer to function which will be used for data. +

+ + +

Class mglDataT

+

represent named reference to column of another data array. +

+
Constructor on mglDataT: mglDataT (const mglDataT & d)
+

Copy constructor. +

+
+
Constructor on mglDataT: mglDataT (const mglDataA & d, long col=0)
+

Create variable which reference col-th column of data d. +

+
+
Method on mglDataT: void SetInd (long col, wchar_t name)
+
Method on mglDataT: void SetInd (long col, const wchar_t * name)
+

Set reference to another column of the same data and its name. +

+ + +

Class mglDataR

+

represent named reference to row of another data array. +

+
Constructor on mglDataR: mglDataR (const mglDataR & d)
+

Copy constructor. +

+
+
Constructor on mglDataR: mglDataR (const mglDataA & d, long row=0)
+

Create variable which reference row-th row of data d. +

+
+
Method on mglDataR: void SetInd (long row, wchar_t name)
+
Method on mglDataR: void SetInd (long row, const wchar_t * name)
+

Set reference to another row of the same data and its name. +

+ + +

Class mglDataW

+

represent FFT frequency as data array. +

+
Constructor on mglDataW: mglDataW (const mglDataW & d)
+

Copy constructor. +

+
+
Constructor on mglDataW: mglDataW (long xx=1, long yy=1, long zz=1, double dp=0, char dir='x')
+

Set frequency sizes, direction dir and increment dp. +

+
+
Method on mglDataR: void Freq (double dp, char dir='x')
+

Equidistantly fill the data with step dp in direction dir. +

+ + + +

Class mglDataS

+

incapsulate std::vector and present it as data array. +

+
Variable of mglDataS: std::vector<mreal> dat
+

Data array itself. +

+
+
Constructor on mglDataS: mglDataS (const mglDataS & d)
+

Copy constructor. +

+
+
Constructor on mglDataS: mglDataS (const std::vector<mreal> & d)
+

Create copy data from d. +

+
+
Constructor on mglDataS: mglDataS (size_t s)
+

Allocate memory for s . +

+
+
Method on mglDataS: void reserve (size_t num)
+

Reserve space for num elements. +

+
+
Method on mglDataS: void push_back (double v)
+

Appends value v to the end of data. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ + +

7 MGL scripts

+ + +

MathGL library supports the simplest scripts for data handling and plotting. These scripts can be used independently (with the help of UDAV, mglconv, mglview programs and others +, see Utilities) or in the frame of the library using. +

+ + + + + + + + + + +
+ + + +

7.1 MGL definition

+ + +

MGL script language is rather simple. Each string is a command. First word of string is the name of command. Other words are command arguments. Words are separated from each other by space or tabulation symbol. The upper or lower case of words is important, i.e. variables a and A are different variables. Symbol ‘#’ starts the comment (all characters after # will be ignored). The exception is situation when ‘#’ is a part of some string. Also options can be specified after symbol ‘;’ (see Command options). Symbol ‘:’ starts new command (like new line character) if it is not placed inside a string or inside brackets. +

+

If string contain references to external parameters (substrings ‘$0’, ‘$1’ ... ‘$9’) or definitions (substrings ‘$a’, ‘$b’ ... ‘$z’) then before execution the values of parameter/definition will be substituted instead of reference. It allows to use the same MGL script for different parameters (filenames, paths, condition and so on). +

+

Argument can be a string, a variable (data arrays) or a number (scalars). +

    +
  • The string is any symbols between ordinary marks ‘'’. Long strings can be concatenated from several lines by ‘\’ symbol. I.e. the string ‘'a +\<br> b'’ will give string ‘'a + b'’ (here ‘<br>’ is newline). There are several operations which can be performed with string: +
      +
    • Concatenation of strings and numbers using ‘,’ with out spaces (for example, ‘'max(u)=',u.max,' a.u.'’ or ‘'u=',!(1+i2)’ for complex numbers); +
    • Getting n-th symbol of the string using ‘[]’ (for example, ‘'abc'[1]’ will give 'b'); +
    • Adding value to the last character of the string using ‘+’ (for example, ‘'abc'+3’ will give 'abf'). +
    + +
  • Usually variable have a name which is arbitrary combination of symbols (except spaces and ‘'’) started from a letter. Note, you can start an expression with ‘!’ symbol if you want to use complex values. For example, the code new x 100 'x':copy !b !exp(1i*x) will create real valued data x and complex data b, which is equal to exp(I*x), where I^2=-1. A temporary array can be used as variable too: +
      +
    • sub-arrays (like in subdata command) as command argument. For example, a(1) or a(1,:) or a(1,:,:) is second row, a(:,2) or a(:,2,:) is third column, a(:,:,0) is first slice and so on. Also you can extract a part of array from m-th to n-th element by code a(m:n,:,:) or just a(m:n). + +
    • any column combinations defined by formulas, like a('n*w^2/exp(t)') if names for data columns was specified (by idset command or in the file at string started with ##). + +
    • any expression (without spaces) of existed variables produce temporary variable. For example, ‘sqrt(dat(:,5)+1)’ will produce temporary variable with data values equal to tmp[i,j] = sqrt(dat[i,5,j]+1). At this symbol ‘`’ will return transposed data array: both ‘`sqrt(dat(:,5)+1)’ and ‘sqrt(`dat(:,5)+1)’ will produce temporary variable with data values equal to tmp[i,j] = sqrt(dat[j,5,i]+1). + +
    • temporary variable of higher dimensions by help of []. For example, ‘[1,2,3]’ will produce a temporary vector of 3 elements {1, 2, 3}; ‘[[11,12],[21,22]]’ will produce matrix 2*2 and so on. Here you can join even an arrays of the same dimensions by construction like ‘[v1,v2,...,vn]’. + +
    • result of code for making new data (see Make another data) inside {}. For example, ‘{sum dat 'x'}’ produce temporary variable which contain result of summation of dat along direction ’x’. This is the same array tmp as produced by command ‘sum tmp dat 'x'’. You can use nested constructions, like ‘{sum {max dat 'z'} 'x'}’. +
    +

    Temporary variables can not be used as 1st argument for commands which create (return) the data (like ‘new’, ‘read’, ‘hist’ and so on). +

    +
  • Special names nan=#QNAN, inf=INFINITY, rnd=random value, pi=3.1415926..., on=1, off=0, all=-1, :=-1, variables with suffixes (see Data information), names defined by define command, time values (in format "hh-mm-ss_DD.MM.YYYY", "hh-mm-ss" or "DD.MM.YYYY") are treated as number. Also results of formulas with sizes 1x1x1 are treated as number (for example, ‘pi/dat.nx’). +
+

Before the first using all variables must be defined with the help of commands, like, new, var, list, copy, read, hist, sum and so on (see sections Data constructor, Data filling and Make another data). +

+

Command may have several set of possible arguments (for example, plot ydat and plot xdat ydat). All command arguments for a selected set must be specified. However, some arguments can have default values. These argument are printed in [], like text ydat ['stl'=''] or text x y 'txt' ['fnt'='' size=-1]. At this, the record [arg1 arg2 arg3 ...] means [arg1 [arg2 [arg3 ...]]], i.e. you can omit only tailing arguments if you agree with its default values. For example, text x y 'txt' '' 1 or text x y 'txt' '' is correct, but text x y 'txt' 1 is incorrect (argument 'fnt' is missed). +

+

You can provide several variants of arguments for a command by using ‘?’ symbol for separating them. The actual argument being used is set by variant. At this, the last argument is used if the value of variant is large than the number of provided variants. By default the first argument is used (i.e. as for variant 0). For example, the first plot will be drawn by blue (default is the first argument ‘b’), but the plot after variant 1 will be drawn by red dash (the second is ‘r|’): +

fplot 'x' 'b'?'r'
+variant 1
+fplot 'x^3' 'b'?'r|'
+
+ + +
+ +
+

+Next: , Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

7.2 Program flow commands

+ + +

Below I show commands to control program flow, like, conditions, loops, define script arguments and so on. Other commands can be found in chapters MathGL core and Data processing. Note, that some of program flow commands (like define, ask, call, for, func) should be placed alone in the string. +

+ +
+
MGL command: chdir 'path'
+

Changes the current directory to path. +

+ + +
+
MGL command: ask $N 'question'
+

Sets N-th script argument to answer which give the user on the question. Usually this show dialog with question where user can enter some text as answer. Here N is digit (0...9) or alpha (a...z). +

+ + +
+
MGL command: define $N smth
+

Sets N-th script argument to smth. Note, that smth is used as is (with ‘'’ symbols if present). Here N is digit (0...9) or alpha (a...z). +

+
+
MGL command: define name smth
+

Create scalar variable name which have the numeric value of smth. Later you can use this variable as usual number. +

+ +
+
MGL command: defchr $N smth
+

Sets N-th script argument to character with value evaluated from smth. Here N is digit (0...9) or alpha (a...z). +

+ +
+
MGL command: defnum $N smth
+

Sets N-th script argument to number with value evaluated from smth. Here N is digit (0...9) or alpha (a...z). +

+ + + +
+
MGL command: call 'funcname' [ARG1 ARG2 ... ARG9]
+

Executes function fname (or script if function is not found). Optional arguments will be passed to functions. See also func. +

+ +
+
MGL command: func 'funcname' [narg=0]
+

Define the function fname and number of required arguments. The arguments will be placed in script parameters $1, $2, ... $9. Note, script execution is stopped at func keyword, similarly to stop command. See also return. +

+ +
+
MGL command: return
+

Return from the function. See also func. +

+ + +
+
MGL command: load 'filename'
+

Load additional MGL command from external module (DLL or .so), located in file filename. This module have to contain array with name mgl_cmd_extra of type mglCommand, which describe provided commands. +

+ + + +
+
MGL command: if val then CMD
+

Executes command CMD only if val is nonzero. +

+
+
MGL command: if val
+

Starts block which will be executed if val is nonzero. +

+
+
MGL command: if dat 'cond'
+

Starts block which will be executed if dat satisfy to cond. +

+ +
+
MGL command: elseif val
+

Starts block which will be executed if previous if or elseif is false and val is nonzero. +

+
+
MGL command: elseif dat 'cond'
+

Starts block which will be executed if previous if or elseif is false and dat satisfy to cond. +

+ +
+
MGL command: else
+

Starts block which will be executed if previous if or elseif is false. +

+ +
+
MGL command: endif
+

Finishes if/elseif/else block. +

+ + +
+
MGL command: for $N v1 v2 [dv=1]
+

Starts loop with $N-th argument changing from v1 to v2 with the step dv. Here N is digit (0...9) or alpha (a...z). +

+
+
MGL command: for $N dat
+

Starts loop with $N-th argument changing for dat values. Here N is digit (0...9) or alpha (a...z). +

+ +
+
MGL command: next
+

Finishes for loop. +

+ + +
+
MGL command: do
+

Starts infinite loop. +

+ +
+
MGL command: while val
+

Continue loop iterations if val is nonzero, or finishes loop otherwise. +

+
+
MGL command: while dat 'cond'
+

Continue loop iterations if dat satisfy to cond, or finishes loop otherwise. +

+ + +
+
MGL command: once val
+

The code between once on and once off will be executed only once. Useful for large data manipulation in programs like UDAV. +

+ +
+
MGL command: stop
+

Terminate execution. +

+ + +
+
MGL command: variant val
+

Set variant of argument(s) separated by ‘?’ symbol to be used in further commands. +

+ + + +
+
MGL command: rkstep eq1;... var1;... [dt=1]
+

Make one step for ordinary differential equation(s) {var1’ = eq1, ... } with time-step dt. Here variable(s) ‘var1’, ... are the ones, defined in MGL script previously. The Runge-Kutta 4-th order method is used for solution. +

+ + + +
+ + + +

7.3 Special comments

+ + +

There are number of special comments for MGL script, which set some global behavior (like, animation, dialog for parameters and so on). All these special comments starts with double sign ##. Let consider them. +

+
+
##c v1 v2 [dv=1]
+

Sets the parameter for animation loop relative to variable $0. Here v1 and v2 are initial and final values, dv is the increment. +

+
+
##a val
+

Adds the parameter val to the list of animation relative to variable $0. You can use it several times (one parameter per line) or combine it with animation loop ##c. +

+
+
##d $I kind|label|par1|par2|...
+

Creates custom dialog for changing plot properties. Each line adds one widget to the dialog. Here $I is id ($0,$1...$9,$a,$b...$z), label is the label of widget, kind is the kind of the widget: +

    +
  • ’e’ for editor or input line (parameter is initial value) , +
  • ’v’ for spinner or counter (parameters are "ini|min|max|step|big_step"), +
  • ’s’ for slider (parameters are "ini|min|max|step"), +
  • ’b’ for check box (parameter is "ini"; also understand "on"=1), +
  • ’c’ for choice (parameters are possible choices). +
+

Now, it work in FLTK-based mgllab and mglview only. +

+

You can make custom dialog in C/C++ code too by using one of following functions. +

+
+
Method on mglWnd: void MakeDialog (const char *ids, char const * const *args, const char *title)
+
Method on mglWnd: void MakeDialog (const std::string &ids, const std::vector<std::string> &args, const char *title)
+
C function: void mgl_wnd_make_dialog (HMGL gr, const char *ids, char const * const *args, const char *title)
+

Makes custom dialog for parameters ids of element properties defined by args. +

+ +

At this you need to provide callback function for setting up properties. You can do it by overloading Param() function of mglDraw class or set it manually. +

+
+
Method on mglDraw: void Param (char id, const char * val)
+
Method on mglWnd: void SetPropFunc (void (*prop)(char id, const char *val, void *p), void *par=NULL)
+
C function: void mgl_wnd_set_prop (void (*prop)(char id, const char *val, void *p), void *par)
+

Set callback function for properties setup. +

+ + +
+
+ + +
+ +
+

+Next: , Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

7.4 LaTeX package

+ + +

There is LaTeX package mgltex (was made by Diego Sejas Viscarra) which allow one to make figures directly from MGL script located in LaTeX file. +

+

For using this package you need to specify --shell-escape option for latex/pdflatex or manually run mglconv tool with produced MGL scripts for generation of images. Don’t forgot to run latex/pdflatex second time to insert generated images into the output document. Also you need to run pdflatex third time to update converted from EPS images if you are using vector EPS output (default). +

+

The package may have following options: draft, final — the same as in the graphicx package; on, off — to activate/deactivate the creation of scripts and graphics; comments, nocomments — to make visible/invisible comments contained inside mglcomment environments; jpg, jpeg, png — to export graphics as JPEG/PNG images; eps, epsz — to export to uncompressed/compressed EPS format as primitives; bps, bpsz — to export to uncompressed/compressed EPS format as bitmap (doesn’t work with pdflatex); pdf — to export to 3D PDF; tex — to export to LaTeX/tikz document. +

+

The package defines the following environments: +

+
mgl
+

It writes its contents to a general script which has the same name as the LaTeX document, but its extension is .mgl. The code in this environment is compiled and the image produced is included. It takes exactly the same optional arguments as the \includegraphics command, plus an additional argument imgext, which specifies the extension to save the image. +

+

An example of usage of ‘mgl’ environment would be: +

\begin{mglfunc}{prepare2d}
+  new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+  new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+\end{mglfunc}
+
+\begin{figure}[!ht]
+  \centering
+  \begin{mgl}[width=0.85\textwidth,height=7.5cm]
+    fog 0.5
+    call 'prepare2d'
+    subplot 2 2 0 : title 'Surf plot (default)' : rotate 50 60 : light on : box : surf a
+
+    subplot 2 2 1 : title '"\#" style; meshnum 10' : rotate 50 60 : box
+    surf a '#'; meshnum 10
+
+    subplot 2 2 2 : title 'Mesh plot' : rotate 50 60 : box
+    mesh a
+
+    new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+    new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+    new z 50 40 '0.8*cos(pi*(y+1)/2)'
+    subplot 2 2 3 : title 'parametric form' : rotate 50 60 : box
+    surf x y z 'BbwrR'
+  \end{mgl}
+\end{figure}
+
+
+
mgladdon
+

It adds its contents to the general script, without producing any image. +

+
mglcode
+

Is exactly the same as ‘mgl’, but it writes its contents verbatim to its own file, whose name is specified as a mandatory argument. +

+
mglscript
+

Is exactly the same as ‘mglcode’, but it doesn’t produce any image, nor accepts optional arguments. It is useful, for example, to create a MGL script, which can later be post processed by another package like "listings". +

+
mglblock
+

It writes its contents verbatim to a file, specified as a mandatory argument, and to the LaTeX document, and numerates each line of code. +

+
+
mglverbatim
+

Exactly the same as ‘mglblock’, but it doesn’t write to a file. This environment doesn’t have arguments. +

+
mglfunc
+

Is used to define MGL functions. It takes one mandatory argument, which is the name of the function, plus one additional argument, which specifies the number of arguments of the function. The environment needs to contain only the body of the function, since the first and last lines are appended automatically, and the resulting code is written at the end of the general script, after the stop command, which is also written automatically. The warning is produced if 2 or more function with the same name is defined. +

+
mglcomment
+

Is used to contain multiline comments. This comments will be visible/invisible in the output document, depending on the use of the package options comments and nocomments (see above), or the \mglcomments and \mglnocomments commands (see bellow). +

+
mglsetup
+

If many scripts with the same code are to be written, the repetitive code can be written inside this environment only once, then this code will be used automatically every time the ‘\mglplot’ command is used (see below). It takes one optional argument, which is a name to be associated to the corresponding contents of the environment; this name can be passed to the ‘\mglplot’ command to use the corresponding block of code automatically (see below). +

+
+ +

The package also defines the following commands: +

+
\mglplot
+

It takes one mandatory argument, which is MGL instructions separated by the symbol ‘:’ this argument can be more than one line long. It takes the same optional arguments as the ‘mgl’ environment, plus an additional argument setup, which indicates the name associated to a block of code inside a ‘mglsetup’ environment. The code inside the mandatory argument will be appended to the block of code specified, and the resulting code will be written to the general script. +

+

An example of usage of ‘\mglplot’ command would be: +

\begin{mglsetup}
+    box '@{W9}' : axis
+\end{mglsetup}
+\begin{mglsetup}[2d]
+  box : axis
+  grid 'xy' ';k'
+\end{mglsetup}
+\begin{mglsetup}[3d]
+  rotate 50 60
+  box : axis : grid 'xyz' ';k'
+\end{mglsetup}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5]{new a 200 'sin(pi*x)' : plot a '2B'}
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5,setup=2d]{
+    fplot 'sin(pi*x)' '2B' :
+    fplot 'cos(pi*x^2)' '2R'
+  }
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[setup=3d]{fsurf 'sin(pi*x)+cos(pi*y)'}
+\end{figure}
+
+
+
\mglgraphics
+

This command takes the same optional arguments as the ‘mgl’ environment, and one mandatory argument, which is the name of a MGL script. This command will compile the corresponding script and include the resulting image. It is useful when you have a script outside the LaTeX document, and you want to include the image, but you don’t want to type the script again. +

+
\mglinclude
+

This is like ‘\mglgraphics’ but, instead of creating/including the corresponding image, it writes the contents of the MGL script to the LaTeX document, and numerates the lines. +

+
\mgldir
+

This command can be used in the preamble of the document to specify a directory where LaTeX will save the MGL scripts and generate the corresponding images. This directory is also where ‘\mglgraphics’ and ‘\mglinclude’ will look for scripts. +

+
\mglquality
+

Adjust the quality of the MGL graphics produced similarly to quality. +

+
\mgltexon, \mgltexoff
+

Activate/deactivate the creation of MGL scripts and images. Notice these commands have local behavior in the sense that their effect is from the point they are called on. +

+
\mglcomment, \mglnocomment
+

Make visible/invisible the contents of the mglcomment environments. These commands have local effect too. +

+
\mglTeX
+

It just pretty prints the name of the package. +

+
+ +

As an additional feature, when an image is not found or cannot be included, instead of issuing an error, mgltex prints a box with the word ‘MGL image not found’ in the LaTeX document. +

+ + + +
+ +
+

+Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

7.5 mglParse class

+ + + +

Class for parsing and executing MGL script. This class is defined in #include <mgl2/mgl.h>. +

+

The main function of mglParse class is Execute(). Exactly this function parses and executes the script string-by-string. Also there are subservient functions for the finding and creation of a variable (object derived from mglDataA). These functions can be useful for displaying values of variables (arrays) in some external object (like, window) or for providing access to internal data. Function AllowSetSize() allows one to prevent changing the size of the picture inside the script (forbids the MGL command setsize). +

+ +
+
Constructor on mglParse: mglParse (bool setsize=false)
+
Constructor on mglParse: mglParse (HMPR pr)
+
Constructor on mglParse: mglParse (mglParse &pr)
+
C function: HMPR mgl_create_parser ()
+

Constructor initializes all values with zero and set AllowSetSize value. +

+ +
+
Destructor on mglParse: ~mglParse ()
+
C function: void mgl_delete_parser (HMPR p)
+

Destructor delete parser +

+ +
+
Method on mglParse: HMPR Self ()
+

Returns the pointer to internal object of type HMPR. +

+ +
+
Method on mglParse: void Execute (mglGraph *gr, const char *text)
+
Method on mglParse: void Execute (mglGraph *gr, const wchar_t *text)
+
C function: void mgl_parse_text (HMGL gr, HMPR p, const char *text)
+
C function: void mgl_parse_textw (HMGL gr, HMPR p, const wchar_t *text)
+

Main function in the class. Function parse and execute line-by-line MGL script in array text. Lines are separated by newline symbol ‘\n’ as usual. +

+ +
+
Method on mglParse: void Execute (mglGraph *gr, FILE *fp, bool print=false)
+
C function: void mgl_parse_file (HMGL gr, HMPR p, FILE *fp, int print)
+

The same as previous but read script from the file fp. If print=true then all warnings and information will be printed in stdout. +

+ +
+
Method on mglParse: int Parse (mglGraph *gr, const char *str, long pos=0)
+
Method on mglParse: int Parse (mglGraph *gr, const wchar_t *str, long pos=0)
+
C function: int mgl_parse_line (HMGL gr, HMPR p, const char *str, int pos)
+
C function: int mgl_parse_linew (HMGL gr, HMPR p, const wchar_t *str, int pos)
+

Function parses the string str and executes it by using gr as a graphics plotter. Returns the value depending on an error presence in the string str: 0 – no error, 1 – wrong command argument(s), 2 – unknown command, 3 – string is too long, 4 – strings is not closed. Optional argument pos allows to save the string position in the document (or file) for using for|next command. +

+ +
+
Method on mglParse: mglData Calc (const char *formula)
+
Method on mglParse: mglData Calc (const wchar_t *formula)
+
C function: HMDT mgl_parser_calc (HMPR p, const char *formula)
+
C function: HMDT mgl_parser_calcw (HMPR p, const wchar_t *formula)
+

Function parses the string formula and return resulting data array. In difference to AddVar() or FindVar(), it is usual data array which should be deleted after usage. +

+ +
+
Method on mglParse: mglDataC CalcComplex (const char *formula)
+
Method on mglParse: mglDataC CalcComplex (const wchar_t *formula)
+
C function: HADT mgl_parser_calc_complex (HMPR p, const char *formula)
+
C function: HADT mgl_parser_calc_complexw (HMPR p, const wchar_t *formula)
+

Function parses the string formula and return resulting data array with complex values. In difference to AddVar() or FindVar(), it is usual data array which should be deleted after usage. +

+ +
+
Method on mglParse: void AddParam (int n, const char *str)
+
Method on mglParse: void AddParam (int n, const wchar_t *str)
+
C function: void mgl_parser_add_param (HMPR p, int id, const char *val)
+
C function: void mgl_parser_add_paramw (HMPR p, int id, const wchar_t *val)
+

Function set the value of n-th parameter as string str (n=0, 1 ... ’z’-’a’+10). String str shouldn’t contain ‘$’ symbol. +

+ +
+
Method on mglParse: mglVar * FindVar (const char *name)
+
Method on mglParse: mglVar * FindVar (const wchar_t *name)
+
C function: HMDT mgl_parser_find_var (HMPR p, const char *name)
+
C function: HMDT mgl_parser_find_varw (HMPR p, const wchar_t *name)
+

Function returns the pointer to variable with name name or zero if variable is absent. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays! +

+
+
Method on mglParse: mglVar * AddVar (const char *name)
+
Method on mglParse: mglVar * AddVar (const wchar_t *name)
+
C function: HMDT mgl_parser_add_var (HMPR p, const char *name)
+
C function: HMDT mgl_parser_add_varw (HMPR p, const wchar_t *name)
+

Function returns the pointer to variable with name name. If variable is absent then new variable is created with name name. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays! +

+ +
+
Method on mglParse: void OpenHDF (const char *fname)
+
C function: void mgl_parser_openhdf (HMPR pr, const char *fname)
+

Reads all data array from HDF5 file fname and create MGL variables with names of data names in HDF file. Complex variables will be created if data name starts with ‘!’. +

+ +
+
Method on mglParse (C++): void DeleteVar (const char *name)
+
Method on mglParse (C++): void DeleteVar (const wchar_t *name)
+
C function: void mgl_parser_del_var (HMPR p, const char *name)
+
C function: void mgl_parser_del_varw (HMPR p, const wchar_t *name)
+

Function delete the variable with given name. +

+ +
+
Method on mglParse (C++): void DeleteAll ()
+
C function: void mgl_parser_del_all (HMPR p)
+

Function delete all variables and reset list of commands to default one in this parser. +

+ +
+
Method on mglParse: void RestoreOnce ()
+
C function: void mgl_parser_restore_once (HMPR p)
+

Restore Once flag. +

+ +
+
Method on mglParse: void AllowSetSize (bool a)
+
C function: void mgl_parser_allow_setsize (HMPR p, int a)
+

Allow to parse setsize command or not. +

+ +
+
Method on mglParse: void AllowFileIO (bool a)
+
C function: void mgl_parser_allow_file_io (HMPR p, int a)
+

Allow reading/saving files or not. +

+ +
+
Method on mglParse: void AllowDllCall (bool a)
+
C function: void mgl_parser_allow_dll_call (HMPR p, int a)
+

Allow to parse load command or not. +

+ +
+
Method on mglParse: void Stop ()
+
C function: void mgl_parser_stop (HMPR p)
+

Sends stop signal which terminate execution at next command. +

+ +
+
Method on mglParse: void SetVariant (int var=0)
+
C function: void mgl_parser_variant (HMPR p, int var)
+

Sets variant of argument(s) separated by ‘?’ symbol to be used in further commands. +

+ +
+
Method on mglParse: void StartID (int id=0)
+
C function: void mgl_parser_start_id (HMPR p, int id)
+

Sets id (like, line number) of first line in further script parsing. +

+ +
+
Method on mglParse: long GetCmdNum ()
+
C function: long mgl_parser_cmd_num (HMPR p)
+

Return the number of registered MGL commands. +

+ +
+
Method on mglParse: const char * GetCmdName (long id)
+
C function: const char * mgl_parser_cmd_name (HMPR p, long id)
+

Return the name of command with given id. +

+ +
+
Method on mglParse: int CmdType (const char *name)
+
C function: int mgl_parser_cmd_type (HMPR p, const char *name)
+

Return the type of MGL command name. Type of commands are: 0 – not the command, 1 - data plot, 2 - other plot, 3 - setup, 4 - data handle, 5 - data create, 6 - subplot, 7 - program, 8 - 1d plot, 9 - 2d plot, 10 - 3d plot, 11 - dd plot, 12 - vector plot, 13 - axis, 14 - primitives, 15 - axis setup, 16 - text/legend, 17 - data transform. +

+ +
+
Method on mglParse: const char * CmdFormat (const char *name)
+
C function: const char * mgl_parser_cmd_frmt (HMPR p, const char *name)
+

Return the format of arguments for MGL command name. +

+ +
+
Method on mglParse: const char * CmdDesc (const char *name)
+
C function: const char * mgl_parser_cmd_desc (HMPR p, const char *name)
+

Return the description of MGL command name. +

+ +
+
Method on mglParse: void RK_Step (const char *eqs, const char *vars, mreal dt=1)
+
Method on mglParse: void RK_Step (const wchar_t *eqs, const wchar_t *vars, mreal dt=1)
+
C function: void mgl_rk_step (HMPR p, const char *eqs, const char *vars, mreal dt)
+
C function: void mgl_rk_step_w (HMPR p, const wchar_t *eqs, const wchar_t *vars, mreal dt)
+

Make one step for ordinary differential equation(s) {var1’ = eq1, ... } with time-step dt. Here strings eqs and vars contain the equations and variable names separated by symbol ‘;’. The variable(s) ‘var1’, ... are the ones, defined in MGL script previously. The Runge-Kutta 4-th order method is used. +

+ + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

8 UDAV

+ + +

UDAV (Universal Data Array Visualizator) is cross-platform program for data arrays visualization based on MathGL library. It support wide spectrum of graphics, simple script language and visual data handling and editing. It has window interface for data viewing, changing and plotting. Also it can execute MGL scripts, setup and rotate graphics and so on. UDAV hot-keys can be found in the appendix Hot-keys for UDAV. +

+ + + + + + + +
+ +
+

+Next: , Up: UDAV   [Contents][Index]

+
+ +

8.1 UDAV overview

+ + +

UDAV have main window divided by 2 parts in general case and optional bottom panel(s). Left side contain tabs for MGL script and data arrays. Right side contain tabs with graphics itself, with list of variables and with help on MGL. Bottom side may contain the panel with MGL messages and warnings, and the panel with calculator. +

+
Main window +
+

Main window is shown on the figure above. You can see the script (at left) with current line highlighted by light-yellow, and result of its execution at right. Each panel have its own set of toolbuttons. +

+

Editor toolbuttons allow: open and save script from/to file; undo and redo changes; cut, copy and paste selection; find/replace text; show dialogs for command arguments and for plot setup; show calculator at bottom. +

+

Graphics toolbuttons allow: enable/disable additional transparency and lighting; show grid of absolute coordinates; enable mouse rotation; restore image view; refresh graphics (execute the script); stop calculation; copy graphics into clipboard; add primitives (line, curve, box, rhombus, ellipse, mark, text) to the image; change view angles manually. Vertical toolbuttons allow: shift and zoom in/out of image as whole; show next and previous frame of animation, or start animation (if one present). +

+

Graphics panel support plot editing by mouse. +

    +
  • Axis range can be changed by mouse wheel or by dragging image by middle mouse button. Right button show popup menu. Left button show the coordinates of mouse click. At this double click will highlight plot under mouse and jump to the corresponded string of the MGL script. +
  • Pressing "mouse rotation" toolbutton will change mouse actions: dragging by left button will rotate plot, middle button will shift the plot as whole, right button will zoom in/out plot as whole and add perspective, mouse wheel will zoom in/out plot as whole. +
  • Manual primitives can be added by pressing corresponding toolbutton. They can be shifted as whole at any time by mouse dragging. At this double click open dialog with its properties. If toolbutton "grid of absolute coordinates" is pressed then editing of active points for primitives is enabled. +
+ +
Main window - help panel +
+

Short command description and list of its arguments are shown at the status-bar, when you move cursor to the new line of code. You can press F1 to see more detailed help on special panel. +

+
Main window - data viewing +
+

Also you can look the current list of variables, its dimensions and its size in the memory (right side of above figure). Toolbuttons allow: create new variable, edit variable, delete variable, preview variable plot and its properties, refresh list of variables. Pressing on any column will sort table according its contents. Double click on a variable will open panel with data cells of the variable, where you can view/edit each cell independently or apply a set of transformations. +

+
Main window - calculator and messages +
+

Finally, pressing F2 or F4 you can show/hide windows with messages/warnings and with calculator. Double click on a warning in message window will jump to corresponding line in editor. Calculator allow you type expression by keyboard as well as by toolbuttons. It know about all current variables, so you can use them in formulas. +

+ +
+ +
+

+Next: , Previous: , Up: UDAV   [Contents][Index]

+
+ +

8.2 UDAV dialogs

+ + +

There are a set of dialogs, which allow change/add a command, setup global plot properties, or setup UDAV itself. +

+
New command dialog +
+

One of most interesting dialog (hotkey Meta-C or Win-C) is dialog which help to enter new command or change arguments of existed one. It allows consequently select the category of command, command name in category and appropriate set of command arguments. At this right side show detailed command description. Required argument(s) are denoted by bold text. Strings are placed in apostrophes, like 'txt'. Buttons below table allow to call dialogs for changing style of command (if argument 'fmt' is present in the list of command arguments); to set variable or expression for argument(s); to add options for command. Note, you can click on a cell to enter value, or double-click to call corresponding dialog. +

+
Style dialog - pen style +
Style dialog - color scheme +
Style dialog - text style +
Style dialog - manual mask +
+

Dialog for changing style can be called independently, but usually is called from New command dialog or by double click on primitive. It contain 3 tabs: one for pen style, one for color scheme, one for text style. You should select appropriate one. Resulting string of style and sample picture are shown at bottom of dialog. Usually it can be called from New command dialog. +

+
Variable dialog +
+

Dialog for entering variable allow to select variable or expression which can be used as argument of a command. Here you can select the variable name; range of indexes in each directions; operation which will be applied (like, summation, finding minimal/maximal values and so on). Usually it can be called from New command dialog. +

+
Dialog for options of a command +
+

Dialog for command options allow to change Command options. Usually it can be called from New command dialog. +

+ + +
New inplot dialog +
+

Another interesting dialog, which help to select and properly setup a subplot, inplot, columnplot, stickplot and similar commands. +

+ +
Dialog for general properties +
Dialog for light properties +
+

There is dialog for setting general plot properties, including tab for setting lighting properties. It can be called by called by hotkey ??? and put setup commands at the beginning of MGL script. +

+
Dialog for script parameters +
+

Also you can set or change script parameters (‘$0’ ... ‘$9’, see MGL definition). +

+
Dialog for UDAV settings +
+

Finally, there is dialog for UDAV settings. It allow to change most of things in UDAV appearance and working, including colors of keywords and numbers, default font and image size, and so on (see figure above). +

+

There are also a set of dialogs for data handling, but they are too simple and clear. So, I will not put them here. +

+ +
+ +
+

+Previous: , Up: UDAV   [Contents][Index]

+
+ +

8.3 UDAV hints

+ + +
    +
  • You can shift axis range by pressing middle button and moving mouse. Also, you can zoom in/out axis range by using mouse wheel. +
  • You can rotate/shift/zoom whole plot by mouse. Just press ’Rotate’ toolbutton, click image and hold a mouse button: left button for rotation, right button for zoom/perspective, middle button for shift. +
  • You may quickly draw the data from file. Just use: udav ’filename.dat’ in command line. +
  • You can copy the current image to clipboard by pressing Ctrl-Shift-C. Later you can paste it directly into yours document or presentation. +
  • You can export image into a set of format (EPS, SVG, PNG, JPEG) by pressing right mouse button inside image and selecting ’Export as ...’. +
  • You can setup colors for script highlighting in Property dialog. Just select menu item ’Settings/Properties’. +
  • You can save the parameter of animation inside MGL script by using comment started from ’##a ’ or ’##c ’ for loops. +
  • New drawing never clears things drawn already. For example, you can make a surface with contour lines by calling commands ’surf’ and ’cont’ one after another (in any order). +
  • You can put several plots in the same image by help of commands ’subplot’ or ’inplot’. +
  • All indexes (of data arrays, subplots and so on) are always start from 0. +
  • You can edit MGL file in any text editor. Also you can run it in console by help of commands: mglconv, mglview. +
  • You can use command ’once on|off’ for marking the block which should be executed only once. For example, this can be the block of large data reading/creating/handling. Press F9 (or menu item ’Graphics/Reload’) to re-execute this block. +
  • You can use command ’stop’ for terminating script parsing. It is useful if you don’t want to execute a part of script. +
  • You can type arbitrary expression as input argument for data or number. In last case (for numbers), the first value of data array is used. +
  • There is powerful calculator with a lot of special functions. You can use buttons or keyboard to type the expression. Also you can use existed variables in the expression. +
  • The calculator can help you to put complex expression in the script. Just type the expression (which may depend on coordinates x,y,z and so on) and put it into the script. +
  • You can easily insert file or folder names, last fitted formula or numerical value of selection by using menu Edit|Insert. +
  • The special dialog (Edit|Insert|New Command) help you select the command, fill its arguments and put it into the script. +
  • You can put several plotting commands in the same line or in separate function, for highlighting all of them simultaneously. +
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

9 Other classes

+ + +

There are few end-user classes: mglGraph (see MathGL core), mglWindow and mglGLUT (see Widget classes), mglData (see Data processing), mglParse (see MGL scripts). Exactly these classes I recommend to use in most of user programs. All methods in all of these classes are inline and have exact C/Fortran analogue functions. This give compiler independent binary libraries for MathGL. +

+

However, sometimes you may need to extend MathGL by writing yours own plotting functions or handling yours own data structures. In these cases you may need to use low-level API. This chapter describes it. +

+
Class diagram for MathGL +
+

The internal structure of MathGL is rather complicated. There are C++ classes mglBase, mglCanvas, ... for drawing primitives and positioning the plot (blue ones in the figure). There is a layer of C functions, which include interface for most important methods of these classes. Also most of plotting functions are implemented as C functions. After it, there are “inline” front-end classes which are created for user convenience (yellow ones in the figure). Also there are widgets for FLTK and Qt libraries (green ones in the figure). +

+

Below I show how this internal classes can be used. +

+ + + + + + + + + +
+ + + +

9.1 Define new kind of plot (mglBase class)

+ + +

Basically most of new kinds of plot can be created using just MathGL primitives (see Primitives). However the usage of mglBase methods can give you higher speed of drawing and better control of plot settings. +

+

All plotting functions should use a pointer to mglBase class (or HMGL type in C functions) due to compatibility issues. Exactly such type of pointers are used in front-end classes (mglGraph, mglWindow) and in widgets (QMathGL, Fl_MathGL). +

+

MathGL tries to remember all vertexes and all primitives and plot creation stage, and to use them for making final picture by demand. Basically for making plot, you need to add vertexes by AddPnt() function, which return index for new vertex, and call one of primitive drawing function (like mark_plot(), arrow_plot(), line_plot(), trig_plot(), quad_plot(), text_plot()), using vertex indexes as argument(s). AddPnt() function use 2 mreal numbers for color specification. First one is positioning in textures – integer part is texture index, fractional part is relative coordinate in the texture. Second number is like a transparency of plot (or second coordinate in the 2D texture). +

+

I don’t want to put here detailed description of mglBase class. It was rather well documented in mgl2/base.h file. I just show and example of its usage on the base of circle drawing. +

+

First, we should prototype new function circle() as C function. +

#ifdef __cplusplus
+extern "C" {
+#endif
+void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt);
+#ifdef __cplusplus
+}
+#endif
+

This is done for generating compiler independent binary. Because only C-functions have standard naming mechanism, the same for any compilers. +

+

Now, we create a C++ file and put the code of function. I’ll write it line by line and try to comment all important points. +

void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+

First, we need to check all input arguments and send warnings if something is wrong. In our case it is negative value of r argument. We just send warning, since it is not critical situation – other plot still can be drawn. +

  if(r<=0)  { gr->SetWarn(mglWarnNeg,"Circle"); return; }
+

Next step is creating a group. Group keep some general setting for plot (like options) and useful for export in 3d files. +

  static int cgid=1;  gr->StartGroup("Circle",cgid++);
+

Now let apply options. Options are rather useful things, generally, which allow one easily redefine axis range(s), transparency and other settings (see Command options). +

  gr->SaveState(opt);
+

I use global setting for determining the number of points in circle approximation. Note, that user can change MeshNum by options easily. +

  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+

Let try to determine plot specific flags. MathGL functions expect that most of flags will be sent in string. In our case it is symbol ‘@’ which set to draw filled circle instead of border only (last will be default). Note, you have to handle NULL as string pointer. +

  bool fill = mglchr(stl,'@');
+

Now, time for coloring. I use palette mechanism because circle have few colors: one for filling and another for border. SetPenPal() function parse input string and write resulting texture index in pal. Function return the character for marker, which can be specified in string str. Marker will be plotted at the center of circle. I’ll show on next sample how you can use color schemes (smooth colors) too. +

  long pal=0;
+  char mk=gr->SetPenPal(stl,&pal);
+

Next step, is determining colors for filling and for border. First one for filling. +

  mreal c=gr->NextColor(pal), d;
+

Second one for border. I use black color (call gr->AddTexture('k')) if second color is not specified. +

  mreal k=(gr->GetNumPal(pal)>1)?gr->NextColor(pal):gr->AddTexture('k');
+

If user want draw only border (fill=false) then I use first color for border. +

  if(!fill) k=c;
+

Now we should reserve space for vertexes. This functions need n for border, n+1 for filling and 1 for marker. So, maximal number of vertexes is 2*n+2. Note, that such reservation is not required for normal work but can sufficiently speed up the plotting. +

  gr->Reserve(2*n+2);
+

We’ve done with setup and ready to start drawing. First, we need to add vertex(es). Let define NAN as normals, since I don’t want handle lighting for this plot, +

  mglPoint q(NAN,NAN);
+

and start adding vertexes. First one for central point of filling. I use -1 if I don’t need this point. The arguments of AddPnt() function is: mglPoint(x,y,z) – coordinate of vertex, c – vertex color, q – normal at vertex, -1 – vertex transparency (-1 for default), 3 bitwise flag which show that coordinates will be scaled (0x1) and will not be cutted (0x2). +

  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+

Similar for marker, but we use different color k. +

  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+

Draw marker. +

  if(mk)  gr->mark_plot(n2,mk);
+

Time for drawing circle itself. I use -1 for m1, n1 as sign that primitives shouldn’t be drawn for first point i=0. +

  for(i=0,m1=n1=-1;i<n;i++)
+  {
+

Each function should check Stop variable and return if it is non-zero. It is done for interrupting drawing for system which don’t support multi-threading. +

    if(gr->Stop)  return;
+

Let find coordinates of vertex. +

    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+

Save previous vertex and add next one +

    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+

and copy it for border but with different color. Such copying is much faster than adding new vertex using AddPnt(). +

    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+

Now draw triangle for filling internal part +

    if(fill)  gr->trig_plot(n0,n1,n2);
+

and draw line for border. +

    gr->line_plot(m1,m2);
+  }
+

Drawing is done. Let close group and return. +

  gr->EndGroup();
+}
+
+

Another sample I want to show is exactly the same function but with smooth coloring using color scheme. So, I’ll add comments only in the place of difference. +

+
void circle_cs(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+

In this case let allow negative radius too. Formally it is not the problem for plotting (formulas the same) and this allow us to handle all color range. +

//if(r<=0)  { gr->SetWarn(mglWarnNeg,"Circle"); return; }
+
+  static int cgid=1;  gr->StartGroup("CircleCS",cgid++);
+  gr->SaveState(opt);
+  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+  bool fill = mglchr(stl,'@');
+

Here is main difference. We need to create texture for color scheme specified by user +

  long ss = gr->AddTexture(stl);
+

But we need also get marker and color for it (if filling is enabled). Let suppose that marker and color is specified after ‘:’. This is standard delimiter which stop color scheme entering. So, just lets find it and use for setting pen. +

  const char *pen=0;
+  if(stl) pen = strchr(stl,':');
+  if(pen) pen++;
+

The substring is placed in pen and it will be used as line style. +

  long pal=0;
+  char mk=gr->SetPenPal(pen,&pal);
+

Next step, is determining colors for filling and for border. First one for filling. +

  mreal c=gr->GetC(ss,r);
+

Second one for border. +

  mreal k=gr->NextColor(pal);
+

The rest part is the same as in previous function. +

  if(!fill) k=c;
+
+  gr->Reserve(2*n+2);
+  mglPoint q(NAN,NAN);
+  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+  if(mk)  gr->mark_plot(n2,mk);
+  for(i=0,m1=n1=-1;i<n;i++)
+  {
+    if(gr->Stop)  return;
+    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+    if(fill)  gr->trig_plot(n0,n1,n2);
+    gr->line_plot(m1,m2);
+  }
+  gr->EndGroup();
+}
+
+

The last thing which we can do is derive our own class with new plotting functions. Good idea is to derive it from mglGraph (if you don’t need extended window), or from mglWindow (if you need to extend window). So, in our case it will be +

class MyGraph : public mglGraph
+{
+public:
+  inline void Circle(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle(p.x,p.y,p.z, r, stl, opt); }
+  inline void CircleCS(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle_cs(p.x,p.y,p.z, r, stl, opt); }
+};
+

Note, that I use inline modifier for using the same binary code with different compilers. +

+

So, the complete sample will be +

#include <mgl2/mgl.h>
+//---------------------------------------------------------
+#ifdef __cplusplus
+extern "C" {
+#endif
+void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt);
+void circle_cs(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt);
+#ifdef __cplusplus
+}
+#endif
+//---------------------------------------------------------
+class MyGraph : public mglGraph
+{
+public:
+  inline void CircleCF(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle(p.x,p.y,p.z, r, stl, opt); }
+  inline void CircleCS(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle_cs(p.x,p.y,p.z, r, stl, opt); }
+};
+//---------------------------------------------------------
+void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+  if(r<=0)  { gr->SetWarn(mglWarnNeg,"Circle"); return; }
+  static int cgid=1;  gr->StartGroup("Circle",cgid++);
+  gr->SaveState(opt);
+  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+  bool fill = mglchr(stl,'@');
+  long pal=0;
+  char mk=gr->SetPenPal(stl,&pal);
+  mreal c=gr->NextColor(pal), d;
+  mreal k=(gr->GetNumPal(pal)>1)?gr->NextColor(pal):gr->AddTexture('k');
+  if(!fill) k=c;
+  gr->Reserve(2*n+2);
+  mglPoint q(NAN,NAN);
+  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+  if(mk)  gr->mark_plot(n2,mk);
+  for(i=0,m1=n1=-1;i<n;i++)
+  {
+    if(gr->Stop)  return;
+    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+    if(fill)  gr->trig_plot(n0,n1,n2);
+    gr->line_plot(m1,m2);
+  }
+  gr->EndGroup();
+}
+//---------------------------------------------------------
+void circle_cs(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+  static int cgid=1;  gr->StartGroup("CircleCS",cgid++);
+  gr->SaveState(opt);
+  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+  bool fill = mglchr(stl,'@');
+  long ss = gr->AddTexture(stl);
+  const char *pen=0;
+  if(stl) pen = strchr(stl,':');
+  if(pen) pen++;
+  long pal=0;
+  char mk=gr->SetPenPal(pen,&pal);
+  mreal c=gr->GetC(ss,r);
+  mreal k=gr->NextColor(pal);
+  if(!fill) k=c;
+
+  gr->Reserve(2*n+2);
+  mglPoint q(NAN,NAN);
+  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+  if(mk)  gr->mark_plot(n2,mk);
+  for(i=0,m1=n1=-1;i<n;i++)
+  {
+    if(gr->Stop)  return;
+    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+    if(fill)  gr->trig_plot(n0,n1,n2);
+    gr->line_plot(m1,m2);
+  }
+  gr->EndGroup();
+}
+//---------------------------------------------------------
+int main()
+{
+  MyGraph gr;
+  gr.Box();
+  // first let draw circles with fixed colors
+  for(int i=0;i<10;i++)
+    gr.CircleCF(mglPoint(2*mgl_rnd()-1, 2*mgl_rnd()-1), mgl_rnd());
+  // now let draw circles with color scheme
+  for(int i=0;i<10;i++)
+    gr.CircleCS(mglPoint(2*mgl_rnd()-1, 2*mgl_rnd()-1), 2*mgl_rnd()-1);
+}
+
+ + + + +
+ +
+

+Next: , Previous: , Up: Other classes   [Contents][Index]

+
+ +

9.2 User defined types (mglDataA class)

+ + +

mglData class have abstract predecessor class mglDataA. Exactly the pointers to mglDataA instances are used in all plotting functions and some of data processing functions. This was done for taking possibility to define yours own class, which will handle yours own data (for example, complex numbers, or differently organized data). And this new class will be almost the same as mglData for plotting purposes. +

+

However, the most of data processing functions will be slower as if you used mglData instance. This is more or less understandable – I don’t know how data in yours particular class will be organized, and couldn’t optimize the these functions generally. +

+

There are few virtual functions which must be provided in derived classes. This functions give: +

    +
  • the sizes of the data (GetNx, GetNy, GetNz), +
  • give data value and numerical derivatives for selected cell (v, dvx, dvy, dvz), +
  • give maximal and minimal values (Maximal, Minimal) – you can use provided functions (like mgl_data_max and mgl_data_min), but yours own realization can be more efficient, +
  • give access to all element as in single array (vthr) – you need this only if you want using MathGL’s data processing functions. +
+ +

Let me, for example define class mglComplex which will handle complex number and draw its amplitude or phase, depending on flag use_abs: +

#include <complex>
+#include <mgl2/mgl.h>
+#define dual std::complex<double>
+class mglComplex : public mglDataA
+{
+public:
+  long nx;      ///< number of points in 1st dimensions ('x' dimension)
+  long ny;      ///< number of points in 2nd dimensions ('y' dimension)
+  long nz;      ///< number of points in 3d dimensions ('z' dimension)
+  dual *a;      ///< data array
+  bool use_abs; ///< flag to use abs() or arg()
+
+  inline mglComplex(long xx=1,long yy=1,long zz=1)
+  { a=0;  use_abs=true; Create(xx,yy,zz); }
+  virtual ~mglComplex()  { if(a)  delete []a; }
+
+  /// Get sizes
+  inline long GetNx() const { return nx;  }
+  inline long GetNy() const { return ny;  }
+  inline long GetNz() const { return nz;  }
+  /// Create or recreate the array with specified size and fill it by zero
+  inline void Create(long mx,long my=1,long mz=1)
+  { nx=mx;  ny=my;  nz=mz;  if(a) delete []a;
+  a = new dual[nx*ny*nz]; }
+  /// Get maximal value of the data
+  inline mreal Maximal() const  { return mgl_data_max(this);  }
+  /// Get minimal value of the data
+  inline mreal Minimal() const  { return mgl_data_min(this);  }
+
+protected:
+  inline mreal v(long i,long j=0,long k=0) const
+  { return use_abs ? abs(a[i+nx*(j+ny*k)]) : arg(a[i+nx*(j+ny*k)]);  }
+  inline mreal vthr(long i) const
+  { return use_abs ? abs(a[i]) : arg(a[i]);  }
+  inline mreal dvx(long i,long j=0,long k=0) const
+  { long i0=i+nx*(j+ny*k);
+    std::complex<double> res=i>0? (i<nx-1? (a[i0+1]-a[i0-1])/2.:a[i0]-a[i0-1]) : a[i0+1]-a[i0];
+    return use_abs? abs(res) : arg(res);  }
+  inline mreal dvy(long i,long j=0,long k=0) const
+  { long i0=i+nx*(j+ny*k);
+    std::complex<double> res=j>0? (j<ny-1? (a[i0+nx]-a[i0-nx])/2.:a[i0]-a[i0-nx]) : a[i0+nx]-a[i0];
+    return use_abs? abs(res) : arg(res);  }
+  inline mreal dvz(long i,long j=0,long k=0) const
+  { long i0=i+nx*(j+ny*k), n=nx*ny;
+    std::complex<double> res=k>0? (k<nz-1? (a[i0+n]-a[i0-n])/2.:a[i0]-a[i0-n]) : a[i0+n]-a[i0];
+    return use_abs? abs(res) : arg(res);  }
+};
+int main()
+{
+  mglComplex dat(20);
+  for(long i=0;i<20;i++)
+    dat.a[i] = 3*exp(-0.05*(i-10)*(i-10))*dual(cos(M_PI*i*0.3), sin(M_PI*i*0.3));
+  mglGraph gr;
+  gr.SetRange('y', -M_PI, M_PI);  gr.Box();
+
+  gr.Plot(dat,"r","legend 'abs'");
+  dat.use_abs=false;
+  gr.Plot(dat,"b","legend 'arg'");
+  gr.Legend();
+  gr.WritePNG("complex.png");
+  return 0;
+}
+
+ + +
+ +
+

+Next: , Previous: , Up: Other classes   [Contents][Index]

+
+ +

9.3 mglColor class

+ + + +

Structure for working with colors. This structure is defined in #include <mgl2/type.h>. +

+

There are two ways to set the color in MathGL. First one is using of mreal values of red, green and blue channels for precise color definition. The second way is the using of character id. There are a set of characters specifying frequently used colors. Normally capital letter gives more dark color than lowercase one. See Line styles. +

+
+
Parameter of mglColor: mreal r, g, b, a
+

Reg, green and blue component of color. +

+ +
+
Method on mglColor: mglColor (mreal R, mreal G, mreal B, mreal A=1)
+

Constructor sets the color by mreal values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1]. +

+
+
Method on mglColor: mglColor (char c='k', mreal bright=1)
+

Constructor sets the color from character id. The black color is used by default. Parameter br set additional “lightness” of color. +

+
+
Method on mglColor: void Set (mreal R, mreal G, mreal B, mreal A=1)
+

Sets color from values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1]. +

+
+
Method on mglColor: void Set (mglColor c, mreal bright=1)
+

Sets color as “lighted” version of color c. +

+
+
Method on mglColor: void Set (char p, mreal bright=1)
+

Sets color from symbolic id. +

+
+
Method on mglColor: bool Valid ()
+

Checks correctness of the color. +

+
+
Method on mglColor: mreal Norm ()
+

Gets maximal of spectral component. +

+
+
Method on mglColor: bool operator== (const mglColor &c)
+
Method on mglColor: bool operator!= (const mglColor &c)
+

Compare with another color +

+ +
+
Method on mglColor: bool operator*= (mreal v)
+

Multiplies color components by number v. +

+ +
+
Method on mglColor: bool operator+= (const mglColor &c)
+

Adds color c component by component. +

+ +
+
Method on mglColor: bool operator-= (const mglColor &c)
+

Subtracts color c component by component. +

+ + +
+
Library Function: mglColor operator+ (const mglColor &a, const mglColor &b)
+

Adds colors by its RGB values. +

+
+
Library Function: mglColor operator- (const mglColor &a, const mglColor &b)
+

Subtracts colors by its RGB values. +

+
+
Library Function: mglColor operator* (const mglColor &a, mreal b)
+
Library Function: mglColor operator* (mreal a, const mglColor &b)
+

Multiplies color by number. +

+
+
Library Function: mglColor operator/ (const mglColor &a, mreal b)
+

Divide color by number. +

+
+
Library Function: mglColor operator! (const mglColor &a)
+

Return inverted color. +

+ + +
+ +
+

+Previous: , Up: Other classes   [Contents][Index]

+
+ +

9.4 mglPoint class

+ + + +

Structure describes point in space. This structure is defined in #include <mgl2/type.h> +

+
+
Parameter of mglPoint: mreal x, y, z, c
+

Point coordinates {x,y,z} and one extra value c used for amplitude, transparency and so on. By default all values are zero. +

+ +
+
Method on mglPoint: mglPoint (mreal X=0, mreal Y=0, mreal Z=0, mreal C=0)
+

Constructor sets the color by mreal values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1]. +

+ +
+
Method on mglPoint: bool IsNAN ()
+

Returns true if point contain NAN values. +

+
+
Method on mglPoint: mreal norm ()
+

Returns the norm \sqrt{x^2+y^2+z^2} of vector. +

+
+
Method on mglPoint: void Normalize ()
+

Normalizes vector to be unit vector. +

+
+
Method on mglPoint: mreal val (int i)
+

Returns point component: x for i=0, y for i=1, z for i=2, c for i=3. +

+ + +
+
Library Function: mglPoint operator+ (const mglPoint &a, const mglPoint &b)
+

Point of summation (summation of vectors). +

+
+
Library Function: mglPoint operator- (const mglPoint &a, const mglPoint &b)
+

Point of difference (difference of vectors). +

+
+
Library Function: mglPoint operator* (mreal a, const mglPoint &b)
+
Library Function: mglPoint operator* (const mglPoint &a, mreal b)
+

Multiplies (scale) points by number. +

+
+
Library Function: mglPoint operator/ (const mglPoint &a, mreal b)
+

Multiplies (scale) points by number 1/b. +

+
+
Library Function: mreal operator* (const mglPoint &a, const mglPoint &b)
+

Scalar product of vectors. +

+ +
+
Library Function: mglPoint operator/ (const mglPoint &a, const mglPoint &b)
+

Return vector of element-by-element product. +

+ +
+
Library Function: mglPoint operator^ (const mglPoint &a, const mglPoint &b)
+

Cross-product of vectors. +

+
+
Library Function: mglPoint operator& (const mglPoint &a, const mglPoint &b)
+

The part of a which is perpendicular to vector b. +

+
+
Library Function: mglPoint operator| (const mglPoint &a, const mglPoint &b)
+

The part of a which is parallel to vector b. +

+ +
+
Library Function: mglPoint operator! (const mglPoint &a)
+

Return vector perpendicular to vector a. +

+
+
Library Function: mreal mgl_norm (const mglPoint &a)
+

Return the norm sqrt(|a|^2) of vector a. +

+ +
+
Library Function: bool operator== (const mglPoint &a, const mglPoint &b)
+

Return true if points are the same. +

+
+
Library Function: bool operator!= (const mglPoint &a, const mglPoint &b)
+

Return true if points are different. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

10 All samples

+ + +

This chapter contain alphabetical list of MGL and C++ samples for most of MathGL graphics and features. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: All samples   [Contents][Index]

+
+ +

10.1 Functions for initialization

+ + +

This section contain functions for input data for most of further samples. +

+

MGL code: +

+func 'prepare1d'
+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
+new x1 50 'x'
+new x2 50 '0.05-0.03*cos(pi*x)'
+new y1 50 '0.5-0.3*cos(pi*x)'
+new y2 50 '-0.3*sin(pi*x)'
+return
+
+func 'prepare2d'
+new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3d'
+new c 61 50 40 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 61 50 40 '1-2*tanh((x+y)*(x+y))'
+return
+
+func 'prepare2v'
+new a 20 30 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 20 30 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3v'
+define $1 pow(x*x+y*y+(z-0.3)*(z-0.3)+0.03,1.5)
+define $2 pow(x*x+y*y+(z+0.3)*(z+0.3)+0.03,1.5)
+new ex 10 10 10 '0.2*x/$1-0.2*x/$2'
+new ey 10 10 10 '0.2*y/$1-0.2*y/$2'
+new ez 10 10 10 '0.2*(z-0.3)/$1-0.2*(z+0.3)/$2'
+return
+
+

C++ code: +

void mgls_prepare1d(mglData *y, mglData *y1, mglData *y2, mglData *x1, mglData *x2)
+{
+	long n=50;
+	if(y)	y->Create(n,3);
+	if(x1)	x1->Create(n);
+	if(x2)	x2->Create(n);
+	if(y1)	y1->Create(n);
+	if(y2)	y2->Create(n);
+	for(long i=0;i<n;i++)
+	{
+		double xx = i/(n-1.);
+		if(y)
+		{
+			y->a[i] = 0.7*sin(2*M_PI*xx) + 0.5*cos(3*M_PI*xx) + 0.2*sin(M_PI*xx);
+			y->a[i+n] = sin(2*M_PI*xx);
+			y->a[i+2*n] = cos(2*M_PI*xx);
+		}
+		if(y1)	y1->a[i] = 0.5+0.3*cos(2*M_PI*xx);
+		if(y2)	y2->a[i] = 0.3*sin(2*M_PI*xx);
+		if(x1)	x1->a[i] = xx*2-1;
+		if(x2)	x2->a[i] = 0.05+0.03*cos(2*M_PI*xx);
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare2d(mglData *a, mglData *b, mglData *v)
+{
+	long n=50,m=40;
+	if(a)	a->Create(n,m);
+	if(b)	b->Create(n,m);
+	if(v)	{	v->Create(9);	v->Fill(-1,1);	}
+	for(long j=0;j<m;j++)	for(long i=0;i<n;i++)
+	{
+		double x = i/(n-1.), y = j/(m-1.);
+		long i0 = i+n*j;
+		if(a)	a->a[i0] = 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+		if(b)	b->a[i0] = 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare3d(mglData *a, mglData *b)
+{
+	long n=61,m=50,l=40;
+	if(a)	a->Create(n,m,l);
+	if(b)	b->Create(n,m,l);
+	for(long k=0;k<l;k++)	for(long j=0;j<m;j++)	for(long i=0;i<n;i++)
+	{
+		double x=2*i/(n-1.)-1, y=2*j/(m-1.)-1, z=2*k/(l-1.)-1;
+		long i0 = i+n*(j+m*k);
+		if(a)	a->a[i0] = -2*(x*x + y*y + z*z*z*z - z*z - 0.1);
+		if(b)	b->a[i0] = 1-2*tanh((x+y)*(x+y));
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare2v(mglData *a, mglData *b)
+{
+	long n=20,m=30;
+	if(a)	a->Create(n,m);
+	if(b)	b->Create(n,m);
+	for(long j=0;j<m;j++)	for(long i=0;i<n;i++)
+	{
+		double x=i/(n-1.), y=j/(m-1.);
+		long i0 = i+n*j;
+		if(a)	a->a[i0] = 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+		if(b)	b->a[i0] = 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare3v(mglData *ex, mglData *ey, mglData *ez)
+{
+	long n=10;
+	double z0=0.3;
+	if(!ex || !ey || !ez)	return;
+	ex->Create(n,n,n);	ey->Create(n,n,n);	ez->Create(n,n,n);
+	for(long k=0;k<n;k++)	for(long j=0;j<n;j++)	for(long i=0;i<n;i++)
+	{
+		double x=2*i/(n-1.)-1, y=2*j/(n-1.)-1, z=2*k/(n-1.)-1;
+		long i0 = i+n*(j+k*n);
+		double r1 = pow(x*x+y*y+(z-z0)*(z-z0)+0.03,1.5);
+		double r2 = pow(x*x+y*y+(z+z0)*(z+z0)+0.03,1.5);
+		ex->a[i0]=0.2*x/r1 - 0.2*x/r2;
+		ey->a[i0]=0.2*y/r1 - 0.2*y/r2;
+		ez->a[i0]=0.2*(z-z0)/r1 - 0.2*(z+z0)/r2;
+	}
+}
+//-----------------------------------------------------------------------------
+
+
+ +
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.2 Sample ‘3wave

+ + +

Example of complex ode on basis of 3-wave decay. +

+

MGL code: +

define t 50
+ode !r '-b*f;a*conj(f);a*conj(b)-0.1*f' 'abf' [1,1e-3,0] 0.1 t
+ranges 0 t 0 r.max
+plot r(0) 'b';legend 'a'
+plot r(1) 'g';legend 'b'
+plot r(2) 'r';legend 'f'
+axis:box:legend
+
+

C++ code: +

void smgl_3wave(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Complex ODE sample");
+	double t=50;
+	mglData ini;	ini.SetList(3, 1., 1e-3, 0.);
+	mglDataC r(mglODEc("-b*f;a*conj(f);a*conj(b)-0.1*f","abf",ini,0.1,t));
+	gr->SetRanges(0, t, 0, r.Maximal());
+	gr->Plot(r.SubData(0),"b","legend 'a'");
+	gr->Plot(r.SubData(1),"g","legend 'b'");
+	gr->Plot(r.SubData(2),"r","legend 'f'");
+	gr->Axis();	gr->Box();	gr->Legend();
+}
+
Sample 3wave +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.3 Sample ‘alpha

+ + +

Example of light and alpha (transparency). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'default':rotate 50 60:box
+surf a
+subplot 2 2 1:title 'light on':rotate 50 60:box
+light on:surf a
+subplot 2 2 3:title 'light on; alpha on':rotate 50 60:box
+alpha on:surf a
+subplot 2 2 2:title 'alpha on':rotate 50 60:box
+light off:surf a
+
+

C++ code: +

void smgl_alpha(mglGraph *gr)	// alpha and lighting
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->SubPlot(2,2,0);	gr->Title("default");	gr->Rotate(50,60);
+	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,1);	gr->Title("light on");	gr->Rotate(50,60);
+	gr->Box();	gr->Light(true);	gr->Surf(a);
+	gr->SubPlot(2,2,3);	gr->Title("alpha on; light on");	gr->Rotate(50,60);
+	gr->Box();	gr->Alpha(true);	gr->Surf(a);
+	gr->SubPlot(2,2,2);	gr->Title("alpha on");	gr->Rotate(50,60);
+	gr->Box();	gr->Light(false);	gr->Surf(a);
+}
+
Sample alpha +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.4 Sample ‘apde

+ + +

Comparison of advanced PDE solver (apde) and ordinary one (pde). +

+

MGL code: +

ranges -1 1 0 2 0 2
+new ar 256 'exp(-2*(x+0.0)^2)'
+new ai 256
+
+apde res1 'exp(-x^2-p^2)' ar ai 0.01:transpose res1
+pde res2 'exp(-x^2-p^2)' ar ai 0.01
+
+subplot 1 2 0 '_':title 'Advanced PDE solver'
+ranges 0 2 -1 1:crange res1
+dens res1:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u = exp(-\i x^2+\partial_x^2)[\i u]' 'y'
+
+subplot 1 2 1 '_':title 'Simplified PDE solver'
+dens res2:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u \approx\ exp(-\i x^2)\i u+exp(\partial_x^2)[\i u]' 'y'
+
+

C++ code: +

void smgl_apde(mglGraph *gr)
+{
+	gr->SetRanges(-1,1,0,2,0,2);
+	mglData ar(256), ai(256);	gr->Fill(ar,"exp(-2*(x+0.0)^2)");
+
+	mglData res1(gr->APDE("exp(-x^2-p^2)",ar,ai,0.01));	res1.Transpose();
+	mglData res2(gr->PDE("exp(-x^2-p^2)",ar,ai,0.01));
+
+	gr->SubPlot(1,2,0,"_");	gr->Title("Advanced PDE solver");
+	gr->SetRanges(0,2,-1,1);	gr->SetRange('c',res1);
+	gr->Dens(res1);	gr->Axis();	gr->Box();
+	gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+	gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u = exp(-\\i x^2+\\partial_x^2)[\\i u]","y");
+
+	gr->SubPlot(1,2,1,"_");	gr->Title("Simplified PDE solver");
+	gr->Dens(res2);	gr->Axis();	gr->Box();
+	gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+	gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u \\approx\\ exp(-\\i x^2)\\i u+exp(\\partial_x^2)[\\i u]","y");
+}
+
Sample apde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.5 Sample ‘area

+ + +

Function area fill the area between curve and axis plane. It support gradient filling if 2 colors per curve is specified. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0
+subplot 2 2 0 '':title 'Area plot (default)':box:area y
+subplot 2 2 1 '':title '2 colors':box:area y 'cbgGyr'
+subplot 2 2 2 '':title '"!" style':box:area y '!'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 3:title '3d variant':rotate 50 60:box
+area xc yc z 'r'
+area xc -yc z 'b#'
+
+

C++ code: +

void smgl_area(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Area plot (default)");	}
+	gr->Box();	gr->Area(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Area(y,"cbgGyr");
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style");	gr->Box();	gr->Area(y,"!");
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Area(xc,yc,z,"r");
+	yc.Modify("-sin(pi*(2*x-1))");	gr->Area(xc,yc,z,"b#");
+}
+
Sample area +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.6 Sample ‘aspect

+ + +

Example of subplot, inplot, rotate, aspect, shear. +

+

MGL code: +

subplot 2 2 0:box:text -1 1.1 'Just box' ':L'
+inplot 0.2 0.5 0.7 1 off:box:text 0 1.2 'InPlot example'
+subplot 2 2 1:title 'Rotate only':rotate 50 60:box
+subplot 2 2 2:title 'Rotate and Aspect':rotate 50 60:aspect 1 1 2:box
+subplot 2 2 3:title 'Shear':box 'c':shear 0.2 0.1:box
+
+

C++ code: +

void smgl_aspect(mglGraph *gr)	// transformation
+{
+	gr->SubPlot(2,2,0);	gr->Box();
+	gr->Puts(mglPoint(-1,1.1),"Just box",":L");
+	gr->InPlot(0.2,0.5,0.7,1,false);	gr->Box();
+	gr->Puts(mglPoint(0,1.2),"InPlot example");
+	gr->SubPlot(2,2,1);	gr->Title("Rotate only");
+	gr->Rotate(50,60);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Title("Rotate and Aspect");
+	gr->Rotate(50,60);	gr->Aspect(1,1,2);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Title("Shear");
+	gr->Box("c");		gr->Shear(0.2,0.1);	gr->Box();
+}
+
Sample aspect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.7 Sample ‘axial

+ + +

Function axial draw surfaces of rotation for contour lines. You can draw wire surfaces (‘#’ style) or ones rotated in other directions (‘x’, ‘z’ styles). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Axial plot (default)':light on:alpha on:rotate 50 60:box:axial a
+subplot 2 2 1:title '"x" style;"." style':light on:rotate 50 60:box:axial a 'x.'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:axial a 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:axial a '#'
+
+

C++ code: +

void smgl_axial(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Axial plot (default)");	}
+	gr->Light(true);	gr->Alpha(true);	gr->Rotate(50,60);	gr->Box();	gr->Axial(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'x' style; '.'style");	gr->Rotate(50,60);	gr->Box();	gr->Axial(a,"x.");
+	gr->SubPlot(2,2,2);	gr->Title("'z' style");	gr->Rotate(50,60);	gr->Box();	gr->Axial(a,"z");
+	gr->SubPlot(2,2,3);	gr->Title("'\\#' style");	gr->Rotate(50,60);	gr->Box();	gr->Axial(a,"#");
+}
+
Sample axial +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.8 Sample ‘axis

+ + +

Different forms of axis position. +

+

MGL code: +

subplot 2 2 0:title 'Axis origin, Grid':origin 0 0:axis:grid:fplot 'x^3'
+subplot 2 2 1:title '2 axis':ranges -1 1 -1 1:origin -1 -1:axis:ylabel 'axis_1':fplot 'sin(pi*x)' 'r2'
+ranges 0 1 0 1:origin 1 1:axis:ylabel 'axis_2':fplot 'cos(pi*x)'
+subplot 2 2 3:title 'More axis':origin nan nan:xrange -1 1:axis:xlabel 'x' 0:ylabel 'y_1' 0:fplot 'x^2' 'k'
+yrange -1 1:origin -1.3 -1:axis 'y' 'r':ylabel '#r{y_2}' 0.2:fplot 'x^3' 'r'
+
+subplot 2 2 2:title '4 segments, inverted axis':origin 0 0:
+inplot 0.5 1 0.5 1 on:ranges 0 10 0 2:axis
+fplot 'sqrt(x/2)':xlabel 'W' 1:ylabel 'U' 1
+inplot 0 0.5 0.5 1 on:ranges 1 0 0 2:axis 'x':fplot 'sqrt(x)+x^3':xlabel '\tau' 1
+inplot 0.5 1 0 0.5 on:ranges 0 10 4 0:axis 'y':fplot 'x/4':ylabel 'L' -1
+inplot 0 0.5 0 0.5 on:ranges 1 0 4 0:fplot '4*x^2'
+
+

C++ code: +

void smgl_axis(mglGraph *gr)
+{
+	gr->SubPlot(2,2,0);	gr->Title("Axis origin, Grid");	gr->SetOrigin(0,0);
+	gr->Axis();	gr->Grid();	gr->FPlot("x^3");
+
+	gr->SubPlot(2,2,1);	gr->Title("2 axis");
+	gr->SetRanges(-1,1,-1,1);	gr->SetOrigin(-1,-1,-1);	// first axis
+	gr->Axis();	gr->Label('y',"axis 1",0);	gr->FPlot("sin(pi*x)","r2");
+	gr->SetRanges(0,1,0,1);		gr->SetOrigin(1,1,1);		// second axis
+	gr->Axis();	gr->Label('y',"axis 2",0);	gr->FPlot("cos(pi*x)");
+
+	gr->SubPlot(2,2,3);	gr->Title("More axis");	gr->SetOrigin(NAN,NAN);	gr->SetRange('x',-1,1);
+	gr->Axis();	gr->Label('x',"x",0);	gr->Label('y',"y_1",0);	gr->FPlot("x^2","k");
+	gr->SetRanges(-1,1,-1,1);	gr->SetOrigin(-1.3,-1);	// second axis
+	gr->Axis("y","r");	gr->Label('y',"#r{y_2}",0.2);	gr->FPlot("x^3","r");
+
+	gr->SubPlot(2,2,2);	gr->Title("4 segments, inverted axis");		gr->SetOrigin(0,0);
+	gr->InPlot(0.5,1,0.5,1);	gr->SetRanges(0,10,0,2);	gr->Axis();
+	gr->FPlot("sqrt(x/2)");		gr->Label('x',"W",1);	gr->Label('y',"U",1);
+	gr->InPlot(0,0.5,0.5,1);	gr->SetRanges(1,0,0,2);	gr->Axis("x");
+	gr->FPlot("sqrt(x)+x^3");	gr->Label('x',"\\tau",-1);
+	gr->InPlot(0.5,1,0,0.5);	gr->SetRanges(0,10,4,0);	gr->Axis("y");
+	gr->FPlot("x/4");	gr->Label('y',"L",-1);
+	gr->InPlot(0,0.5,0,0.5);	gr->SetRanges(1,0,4,0);	gr->FPlot("4*x^2");
+}
+
Sample axis +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.9 Sample ‘barh

+ + +

Function barh is the similar to bars but draw horizontal bars. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 2 2 0 '':title 'Barh plot (default)':box:barh ys
+subplot 2 2 1 '':title '2 colors':box:barh ys 'cbgGyr'
+ranges -3 3 -1 1:subplot 2 2 2 '':title '"a" style':box:barh ys 'a'
+subplot 2 2 3 '': title '"f" style':box:barh ys 'f'
+
+

C++ code: +

void smgl_barh(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Barh plot (default)");	}
+	gr->Box();	gr->Barh(ys);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Barh(ys,"cbgGyr");
+	gr->SetRanges(-3,3,-1,1);	// increase range since summation can exceed [-1,1]
+	gr->SubPlot(2,2,2,"");	gr->Title("'a' style");	gr->Box();	gr->Barh(ys,"a");
+	gr->SubPlot(2,2,3,"");	gr->Title("'f' style");	gr->Box();	gr->Barh(ys,"f");
+}
+
Sample barh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.10 Sample ‘bars

+ + +

Function bars draw vertical bars. It have a lot of options: bar-above-bar (‘a’ style), fall like (‘f’ style), 2 colors for positive and negative values, wired bars (‘#’ style), 3D variant. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 3 2 0 '':title 'Bars plot (default)':box:bars ys
+subplot 3 2 1 '':title '2 colors':box:bars ys 'cbgGyr'
+subplot 3 2 4 '':title '"\#" style':box:bars ys '#'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:bars xc yc z 'r'
+ranges -1 1 -3 3:subplot 3 2 2 '':title '"a" style':box:bars ys 'a'
+subplot 3 2 3 '':title '"f" style':box:bars ys 'f'
+
+

C++ code: +

void smgl_bars(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(3,2,0,"");	gr->Title("Bars plot (default)");	}
+	gr->Box();	gr->Bars(ys);
+	if(big==3)	return;
+	gr->SubPlot(3,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Bars(ys,"cbgGyr");
+	gr->SubPlot(3,2,4,"");	gr->Title("'\\#' style");	gr->Box();	gr->Bars(ys,"#");
+	gr->SubPlot(3,2,5);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Bars(xc,yc,z,"r");
+	gr->SetRanges(-1,1,-3,3);	// increase range since summation can exceed [-1,1]
+	gr->SubPlot(3,2,2,"");	gr->Title("'a' style");	gr->Box();	gr->Bars(ys,"a");
+	gr->SubPlot(3,2,3,"");	gr->Title("'f' style");	gr->Box();	gr->Bars(ys,"f");
+}
+
Sample bars +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.11 Sample ‘belt

+ + +

Function belt draw surface by belts. You can use ‘x’ style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Belt plot':rotate 50 60:box:belt a
+
+

C++ code: +

void smgl_belt(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Belt plot");
+	gr->Rotate(50,60);	gr->Box();	gr->Belt(a);
+}
+
Sample belt +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.12 Sample ‘bifurcation

+ + +

Function bifurcation draw Bifurcation diagram for multiple stationary points of the map (like logistic map). +

+

MGL code: +

subplot 1 1 0 '<_':title 'Bifurcation sample'
+ranges 0 4 0 1:axis
+bifurcation 0.005 'x*y*(1-y)' 'r'
+
+

C++ code: +

void smgl_bifurcation(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Bifurcation sample");
+	gr->SetRanges(0,4,0,1);	gr->Axis();
+	gr->Bifurcation(0.005,"x*y*(1-y)","r");
+}
+
Sample bifurcation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.13 Sample ‘box

+ + +

Different styles of bounding box. +

+

MGL code: +

subplot 2 2 0:title 'Box (default)':rotate 50 60:box
+subplot 2 2 1:title 'colored':rotate 50 60:box 'r'
+subplot 2 2 2:title 'with faces':rotate 50 60:box '@'
+subplot 2 2 3:title 'both':rotate 50 60:box '@cm'
+
+

C++ code: +

void smgl_boxplot(mglGraph *gr)	// flow threads and density plot
+{
+	mglData a(10,7);	a.Modify("(2*rnd-1)^3/2");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Boxplot plot");	}
+	gr->Box();	gr->BoxPlot(a);
+}
+
Sample box +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.14 Sample ‘boxplot

+ + +

Function boxplot draw box-and-whisker diagram. +

+

MGL code: +

new a 10 7 '(2*rnd-1)^3/2'
+subplot 1 1 0 '':title 'Boxplot plot':box:boxplot a
+
+

C++ code: +

void smgl_boxplot(mglGraph *gr)	// flow threads and density plot
+{
+	mglData a(10,7);	a.Modify("(2*rnd-1)^3/2");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Boxplot plot");	}
+	gr->Box();	gr->BoxPlot(a);
+}
+
Sample boxplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.15 Sample ‘boxs

+ + +

Function boxs draw surface by boxes. You can use ‘#’ for drawing wire plot. +

+

MGL code: +

call 'prepare2d'
+origin 0 0 0
+subplot 2 2 0:title 'Boxs plot (default)':rotate 40 60:light on:box:boxs a
+subplot 2 2 1:title '"\@" style':rotate 50 60:box:boxs a '@'
+subplot 2 2 2:title '"\#" style':rotate 50 60:box:boxs a '#'
+subplot 2 2 3:title 'compare with Tile':rotate 50 60:box:tile a
+
+

C++ code: +

void smgl_boxs(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetOrigin(0,0,0);	gr->Light(true);
+	if(big!=3)	{gr->SubPlot(2,2,0);	gr->Title("Boxs plot (default)");}
+	gr->Rotate(40,60);	gr->Box();	gr->Boxs(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\@' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Boxs(a,"@");
+	gr->SubPlot(2,2,2);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Boxs(a,"#");
+	gr->SubPlot(2,2,3);	gr->Title("compare with Tile");
+	gr->Rotate(50,60);	gr->Box();	gr->Tile(a);
+}
+
Sample boxs +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.16 Sample ‘candle

+ + +

Function candle draw candlestick chart. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. +

+

MGL code: +

new y 30 'sin(pi*x/2)^2'
+subplot 1 1 0 '':title 'Candle plot (default)'
+yrange 0 1:box
+candle y y/2 (y+1)/2
+
+

C++ code: +

void smgl_candle(mglGraph *gr)
+{
+	mglData y(30);	gr->Fill(y,"sin(pi*x/2)^2");
+	mglData y1(30);	gr->Fill(y1,"v/2",y);
+	mglData y2(30);	gr->Fill(y2,"(1+v)/2",y);
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Candle plot (default)");	}
+	gr->SetRange('y',0,1);	gr->Box();	gr->Candle(y,y1,y2);
+}
+
Sample candle +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.17 Sample ‘chart

+ + +

Function chart draw colored boxes with width proportional to data values. Use ‘ ’ for empty box. It produce well known pie chart if drawn in polar coordinates. +

+

MGL code: +

new ch 7 2 'rnd+0.1':light on
+subplot 2 2 0:title 'Chart plot (default)':rotate 50 60:box:chart ch
+subplot 2 2 1:title '"\#" style':rotate 50 60:box:chart ch '#'
+subplot 2 2 2:title 'Pie chart; " " color':rotate 50 60:
+axis '(y+1)/2*cos(pi*x)' '(y+1)/2*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+subplot 2 2 3:title 'Ring chart; " " color':rotate 50 60:
+axis '(y+2)/3*cos(pi*x)' '(y+2)/3*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+
+

C++ code: +

void smgl_chart(mglGraph *gr)
+{
+	mglData ch(7,2);	for(int i=0;i<7*2;i++)	ch.a[i]=mgl_rnd()+0.1;
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Chart plot (default)");	}
+	gr->Light(true);	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch,"#");
+	gr->SubPlot(2,2,2);	gr->Title("Pie chart; ' ' color");
+	gr->SetFunc("(y+1)/2*cos(pi*x)","(y+1)/2*sin(pi*x)","");
+	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch,"bgr cmy#");
+	gr->SubPlot(2,2,3);	gr->Title("Ring chart; ' ' color");
+	gr->SetFunc("(y+2)/3*cos(pi*x)","(y+2)/3*sin(pi*x)","");
+	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch,"bgr cmy#");
+}
+
Sample chart +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.18 Sample ‘cloud

+ + +

Function cloud draw cloud-like object which is less transparent for higher data values. Similar plot can be created using many (about 10...20 – surf3a a a;value 10) isosurfaces surf3a. +

+

MGL code: +

call 'prepare3d'
+subplot 2 2 0:title 'Cloud plot':rotate 50 60:alpha on:box:cloud c 'wyrRk'
+subplot 2 2 1:title '"i" style':rotate 50 60:box:cloud c 'iwyrRk'
+subplot 2 2 2:title '"." style':rotate 50 60:box:cloud c '.wyrRk'
+subplot 2 2 3:title 'meshnum 10':rotate 50 60:box:cloud c 'wyrRk'; meshnum 10
+
+

C++ code: +

void smgl_cloud(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Cloud plot");	}
+	gr->Rotate(50,60);	gr->Alpha(true);
+	gr->Box();	gr->Cloud(c,"wyrRk");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'i' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cloud(c,"iwyrRk");
+	gr->SubPlot(2,2,2);	gr->Title("'.' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cloud(c,".wyrRk");
+	gr->SubPlot(2,2,3);	gr->Title("meshnum 10");
+	gr->Rotate(50,60);	gr->Box();	gr->Cloud(c,"wyrRk","meshnum 10");
+}
+
Sample cloud +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.19 Sample ‘colorbar

+ + +

Example of colorbar position and styles. +

+

MGL code: +

call 'prepare2d'
+new v 9 'x'
+subplot 2 2 0:title 'Colorbar out of box':box
+colorbar '<':colorbar '>':colorbar '_':colorbar '^'
+subplot 2 2 1:title 'Colorbar near box':box
+colorbar '<I':colorbar '>I':colorbar '_I':colorbar '^I'
+subplot 2 2 2:title 'manual colors':box:contd v a
+colorbar v '<':colorbar v '>':colorbar v '_':colorbar v '^'
+subplot 2 2 3:title '':text -0.5 1.55 'Color positions' ':C' -2
+colorbar 'bwr>' 0.25 0:text -0.9 1.2 'Default'
+colorbar 'b{w,0.3}r>' 0.5 0:text -0.1 1.2 'Manual'
+crange 0.01 1e3
+colorbar '>' 0.75 0:text 0.65 1.2 'Normal scale':colorbar '>':text 1.35 1.2 'Log scale'
+
+

C++ code: +

void smgl_colorbar(mglGraph *gr)
+{
+	gr->SubPlot(2,2,0);	gr->Title("Colorbar out of box");	gr->Box();
+	gr->Colorbar("<");	gr->Colorbar(">");	gr->Colorbar("_");	gr->Colorbar("^");
+	gr->SubPlot(2,2,1);	gr->Title("Colorbar near box");		gr->Box();
+	gr->Colorbar("<I");	gr->Colorbar(">I");	gr->Colorbar("_I");	gr->Colorbar("^I");
+	gr->SubPlot(2,2,2);	gr->Title("manual colors");
+	mglData a,v;	mgls_prepare2d(&a,0,&v);
+	gr->Box();	gr->ContD(v,a);
+	gr->Colorbar(v,"<");	gr->Colorbar(v,">");	gr->Colorbar(v,"_");	gr->Colorbar(v,"^");
+
+	gr->SubPlot(2,2,3);	gr->Title(" ");
+	gr->Puts(mglPoint(-0.5,1.55),"Color positions",":C",-2);
+	gr->Colorbar("bwr>",0.25,0);	gr->Puts(mglPoint(-0.9,1.2),"Default");
+	gr->Colorbar("b{w,0.3}r>",0.5,0);	gr->Puts(mglPoint(-0.1,1.2),"Manual");
+
+	gr->Puts(mglPoint(1,1.55),"log-scale",":C",-2);
+	gr->SetRange('c',0.01,1e3);
+	gr->Colorbar(">",0.75,0);	gr->Puts(mglPoint(0.65,1.2),"Normal scale");
+	gr->SetFunc("","","","lg(c)");
+	gr->Colorbar(">");		gr->Puts(mglPoint(1.35,1.2),"Log scale");
+}
+
Sample colorbar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.20 Sample ‘combined

+ + +

Example of several plots in the same axis. +

+

MGL code: +

call 'prepare2v'
+call 'prepare3d'
+new v 10:fill v -0.5 1:copy d sqrt(a^2+b^2)
+subplot 2 2 0:title 'Surf + Cont':rotate 50 60:light on:box:surf a:cont a 'y'
+subplot 2 2 1 '':title 'Flow + Dens':light off:box:flow a b 'br':dens d
+subplot 2 2 2:title 'Mesh + Cont':rotate 50 60:box:mesh a:cont a '_'
+subplot 2 2 3:title 'Surf3 + ContF3':rotate 50 60:light on
+box:contf3 v c 'z' 0:contf3 v c 'x':contf3 v c
+cut 0 -1 -1 1 0 1.1
+contf3 v c 'z' c.nz-1:surf3 c -0.5
+
+

C++ code: +

void smgl_combined(mglGraph *gr)	// flow threads and density plot
+{
+	mglData a,b,d;	mgls_prepare2v(&a,&b);	d = a;
+	for(int i=0;i<a.nx*a.ny;i++)	d.a[i] = hypot(a.a[i],b.a[i]);
+	mglData c;	mgls_prepare3d(&c);
+	mglData v(10);	v.Fill(-0.5,1);
+	gr->SubPlot(2,2,1,"");	gr->Title("Flow + Dens");
+	gr->Flow(a,b,"br");	gr->Dens(d);	gr->Box();
+	gr->SubPlot(2,2,0);	gr->Title("Surf + Cont");	gr->Rotate(50,60);
+	gr->Light(true);	gr->Surf(a);	gr->Cont(a,"y");	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Title("Mesh + Cont");	gr->Rotate(50,60);
+	gr->Box();	gr->Mesh(a);	gr->Cont(a,"_");
+	gr->SubPlot(2,2,3);	gr->Title("Surf3 + ContF3");gr->Rotate(50,60);
+	gr->Box();	gr->ContF3(v,c,"z",0);	gr->ContF3(v,c,"x");	gr->ContF3(v,c);
+	gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+	gr->ContF3(v,c,"z",c.nz-1);	gr->Surf3(-0.5,c);
+}
+
Sample combined +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.21 Sample ‘cones

+ + +

Function cones is similar to bars but draw cones. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+light on:origin 0 0 0
+subplot 3 2 0:title 'Cones plot':rotate 50 60:box:cones ys
+subplot 3 2 1:title '2 colors':rotate 50 60:box:cones ys 'cbgGyr'
+subplot 3 2 2:title '"\#" style':rotate 50 60:box:cones ys '#'
+subplot 3 2 3:title '"a" style':rotate 50 60:zrange -2 2:box:cones ys 'a'
+subplot 3 2 4:title '"t" style':rotate 50 60:box:cones ys 't'
+subplot 3 2 5:title '"4" style':rotate 50 60:box:cones ys '4'
+
+

C++ code: +

void smgl_cones(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	gr->Light(true);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(3,2,0);	gr->Title("Cones plot");	}
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys);
+	if(big==3)	return;
+	gr->SubPlot(3,2,1);	gr->Title("2 colors");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"cbgGyr");
+	gr->SubPlot(3,2,2);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"#");
+	gr->SubPlot(3,2,3);	gr->Title("'a' style");
+	gr->SetRange('z',-2,2);	// increase range since summation can exceed [-1,1]
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"a");
+	gr->SubPlot(3,2,4);	gr->Title("'t' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"t");
+	gr->SubPlot(3,2,5);	gr->Title("'4' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"4");
+}
+
Sample cones +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.22 Sample ‘cont

+ + +

Function cont draw contour lines for surface. You can select automatic (default) or manual levels for contours, print contour labels, draw it on the surface (default) or at plane (as Dens). +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'Cont plot (default)':rotate 50 60:box:cont a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:cont v a
+subplot 2 2 2:title '"\_" and "." styles':rotate 50 60:box:cont a '_':cont a '_.2k'
+subplot 2 2 3 '':title '"t" style':box:cont a 't'
+
+

C++ code: +

void smgl_cont3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Cont3 sample");
+	gr->Rotate(50,60);	gr->Box();
+	gr->Cont3(c,"x");	gr->Cont3(c);	gr->Cont3(c,"z");
+}
+
Sample cont +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.23 Sample ‘cont3

+ + +

Function contf3 draw ordinary contour lines but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box
+cont3 c 'x':cont3 c:cont3 c 'z'
+
+

C++ code: +

void smgl_cont3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Cont3 sample");
+	gr->Rotate(50,60);	gr->Box();
+	gr->Cont3(c,"x");	gr->Cont3(c);	gr->Cont3(c,"z");
+}
+
Sample cont3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.24 Sample ‘cont_xyz

+ + +

Functions contz, conty, contx draw contour lines on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Cont[XYZ] sample':rotate 50 60:box
+contx {sum c 'x'} '' -1:conty {sum c 'y'} '' 1:contz {sum c 'z'} '' -1
+
+

C++ code: +

void smgl_cont_xyz(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Cont[XYZ] sample");
+	gr->Rotate(50,60);	gr->Box();	gr->ContX(c.Sum("x"),"",-1);
+	gr->ContY(c.Sum("y"),"",1);		gr->ContZ(c.Sum("z"),"",-1);
+}
+
Sample cont_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.25 Sample ‘contd

+ + +

Function contd is similar to contf but with manual contour colors. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContD plot (default)':rotate 50 60:box:contd a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contd v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contd a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contd a1
+
+

C++ code: +

void smgl_contd(mglGraph *gr)
+{
+	mglData a,v(5),a1(30,40,3);	mgls_prepare2d(&a);	v.a[0]=-0.5;
+	v.a[1]=-0.15;	v.a[2]=0;	v.a[3]=0.15;	v.a[4]=0.5;
+	gr->Fill(a1,"0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)");
+
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("ContD plot (default)");	}
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("manual levels");
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(v,a);
+	gr->SubPlot(2,2,2);	gr->Title("'\\_' style");
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(a,"_");
+	gr->SubPlot(2,2,3);	gr->Title("several slices");
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(a1);
+}
+
Sample contd +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.26 Sample ‘contf

+ + +

Function contf draw filled contours. You can select automatic (default) or manual levels for contours. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContF plot (default)':rotate 50 60:box:contf a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contf v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contf a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contf a1
+
+

C++ code: +

void smgl_contf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("ContF3 sample");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Box();
+	gr->ContF3(c,"x");	gr->ContF3(c);		gr->ContF3(c,"z");
+	gr->Cont3(c,"kx");	gr->Cont3(c,"k");	gr->Cont3(c,"kz");
+}
+
Sample contf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.27 Sample ‘contf3

+ + +

Function contf3 draw ordinary filled contours but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box:light on
+contf3 c 'x':contf3 c:contf3 c 'z'
+cont3 c 'xk':cont3 c 'k':cont3 c 'zk'
+
+

C++ code: +

void smgl_contf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("ContF3 sample");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Box();
+	gr->ContF3(c,"x");	gr->ContF3(c);		gr->ContF3(c,"z");
+	gr->Cont3(c,"kx");	gr->Cont3(c,"k");	gr->Cont3(c,"kz");
+}
+
Sample contf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.28 Sample ‘contf_xyz

+ + +

Functions contfz, contfy, contfx, draw filled contours on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'ContF[XYZ] sample':rotate 50 60:box
+contfx {sum c 'x'} '' -1:contfy {sum c 'y'} '' 1:contfz {sum c 'z'} '' -1
+
+

C++ code: +

void smgl_contf_xyz(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("ContF[XYZ] sample");
+	gr->Rotate(50,60);	gr->Box();	gr->ContFX(c.Sum("x"),"",-1);
+	gr->ContFY(c.Sum("y"),"",1);	gr->ContFZ(c.Sum("z"),"",-1);
+}
+
Sample contf_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.29 Sample ‘contv

+ + +

Function contv draw vertical cylinders (belts) at contour lines. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'ContV plot (default)':rotate 50 60:box:contv a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contv v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contv a '_'
+subplot 2 2 3:title 'ContV and ContF':rotate 50 60:light on:box
+contv a:contf a:cont a 'k'
+
+

C++ code: +

void smgl_contv(mglGraph *gr)
+{
+	mglData a,v(5);	mgls_prepare2d(&a);	v.a[0]=-0.5;
+	v.a[1]=-0.15;	v.a[2]=0;	v.a[3]=0.15;	v.a[4]=0.5;
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("ContV plot (default)");	}
+	gr->Rotate(50,60);	gr->Box();	gr->ContV(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("manual levels");
+	gr->Rotate(50,60);	gr->Box();	gr->ContV(v,a);
+	gr->SubPlot(2,2,2);	gr->Title("'\\_' style");
+	gr->Rotate(50,60);	gr->Box();	gr->ContV(a,"_");
+	gr->SubPlot(2,2,3);	gr->Title("ContV and ContF");
+	gr->Rotate(50,60);	gr->Box();	gr->Light(true);
+	gr->ContV(a);	gr->ContF(a);	gr->Cont(a,"k");
+}
+
Sample contv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.30 Sample ‘correl

+ + +

Test of correlation function (correl). +

+

MGL code: +

new a 100 'exp(-10*x^2)'
+new b 100 'exp(-10*(x+0.5)^2)'
+yrange 0 1
+subplot 1 2 0 '_':title 'Input fields'
+plot a:plot b:box:axis
+correl r a b 'x'
+norm r 0 1:swap r 'x' # make it human readable
+subplot 1 2 1 '_':title 'Correlation of a and b'
+plot r 'r':axis:box
+line 0.5 0 0.5 1 'B|'
+
+

C++ code: +

void smgl_correl(mglGraph *gr)
+{
+	mglData a(100),b(100);
+	gr->Fill(a,"exp(-10*x^2)");	gr->Fill(b,"exp(-10*(x+0.5)^2)");
+	gr->SetRange('y',0,1);
+	gr->SubPlot(1,2,0,"_");	gr->Title("Input fields");
+	gr->Plot(a);	gr->Plot(b);	gr->Axis();	gr->Box();
+	mglData r = a.Correl(b,"x");
+	r.Norm(0,1);	r.Swap("x");	// make it human readable
+	gr->SubPlot(1,2,1,"_");	gr->Title("Correlation of a and b");
+	gr->Plot(r,"r");	gr->Axis();	gr->Box();
+	gr->Line(mglPoint(0.5,0),mglPoint(0.5,1),"B|");
+}
+
Sample correl +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.31 Sample ‘curvcoor

+ + +

Some common curvilinear coordinates. +

+

MGL code: +

origin -1 1 -1
+subplot 2 2 0:title 'Cartesian':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' '':subplot 2 2 1:title 'Cylindrical':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis '2*y*x' 'y*y - x*x' '':subplot 2 2 2:title 'Parabolic':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' 'x+z':subplot 2 2 3:title 'Spiral':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+

C++ code: +

void smgl_curvcoor(mglGraph *gr)	// curvilinear coordinates
+{
+	gr->SetOrigin(-1,1,-1);
+
+	gr->SubPlot(2,2,0);	gr->Title("Cartesian");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+
+	gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)",0);
+	gr->SubPlot(2,2,1);	gr->Title("Cylindrical");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+
+	gr->SetFunc("2*y*x","y*y - x*x",0);
+	gr->SubPlot(2,2,2);	gr->Title("Parabolic");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+
+	gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)","x+z");
+	gr->SubPlot(2,2,3);	gr->Title("Spiral");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+	gr->SetFunc(0,0,0);	// set to default Cartesian
+}
+
Sample curvcoor +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.32 Sample ‘cut

+ + +

Example of point cutting (cut. +

+

MGL code: +

call 'prepare2d'
+call 'prepare3d'
+subplot 2 2 0:title 'Cut on (default)':rotate 50 60:light on:box:surf a; zrange -1 0.5
+subplot 2 2 1:title 'Cut off':rotate 50 60:box:surf a; zrange -1 0.5; cut off
+subplot 2 2 2:title 'Cut in box':rotate 50 60:box:alpha on
+cut 0 -1 -1 1 0 1.1:surf3 c
+cut 0 0 0 0 0 0	# restore back
+subplot 2 2 3:title 'Cut by formula':rotate 50 60:box
+cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)':surf3 c
+
+

C++ code: +

void smgl_cut(mglGraph *gr)	// cutting
+{
+	mglData a,c,v(1);	mgls_prepare2d(&a);	mgls_prepare3d(&c);	v.a[0]=0.5;
+	gr->SubPlot(2,2,0);	gr->Title("Cut on (default)");	gr->Rotate(50,60);	gr->Light(true);
+	gr->Box();	gr->Surf(a,"","zrange -1 0.5");
+	gr->SubPlot(2,2,1);	gr->Title("Cut off");		gr->Rotate(50,60);
+	gr->Box();	gr->Surf(a,"","zrange -1 0.5; cut off");
+	gr->SubPlot(2,2,2);	gr->Title("Cut in box");	gr->Rotate(50,60);
+	gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+	gr->Alpha(true);	gr->Box();	gr->Surf3(c);
+	gr->SetCutBox(mglPoint(0), mglPoint(0));	// switch it off
+	gr->SubPlot(2,2,3);	gr->Title("Cut by formula");	gr->Rotate(50,60);
+	gr->CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)");
+	gr->Box();	gr->Surf3(c);	gr->CutOff("");	// switch it off
+}
+
Sample cut +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.33 Sample ‘dat_diff

+ + +

Example of diff and integrate. +

+

MGL code: +

ranges 0 1 0 1 0 1:new a 30 40 'x*y'
+subplot 2 2 0:title 'a(x,y)':rotate 60 40:surf a:box
+subplot 2 2 1:title 'da/dx':rotate 60 40:diff a 'x':surf a:box
+subplot 2 2 2:title '\int da/dx dxdy':rotate 60 40:integrate a 'xy':surf a:box
+subplot 2 2 3:title '\int {d^2}a/dxdy dx':rotate 60 40:diff2 a 'y':surf a:box
+
+

C++ code: +

void smgl_dat_diff(mglGraph *gr)	// differentiate
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData a(30,40);	a.Modify("x*y");
+	gr->SubPlot(2,2,0);	gr->Title("a(x,y)");	gr->Rotate(60,40);
+	gr->Surf(a);		gr->Box();
+	gr->SubPlot(2,2,1);	gr->Title("da/dx");		gr->Rotate(60,40);
+	a.Diff("x");		gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Title("\\int da/dx dxdy");	gr->Rotate(60,40);
+	a.Integral("xy");	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Title("\\int {d^2}a/dxdy dx");	gr->Rotate(60,40);
+	a.Diff2("y");	gr->Surf(a);	gr->Box();
+}
+
Sample dat_diff +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.34 Sample ‘dat_extra

+ + +

Example of envelop, sew, smooth and resize. +

+

MGL code: +

subplot 2 2 0 '':title 'Envelop sample':new d1 1000 'exp(-8*x^2)*sin(10*pi*x)'
+axis:plot d1 'b':envelop d1 'x':plot d1 'r'
+subplot 2 2 1 '':title 'Smooth sample':ranges 0 1 0 1
+new y0 30 '0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd'
+copy y1 y0:smooth y1 'x3':plot y1 'r';legend '"3" style'
+copy y2 y0:smooth y2 'x5':plot y2 'g';legend '"5" style'
+copy y3 y0:smooth y3 'x':plot y3 'b';legend 'default'
+plot y0 '{m7}:s';legend 'none'
+legend:box
+subplot 2 2 2:title 'Sew sample':rotate 50 60:light on:alpha on
+new d2 100 100 'mod((y^2-(1-x)^2)/2,0.1)'
+box:surf d2 'b':sew d2 'xy' 0.1:surf d2 'r'
+subplot 2 2 3:title 'Resize sample (interpolation)'
+new x0 10 'rnd':new v0 10 'rnd'
+resize x1 x0 100:resize v1 v0 100
+plot x0 v0 'b+ ':plot x1 v1 'r-':label x0 v0 '%n'
+
+

C++ code: +

void smgl_dat_extra(mglGraph *gr)	// differentiate
+{
+	gr->SubPlot(2,2,0,"");	gr->Title("Envelop sample");
+	mglData d1(1000);	gr->Fill(d1,"exp(-8*x^2)*sin(10*pi*x)");
+	gr->Axis();			gr->Plot(d1, "b");
+	d1.Envelop('x');	gr->Plot(d1, "r");
+
+	gr->SubPlot(2,2,1,"");	gr->Title("Smooth sample");
+	mglData y0(30),y1,y2,y3;
+	gr->SetRanges(0,1,0,1);
+	gr->Fill(y0, "0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd");
+
+	y1=y0;	y1.Smooth("x3");
+	y2=y0;	y2.Smooth("x5");
+	y3=y0;	y3.Smooth("x");
+
+	gr->Plot(y0,"{m7}:s", "legend 'none'");	//gr->AddLegend("none","k");
+	gr->Plot(y1,"r", "legend ''3' style'");
+	gr->Plot(y2,"g", "legend ''5' style'");
+	gr->Plot(y3,"b", "legend 'default'");
+	gr->Legend();		gr->Box();
+
+	gr->SubPlot(2,2,2);		gr->Title("Sew sample");
+	mglData d2(100, 100);	gr->Fill(d2, "mod((y^2-(1-x)^2)/2,0.1)");
+	gr->Rotate(50, 60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();			gr->Surf(d2, "b");
+	d2.Sew("xy", 0.1);	gr->Surf(d2, "r");
+
+	gr->SubPlot(2,2,3);		gr->Title("Resize sample (interpolation)");
+	mglData x0(10), v0(10), x1, v1;
+	gr->Fill(x0,"rnd");		gr->Fill(v0,"rnd");
+	x1 = x0.Resize(100);	v1 = v0.Resize(100);
+	gr->Plot(x0,v0,"b+ ");	gr->Plot(x1,v1,"r-");
+	gr->Label(x0,v0,"%n");
+}
+
Sample dat_extra +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.35 Sample ‘data1

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:diff b 'x':subplot 5 3 0:call 'splot'
+copy b a:diff2 b 'x':subplot 5 3 1:call 'splot'
+copy b a:cumsum b 'x':subplot 5 3 2:call 'splot'
+copy b a:integrate b 'x':subplot 5 3 3:call 'splot'
+mirror b 'x':subplot 5 3 4:call 'splot'
+copy b a:diff b 'y':subplot 5 3 5:call 'splot'
+copy b a:diff2 b 'y':subplot 5 3 6:call 'splot'
+copy b a:cumsum b 'y':subplot 5 3 7:call 'splot'
+copy b a:integrate b 'y':subplot 5 3 8:call 'splot'
+mirror b 'y':subplot 5 3 9:call 'splot'
+copy b a:diff b 'z':subplot 5 3 10:call 'splot'
+copy b a:diff2 b 'z':subplot 5 3 11:call 'splot'
+copy b a:cumsum b 'z':subplot 5 3 12:call 'splot'
+copy b a:integrate b 'z':subplot 5 3 13:call 'splot'
+mirror b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box:surf3 b
+return
+
+

C++ code: +

void smgl_data1(mglGraph *gr)	// basic data operations
+{
+	mglData a(40,50,60),b;	gr->Fill(a,"exp(-x^2-4*y^2-16*z^2)");
+	gr->Light(true);		gr->Alpha(true);
+	b.Set(a);	b.Diff("x");	gr->SubPlot(5,3,0);	splot1(gr,b);
+	b.Set(a);	b.Diff2("x");	gr->SubPlot(5,3,1);	splot1(gr,b);
+	b.Set(a);	b.CumSum("x");	gr->SubPlot(5,3,2);	splot1(gr,b);
+	b.Set(a);	b.Integral("x");gr->SubPlot(5,3,3);	splot1(gr,b);
+	b.Mirror("x");	gr->SubPlot(5,3,4);	splot1(gr,b);
+	b.Set(a);	b.Diff("y");	gr->SubPlot(5,3,5);	splot1(gr,b);
+	b.Set(a);	b.Diff2("y");	gr->SubPlot(5,3,6);	splot1(gr,b);
+	b.Set(a);	b.CumSum("y");	gr->SubPlot(5,3,7);	splot1(gr,b);
+	b.Set(a);	b.Integral("y");gr->SubPlot(5,3,8);	splot1(gr,b);
+	b.Mirror("y");	gr->SubPlot(5,3,9);	splot1(gr,b);
+	b.Set(a);	b.Diff("z");	gr->SubPlot(5,3,10);splot1(gr,b);
+	b.Set(a);	b.Diff2("z");	gr->SubPlot(5,3,11);splot1(gr,b);
+	b.Set(a);	b.CumSum("z");	gr->SubPlot(5,3,12);splot1(gr,b);
+	b.Set(a);	b.Integral("z");gr->SubPlot(5,3,13);splot1(gr,b);
+	b.Mirror("z");	gr->SubPlot(5,3,14);splot1(gr,b);
+}
+
Sample data1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.36 Sample ‘data2

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:sinfft b 'x':subplot 5 3 0:call 'splot'
+copy b a:cosfft b 'x':subplot 5 3 1:call 'splot'
+copy b a:hankel b 'x':subplot 5 3 2:call 'splot'
+copy b a:swap b 'x':subplot 5 3 3:call 'splot'
+copy b a:smooth b 'x':subplot 5 3 4:call 'splot'
+copy b a:sinfft b 'y':subplot 5 3 5:call 'splot'
+copy b a:cosfft b 'y':subplot 5 3 6:call 'splot'
+copy b a:hankel b 'y':subplot 5 3 7:call 'splot'
+copy b a:swap b 'y':subplot 5 3 8:call 'splot'
+copy b a:smooth b 'y':subplot 5 3 9:call 'splot'
+copy b a:sinfft b 'z':subplot 5 3 10:call 'splot'
+copy b a:cosfft b 'z':subplot 5 3 11:call 'splot'
+copy b a:hankel b 'z':subplot 5 3 12:call 'splot'
+copy b a:swap b 'z':subplot 5 3 13:call 'splot'
+copy b a:smooth b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box
+surf3 b 0.5:surf3 b -0.5
+return
+
+

C++ code: +

void smgl_data2(mglGraph *gr)	// data transforms
+{
+	mglData a(40,50,60),b;	gr->Fill(a,"exp(-x^2-4*y^2-16*z^2)");
+	gr->Light(true);		gr->Alpha(true);
+	b.Set(a);	b.SinFFT("x");	gr->SubPlot(5,3,0);	splot2(gr,b);
+	b.Set(a);	b.CosFFT("x");	gr->SubPlot(5,3,1);	splot2(gr,b);
+	b.Set(a);	b.Hankel("x");	gr->SubPlot(5,3,2);	splot2(gr,b);
+	b.Set(a);	b.Swap("x");	gr->SubPlot(5,3,3);	splot2(gr,b);
+	b.Set(a);	b.Smooth("x");	gr->SubPlot(5,3,4);	splot2(gr,b);
+	b.Set(a);	b.SinFFT("y");	gr->SubPlot(5,3,5);	splot2(gr,b);
+	b.Set(a);	b.CosFFT("y");	gr->SubPlot(5,3,6);	splot2(gr,b);
+	b.Set(a);	b.Hankel("y");	gr->SubPlot(5,3,7);	splot2(gr,b);
+	b.Set(a);	b.Swap("y");	gr->SubPlot(5,3,8);	splot2(gr,b);
+	b.Set(a);	b.Smooth("y");	gr->SubPlot(5,3,9);	splot2(gr,b);
+	b.Set(a);	b.SinFFT("z");	gr->SubPlot(5,3,10);splot2(gr,b);
+	b.Set(a);	b.CosFFT("z");	gr->SubPlot(5,3,11);splot2(gr,b);
+	b.Set(a);	b.Hankel("z");	gr->SubPlot(5,3,12);splot2(gr,b);
+	b.Set(a);	b.Swap("z");	gr->SubPlot(5,3,13);splot2(gr,b);
+	b.Set(a);	b.Smooth("z");	gr->SubPlot(5,3,14);splot2(gr,b);
+}
+
Sample data2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.37 Sample ‘dens

+ + +

Function dens draw density plot (also known as color-map) for surface. +

+

MGL code: +

call 'prepare2d'
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0 '':title 'Dens plot (default)':box:dens a
+subplot 2 2 1:title '3d variant':rotate 50 60:box:dens a
+subplot 2 2 2 '':title '"\#" style; meshnum 10':box:dens a '#'; meshnum 10
+subplot 2 2 3:title 'several slices':rotate 50 60:box:dens a1
+
+

C++ code: +

void smgl_dens3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Dens3 sample");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->SetAlphaDef(0.7);
+	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Dens3(c,"x");	gr->Dens3(c);	gr->Dens3(c,"z");
+}
+
Sample dens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.38 Sample ‘dens3

+ + +

Function dens3 draw ordinary density plots but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Dens3 sample':rotate 50 60:alpha on:alphadef 0.7
+origin 0 0 0:box:axis '_xyz'
+dens3 c 'x':dens3 c ':y':dens3 c 'z'
+
+

C++ code: +

void smgl_dens3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Dens3 sample");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->SetAlphaDef(0.7);
+	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Dens3(c,"x");	gr->Dens3(c);	gr->Dens3(c,"z");
+}
+
Sample dens3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.39 Sample ‘dens_xyz

+ + +

Functions densz, densy, densx draw density plot on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Dens[XYZ] sample':rotate 50 60:box
+densx {sum c 'x'} '' -1:densy {sum c 'y'} '' 1:densz {sum c 'z'} '' -1
+
+

C++ code: +

void smgl_dens_xyz(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Dens[XYZ] sample");
+	gr->Rotate(50,60);	gr->Box();	gr->DensX(c.Sum("x"),0,-1);
+	gr->DensY(c.Sum("y"),0,1);		gr->DensZ(c.Sum("z"),0,-1);
+}
+
Sample dens_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.40 Sample ‘detect

+ + +

Example of curve detect. +

+

MGL code: +

subplot 1 1 0 '':title 'Detect sample'
+new a 200 100 'exp(-30*(y-0.5*sin(pi*x))^2-rnd/10)+exp(-30*(y+0.5*sin(pi*x))^2-rnd/10)+exp(-30*(x+y)^2-rnd/10)'
+ranges 0 a.nx 0 a.ny:box
+alpha on:crange a:dens a
+
+detect r a 0.1 5
+plot r(0) r(1) '.'
+
+

C++ code: +

void smgl_detect(mglGraph *gr)
+{
+	mglData a(200, 100);
+	gr->Fill(a,"exp(-30*(y-0.5*sin(pi*x))^2-rnd/10)+exp(-30*(y+0.5*sin(pi*x))^2-rnd/10)+exp(-30*(x+y)^2-rnd/10)");
+	gr->SubPlot(1,1,0,"");
+	if(big!=3)	gr->Title("Detect sample");
+	gr->SetRanges(0,a.nx,0,a.ny);	gr->SetRange('c',a);
+	gr->Alpha(true);	gr->Box();	gr->Dens(a);
+	mglData r(a.Detect(0.1,5));
+	gr->Plot(r.SubData(0), r.SubData(1), ".");
+}
+
Sample detect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.41 Sample ‘dew

+ + +

Function dew is similar to vect but use drops instead of arrows. +

+

MGL code: +

call 'prepare2v'
+subplot 1 1 0 '':title 'Dew plot':light on:box:dew a b
+
+

C++ code: +

void smgl_dew(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2v(&a,&b);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("Dew plot");}
+	gr->Box();	gr->Light(true);	gr->Dew(a,b);
+}
+
Sample dew +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.42 Sample ‘diffract

+ + + + +

MGL code: +

define n 32	#number of points
+define m 20 # number of iterations
+define dt 0.01 # time step
+new res n m+1
+ranges -1 1 0 m*dt 0 1
+
+#tridmat periodic variant
+new !a n 'i',dt*(n/2)^2/2
+copy !b !(1-2*a)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xdc'
+put res u all $i+1
+next
+subplot 2 2 0 '<_':title 'Tridmat, periodic b.c.'
+axis:box:dens res
+
+#fourier variant
+new k n:fillsample k 'xk'
+copy !e !exp(-i1*dt*k^2)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+fourier u 'x'
+multo u e
+fourier u 'ix'
+put res u all $i+1
+next
+subplot 2 2 1 '<_':title 'Fourier method'
+axis:box:dens res
+
+#tridmat zero variant
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xd'
+put res u all $i+1
+next
+subplot 2 2 2 '<_':title 'Tridmat, zero b.c.'
+axis:box:dens res
+
+#diffract exp variant
+new !u n 'exp(-6*x^2)'
+define q dt*(n/2)^2/8 # need q<0.4 !!!
+put res u all 0
+for $i 0 m
+for $j 1 8	# due to smaller dt
+diffract u 'xe' q
+next
+put res u all $i+1
+next
+subplot 2 2 3 '<_':title 'Diffract, exp b.c.'
+axis:box:dens res
+
+

C++ code: +

void smgl_diffract(mglGraph *gr)
+{
+	long n=32;	// number of points
+	long m=20;	// number of iterations
+	double dt=0.01;	// time step
+	mglData res(n,m+1);
+	gr->SetRanges(-1,1, 0,m*dt, 0,1);
+
+	// tridmat periodic variant
+	mglDataC a(n), b(n);	a = dual(0,dt*n*n/8);
+	for(long i=0;i<n;i++)	b.a[i] = mreal(1)-mreal(2)*a.a[i];
+	mglDataC u(n);	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	for(long i=0;i<m;i++)
+	{
+		u = mglTridMatC(a,b,a,u,"xdc");
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,0,"<_");	gr->Title("Tridmat, periodic b.c.");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+
+	// fourier variant
+	mglData k(n);	k.FillSample("xk");
+	mglDataC e(n);	for(long i=0;i<n;i++)	e.a[i] = exp(-dual(0,dt*k.a[i]*k.a[i]));
+	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	for(long i=0;i<m;i++)
+	{
+		u.FFT("x");	u *= e;	u.FFT("ix");
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Fourier method");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+
+	// tridmat zero variant
+	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	for(long i=0;i<m;i++)
+	{
+		u = mglTridMatC(a,b,a,u,"xd");
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,2,"<_");	gr->Title("Tridmat, zero b.c.");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+	
+	// diffract exp variant
+	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	double q=dt*n*n/4/8;	// NOTE: need q<0.4 !!!
+	for(long i=0;i<m;i++)
+	{
+		for(long j=0;j<8;j++)	// due to smaller dt
+			u.Diffraction("xe",q);
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,3,"<_");	gr->Title("Diffract, exp b.c.");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+}
+
Sample diffract +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.43 Sample ‘dilate

+ + +

Example of dilate and erode. +

+

MGL code: +

subplot 2 2 0:title 'Dilate&Erode 1D sample'
+new y 11:put y 1 5
+ranges 0 10 0 1:axis:box
+plot y 'b*'
+dilate y 0.5 2
+plot y 'rs'
+erode y 0.5 1
+plot y 'g#o'
+
+subplot 2 2 1:title 'Dilate&Erode 2D sample':rotate 40 60
+ranges 0 10 0 10 0 3
+axis:box
+new z 11 11:put z 3 5 5
+boxs z 'b':boxs z 'k#'
+dilate z 1 2
+boxs z 'r':boxs z 'k#'
+erode z 1 1
+boxs 2*z 'g':boxs 2*z 'k#'
+
+subplot 2 2 2
+text 0.5 0.7 'initial' 'ba';size -2
+text 0.5 0.5 'dilate=2' 'ra';size -2
+text 0.5 0.3 'erode=1' 'ga';size -2
+
+subplot 2 2 3:title 'Dilate&Erode 3D sample'
+rotate 60 50:light on:alpha on
+ranges 0 10 0 10 0 10:crange 0 3
+axis:box
+new a 11 11 11:put a 3 5 5 5
+surf3a a a 1.5 'b'
+dilate a 1 2
+surf3a a a 0.5 'r'
+erode a 1 1
+surf3a 2*a 2*a 1 'g'
+
+

C++ code: +

void smgl_dilate(mglGraph *gr)
+{
+	mglData y(11),	z(11,11), a(11,11,11);
+	y.a[5]=1;	z.a[5+11*5]=a.a[5+11*(5+11*5)] = 3;
+
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Dilate&Erode 1D sample");	}
+	else	gr->SubPlot(1,1,0,"");
+	gr->SetRanges(0,10,0,1);	gr->Axis();	gr->Box();	gr->Plot(y,"b*");
+	y.Dilate(1,2);	gr->Plot(y,"rs");
+	y.Erode(1,1);	gr->Plot(y,"g#o");
+	if(big==3)	return;
+	
+	gr->SubPlot(2,2,1);	gr->Title("Dilate&Erode 2D sample");
+	gr->Rotate(40,60);	gr->SetRanges(0,10,0,10,0,3);
+	gr->Axis();	gr->Box();	gr->Boxs(z,"b");	gr->Boxs(z,"k#");
+	z.Dilate(1,2);			gr->Boxs(z,"r");	gr->Boxs(z,"k#");
+	z.Erode(1,1);	z*=2;	gr->Boxs(z,"g");	gr->Boxs(z,"k#");
+	
+	gr->SubPlot(2,2,2);
+	gr->Puts(0.5,0.7,"initial","ba",-2);
+	gr->Puts(0.5,0.5,"dilate=2","ra",-2);
+	gr->Puts(0.5,0.3,"erode=1","ga",-2);
+	
+	gr->SubPlot(2,2,3);	gr->Title("Dilate&Erode 3D sample");
+	gr->Rotate(60,50);	gr->Alpha(true);	gr->Light(true);
+	gr->SetRanges(0,10,0,10,0,10);	gr->SetRange('c',0,3);
+	gr->Axis();	gr->Box();	gr->Surf3A(1.5,a,a,"b");
+	a.Dilate(1,2);			gr->Surf3A(0.5,a,a,"r");
+	a.Erode(1,1);	a*=2;	gr->Surf3A(1,a,a,"g");
+}
+
Sample dilate +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.44 Sample ‘dots

+ + +

Function dots is another way to draw irregular points. Dots use color scheme for coloring (see Color scheme). +

+

MGL code: +

new t 2000 'pi*(rnd-0.5)':new f 2000 '2*pi*rnd'
+copy x 0.9*cos(t)*cos(f):copy y 0.9*cos(t)*sin(f):copy z 0.6*sin(t):copy c cos(2*t)
+subplot 2 2 0:title 'Dots sample':rotate 50 60
+box:dots x y z
+alpha on
+subplot 2 2 1:title 'add transparency':rotate 50 60
+box:dots x y z c
+subplot 2 2 2:title 'add colorings':rotate 50 60
+box:dots x y z x c
+subplot 2 2 3:title 'Only coloring':rotate 50 60
+box:tens x y z x ' .'
+
+

C++ code: +

void smgl_dots(mglGraph *gr)
+{
+	int i, n=1000;
+	mglData x(n),y(n),z(n),c(n);
+	for(i=0;i<n;i++)
+	{
+		double t=M_PI*(mgl_rnd()-0.5), f=2*M_PI*mgl_rnd();
+		x.a[i] = 0.9*cos(t)*cos(f);
+		y.a[i] = 0.9*cos(t)*sin(f);
+		z.a[i] = 0.6*sin(t);
+		c.a[i] = cos(2*t);
+	}
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Dots sample");	}
+	gr->Rotate(50,60);	gr->Box();	gr->Dots(x,y,z);
+	if(big==3)	return;
+	gr->Alpha(true);
+	gr->SubPlot(2,2,1);	gr->Title("add transparency");		gr->Rotate(50,60);	gr->Box();	gr->Dots(x,y,z,c);
+	gr->SubPlot(2,2,2);	gr->Title("add coloring");	gr->Rotate(50,60);	gr->Box();	gr->Dots(x,y,z,x,c);
+	gr->SubPlot(2,2,3);	gr->Title("Only coloring");		gr->Rotate(50,60);	gr->Box();	gr->Tens(x,y,z,x," .");
+}
+
Sample dots +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.45 Sample ‘earth

+ + +

Example of Earth map by using import. +

+

MGL code: +

import dat 'Equirectangular-projection.jpg' 'BbGYw' -1 1
+subplot 1 1 0 '<>':title 'Earth in 3D':rotate 40 60
+copy phi dat 'pi*x':copy tet dat 'pi*y/2'
+copy x cos(tet)*cos(phi)
+copy y cos(tet)*sin(phi)
+copy z sin(tet)
+
+light on
+surfc x y z dat 'BbGYw'
+contp [-0.51,-0.51] x y z dat 'y'
+
+

C++ code: +

void smgl_earth(mglGraph *gr)
+{
+	mglData dat;	dat.Import("Equirectangular-projection.jpg","BbGYw",-1,1);
+	// Calc proper 3d coordinates from projection
+	mglData phi(dat.nx,dat.ny);	phi.Fill(-M_PI,M_PI);
+	mglData tet(dat.nx,dat.ny);	tet.Fill(-M_PI/2,M_PI/2,'y');
+	mglData x(dat.nx,dat.ny), y(dat.nx,dat.ny), z(dat.nx,dat.ny);
+#pragma omp parallel for
+	for(long i=0;i<dat.nx*dat.ny;i++)
+	{	x.a[i] = cos(tet.a[i])*cos(phi.a[i]);
+		y.a[i] = cos(tet.a[i])*sin(phi.a[i]);
+		z.a[i] = sin(tet.a[i]);	}
+
+	gr->SubPlot(1,1,0,"<>");
+	if(big!=3)	gr->Title("Earth in 3D");
+	gr->Rotate(40,60);	gr->Light(true);
+	gr->SurfC(x,y,z,dat,"BbGYw");
+	mglData vals(1);	vals.a[0]=-0.51;
+	gr->ContP(vals, x,y,z,dat,"y");
+}
+
Sample earth +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.46 Sample ‘error

+ + +

Function error draw error boxes around the points. You can draw default boxes or semi-transparent symbol (like marker, see Line styles). Also you can set individual color for each box. See also error2 sample. +

+

MGL code: +

call 'prepare1d'
+new y 50 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2)'
+new x0 10 'x + 0.1*rnd-0.05':new ex 10 '0.1':new ey 10 '0.2'
+new y0 10 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2) + 0.2*rnd-0.1'
+subplot 2 2 0 '':title 'Error plot (default)':box:plot y:error x0 y0 ex ey 'k'
+subplot 2 2 1 '':title '"!" style; no e_x':box:plot y:error x0 y0 ey 'o!rgb'
+subplot 2 2 2 '':title '"\@" style':alpha on:box:plot y:error x0 y0 ex ey '@'; alpha 0.5
+subplot 2 2 3:title '3d variant':rotate 50 60:axis
+for $1 0 9
+	errbox 2*rnd-1 2*rnd-1 2*rnd-1 0.2 0.2 0.2 'bo'
+next
+
+

C++ code: +

void smgl_error2(mglGraph *gr)
+{
+	mglData x0(10), y0(10), ex(10), ey(10);
+	for(int i=0;i<10;i++)
+	{	x0.a[i] = mgl_rnd();	y0.a[i] = mgl_rnd();	ey.a[i] = ex.a[i] = 0.1;	}
+	gr->SetRanges(0,1,0,1);	gr->Alpha(true);
+	gr->SubPlot(4,3,0,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#+@");
+	gr->SubPlot(4,3,1,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#x@");
+	gr->SubPlot(4,3,2,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#s@","alpha 0.5");
+	gr->SubPlot(4,3,3,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"s@");
+	gr->SubPlot(4,3,4,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"d@");
+	gr->SubPlot(4,3,5,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#d@","alpha 0.5");
+	gr->SubPlot(4,3,6,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"+@");
+	gr->SubPlot(4,3,7,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"x@");
+	gr->SubPlot(4,3,8,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"o@");
+	gr->SubPlot(4,3,9,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#o@","alpha 0.5");
+	gr->SubPlot(4,3,10,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#.@");
+	gr->SubPlot(4,3,11,"");	gr->Box();	gr->Error(x0,y0,ex,ey);
+}
+
Sample error +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.47 Sample ‘error2

+ + +

Example of error kinds. +

+

MGL code: +

new x0 10 'rnd':new ex 10 '0.1'
+new y0 10 'rnd':new ey 10 '0.1'
+ranges 0 1 0 1
+subplot 4 3 0 '':box:error x0 y0 ex ey '#+@'
+subplot 4 3 1 '':box:error x0 y0 ex ey '#x@'
+subplot 4 3 2 '':box:error x0 y0 ex ey '#s@'; alpha 0.5
+subplot 4 3 3 '':box:error x0 y0 ex ey 's@'
+subplot 4 3 4 '':box:error x0 y0 ex ey 'd@'
+subplot 4 3 5 '':box:error x0 y0 ex ey '#d@'; alpha 0.5
+subplot 4 3 6 '':box:error x0 y0 ex ey '+@'
+subplot 4 3 7 '':box:error x0 y0 ex ey 'x@'
+subplot 4 3 8 '':box:error x0 y0 ex ey 'o@'
+subplot 4 3 9 '':box:error x0 y0 ex ey '#o@'; alpha 0.5
+subplot 4 3 10 '':box:error x0 y0 ex ey '#.@'
+subplot 4 3 11 '':box:error x0 y0 ex ey; alpha 0.5
+
+

C++ code: +

void smgl_error2(mglGraph *gr)
+{
+	mglData x0(10), y0(10), ex(10), ey(10);
+	for(int i=0;i<10;i++)
+	{	x0.a[i] = mgl_rnd();	y0.a[i] = mgl_rnd();	ey.a[i] = ex.a[i] = 0.1;	}
+	gr->SetRanges(0,1,0,1);	gr->Alpha(true);
+	gr->SubPlot(4,3,0,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#+@");
+	gr->SubPlot(4,3,1,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#x@");
+	gr->SubPlot(4,3,2,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#s@","alpha 0.5");
+	gr->SubPlot(4,3,3,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"s@");
+	gr->SubPlot(4,3,4,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"d@");
+	gr->SubPlot(4,3,5,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#d@","alpha 0.5");
+	gr->SubPlot(4,3,6,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"+@");
+	gr->SubPlot(4,3,7,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"x@");
+	gr->SubPlot(4,3,8,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"o@");
+	gr->SubPlot(4,3,9,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#o@","alpha 0.5");
+	gr->SubPlot(4,3,10,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#.@");
+	gr->SubPlot(4,3,11,"");	gr->Box();	gr->Error(x0,y0,ex,ey);
+}
+
Sample error2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.48 Sample ‘export

+ + +

Example of data export and import. +

+

MGL code: +

new a 100 100 'x^2*y':new b 100 100
+export a 'test_data.png' 'BbcyrR' -1 1
+import b 'test_data.png' 'BbcyrR' -1 1
+subplot 2 1 0 '':title 'initial':box:dens a
+subplot 2 1 1 '':title 'imported':box:dens b
+
+

C++ code: +

void smgl_export(mglGraph *gr)	// basic data operations
+{
+	mglData a(100,100), b; gr->Fill(a,"x^2*y");
+	a.Export("test_data.png","BbcyrR");
+	b.Import("test_data.png","BbcyrR",-1,1);
+	gr->SubPlot(2,1,0,"");	gr->Title("initial");	gr->Box();	gr->Dens(a);
+	gr->SubPlot(2,1,1,"");	gr->Title("imported");	gr->Box();	gr->Dens(b);
+}
+
Sample export +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.49 Sample ‘fall

+ + +

Function fall draw waterfall surface. You can use meshnum for changing number of lines to be drawn. Also you can use ‘x’ style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Fall plot':rotate 50 60:box:fall a
+
+

C++ code: +

void smgl_fall(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Fall plot");
+	gr->Rotate(50,60);	gr->Box();	gr->Fall(a);
+}
+
Sample fall +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.50 Sample ‘fexport

+ + +

Example of write to different file formats. +

+

MGL code: +

subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+write 'fexport.jpg':#write 'fexport.png'
+write 'fexport.bmp':write 'fexport.tga'
+write 'fexport.eps':write 'fexport.svg'
+write 'fexport.gif':write 'fexport.xyz'
+write 'fexport.stl':write 'fexport.off'
+write 'fexport.tex':write 'fexport.obj'
+write 'fexport.prc':write 'fexport.json'
+write 'fexport.mgld'
+
+

C++ code: +

void smgl_fexport(mglGraph *gr)	// test file export
+{
+	all_prims(gr);
+	gr->WriteJPEG("fexport.jpg");
+//	gr->WritePNG("fexport.png");
+	gr->WriteBMP("fexport.bmp");
+	gr->WriteTGA("fexport.tga");
+	gr->WriteEPS("fexport.eps");
+	gr->WriteSVG("fexport.svg");
+	gr->WriteGIF("fexport.gif");
+
+	gr->WriteXYZ("fexport.xyz");
+	gr->WriteSTL("fexport.stl");
+	gr->WriteOFF("fexport.off");
+	gr->WriteTEX("fexport.tex");
+	gr->WriteOBJ("fexport.obj");
+	gr->WritePRC("fexport.prc");
+	gr->WriteJSON("fexport.json");
+
+	gr->ExportMGLD("fexport.mgld");
+	gr->Clf();
+	gr->ImportMGLD("fexport.mgld");
+}
+
Sample fexport +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.51 Sample ‘fit

+ + +

Example of nonlinear fit. +

+

MGL code: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r':text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+

C++ code: +

void smgl_fit(mglGraph *gr)	// nonlinear fitting
+{
+	mglData dat(100), in(100), res;
+	gr->Fill(dat,"0.4*rnd+0.1+sin(2*pi*x)");
+	gr->Fill(in,"0.3+sin(2*pi*x)");
+	double ini[3] = {1,1,3};
+	mglData Ini(3,ini);
+	res = gr->Fit(dat, "a+b*sin(c*x)", "abc", Ini);
+	if(big!=3)	gr->Title("Fitting sample");
+	gr->SetRange('y',-2,2);	gr->Box();	gr->Plot(dat, "k. ");
+	gr->Axis();		gr->Plot(res, "r");	gr->Plot(in, "b");
+	gr->Puts(mglPoint(-0.9, -1.3), "fitted:", "r:L");
+	gr->PutsFit(mglPoint(0, -1.8), "y = ", "r");
+	gr->Puts(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "b");
+//	gr->SetRanges(mglPoint(-1,-1,-1),mglPoint(1,1,1));	gr->SetOrigin(0,0,0);
+}
+
Sample fit +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.52 Sample ‘flame2d

+ + +

Function flame2d generate points for flame fractals in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+new B 2 3 A.ny '0.3'
+put B 3 0 0 -1
+put B 3 0 1 -1
+put B 3 0 2 -1
+flame2d fx fy A B 1000000
+subplot 1 1 0 '<_':title 'Flame2d sample'
+ranges fx fy:box:axis
+plot fx fy 'r#o ';size 0.05
+
+

C++ code: +

void smgl_flame2d(mglGraph *gr)
+{
+	mglData A, B(2,3,5);
+	A.SetList(35, 0.33,0.,0.,0.33,0.,0.,0.2, 0.33,0.,0.,0.33,0.67,0.,0.2, 0.33,0.,0.,0.33,0.33,0.33,0.2,
+			0.33,0.,0.,0.33,0.,0.67,0.2, 0.33,0.,0.,0.33,0.67,0.67,0.2);
+	A.Rearrange(7);
+	for(long i=0;i<2*3*5;i++)	B.a[i] = 0.3;
+	for(long i=0;i<5;i++)	B.a[2*3*i] = B.a[2*3*i+1*2] = B.a[2*3*i+2*2] = 3;
+	mglData f(mglFlame2d(A,B,1000000));
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Flame2d sample");
+	gr->SetRanges(f.SubData(0), f.SubData(1));
+	gr->Axis();	gr->Box();
+	gr->Plot(f.SubData(0), f.SubData(1),"r#o ","size 0.05");
+}
+
Sample flame2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.53 Sample ‘flow

+ + +

Function flow is another standard way to visualize vector fields – it draw lines (threads) which is tangent to local vector field direction. MathGL draw threads from edges of bounding box and from central slices. Sometimes it is not most appropriate variant – you may want to use flowp to specify manual position of threads. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Flow plot (default)':box:flow a b
+subplot 2 2 1 '':title '"v" style':box:flow a b 'v'
+subplot 2 2 2 '':title '"#" and "." styles':box:flow a b '#':flow a b '.2k'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:flow ex ey ez
+
+

C++ code: +

void smgl_flow(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2v(&a,&b);
+	if(big!=3)	{gr->SubPlot(2,2,0,"");	gr->Title("Flow plot (default)");}
+	gr->Box();	gr->Flow(a,b);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("'v' style");
+	gr->Box();	gr->Flow(a,b,"v");
+	gr->SubPlot(2,2,2,"");	gr->Title("'\\#' and '.' styles");
+	gr->Box();	gr->Flow(a,b,"#");	gr->Flow(a,b,".2k");
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Flow(ex,ey,ez);
+}
+
Sample flow +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.54 Sample ‘flow3

+ + +

Function flow3 draw flow threads, which start from given plane. +

+

MGL code: +

call 'prepare3v'
+subplot 2 2 0:title 'Flow3 plot (default)':rotate 50 60:box
+flow3 ex ey ez
+subplot 2 2 1:title '"v" style, from boundary':rotate 50 60:box
+flow3 ex ey ez 'v' 0
+subplot 2 2 2:title '"t" style':rotate 50 60:box
+flow3 ex ey ez 't' 0
+subplot 2 2 3:title 'from \i z planes':rotate 50 60:box
+flow3 ex ey ez 'z' 0
+flow3 ex ey ez 'z' 9
+
+

C++ code: +

void smgl_flow3(mglGraph *gr)
+{
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	if(big!=3)	{gr->SubPlot(2,2,0);	gr->Title("Flow3 plot (default)");}
+	gr->Rotate(50,60);	gr->Box();		gr->Flow3(ex,ey,ez);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'v' style, from boundary");
+	gr->Rotate(50,60);	gr->Box();	gr->Flow3(ex,ey,ez,"v",0);
+	gr->SubPlot(2,2,2);	gr->Title("'t' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Flow3(ex,ey,ez,"t",0);
+	gr->SubPlot(2,2,3);	gr->Title("from \\i z planes");
+	gr->Rotate(50,60);	gr->Box();	gr->Flow3(ex,ey,ez,"z",0);	gr->Flow3(ex,ey,ez,"z",9);
+}
+
Sample flow3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.55 Sample ‘fog

+ + +

Example of fog. +

+

MGL code: +

call 'prepare2d'
+title 'Fog sample':rotate 50 60:light on:fog 1
+box:surf a:cont a 'y'
+
+

C++ code: +

void smgl_fog(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Fog sample");
+	gr->Light(true);	gr->Rotate(50,60);	gr->Fog(1);	gr->Box();
+	gr->Surf(a);	gr->Cont(a,"y");
+}
+
Sample fog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.56 Sample ‘fonts

+ + +

Example of font typefaces. +

+

MGL code: +

define d 0.25
+loadfont 'STIX':text 0 1.1 'default font (STIX)'
+loadfont 'adventor':text 0 1.1-d 'adventor font'
+loadfont 'bonum':text 0 1.1-2*d 'bonum font'
+loadfont 'chorus':text 0 1.1-3*d 'chorus font'
+loadfont 'cursor':text 0 1.1-4*d 'cursor font'
+loadfont 'heros':text 0 1.1-5*d 'heros font'
+loadfont 'heroscn':text 0 1.1-6*d 'heroscn font'
+loadfont 'pagella':text 0 1.1-7*d 'pagella font'
+loadfont 'schola':text 0 1.1-8*d 'schola font'
+loadfont 'termes':text 0 1.1-9*d 'termes font'
+loadfont ''
+
+

C++ code: +

void smgl_fonts(mglGraph *gr)	// font typefaces
+{
+	double h=1.1, d=0.25;
+	gr->LoadFont("STIX");		gr->Puts(mglPoint(0,h), "default font (STIX)");
+	gr->LoadFont("adventor");	gr->Puts(mglPoint(0,h-d), "adventor font");
+	gr->LoadFont("bonum");		gr->Puts(mglPoint(0,h-2*d), "bonum font");
+	gr->LoadFont("chorus");		gr->Puts(mglPoint(0,h-3*d), "chorus font");
+	gr->LoadFont("cursor");		gr->Puts(mglPoint(0,h-4*d), "cursor font");
+	gr->LoadFont("heros");		gr->Puts(mglPoint(0,h-5*d), "heros font");
+	gr->LoadFont("heroscn");	gr->Puts(mglPoint(0,h-6*d), "heroscn font");
+	gr->LoadFont("pagella");	gr->Puts(mglPoint(0,h-7*d), "pagella font");
+	gr->LoadFont("schola");		gr->Puts(mglPoint(0,h-8*d), "schola font");
+	gr->LoadFont("termes");		gr->Puts(mglPoint(0,h-9*d), "termes font");
+	gr->LoadFont("");
+}
+
Sample fonts +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.57 Sample ‘grad

+ + +

Function grad draw gradient lines for matrix. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Grad plot':box:grad a:dens a '{u8}w{q8}'
+
+

C++ code: +

void smgl_grad(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("Grad plot");}
+	gr->Box();	gr->Grad(a);	gr->Dens(a,"{u8}w{q8}");
+}
+
Sample grad +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.58 Sample ‘hist

+ + +

Example of hist (histogram). +

+

MGL code: +

new x 10000 '2*rnd-1':new y 10000 '2*rnd-1':copy z exp(-6*(x^2+y^2))
+hist xx x z:norm xx 0 1:hist yy y z:norm yy 0 1
+multiplot 3 3 3 2 2 '':ranges -1 1 -1 1 0 1:box:dots x y z 'wyrRk'
+multiplot 3 3 0 2 1 '':ranges -1 1 0 1:box:bars xx
+multiplot 3 3 5 1 2 '':ranges 0 1 -1 1:box:barh yy
+subplot 3 3 2:text 0.5 0.5 'Hist and\n{}MultiPlot\n{}sample' 'a' -3
+
+

C++ code: +

void smgl_hist(mglGraph *gr)
+{
+	mglData x(10000), y(10000), z(10000);	gr->Fill(x,"2*rnd-1");	gr->Fill(y,"2*rnd-1");	gr->Fill(z,"exp(-6*(v^2+w^2))",x,y);
+	mglData xx=gr->Hist(x,z), yy=gr->Hist(y,z);	xx.Norm(0,1);	yy.Norm(0,1);
+	gr->MultiPlot(3,3,3,2,2,"");	gr->SetRanges(-1,1,-1,1,0,1);	gr->Box();	gr->Dots(x,y,z,"wyrRk");
+	gr->MultiPlot(3,3,0,2,1,"");	gr->SetRanges(-1,1,0,1);	gr->Box();	gr->Bars(xx);
+	gr->MultiPlot(3,3,5,1,2,"");	gr->SetRanges(0,1,-1,1);	gr->Box();	gr->Barh(yy);
+	gr->SubPlot(3,3,2);		gr->Puts(mglPoint(0.5,0.5),"Hist and\nMultiPlot\nsample","a",-3);
+}
+
Sample hist +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.59 Sample ‘ifs2d

+ + +

Function ifs2d generate points for fractals using iterated function system in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+ifs2d fx fy A 100000
+subplot 1 1 0 '<_':title 'IFS 2d sample'
+ranges fx fy:axis
+plot fx fy 'r#o ';size 0.05
+
+

C++ code: +

void smgl_ifs2d(mglGraph *gr)
+{
+	mglData A;
+	A.SetList(35, 0.33,0.,0.,0.33,0.,0.,0.2, 0.33,0.,0.,0.33,0.67,0.,0.2, 0.33,0.,0.,0.33,0.33,0.33,0.2, 0.33,0.,0.,0.33,0.,0.67,0.2, 0.33,0.,0.,0.33,0.67,0.67,0.2);
+	A.Rearrange(7);
+	mglData f(mglIFS2d(A,100000));
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("IFS 2d sample");
+	gr->SetRanges(f.SubData(0), f.SubData(1));
+	gr->Axis();	gr->Plot(f.SubData(0), f.SubData(1),"r#o ","size 0.05");
+}
+
Sample ifs2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.60 Sample ‘ifs3d

+ + +

Function ifs3d generate points for fractals using iterated function system in 3d case. +

+

MGL code: +

list A [0,0,0,0,.18,0,0,0,0,0,0,0,.01] [.85,0,0,0,.85,.1,0,-0.1,0.85,0,1.6,0,.85]\
+	[.2,-.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07] [-.2,.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07]
+ifs3d f A 100000
+title 'IFS 3d sample':rotate 50 60
+ranges f(0) f(1) f(2):axis:box
+dots f(0) f(1) f(2) 'G#o';size 0.05
+
+

C++ code: +

void smgl_ifs3d(mglGraph *gr)
+{
+	mglData A;
+	A.SetList(52, 0.,0.,0.,0.,.18,0.,0.,0.,0.,0.,0.,0.,.01, .85,0.,0.,0.,.85,.1,0.,-0.1,0.85,0.,1.6,0.,.85,
+			.2,-.2,0.,.2,.2,0.,0.,0.,0.3,0.,0.8,0.,.07, -.2,.2,0.,.2,.2,0.,0.,0.,0.3,0.,0.8,0.,.07);
+	A.Rearrange(13);
+	mglData f(mglIFS3d(A,100000));
+	if(big!=3)	gr->Title("IFS 3d sample");
+	gr->SetRanges(f.SubData(0), f.SubData(1), f.SubData(2));
+	gr->Rotate(50,60);	gr->Axis();	gr->Box();
+	gr->Dots(f.SubData(0), f.SubData(1), f.SubData(2),"G#o","size 0.05");
+}
+
Sample ifs3d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.61 Sample ‘indirect

+ + +

Comparison of subdata vs evaluate/ +

+

MGL code: +

subplot 1 1 0 '':title 'SubData vs Evaluate'
+new in 9 'x^3/1.1':plot in 'ko ':box
+new arg 99 '4*x+4'
+evaluate e in arg off:plot e 'b.'; legend 'Evaluate'
+subdata s in arg:plot s 'r.';legend 'SubData'
+legend 2
+
+

C++ code: +

void smgl_indirect(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"");	gr->Title("SubData vs Evaluate");
+	mglData in(9), arg(99), e, s;
+	gr->Fill(in,"x^3/1.1");	gr->Fill(arg,"4*x+4");
+	gr->Plot(in,"ko ");		gr->Box();
+	e = in.Evaluate(arg,false);	gr->Plot(e,"b.","legend 'Evaluate'");
+	s = in.SubData(arg);	gr->Plot(s,"r.","legend 'SubData'");
+	gr->Legend(2);
+}
+
Sample indirect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.62 Sample ‘inplot

+ + +

Example of inplot, multiplot, columnplot, gridplot, shearplot, stickplot. +

+

MGL code: +

subplot 3 2 0:title 'StickPlot'
+stickplot 3 0 20 30:box 'r':text 0 0 0 '0' 'r'
+stickplot 3 1 20 30:box 'g':text 0 0 0 '1' 'g'
+stickplot 3 2 20 30:box 'b':text 0 9 0 '2' 'b'
+subplot 3 2 3 '':title 'ColumnPlot'
+columnplot 3 0:box 'r':text 0 0 '0' 'r'
+columnplot 3 1:box 'g':text 0 0 '1' 'g'
+columnplot 3 2:box 'b':text 0 0 '2' 'b'
+subplot 3 2 4 '':title 'GridPlot'
+gridplot 2 2 0:box 'r':text 0 0 '0' 'r'
+gridplot 2 2 1:box 'g':text 0 0 '1' 'g'
+gridplot 2 2 2:box 'b':text 0 0 '2' 'b'
+gridplot 2 2 3:box 'm':text 0 0 '3' 'm'
+subplot 3 2 5 '':title 'InPlot':box
+inplot 0.4 1 0.6 1 on:box 'r'
+multiplot 3 2 1 2 1 '':title 'MultiPlot and ShearPlot':box
+shearplot 3 0 0.2 0.1:box 'r':text 0 0 '0' 'r'
+shearplot 3 1 0.2 0.1:box 'g':text 0 0 '1' 'g'
+shearplot 3 2 0.2 0.1:box 'b':text 0 0 '2' 'b'
+
+

C++ code: +

void smgl_inplot(mglGraph *gr)
+{
+	gr->SubPlot(3,2,0);	gr->Title("StickPlot");
+	gr->StickPlot(3, 0, 20, 30);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->StickPlot(3, 1, 20, 30);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->StickPlot(3, 2, 20, 30);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+	gr->SubPlot(3,2,3,"");	gr->Title("ColumnPlot");
+	gr->ColumnPlot(3, 0);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->ColumnPlot(3, 1);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->ColumnPlot(3, 2);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+	gr->SubPlot(3,2,4,"");	gr->Title("GridPlot");
+	gr->GridPlot(2, 2, 0);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->GridPlot(2, 2, 1);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->GridPlot(2, 2, 2);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+	gr->GridPlot(2, 2, 3);	gr->Box("m");	gr->Puts(mglPoint(0),"3","m");
+	gr->SubPlot(3,2,5,"");	gr->Title("InPlot");	gr->Box();
+	gr->InPlot(0.4, 1, 0.6, 1, true);	gr->Box("r");
+	gr->MultiPlot(3,2,1, 2, 1,"");	gr->Title("MultiPlot and ShearPlot");	gr->Box();
+	gr->ShearPlot(3, 0, 0.2, 0.1);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->ShearPlot(3, 1, 0.2, 0.1);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->ShearPlot(3, 2, 0.2, 0.1);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+}
+
Sample inplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.63 Sample ‘iris

+ + +

Function iris draw Iris plot for columns of data array. +

+

MGL code: +

read a 'iris.dat'
+crop a 0 4 'x':rearrange a a.nx 50
+subplot 1 1 0 '':title 'Iris plot'
+iris a 'sepal\n length;sepal\n width;petal\n length;petal\n width' '. ';value -1.5;size -2
+
+

C++ code: +

void smgl_iris(mglGraph *gr)
+{
+	mglData a("iris.dat");	a.Crop(0,4,'x');	a.Rearrange(4,50);
+	gr->SubPlot(1,1,0,"");
+	if(big!=3)	gr->Title("Iris sample");
+	gr->Iris(a, "sepal\nlength;sepal\nwidth;petal\nlength;petal\nwidth", ". ", "value -1.5;size -2");
+}
+
Sample iris +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.64 Sample ‘label

+ + +

Function label print text at data points. The string may contain ‘%x’, ‘%y’, ‘%z’ for x-, y-, z-coordinates of points, ‘%n’ for point index. +

+

MGL code: +

new ys 10 '0.2*rnd-0.8*sin(pi*x)'
+subplot 1 1 0 '':title 'Label plot':box:plot ys ' *':label ys 'y=%y'
+
+

C++ code: +

void smgl_label(mglGraph *gr)
+{
+	mglData ys(10);	ys.Modify("0.8*sin(pi*2*x)+0.2*rnd");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Label plot");	}
+	gr->Box();	gr->Plot(ys," *");	gr->Label(ys,"y=%y");
+}
+
Sample label +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.65 Sample ‘lamerey

+ + +

Function lamerey draw Lamerey diagram. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Lamerey sample'
+axis:xlabel '\i x':ylabel '\bar{\i x} = 2 \i{x}'
+fplot 'x' 'k='
+fplot '2*x' 'b'
+lamerey 0.00097 '2*x' 'rv~';size 2
+lamerey -0.00097 '2*x' 'rv~';size 2
+
+

C++ code: +

void smgl_lamerey(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Lamerey sample");
+	gr->Axis();	gr->Label('x',"\\i x");	gr->Label('y',"\\bar{\\i x} = 2 \\i{x}");
+	gr->FPlot("x","k=");	gr->FPlot("2*x","b");
+	gr->Lamerey( 0.00097,"2*x","rv~");
+	gr->Lamerey(-0.00097,"2*x","rv~");
+}
+
Sample lamerey +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.66 Sample ‘legend

+ + +

Example of legend styles. +

+

MGL code: +

addlegend 'sin(\pi {x^2})' 'b':addlegend 'sin(\pi x)' 'g*'
+addlegend 'sin(\pi \sqrt{x})' 'rd':addlegend 'jsut text' ' ':addlegend 'no indent for this' ''
+subplot 2 2 0 '':title 'Legend (default)':box:legend
+legend 1 0.5 '^':text 0.49 0.88 'Style "\^"' 'A:L'
+legend 3 'A#':text 0.75 0.65 'Absolute position' 'A'
+subplot 2 2 2 '':title 'coloring':box:legend 0 'r#':legend 1 'Wb#':legend 2 'ygr#'
+subplot 2 2 3 '':title 'manual position':box
+legend 0.5 1:text 0.5 0.5 'at x=0.5, y=1' 'a'
+legend 1 '#-':text 0.75 0.25 'Horizontal legend' 'a'
+
+

C++ code: +

void smgl_legend(mglGraph *gr)
+{
+	gr->AddLegend("sin(\\pi {x^2})","b");
+	gr->AddLegend("sin(\\pi x)","g*");
+	gr->AddLegend("sin(\\pi \\sqrt{x})","rd");
+	gr->AddLegend("just text"," ");
+	gr->AddLegend("no indent for this","");
+	if(big!=3)	{gr->SubPlot(2,2,0,"");	gr->Title("Legend (default)");}
+	gr->Box();	gr->Legend();
+	if(big==3)	return;
+	gr->Legend(1,0.5,"^");	gr->Puts(0.49, 0.88, "Style '\\^'","A:L");
+	gr->Legend(3,"A#");
+	gr->Puts(mglPoint(0.75,0.65),"Absolute position","A");
+	gr->SubPlot(2,2,2,"");	gr->Title("coloring");	gr->Box();
+	gr->Legend(0,"r#");	gr->Legend(1,"Wb#");	gr->Legend(2,"ygr#");
+	gr->SubPlot(2,2,3,"");	gr->Title("manual position");	gr->Box();
+	gr->Legend(0.5,1);
+	gr->Puts(mglPoint(0.5,0.5),"at x=0.5, y=1","a");
+	gr->Legend(1,"#-");
+	gr->Puts(mglPoint(0.75,0.25),"Horizontal legend","a");
+}
+
Sample legend +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.67 Sample ‘light

+ + +

Example of light with different types. +

+

MGL code: +

light on:attachlight on
+call 'prepare2d'
+subplot 2 2 0:title 'Default':rotate 50 60:box:surf a
+line -1 -0.7 1.7 -1 -0.7 0.7 'BA'
+
+subplot 2 2 1:title 'Local':rotate 50 60
+light 0 1 0 1 -2 -1 -1
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 2:title 'no diffuse':rotate 50 60
+diffuse 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 3:title 'diffusive only':rotate 50 60
+diffuse 0.5:light 0 1 0 1 -2 -1 -1 'w' 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+

C++ code: +

void smgl_light(mglGraph *gr)	// local light sources
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->Light(true);	gr->AttachLight(true);
+	if(big==3)
+	{	gr->Rotate(50,60);	gr->Box();	gr->Surf(a);	return;	}
+	gr->SubPlot(2,2,0);	gr->Title("Default");	gr->Rotate(50,60);
+	gr->Line(mglPoint(-1,-0.7,1.7),mglPoint(-1,-0.7,0.7),"BA");	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,1);	gr->Title("Local");	gr->Rotate(50,60);
+	gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1));
+	gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,2);	gr->Title("no diffuse");	gr->Rotate(50,60);
+	gr->SetDiffuse(0);
+	gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,3);	gr->Title("diffusive only");	gr->Rotate(50,60);
+	gr->SetDiffuse(0.5);
+	gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1),'w',0);
+	gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");	gr->Box();	gr->Surf(a);
+}
+
Sample light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.68 Sample ‘loglog

+ + +

Example of log- and log-log- axis labels. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Semi-log axis':ranges 0.01 100 -1 1:axis 'lg(x)' '' ''
+axis:grid 'xy' 'g':fplot 'sin(1/x)':xlabel 'x' 0:ylabel 'y = sin 1/x' 0
+subplot 2 2 1 '<_':title 'Log-log axis':ranges 0.01 100 0.1 100:axis 'lg(x)' 'lg(y)' ''
+axis:grid '!' 'h=':grid:fplot 'sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = \sqrt{1+x^2}' 0
+subplot 2 2 2 '<_':title 'Minus-log axis':ranges -100 -0.01 -100 -0.1:axis '-lg(-x)' '-lg(-y)' ''
+axis:fplot '-sqrt(1+x^2)':xlabel 'x' 0:ylabel 'y = -\sqrt{1+x^2}' 0
+subplot 2 2 3 '<_':title 'Log-ticks':ranges 0.01 100 0 100:axis 'sqrt(x)' '' ''
+axis:fplot 'x':xlabel 'x' 1:ylabel 'y = x' 0
+
+

C++ code: +

void smgl_loglog(mglGraph *gr)	// log-log axis
+{
+	gr->SubPlot(2,2,0,"<_");	gr->Title("Semi-log axis");	gr->SetRanges(0.01,100,-1,1);	gr->SetFunc("lg(x)","");
+	gr->Axis();	gr->Grid("xy","g");	gr->FPlot("sin(1/x)");	gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0);
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Log-log axis");	gr->SetRanges(0.01,100,0.1,100);	gr->SetFunc("lg(x)","lg(y)");
+	gr->Axis();	gr->Grid("!","h=");	gr->Grid();	gr->FPlot("sqrt(1+x^2)");	gr->Label('x',"x",0); gr->Label('y', "y = \\sqrt{1+x^2}",0);
+	gr->SubPlot(2,2,2,"<_");	gr->Title("Minus-log axis");	gr->SetRanges(-100,-0.01,-100,-0.1);	gr->SetFunc("-lg(-x)","-lg(-y)");
+	gr->Axis();	gr->FPlot("-sqrt(1+x^2)");	gr->Label('x',"x",0); gr->Label('y', "y = -\\sqrt{1+x^2}",0);
+	gr->SubPlot(2,2,3,"<_");	gr->Title("Log-ticks");	gr->SetRanges(0.1,100,0,100);	gr->SetFunc("sqrt(x)","");
+	gr->Axis();	gr->FPlot("x");	gr->Label('x',"x",1); gr->Label('y', "y = x",0);
+}
+
Sample loglog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.69 Sample ‘map

+ + +

Example of map. +

+

MGL code: +

new a 50 40 'x':new b 50 40 'y':zrange -2 2:text 0 0 '\to'
+subplot 2 1 0:text 0 1.1 '\{x, y\}' '' -2:box:map a b 'brgk'
+subplot 2 1 1:text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2
+box:fill a '(x^3+y^3)/2':fill b '(x-y)/2':map a b 'brgk'
+
+

C++ code: +

void smgl_map(mglGraph *gr)	// example of mapping
+{
+	mglData a(50, 40), b(50, 40);
+	gr->Puts(mglPoint(0, 0), "\\to", ":C", -1.4);
+	gr->SetRanges(-1,1,-1,1,-2,2);
+
+	gr->SubPlot(2, 1, 0);
+	gr->Fill(a,"x");	gr->Fill(b,"y");
+	gr->Puts(mglPoint(0, 1.1), "\\{x, y\\}", ":C", -2);		gr->Box();
+	gr->Map(a, b, "brgk");
+
+	gr->SubPlot(2, 1, 1);
+	gr->Fill(a,"(x^3+y^3)/2");	gr->Fill(b,"(x-y)/2");
+	gr->Puts(mglPoint(0, 1.1), "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", ":C", -2);
+	gr->Box();
+	gr->Map(a, b, "brgk");
+}
+
Sample map +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.70 Sample ‘mark

+ + +

Example of mark. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Mark plot (default)':box:mark y y1 's'
+
+

C++ code: +

void smgl_mark(mglGraph *gr)
+{
+	mglData y,y1;	mgls_prepare1d(&y,&y1);
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Mark plot (default)");	}
+	gr->Box();	gr->Mark(y,y1,"s");
+}
+
Sample mark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.71 Sample ‘mask

+ + +

Example of mask kinds. +

+

MGL code: +

new a 10 10 'x'
+subplot 5 4 0 '':title '"-" mask':dens a '3-'
+subplot 5 4 1 '':title '"+" mask':dens a '3+'
+subplot 5 4 2 '':title '"=" mask':dens a '3='
+subplot 5 4 3 '':title '";" mask':dens a '3;'
+subplot 5 4 4 '':title '";I" mask':dens a '3;I'
+subplot 5 4 5 '':title '"o" mask':dens a '3o'
+subplot 5 4 6 '':title '"O" mask':dens a '3O'
+subplot 5 4 7 '':title '"s" mask':dens a '3s'
+subplot 5 4 8 '':title '"S" mask':dens a '3S'
+subplot 5 4 9 '':title '";/" mask':dens a '3;/'
+subplot 5 4 10 '':title '"~" mask':dens a '3~'
+subplot 5 4 11 '':title '"<" mask':dens a '3<'
+subplot 5 4 12 '':title '">" mask':dens a '3>'
+subplot 5 4 13 '':title '"j" mask':dens a '3j'
+subplot 5 4 14 '':title '"-;\" mask':dens a '3\;'
+subplot 5 4 15 '':title '"d" mask':dens a '3d'
+subplot 5 4 16 '':title '"D" mask':dens a '3D'
+subplot 5 4 17 '':title '"*" mask':dens a '3*'
+subplot 5 4 18 '':title '"\^" mask':dens a '3^'
+subplot 5 4 19 '':title 'manual mask'
+mask '+' '24242424FF0101FF':dens a '3+'
+
+

C++ code: +

void smgl_mask(mglGraph *gr)
+{
+	mglData a(10,10);	a.Fill(-1,1);
+	gr->SubPlot(5,4,0,"");	gr->Title("'-' mask");	gr->Dens(a,"3-");
+	gr->SubPlot(5,4,1,"");	gr->Title("'+' mask");	gr->Dens(a,"3+");
+	gr->SubPlot(5,4,2,"");	gr->Title("'=' mask");	gr->Dens(a,"3=");
+	gr->SubPlot(5,4,3,"");	gr->Title("';' mask");	gr->Dens(a,"3;");
+	gr->SubPlot(5,4,4,"");	gr->Title("';I' mask");	gr->Dens(a,"3;I");
+	gr->SubPlot(5,4,5,"");	gr->Title("'o' mask");	gr->Dens(a,"3o");
+	gr->SubPlot(5,4,6,"");	gr->Title("'O' mask");	gr->Dens(a,"3O");
+	gr->SubPlot(5,4,7,"");	gr->Title("'s' mask");	gr->Dens(a,"3s");
+	gr->SubPlot(5,4,8,"");	gr->Title("'S' mask");	gr->Dens(a,"3S");
+	gr->SubPlot(5,4,9,"");	gr->Title("';/' mask");	gr->Dens(a,"3;/");
+	gr->SubPlot(5,4,10,"");	gr->Title("'~' mask");	gr->Dens(a,"3~");
+	gr->SubPlot(5,4,11,"");	gr->Title("'<' mask");	gr->Dens(a,"3<");
+	gr->SubPlot(5,4,12,"");	gr->Title("'>' mask");	gr->Dens(a,"3>");
+	gr->SubPlot(5,4,13,"");	gr->Title("'j' mask");	gr->Dens(a,"3j");
+	gr->SubPlot(5,4,14,"");	gr->Title("';\\\\' mask");	gr->Dens(a,"3;\\");
+	gr->SubPlot(5,4,15,"");	gr->Title("'d' mask");	gr->Dens(a,"3d");
+	gr->SubPlot(5,4,16,"");	gr->Title("'D' mask");	gr->Dens(a,"3D");
+	gr->SubPlot(5,4,17,"");	gr->Title("'*' mask");	gr->Dens(a,"3*");
+	gr->SubPlot(5,4,18,"");	gr->Title("'\\^' mask");	gr->Dens(a,"3^");
+	gr->SubPlot(5,4,19,"");	gr->Title("manual mask");
+	gr->SetMask('+', "24242424FF0101FF");	gr->Dens(a,"3+");
+}
+
Sample mask +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.72 Sample ‘mesh

+ + +

Function mesh draw wired surface. You can use meshnum for changing number of lines to be drawn. +

+

MGL code: +

call 'prepare2d'
+title 'Mesh plot':rotate 50 60:box:mesh a
+
+

C++ code: +

void smgl_mesh(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Mesh plot");
+	gr->Rotate(50,60);	gr->Box();	gr->Mesh(a);
+}
+
Sample mesh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.73 Sample ‘mirror

+ + +

Example of using options. +

+

MGL code: +

new a 31 41 '-pi*x*exp(-(y+1)^2-4*x^2)'
+subplot 2 2 0:title 'Options for coordinates':alpha on:light on:rotate 40 60:box
+surf a 'r';yrange 0 1:surf a 'b';yrange 0 -1
+subplot 2 2 1:title 'Option "meshnum"':rotate 40 60:box
+mesh a 'r'; yrange 0 1:mesh a 'b';yrange 0 -1; meshnum 5
+subplot 2 2 2:title 'Option "alpha"':rotate 40 60:box
+surf a 'r';yrange 0 1; alpha 0.7:surf a 'b';yrange 0 -1; alpha 0.3
+subplot 2 2 3 '<_':title 'Option "legend"'
+fplot 'x^3' 'r'; legend 'y = x^3':fplot 'cos(pi*x)' 'b'; legend 'y = cos \pi x'
+box:axis:legend 2
+
+

C++ code: +

void smgl_mirror(mglGraph *gr)	// flag #
+{
+	mglData a(31,41);
+	gr->Fill(a,"-pi*x*exp(-(y+1)^2-4*x^2)");
+
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Options for coordinates");	}
+	gr->Alpha(true);	gr->Light(true);
+	gr->Rotate(40,60);	gr->Box();
+	gr->Surf(a,"r","yrange 0 1"); gr->Surf(a,"b","yrange 0 -1");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("Option 'meshnum'");
+	gr->Rotate(40,60);	gr->Box();
+	gr->Mesh(a,"r","yrange 0 1"); gr->Mesh(a,"b","yrange 0 -1; meshnum 5");
+	gr->SubPlot(2,2,2);	gr->Title("Option 'alpha'");
+	gr->Rotate(40,60);	gr->Box();
+	gr->Surf(a,"r","yrange 0 1; alpha 0.7"); gr->Surf(a,"b","yrange 0 -1; alpha 0.3");
+	gr->SubPlot(2,2,3,"<_");	gr->Title("Option 'legend'");
+	gr->FPlot("x^3","r","legend 'y = x^3'"); gr->FPlot("cos(pi*x)","b","legend 'y = cos \\pi x'");
+	gr->Box();	gr->Axis();	gr->Legend(2,"");
+}
+
Sample mirror +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.74 Sample ‘molecule

+ + +

Example of drawing molecules. +

+

MGL code: +

alpha on:light on
+subplot 2 2 0 '':title 'Methane, CH_4':rotate 60 120
+sphere 0 0 0 0.25 'k':drop 0 0 0 0 0 1 0.35 'h' 1 2:sphere 0 0 0.7 0.25 'g'
+drop 0 0 0 -0.94 0 -0.33 0.35 'h' 1 2:sphere -0.66 0 -0.23 0.25 'g'
+drop 0 0 0 0.47 0.82 -0.33 0.35 'h' 1 2:sphere 0.33 0.57 -0.23 0.25 'g'
+drop 0 0 0 0.47 -0.82 -0.33 0.35 'h' 1 2:sphere 0.33 -0.57 -0.23 0.25 'g'
+subplot 2 2 1 '':title 'Water, H{_2}O':rotate 60 100
+sphere 0 0 0 0.25 'r':drop 0 0 0 0.3 0.5 0 0.3 'm' 1 2:sphere 0.3 0.5 0 0.25 'g'
+drop 0 0 0 0.3 -0.5 0 0.3 'm' 1 2:sphere 0.3 -0.5 0 0.25 'g'
+subplot 2 2 2 '':title 'Oxygen, O_2':rotate 60 120
+drop 0 0.5 0 0 -0.3 0 0.3 'm' 1 2:sphere 0 0.5 0 0.25 'r'
+drop 0 -0.5 0 0 0.3 0 0.3 'm' 1 2:sphere 0 -0.5 0 0.25 'r'
+subplot 2 2 3 '':title 'Ammonia, NH_3':rotate 60 120
+sphere 0 0 0 0.25 'b':drop 0 0 0 0.33 0.57 0 0.32 'n' 1 2
+sphere 0.33 0.57 0 0.25 'g':drop 0 0 0 0.33 -0.57 0 0.32 'n' 1 2
+sphere 0.33 -0.57 0 0.25 'g':drop 0 0 0 -0.65 0 0 0.32 'n' 1 2
+sphere -0.65 0 0 0.25 'g'
+
+

C++ code: +

void smgl_molecule(mglGraph *gr)	// example of moleculas
+{
+	gr->VertexColor(false);	gr->Compression(false); // per-vertex colors and compression are detrimental to transparency
+	gr->DoubleSided(false); // we do not get into atoms, while rendering internal surface has negative impact on trasparency
+	gr->Alpha(true);	gr->Light(true);
+
+	gr->SubPlot(2,2,0,"");	gr->Title("Methane, CH_4");
+	gr->StartGroup("Methane");
+	gr->Rotate(60,120);
+	gr->Sphere(mglPoint(0,0,0),0.25,"k");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0,0,1),0.35,"h",1,2);
+	gr->Sphere(mglPoint(0,0,0.7),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(-0.94,0,-0.33),0.35,"h",1,2);
+	gr->Sphere(mglPoint(-0.66,0,-0.23),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.47,0.82,-0.33),0.35,"h",1,2);
+	gr->Sphere(mglPoint(0.33,0.57,-0.23),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.47,-0.82,-0.33),0.35,"h",1,2);
+	gr->Sphere(mglPoint(0.33,-0.57,-0.23),0.25,"g");
+	gr->EndGroup();
+
+	gr->SubPlot(2,2,1,"");	gr->Title("Water, H_{2}O");
+	gr->StartGroup("Water");
+	gr->Rotate(60,100);
+	gr->StartGroup("Water_O");
+	gr->Sphere(mglPoint(0,0,0),0.25,"r");
+	gr->EndGroup();
+	gr->StartGroup("Water_Bond_1");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.3,0.5,0),0.3,"m",1,2);
+	gr->EndGroup();
+	gr->StartGroup("Water_H_1");
+	gr->Sphere(mglPoint(0.3,0.5,0),0.25,"g");
+	gr->EndGroup();
+	gr->StartGroup("Water_Bond_2");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.3,-0.5,0),0.3,"m",1,2);
+	gr->EndGroup();
+	gr->StartGroup("Water_H_2");
+	gr->Sphere(mglPoint(0.3,-0.5,0),0.25,"g");
+	gr->EndGroup();
+	gr->EndGroup();
+
+	gr->SubPlot(2,2,2,"");	gr->Title("Oxygen, O_2");
+	gr->StartGroup("Oxygen");
+	gr->Rotate(60,120);
+	gr->Drop(mglPoint(0,0.5,0),mglPoint(0,-0.3,0),0.3,"m",1,2);
+	gr->Sphere(mglPoint(0,0.5,0),0.25,"r");
+	gr->Drop(mglPoint(0,-0.5,0),mglPoint(0,0.3,0),0.3,"m",1,2);
+	gr->Sphere(mglPoint(0,-0.5,0),0.25,"r");
+	gr->EndGroup();
+
+	gr->SubPlot(2,2,3,"");	gr->Title("Ammonia, NH_3");
+	gr->StartGroup("Ammonia");
+	gr->Rotate(60,120);
+	gr->Sphere(mglPoint(0,0,0),0.25,"b");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.33,0.57,0),0.32,"n",1,2);
+	gr->Sphere(mglPoint(0.33,0.57,0),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.33,-0.57,0),0.32,"n",1,2);
+	gr->Sphere(mglPoint(0.33,-0.57,0),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(-0.65,0,0),0.32,"n",1,2);
+	gr->Sphere(mglPoint(-0.65,0,0),0.25,"g");
+	gr->EndGroup();
+	gr->DoubleSided( true ); // put back
+}
+
Sample molecule +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.75 Sample ‘ode

+ + +

Example of phase plain created by ode solving, contour lines (cont) and flow threads. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Cont':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new f 100 100 'y^2+2*x^3-x^2-0.5':cont f
+
+subplot 2 2 1 '<_':title 'Flow':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new fx 100 100 'x-3*x^2'
+new fy 100 100 'y'
+flow fy fx 'v';value 7
+
+subplot 2 2 2 '<_':title 'ODE':box
+axis:xlabel 'x':ylabel '\dot{x}'
+for $x -1 1 0.1
+  ode r 'y;x-3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+  ode r '-y;-x+3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+next
+
+

C++ code: +

void smgl_ode(mglGraph *gr)
+{
+	gr->SubPlot(2,2,0,"<_");	gr->Title("Cont");	gr->Box();
+	gr->Axis();	gr->Label('x',"x");	gr->Label('y',"\\dot{x}");
+	mglData f(100,100);	gr->Fill(f,"y^2+2*x^3-x^2-0.5");
+	gr->Cont(f);
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Flow");	gr->Box();
+	gr->Axis();	gr->Label('x',"x");	gr->Label('y',"\\dot{x}");
+	mglData fx(100,100), fy(100,100);	gr->Fill(fx,"x-3*x^2");	gr->Fill(fy,"y");
+	gr->Flow(fy,fx,"v","value 7");
+	gr->SubPlot(2,2,2,"<_");	gr->Title("ODE");	gr->Box();
+	gr->Axis();	gr->Label('x',"x");	gr->Label('y',"\\dot{x}");
+	for(double x=-1;x<1;x+=0.1)
+	{
+		mglData in(2), r;	in.a[0]=x;
+		r = mglODE("y;x-3*x^2","xy",in);
+		gr->Plot(r.SubData(0), r.SubData(1));
+		r = mglODE("-y;-x+3*x^2","xy",in);
+		gr->Plot(r.SubData(0), r.SubData(1));
+	}
+}
+
Sample ode +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.76 Sample ‘ohlc

+ + +

Function ohlc draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high) and minimal(low) values, as well as horizontal lines before/after vertical line for initial(open)/final(close) values of some process. +

+

MGL code: +

new o 10 '0.5*sin(pi*x)'
+new c 10 '0.5*sin(pi*(x+2/9))'
+new l 10 '0.3*rnd-0.8'
+new h 10 '0.3*rnd+0.5'
+subplot 1 1 0 '':title 'OHLC plot':box:ohlc o h l c
+
+

C++ code: +

void smgl_ohlc(mglGraph *gr)	// flow threads and density plot
+{
+	mglData o(10), h(10), l(10), c(10);
+	gr->Fill(o,"0.5*sin(pi*x)");	gr->Fill(c,"0.5*sin(pi*(x+2/9))");
+	gr->Fill(l,"0.3*rnd-0.8");		gr->Fill(h,"0.3*rnd+0.5");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("OHLC plot");	}
+	gr->Box();	gr->OHLC(o,h,l,c);
+}
+
Sample ohlc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.77 Sample ‘param1

+ + +

Example of parametric plots for 1D data. +

+

MGL code: +

new x 100 'sin(pi*x)'
+new y 100 'cos(pi*x)'
+new z 100 'sin(2*pi*x)'
+new c 100 'cos(2*pi*x)'
+
+subplot 4 3 0:rotate 40 60:box:plot x y z
+subplot 4 3 1:rotate 40 60:box:area x y z
+subplot 4 3 2:rotate 40 60:box:tens x y z c
+subplot 4 3 3:rotate 40 60:box:bars x y z
+subplot 4 3 4:rotate 40 60:box:stem x y z
+subplot 4 3 5:rotate 40 60:box:textmark x y z c*2 '\alpha'
+subplot 4 3 6:rotate 40 60:box:tube x y z c/10
+subplot 4 3 7:rotate 40 60:box:mark x y z c 's'
+subplot 4 3 8:box:error x y z/10 c/10
+subplot 4 3 9:rotate 40 60:box:step x y z
+subplot 4 3 10:rotate 40 60:box:torus x z 'z';light on
+subplot 4 3 11:rotate 40 60:box:label x y z '%z'
+
+

C++ code: +

void smgl_param1(mglGraph *gr)	// 1d parametric plots
+{
+	mglData x(100), y(100), z(100), c(100);
+	gr->Fill(x,"sin(pi*x)");	gr->Fill(y,"cos(pi*x)");
+	gr->Fill(z,"sin(2*pi*x)");	gr->Fill(c,"cos(2*pi*x)");
+
+	gr->SubPlot(4,3,0);	gr->Rotate(40,60);	gr->Box();	gr->Plot(x,y,z);
+	gr->SubPlot(4,3,1);	gr->Rotate(40,60);	gr->Box();	gr->Area(x,y,z);
+	gr->SubPlot(4,3,2);	gr->Rotate(40,60);	gr->Box();	gr->Tens(x,y,z,c);
+	gr->SubPlot(4,3,3);	gr->Rotate(40,60);	gr->Box();	gr->Bars(x,y,z);
+	gr->SubPlot(4,3,4);	gr->Rotate(40,60);	gr->Box();	gr->Stem(x,y,z);
+	gr->SubPlot(4,3,5);	gr->Rotate(40,60);	gr->Box();	gr->TextMark(x,y,z,c*2,"\\alpha");
+	gr->SubPlot(4,3,6);	gr->Rotate(40,60);	gr->Box();	gr->Tube(x,y,z,c/10,"","light on");
+	gr->SubPlot(4,3,7);	gr->Rotate(40,60);	gr->Box();	gr->Mark(x,y,z,c,"s");
+	gr->SubPlot(4,3,8);	gr->Rotate(40,60);	gr->Box();	gr->Error(x,y,z/10,c/10);
+	gr->SubPlot(4,3,9);	gr->Rotate(40,60);	gr->Box();	gr->Step(x,y,z);
+	gr->SubPlot(4,3,10);gr->Rotate(40,60);	gr->Box();	gr->Torus(x,z,"z","light on");
+	gr->SubPlot(4,3,11);gr->Rotate(40,60);	gr->Box();	gr->Label(x,y,z,"%z");
+}
+
Sample param1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.78 Sample ‘param2

+ + +

Example of parametric plots for 2D data. +

+

MGL code: +

new x 100 100 'sin(pi*(x+y)/2)*cos(pi*y/2)'
+new y 100 100 'cos(pi*(x+y)/2)*cos(pi*y/2)'
+new z 100 100 'sin(pi*y/2)'
+new c 100 100 'cos(pi*x)'
+
+subplot 4 4 0:rotate 40 60:box:surf x y z
+subplot 4 4 1:rotate 40 60:box:surfc x y z c
+subplot 4 4 2:rotate 40 60:box:surfa x y z c;alpha 1
+subplot 4 4 3:rotate 40 60:box:mesh x y z;meshnum 10
+subplot 4 4 4:rotate 40 60:box:tile x y z;meshnum 10
+subplot 4 4 5:rotate 40 60:box:tiles x y z c;meshnum 10
+subplot 4 4 6:rotate 40 60:box:axial x y z;alpha 0.5;light on
+subplot 4 4 7:rotate 40 60:box:cont x y z
+subplot 4 4 8:rotate 40 60:box:contf x y z;light on:contv x y z;light on
+subplot 4 4 9:rotate 40 60:box:belt x y z 'x';meshnum 10;light on
+subplot 4 4 10:rotate 40 60:box:dens x y z;alpha 0.5
+subplot 4 4 11:rotate 40 60:box
+fall x y z 'g';meshnum 10:fall x y z 'rx';meshnum 10
+subplot 4 4 12:rotate 40 60:box:belt x y z '';meshnum 10;light on
+subplot 4 4 13:rotate 40 60:box:boxs x y z '';meshnum 10;light on
+subplot 4 4 14:rotate 40 60:box:boxs x y z '#';meshnum 10;light on
+subplot 4 4 15:rotate 40 60:box:boxs x y z '@';meshnum 10;light on
+
+

C++ code: +

void smgl_param2(mglGraph *gr)	// 2d parametric plots
+{
+	mglData x(100,100), y(100,100), z(100,100), c(100,100);
+	gr->Fill(x,"sin(pi*(x+y)/2)*cos(pi*y/2)");	gr->Fill(y,"cos(pi*(x+y)/2)*cos(pi*y/2)");
+	gr->Fill(z,"sin(pi*y/2)");	gr->Fill(c,"cos(pi*x)");
+
+	gr->SubPlot(4,4,0);	gr->Rotate(40,60);	gr->Box();	gr->Surf(x,y,z);
+	gr->SubPlot(4,4,1);	gr->Rotate(40,60);	gr->Box();	gr->SurfC(x,y,z,c);
+	gr->SubPlot(4,4,2);	gr->Rotate(40,60);	gr->Box();	gr->SurfA(x,y,z,c,"","alpha 1");
+	gr->SubPlot(4,4,3);	gr->Rotate(40,60);	gr->Box();	gr->Mesh(x,y,z,"","meshnum 10");
+	gr->SubPlot(4,4,4);	gr->Rotate(40,60);	gr->Box();	gr->Tile(x,y,z,"","meshnum 10");
+	gr->SubPlot(4,4,5);	gr->Rotate(40,60);	gr->Box();	gr->TileS(x,y,z,c,"","meshnum 10");
+	gr->SubPlot(4,4,6);	gr->Rotate(40,60);	gr->Box();	gr->Axial(x,y,z,"","alpha 0.5;light on");
+	gr->SubPlot(4,4,7);	gr->Rotate(40,60);	gr->Box();	gr->Cont(x,y,z);
+	gr->SubPlot(4,4,8);	gr->Rotate(40,60);	gr->Box();	gr->ContF(x,y,z,"","light on");	gr->ContV(x,y,z,"","light on");
+	gr->SubPlot(4,4,9);	gr->Rotate(40,60);	gr->Box();	gr->Belt(x,y,z,"x","meshnum 10;light on");
+	gr->SubPlot(4,4,10);gr->Rotate(40,60);	gr->Box();	gr->Dens(x,y,z,"","alpha 0.5");
+	gr->SubPlot(4,4,11);gr->Rotate(40,60);	gr->Box();
+	gr->Fall(x,y,z,"g","meshnum 10");	gr->Fall(x,y,z,"rx","meshnum 10");
+	gr->SubPlot(4,4,12);	gr->Rotate(40,60);	gr->Box();	gr->Belt(x,y,z,"","meshnum 10;light on");
+	gr->SubPlot(4,4,13);	gr->Rotate(40,60);	gr->Box();	gr->Boxs(x,y,z,"","meshnum 10;light on");
+	gr->SubPlot(4,4,14);	gr->Rotate(40,60);	gr->Box();	gr->Boxs(x,y,z,"#","meshnum 10");
+	gr->SubPlot(4,4,15);	gr->Rotate(40,60);	gr->Box();	gr->Boxs(x,y,z,"@","meshnum 10;light on");
+}
+
Sample param2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.79 Sample ‘param3

+ + +

Example of parametric plots for 3D data. +

+

MGL code: +

new x 50 50 50 '(x+2)/3*sin(pi*y/2)'
+new y 50 50 50 '(x+2)/3*cos(pi*y/2)'
+new z 50 50 50 'z'
+new c 50 50 50 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 50 50 50 '1-2*tanh(2*(x+y)^2)'
+
+alpha on:light on
+subplot 4 3 0:rotate 40 60:box:surf3 x y z c
+subplot 4 3 1:rotate 40 60:box:surf3c x y z c d
+subplot 4 3 2:rotate 40 60:box:surf3a x y z c d
+subplot 4 3 3:rotate 40 60:box:cloud x y z c
+subplot 4 3 4:rotate 40 60:box:cont3 x y z c:cont3 x y z c 'x':cont3 x y z c 'z'
+subplot 4 3 5:rotate 40 60:box:contf3 x y z c:contf3 x y z c 'x':contf3 x y z c 'z'
+subplot 4 3 6:rotate 40 60:box:dens3 x y z c:dens3 x y z c 'x':dens3 x y z c 'z'
+subplot 4 3 7:rotate 40 60:box:dots x y z c;meshnum 15
+subplot 4 3 8:rotate 40 60:box:densx c '' 0:densy c '' 0:densz c '' 0
+subplot 4 3 9:rotate 40 60:box:contx c '' 0:conty c '' 0:contz c '' 0
+subplot 4 3 10:rotate 40 60:box:contfx c '' 0:contfy c '' 0:contfz c '' 0
+
+

C++ code: +

void smgl_param3(mglGraph *gr)	// 3d parametric plots
+{
+	mglData x(50,50,50), y(50,50,50), z(50,50,50), c(50,50,50), d(50,50,50);
+	gr->Fill(x,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y,"(x+2)/3*cos(pi*y/2)");	gr->Fill(z,"z");
+	gr->Fill(c,"-2*(x^2+y^2+z^4-z^2)+0.2");	gr->Fill(d,"1-2*tanh(2*(x+y)^2)");
+
+	gr->Light(true);	gr->Alpha(true);
+	gr->SubPlot(4,3,0);	gr->Rotate(40,60);	gr->Box();	gr->Surf3(x,y,z,c);
+	gr->SubPlot(4,3,1);	gr->Rotate(40,60);	gr->Box();	gr->Surf3C(x,y,z,c,d);
+	gr->SubPlot(4,3,2);	gr->Rotate(40,60);	gr->Box();	gr->Surf3A(x,y,z,c,d);
+	gr->SubPlot(4,3,3);	gr->Rotate(40,60);	gr->Box();	gr->Cloud(x,y,z,c);
+	gr->SubPlot(4,3,4);	gr->Rotate(40,60);	gr->Box();	gr->Cont3(x,y,z,c);	gr->Cont3(x,y,z,c,"x");	gr->Cont3(x,y,z,c,"z");
+	gr->SubPlot(4,3,5);	gr->Rotate(40,60);	gr->Box();	gr->ContF3(x,y,z,c);gr->ContF3(x,y,z,c,"x");gr->ContF3(x,y,z,c,"z");
+	gr->SubPlot(4,3,6);	gr->Rotate(40,60);	gr->Box();	gr->Dens3(x,y,z,c);	gr->Dens3(x,y,z,c,"x");	gr->Dens3(x,y,z,c,"z");
+	gr->SubPlot(4,3,7);	gr->Rotate(40,60);	gr->Box();	gr->Dots(x,y,z,c,"","meshnum 15");
+	gr->SubPlot(4,3,8);	gr->Rotate(40,60);	gr->Box();	gr->DensX(c,"",0);	gr->DensY(c,"",0);	gr->DensZ(c,"",0);
+	gr->SubPlot(4,3,9);	gr->Rotate(40,60);	gr->Box();	gr->ContX(c,"",0);	gr->ContY(c,"",0);	gr->ContZ(c,"",0);
+	gr->SubPlot(4,3,10);gr->Rotate(40,60);	gr->Box();	gr->ContFX(c,"",0);	gr->ContFY(c,"",0);	gr->ContFZ(c,"",0);
+}
+
Sample param3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.80 Sample ‘paramv

+ + +

Example of parametric plots for vector fields. +

+

MGL code: +

new x 20 20 20 '(x+2)/3*sin(pi*y/2)'
+new y 20 20 20 '(x+2)/3*cos(pi*y/2)'
+new z 20 20 20 'z+x'
+new ex 20 20 20 'x'
+new ey 20 20 20 'x^2+y'
+new ez 20 20 20 'y^2+z'
+
+new x1 50 50 '(x+2)/3*sin(pi*y/2)'
+new y1 50 50 '(x+2)/3*cos(pi*y/2)'
+new e1 50 50 'x'
+new e2 50 50 'x^2+y'
+
+subplot 3 3 0:rotate 40 60:box:vect x1 y1 e1 e2
+subplot 3 3 1:rotate 40 60:box:flow x1 y1 e1 e2
+subplot 3 3 2:rotate 40 60:box:pipe x1 y1 e1 e2
+subplot 3 3 3:rotate 40 60:box:dew x1 y1 e1 e2
+subplot 3 3 4:rotate 40 60:box:vect x y z ex ey ez
+subplot 3 3 5:rotate 40 60:box
+vect3 x y z ex ey ez:vect3 x y z ex ey ez 'x':vect3 x y z ex ey ez 'z'
+grid3 x y z z '{r9}':grid3 x y z z '{g9}x':grid3 x y z z '{b9}z'
+subplot 3 3 6:rotate 40 60:box:flow x y z ex ey ez
+subplot 3 3 7:rotate 40 60:box:pipe x y z ex ey ez
+
+

C++ code: +

void smgl_paramv(mglGraph *gr)	// parametric plots for vector field
+{
+	mglData x(20,20,20), y(20,20,20), z(20,20,20), ex(20,20,20), ey(20,20,20), ez(20,20,20);
+	gr->Fill(x,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y,"(x+2)/3*cos(pi*y/2)");	gr->Fill(z,"x+z");
+	gr->Fill(ex,"x");	gr->Fill(ey,"x^2+y");	gr->Fill(ez,"y^2+z");
+	mglData x1(20,20), y1(20,20), e1(20,20), e2(20,20);
+	gr->Fill(x1,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y1,"(x+2)/3*cos(pi*y/2)");
+	gr->Fill(e1,"x");	gr->Fill(e2,"x^2+y");
+
+	gr->SubPlot(3,3,0);	gr->Rotate(40,60);	gr->Box();	gr->Vect(x1,y1,e1,e2);
+	gr->SubPlot(3,3,1);	gr->Rotate(40,60);	gr->Box();	gr->Flow(x1,y1,e1,e2);
+	gr->SubPlot(3,3,2);	gr->Rotate(40,60);	gr->Box();	gr->Pipe(x1,y1,e1,e2);
+	gr->SubPlot(3,3,3);	gr->Rotate(40,60);	gr->Box();	gr->Dew(x1,y1,e1,e2);
+	gr->SubPlot(3,3,4);	gr->Rotate(40,60);	gr->Box();	gr->Vect(x,y,z,ex,ey,ez);
+	gr->SubPlot(3,3,5);	gr->Rotate(40,60);	gr->Box();
+	gr->Vect3(x,y,z,ex,ey,ez);	gr->Vect3(x,y,z,ex,ey,ez,"x");	gr->Vect3(x,y,z,ex,ey,ez,"z");
+	gr->Grid3(x,y,z,z,"{r9}");	gr->Grid3(x,y,z,z,"{g9}x");		gr->Grid3(x,y,z,z,"{b9}z");
+	gr->SubPlot(3,3,6);	gr->Rotate(40,60);	gr->Box();	gr->Flow(x,y,z,ex,ey,ez);
+	gr->SubPlot(3,3,7);	gr->Rotate(40,60);	gr->Box();	gr->Pipe(x,y,z,ex,ey,ez);
+}
+
Sample paramv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.81 Sample ‘parser

+ + +

Basic MGL script. +

+

MGL code: +

title 'MGL parser sample'
+# call function
+call 'sample'
+
+# ordinary for-loop
+for $0 -1 1 0.1
+if $0<0:line 0 0 1 $0 'r':else:line 0 0 1 $0 'g':endif
+next
+
+# if-elseif-else
+for $i -1 1 0.5
+if $i<0
+text 1.1 $i '$i' 'b'
+elseif $i>0
+text 1.1 $i '$i' 'r'
+else
+text 1.1 $i '$i'
+endif
+next
+
+# ordinary do-while
+do
+defnum $i $i-0.2
+line 0 0 $i 1 'b'
+while $i>0
+
+# do-next-break
+do
+defnum $i $i-0.2
+if $i<-1 then break
+line 0 0 $i 1 'm'
+next
+
+# for-while-continue
+for $i -5 10
+text $i/5 1.1 'a'+($i+5)
+if $i<0
+text $i/5-0.06 1.1 '--' 'b'
+elseif mod($i,2)=0
+text $i/5-0.06 1.1 '~' 'r'
+else
+# NOTE: 'continue' bypass the 'while'!
+continue
+endif
+# NOTE: 'while' limit the actual number of iterations
+while $i<5
+
+# nested loops
+for $i 0 1 0.1
+for $j 0 1 0.1
+ball $i $j
+if $j>0.5 then continue
+ball $i $j 'b+'
+next
+next
+
+func 'sample'
+new dat 100 'sin(2*pi*(i/99+1))'
+plot dat;xrange -1 0
+box:axis
+xlabel 'x':ylabel 'y'
+return
+
+

C++ code: +

void smgl_parser(mglGraph *gr)	// example of MGL parsing
+{	// NOTE: MGL version show much more variants of loops and conditions.
+	gr->Title("MGL parser sample");
+	double a[100];   // let a_i = sin(4*pi*x), x=0...1
+	for(int i=0;i<100;i++)a[i]=sin(2*M_PI*i/99);
+	mglParse *parser = new mglParse;
+	// Add MGL variable and set yours data to it.
+	mglData *d = dynamic_cast<mglData*>(parser->AddVar("dat"));
+	if(d)	d->Set(a,100);
+	parser->Execute(gr, "plot dat; xrange -1 0\nbox\naxis");
+	// You may break script at any line do something
+	// and continue after that.
+	parser->Execute(gr, "xlabel 'x'\nylabel 'y'\nbox");
+	// Also you may use cycles or conditions in script.
+	parser->Execute(gr, "for $0 -1 1 0.1\nif $0<0\n"
+		"line 0 0 1 $0 'r':else:line 0 0 1 $0 'g'\n"
+		"endif\nnext");
+	// You may use for or do-while loops as C/C++ one
+	double i=1;
+	do	{
+		char buf[64];	sprintf(buf,"line 0 0 %g 1 'b'",i);
+		parser->Execute(gr, buf);	i=i-0.2;
+	} while(i>0);
+	// or as MGL one.
+	parser->Execute(gr, "for $i -1 1 0.5\n"
+		"if $i<0\ntext 1.1 $i '$i' 'b'\n"
+		"elseif $i>0\ntext 1.1 $i '$i' 'r'\n"
+		"else\ntext 1.1 $i '$i'\nendif\nnext\n");
+	// There are 'break' and 'continue' commands in MGL too.
+	// NOTE: 'next' act as "while(1)" in do-while loops.
+	parser->Execute(gr, "do\ndefnum $i $i-0.2\n"
+		"if $i<-1 then break\nline 0 0 $i 1 'm'\nnext\n");
+	// One issue with 'continue' -- it bypass 'while' checking
+	parser->Execute(gr, "for $i -5 10\ntext $i/5 1.1 'a'+($i+5)\nif $i<0\n"
+		"text $i/5-0.06 1.1 '--' 'b'\n"
+		"elseif mod($i,2)=0\ntext $i/5-0.06 1.1 '~' 'r'\n"
+		"else\ncontinue\nendif\n"
+		// NOTE: 'while' limit the actual number of iterations in for-loop.
+		"while $i<5\n");
+	// Finally, MGL support nested loops too.
+	parser->Execute(gr, "for $i 0 1 0.1\nfor $j 0 1 0.1\nball $i $j\n"
+		"if $j>0.5 then continue\nball $i $j 'b+'\nnext\nnext\n");
+	// Clean up memory.
+	delete parser;
+}
+
Sample parser +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.82 Sample ‘pde

+ + +

Example of pde solver. +

+

MGL code: +

new re 128 'exp(-48*(x+0.7)^2)':new im 128
+pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30
+transpose a
+subplot 1 1 0 '<_':title 'PDE solver'
+axis:xlabel '\i x':ylabel '\i z'
+crange 0 1:dens a 'wyrRk'
+fplot '-x' 'k|'
+text 0 0.95 'Equation: ik_0\partial_zu + \Delta u + x\cdot u + i \frac{x+z}{2}\cdot u = 0\n{}absorption: (x+z)/2 for x+z>0'
+
+

C++ code: +

void smgl_pde(mglGraph *gr)	// PDE sample
+{
+	mglData a,re(128),im(128);
+	gr->Fill(re,"exp(-48*(x+0.7)^2)");
+	a = gr->PDE("p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, 0.01, 30);
+	a.Transpose("yxz");
+	if(big!=3)	{gr->SubPlot(1,1,0,"<_");	gr->Title("PDE solver");	}
+	gr->SetRange('c',0,1);	gr->Dens(a,"wyrRk");
+	gr->Axis();	gr->Label('x', "\\i x");	gr->Label('y', "\\i z");
+	gr->FPlot("-x", "k|");
+	gr->Puts(mglPoint(0, 0.95), "Equation: ik_0\\partial_zu + \\Delta u + x\\cdot u + i \\frac{x+z}{2}\\cdot u = 0\nabsorption: (x+z)/2 for x+z>0");
+}
+
Sample pde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.83 Sample ‘pendelta

+ + +

Example of pendelta for lines and glyphs smoothing. +

+

MGL code: +

quality 6
+list a 0.25 0.5 1 2 4
+for $0 0 4
+pendelta a($0)
+define $1 0.5*$0-1
+line -1 $1 1 $1 'r'
+text 0 $1 'delta=',a($0)
+next
+
+

C++ code: +

void smgl_pendelta(mglGraph *gr)
+{
+	double a[5]={0.25,0.5,1,2,4};
+	gr->SetQuality(6);
+	char buf[64];
+	for(int i=0;i<5;i++)
+	{
+		gr->SetPenDelta(a[i]);
+		gr->Line(mglPoint(-1,0.5*i-1), mglPoint(1,0.5*i-1),"r");
+		sprintf(buf,"delta=%g",a[i]);
+		gr->Puts(mglPoint(0,0.5*i-1),buf);
+	}
+}
+
Sample pendelta +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.84 Sample ‘pipe

+ + +

Function pipe is similar to flow but draw pipes (tubes) which radius is proportional to the amplitude of vector field. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Pipe plot (default)':light on:box:pipe a b
+subplot 2 2 1 '':title '"i" style':box:pipe a b 'i'
+subplot 2 2 2 '':title 'from edges only':box:pipe a b '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:pipe ex ey ez '' 0.1
+
+

C++ code: +

void smgl_pipe(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2v(&a,&b);
+	if(big!=3)	{gr->SubPlot(2,2,0,"");	gr->Title("Pipe plot (default)");}
+	gr->Light(true);	gr->Box();	gr->Pipe(a,b);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("'i' style");	gr->Box();	gr->Pipe(a,b,"i");
+	gr->SubPlot(2,2,2,"");	gr->Title("'\\#' style");	gr->Box();	gr->Pipe(a,b,"#");
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Pipe(ex,ey,ez,"",0.1);
+}
+
Sample pipe +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.85 Sample ‘plot

+ + +

Function plot is most standard way to visualize 1D data array. By default, Plot use colors from palette. However, you can specify manual color/palette, and even set to use new color for each points by using ‘!’ style. Another feature is ‘ ’ style which draw only markers without line between points. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Plot plot (default)':box:plot y
+subplot 2 2 2 '':title ''!' style; 'rgb' palette':box:plot y 'o!rgb'
+subplot 2 2 3 '':title 'just markers':box:plot y ' +'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:plot xc yc z 'rs'
+
+

C++ code: +

void smgl_plot(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Plot plot (default)");	}
+	gr->Box();	gr->Plot(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style; 'rgb' palette");	gr->Box();	gr->Plot(y,"o!rgb");
+	gr->SubPlot(2,2,3,"");	gr->Title("just markers");	gr->Box();	gr->Plot(y," +");
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Plot(xc,yc,z,"rs");
+}
+
Sample plot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.86 Sample ‘pmap

+ + +

Function pmap draw Poincare map – show intersections of the curve and the surface. +

+

MGL code: +

subplot 1 1 0 '<_^':title 'Poincare map sample'
+ode r 'cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)' 'xyz' [0.1,0,0] 0.1 100
+rotate 40 60:copy x r(0):copy y r(1):copy z r(2)
+ranges x y z
+axis:plot x y z 'b'
+xlabel '\i x' 0:ylabel '\i y' 0:zlabel '\i z'
+pmap x y z z 'b#o'
+fsurf '0'
+
+

C++ code: +

void smgl_pmap(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_^");
+	if(big!=3)	gr->Title("Poincare map sample");
+	mglData ini(3);	ini[0]=0.1;
+	mglData r(mglODE("cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)","xyz",ini,0.1,100));
+	mglData x(r.SubData(0)),y(r.SubData(1)), z(r.SubData(2));
+	gr->Rotate(40,60);	gr->SetRanges(x,y,z);
+	gr->Axis();	gr->FSurf("0");	gr->Plot(x,y,z,"b");
+	gr->Label('x',"\\i x",0);	gr->Label('y',"\\i y",0);	gr->Label('z',"\\i z",0);
+	gr->Pmap(x,y,z,z, "b#o");
+}
+
Sample pmap +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.87 Sample ‘primitives

+ + +

Example of primitives: line, curve, rhomb, ellipse, face, sphere, drop, cone. +

+

MGL code: +

subplot 2 2 0 '':title 'Line, Curve, Rhomb, Ellipse' '' -1.5
+line -1 -1 -0.5 1 'qAI'
+curve -0.6 -1 1 1 0 1 1 1 'rA'
+ball 0 -0.5 '*':ball 1 -0.1 '*'
+rhomb 0 0.4 1 0.9 0.2 'b#'
+rhomb 0 0 1 0.4 0.2 'cg@'
+ellipse 0 -0.5 1 -0.1 0.2 'u#'
+ellipse 0 -1 1 -0.6 0.2 'm@'
+
+subplot 2 3 1 '':title 'Arc, Polygon, Symbol';size -1.2
+arc -0.6 0 -0.6 0.3 180 '2kA':ball -0.6 0
+polygon 0 0 0 0.4 6 'r'
+new x 50 'cos(3*pi*x)':new y 50 'sin(pi*x)'
+addsymbol 'a' x y
+symbol 0.7 0 'a'
+
+light on
+subplot 2 3 3 '<^>' 0 -0.2:title 'Face[xyz]';size -1.5:rotate 50 60:box
+facex 1 0 -1 1 1 'r':facey -1 -1 -1 1 1 'g':facez 1 -1 -1 -1 1 'b'
+face -1 -1 1 -1 1 1 1 -1 0 1 1 1 'bmgr'
+
+subplot 2 3 5 '':title 'Cone';size -1.5
+cone -0.7 -0.3 0 -0.7 0.7 0.5 0.2 0.1 'b':text -0.7 -0.7 'no edges\n(default)';size -1.5
+cone 0 -0.3 0 0 0.7 0.5 0.2 0.1 'g@':text 0 -0.7 'with edges\n("\@" style)';size -1.5
+cone 0.7 -0.3 0 0.7 0.7 0.5 0.2 0 'Ggb':text 0.7 -0.7 '"arrow" with\n{}gradient';size -1.5
+subplot 2 2 2 '':title 'Sphere and Drop'
+line -0.9 0 1 0.9 0 1
+text -0.9 0.4 'sh=0':drop -0.9 0 0 1 0.5 'r' 0:ball -0.9 0 1 'k'
+text -0.3 0.6 'sh=0.33':drop -0.3 0 0 1 0.5 'r' 0.33:ball -0.3 0 1 'k'
+text 0.3 0.8 'sh=0.67':drop 0.3 0 0 1 0.5 'r' 0.67:ball 0.3 0 1 'k'
+text 0.9 1. 'sh=1':drop 0.9 0 0 1 0.5 'r' 1:ball 0.9 0 1 'k'
+
+text -0.9 -1.1 'asp=0.33':drop -0.9 -0.7 0 1 0.5 'b' 0 0.33
+text -0.3 -1.1 'asp=0.67':drop -0.3 -0.7 0 1 0.5 'b' 0 0.67
+text 0.3 -1.1 'asp=1':drop 0.3 -0.7 0 1 0.5 'b' 0 1
+text 0.9 -1.1 'asp=1.5':drop 0.9 -0.7 0 1 0.5 'b' 0 1.5
+
+

C++ code: +

void smgl_primitives(mglGraph *gr)	// flag #
+{
+	gr->SubPlot(2,2,0,"");	gr->Title("Line, Curve, Rhomb, Ellipse","",-1.5);
+	gr->Line(mglPoint(-1,-1),mglPoint(-0.5,1),"qAI");
+	gr->Curve(mglPoint(-0.6,-1),mglPoint(1,1),mglPoint(0,1),mglPoint(1,1),"rA");
+	gr->Rhomb(mglPoint(0,0.4),mglPoint(1,0.9),0.2,"b#");
+	gr->Rhomb(mglPoint(0,0),mglPoint(1,0.4),0.2,"cg@");
+	gr->Ellipse(mglPoint(0,-0.5),mglPoint(1,-0.1),0.2,"u#");
+	gr->Ellipse(mglPoint(0,-1),mglPoint(1,-0.6),0.2,"m@");
+	gr->Mark(mglPoint(0,-0.5),"*");	gr->Mark(mglPoint(1,-0.1),"*");
+
+	gr->SubPlot(2,3,1,"");	gr->Title("Arc, Polygon, Symbol","", -1.2*2);
+	gr->Arc(mglPoint(-0.6,0), mglPoint(-0.6,0.3), 180, "2kA");	gr->Ball(-0.6,0);
+	gr->Polygon(mglPoint(), mglPoint(0,0.4), 6, "r");
+	mglData x(50), y(50);	gr->Fill(x,"cos(3*pi*x)");	gr->Fill(y,"sin(pi*x)");
+	gr->DefineSymbol('a',x,y);	gr->Symbol(mglPoint(0.7),'a');
+
+	gr->Light(true);
+	gr->SubPlot(2,3,3,"<^>",0,-0.2);	gr->Title("Face[xyz]", "", -1.5*2);
+	gr->Rotate(50,60);	gr->Box();
+	gr->FaceX(mglPoint(1,0,-1),1,1,"r");
+	gr->FaceY(mglPoint(-1,-1,-1),1,1,"g");
+	gr->FaceZ(mglPoint(1,-1,-1),-1,1,"b");
+	gr->Face(mglPoint(-1,-1,1),mglPoint(-1,1,1),mglPoint(1,-1,0),mglPoint(1,1,1),"bmgr");
+
+	gr->SubPlot(2,3,5,"");	gr->Title("Cone", "", -1.5*2);
+	gr->Cone(mglPoint(-0.7,-0.3),mglPoint(-0.7,0.7,0.5),0.2,0.1,"b");
+	gr->Puts(mglPoint(-0.7,-0.7),"no edges\n(default)","", -1.5);
+	gr->Cone(mglPoint(0,-0.3),mglPoint(0,0.7,0.5),0.2,0.1,"g@");
+	gr->Puts(mglPoint(0,-0.7),"with edges\n('\\@' style)","", -1.5);
+	gr->Cone(mglPoint(0.7,-0.3),mglPoint(0.7,0.7,0.5),0.2,0,"ry");
+	gr->Puts(mglPoint(0.7,-0.7),"'arrow' with\ngradient","", -1.5);
+
+	gr->SubPlot(2,2,2,"");	gr->Title("Sphere and Drop");	gr->Alpha(false);
+	gr->Puts(mglPoint(-0.9,0.4),"sh=0");		gr->Ball(mglPoint(-0.9,0,1),'k');
+	gr->Drop(mglPoint(-0.9,0),mglPoint(0,1),0.5,"r",0);
+	gr->Puts(mglPoint(-0.3,0.6),"sh=0.33");	gr->Ball(mglPoint(-0.3,0,1),'k');
+	gr->Drop(mglPoint(-0.3,0),mglPoint(0,1),0.5,"r",0.33);
+	gr->Puts(mglPoint(0.3,0.8),"sh=0.67");		gr->Ball(mglPoint(0.3,0,1),'k');
+	gr->Drop(mglPoint(0.3,0),mglPoint(0,1),0.5,"r",0.67);
+	gr->Puts(mglPoint(0.9,1),"sh=1");			gr->Ball(mglPoint(0.9,0,1),'k');
+	gr->Drop(mglPoint(0.9,0),mglPoint(0,1),0.5,"r",1);
+	gr->Line(mglPoint(-0.9,0,1),mglPoint(0.9,0,1),"b");
+
+	gr->Puts(mglPoint(-0.9,-1.1),"asp=0.33");
+	gr->Drop(mglPoint(-0.9,-0.7),mglPoint(0,1),0.5,"b",0,0.33);
+	gr->Puts(mglPoint(-0.3,-1.1),"asp=0.67");
+	gr->Drop(mglPoint(-0.3,-0.7),mglPoint(0,1),0.5,"b",0,0.67);
+	gr->Puts(mglPoint(0.3,-1.1),"asp=1");
+	gr->Drop(mglPoint(0.3,-0.7),mglPoint(0,1),0.5,"b",0,1);
+	gr->Puts(mglPoint(0.9,-1.1),"asp=1.5");
+	gr->Drop(mglPoint(0.9,-0.7),mglPoint(0,1),0.5,"b",0,1.5);
+}
+
Sample primitives +
+
+ + + +

10.88 Sample ‘projection

+ + +

Example of plot projection (ternary=4). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample':ternary 4:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+

C++ code: +

void smgl_projection(mglGraph *gr)	// flag #
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+	a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+	x.Modify("0.25*(1+cos(2*pi*x))");
+	y.Modify("0.25*(1+sin(2*pi*x))");
+	rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+	z.Modify("x");
+
+	if(big!=3)	gr->Title("Projection sample");
+	gr->Ternary(4);
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('x',"X",1);	gr->Label('y',"Y",1);	gr->Label('z',"Z",1);
+}
+
Sample projection +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.89 Sample ‘projection5

+ + +

Example of plot projection in ternary coordinates (ternary=5). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample (ternary)':ternary 5:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+

C++ code: +

void smgl_projection5(mglGraph *gr)	// flag #
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+	a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+	x.Modify("0.25*(1+cos(2*pi*x))");
+	y.Modify("0.25*(1+sin(2*pi*x))");
+	rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+	z.Modify("x");
+
+	if(big!=3)	gr->Title("Projection sample (ternary)");
+	gr->Ternary(5);
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('x',"X",1);	gr->Label('y',"Y",1);	gr->Label('z',"Z",1);
+}
+
Sample projection5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.90 Sample ‘pulse

+ + +

Example of pulse parameter determining. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Pulse sample'
+new a 100 'exp(-6*x^2)':ranges 0 a.nx-1 0 1
+axis:plot a
+
+pulse b a 'x'
+
+define m a.max
+
+line b(1) 0 b(1) m 'r='
+line b(1)-b(3)/2 0  b(1)-b(3)/2 m 'm|'
+line b(1)+b(3)/2 0  b(1)+b(3)/2 m 'm|'
+line 0 0.5*m a.nx-1 0.5*m 'h'
+new x 100 'x'
+plot b(0)*(1-((x-b(1))/b(2))^2) 'g'
+
+

C++ code: +

void smgl_pulse(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Pulse sample");
+	mglData a(100);	gr->Fill(a,"exp(-6*x^2)");
+	gr->SetRanges(0, a.nx-1, 0, 1);
+	gr->Axis();	gr->Plot(a);
+	mglData b(a.Pulse('x'));
+	double m = b[0];
+	gr->Line(mglPoint(b[1],0), mglPoint(b[1],m),"r=");
+	gr->Line(mglPoint(b[1]-b[3]/2,0), mglPoint(b[1]-b[3]/2,m),"m|");
+	gr->Line(mglPoint(b[1]+b[3]/2,0), mglPoint(b[1]+b[3]/2,m),"m|");
+	gr->Line(mglPoint(0,m/2), mglPoint(a.nx-1,m/2),"h");
+	char func[128];	sprintf(func,"%g*(1-((x-%g)/%g)^2)",b[0],b[1],b[2]);
+	gr->FPlot(func,"g");
+}
+
Sample pulse +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.91 Sample ‘qo2d

+ + +

Example of PDE solving by quasioptical approach qo2d. +

+

MGL code: +

define $1 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)'
+subplot 1 1 0 '<_':title 'Beam and ray tracing'
+ray r $1 -0.7 -1 0 0 0.5 0 0.02 2:plot r(0) r(1) 'k'
+axis:xlabel '\i x':ylabel '\i z'
+new re 128 'exp(-48*x^2)':new im 128
+new xx 1:new yy 1
+qo2d a $1 re im r 1 30 xx yy
+crange 0 1:dens xx yy a 'wyrRk':fplot '-x' 'k|'
+text 0 0.85 'absorption: (x+y)/2 for x+y>0'
+text 0.7 -0.05 'central ray'
+
+

C++ code: +

void smgl_qo2d(mglGraph *gr)
+{
+	mglData r, xx, yy, a, im(128), re(128);
+	const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+	r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+	if(big!=3)	{gr->SubPlot(1,1,0,"<_");	gr->Title("Beam and ray tracing");}
+	gr->Plot(r.SubData(0), r.SubData(1), "k");
+	gr->Axis();	gr->Label('x', "\\i x");	gr->Label('y', "\\i y");
+	// now start beam tracing
+	gr->Fill(re,"exp(-48*x^2)");
+	a = mglQO2d(ham, re, im, r, xx, yy, 1, 30);
+	gr->SetRange('c',0, 1);
+	gr->Dens(xx, yy, a, "wyrRk");
+	gr->FPlot("-x", "k|");
+	gr->Puts(mglPoint(0, 0.85), "absorption: (x+y)/2 for x+y>0");
+	gr->Puts(mglPoint(0.7, -0.05), "central ray");
+}
+
Sample qo2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.92 Sample ‘quality0

+ + +

Show all kind of primitives in quality=0. +

+

MGL code: +

quality 0
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality0(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(0);	all_prims(gr);
+}
+
Sample quality0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.93 Sample ‘quality1

+ + +

Show all kind of primitives in quality=1. +

+

MGL code: +

quality 1
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality1(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(1);	all_prims(gr);	
+}
+
Sample quality1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.94 Sample ‘quality2

+ + +

Show all kind of primitives in quality=2. +

+

MGL code: +

quality 2
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality2(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(2);	all_prims(gr);	
+}
+
Sample quality2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.95 Sample ‘quality4

+ + +

Show all kind of primitives in quality=4. +

+

MGL code: +

quality 4
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality4(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(4);	all_prims(gr);	
+}
+
Sample quality4 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.96 Sample ‘quality5

+ + +

Show all kind of primitives in quality=5. +

+

MGL code: +

quality 5
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality5(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(5);	all_prims(gr);	
+}
+
Sample quality5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.97 Sample ‘quality6

+ + +

Show all kind of primitives in quality=6. +

+

MGL code: +

quality 6
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality6(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(6);	all_prims(gr);	
+}
+
Sample quality6 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.98 Sample ‘quality8

+ + +

Show all kind of primitives in quality=8. +

+

MGL code: +

quality 8
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality8(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(8);	all_prims(gr);	
+}
+
Sample quality8 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.99 Sample ‘radar

+ + +

The radar plot is variant of plot, which make plot in polar coordinates and draw radial rays in point directions. If you just need a plot in polar coordinates then I recommend to use Curvilinear coordinates or plot in parametric form with x=r*cos(fi); y=r*sin(fi);. +

+

MGL code: +

new yr 10 3 '0.4*sin(pi*(x+1.5+y/2)+0.1*rnd)'
+subplot 1 1 0 '':title 'Radar plot (with grid, "\#")':radar yr '#'
+
+

C++ code: +

void smgl_radar(mglGraph *gr)
+{
+	mglData yr(10,3);	yr.Modify("0.4*sin(pi*(2*x+y))+0.1*rnd");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Radar plot (with grid, '\\#')");	}
+	gr->Radar(yr,"#");
+}
+
Sample radar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.100 Sample ‘refill

+ + +

Example of refill and gspline. +

+

MGL code: +

new x 10 '0.5+rnd':cumsum x 'x':norm x -1 1
+copy y sin(pi*x)/1.5
+subplot 2 2 0 '<_':title 'Refill sample'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:refill r x y:plot r 'r'
+
+subplot 2 2 1 '<_':title 'Global spline'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:gspline r x y:plot r 'r'
+
+new y 10 '0.5+rnd':cumsum y 'x':norm y -1 1
+copy xx x:extend xx 10
+copy yy y:extend yy 10:transpose yy
+copy z sin(pi*xx*yy)/1.5
+alpha on:light on
+subplot 2 2 2:title '2d regular':rotate 40 60
+box:axis:mesh xx yy z 'k'
+new rr 100 100:refill rr x y z:surf rr
+
+new xx 10 10 '(x+1)/2*cos(y*pi/2-1)':new yy 10 10 '(x+1)/2*sin(y*pi/2-1)'
+copy z sin(pi*xx*yy)/1.5
+subplot 2 2 3:title '2d non-regular':rotate 40 60
+box:axis:plot xx yy z 'ko '
+new rr 100 100:refill rr xx yy z:surf rr
+
+

C++ code: +

void smgl_refill(mglGraph *gr)
+{
+	mglData x(10), y(10), r(100);
+	x.Modify("0.5+rnd");	x.CumSum("x");	x.Norm(-1,1);
+	y.Modify("sin(pi*v)/1.5",x);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"<_");	gr->Title("Refill sample");	}
+	gr->Axis();	gr->Box();	gr->Plot(x,y,"o ");
+	gr->Refill(r,x,y);	// or you can use r.Refill(x,y,-1,1);
+	gr->Plot(r,"r");	gr->FPlot("sin(pi*x)/1.5","B:");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Global spline");
+	gr->Axis();	gr->Box();	gr->Plot(x,y,"o ");
+	r.RefillGS(x,y,-1,1);	gr->Plot(r,"r");
+	gr->FPlot("sin(pi*x)/1.5","B:");
+
+	gr->Alpha(true);	gr->Light(true);
+	mglData z(10,10), xx(10,10), yy(10,10), rr(100,100);
+	y.Modify("0.5+rnd");	y.CumSum("x");	y.Norm(-1,1);
+	for(int i=0;i<10;i++)	for(int j=0;j<10;j++)
+		z.a[i+10*j] = sin(M_PI*x.a[i]*y.a[j])/1.5;
+	gr->SubPlot(2,2,2);	gr->Title("2d regular");	gr->Rotate(40,60);
+	gr->Axis();	gr->Box();	gr->Mesh(x,y,z,"k");
+	gr->Refill(rr,x,y,z);	gr->Surf(rr);
+
+	gr->Fill(xx,"(x+1)/2*cos(y*pi/2-1)");
+	gr->Fill(yy,"(x+1)/2*sin(y*pi/2-1)");
+	for(int i=0;i<10*10;i++)
+		z.a[i] = sin(M_PI*xx.a[i]*yy.a[i])/1.5;
+	gr->SubPlot(2,2,3);	gr->Title("2d non-regular");	gr->Rotate(40,60);
+	gr->Axis();	gr->Box();	gr->Plot(xx,yy,z,"ko ");
+	gr->Refill(rr,xx,yy,z);	gr->Surf(rr);
+}
+
Sample refill +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.101 Sample ‘region

+ + +

Function region fill the area between 2 curves. It support gradient filling if 2 colors per curve is specified. Also it can fill only the region y1<y<y2 if style ‘i’ is used. +

+

MGL code: +

call 'prepare1d'
+copy y1 y(:,1):copy y2 y(:,2)
+subplot 2 2 0 '':title 'Region plot (default)':box:region y1 y2:plot y1 'k2':plot y2 'k2'
+subplot 2 2 1 '':title '2 colors':box:region y1 y2 'yr':plot y1 'k2':plot y2 'k2'
+subplot 2 2 2 '':title '"i" style':box:region y1 y2 'ir':plot y1 'k2':plot y2 'k2'
+subplot 2 2 3 '^_':title '3d variant':rotate 40 60:box
+new x1 100 'sin(pi*x)':new y1 100 'cos(pi*x)':new z 100 'x'
+new x2 100 'sin(pi*x+pi/3)':new y2 100 'cos(pi*x+pi/3)'
+plot x1 y1 z 'r2':plot x2 y2 z 'b2'
+region x1 y1 z x2 y2 z 'cmy!'
+
+

C++ code: +

void smgl_region(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);
+	mglData y1 = y.SubData(-1,1), y2 = y.SubData(-1,2);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Region plot (default)");	}
+	gr->Box();	gr->Region(y1,y2);	gr->Plot(y1,"k2");	gr->Plot(y2,"k2");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Region(y1,y2,"yr");	gr->Plot(y1,"k2");	gr->Plot(y2,"k2");
+	gr->SubPlot(2,2,2,"");	gr->Title("'i' style");	gr->Box();	gr->Region(y1,y2,"ir");	gr->Plot(y1,"k2");	gr->Plot(y2,"k2");
+	gr->SubPlot(2,2,3,"^_");	gr->Title("3d variant");	gr->Rotate(40,60);	gr->Box();
+	gr->Fill(y1,"cos(pi*x)");	gr->Fill(y2,"cos(pi*x+pi/3)");
+	mglData x1(y1.nx), x2(y1.nx), z(y1.nx);
+	gr->Fill(x1,"sin(pi*x)");	gr->Fill(x2,"sin(pi*x+pi/3)");	gr->Fill(z,"x");
+	gr->Plot(x1,y1,z,"r2");		gr->Plot(x2,y2,z,"b2");
+	gr->Region(x1,y1,z,x2,y2,z,"cmy!");
+}
+
Sample region +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.102 Sample ‘scanfile

+ + +

Example of scanfile for reading ’named’ data. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Save and scanfile sample'
+list a 1 -1 0
+save 'This is test: 0 -> ',a(0),' q' 'test.txt' 'w'
+save 'This is test: 1 -> ',a(1),' q' 'test.txt'
+save 'This is test: 2 -> ',a(2),' q' 'test.txt'
+
+scanfile a 'test.txt' 'This is test: %g -> %g'
+ranges a(0) a(1):axis:plot a(0) a(1) 'o'
+
+

C++ code: +

void smgl_scanfile(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Save and scanfile sample");
+	FILE *fp=fopen("test.txt","w");
+	fprintf(fp,"This is test: 0 -> 1 q\n");
+	fprintf(fp,"This is test: 1 -> -1 q\n");
+	fprintf(fp,"This is test: 2 -> 0 q\n");
+	fclose(fp);
+
+	mglData a;
+	a.ScanFile("test.txt","This is test: %g -> %g");
+	gr->SetRanges(a.SubData(0), a.SubData(1));
+	gr->Axis();	gr->Plot(a.SubData(0),a.SubData(1),"o");
+}
+
Sample scanfile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.103 Sample ‘schemes

+ + +

Example of popular color schemes. +

+

MGL code: +

new x 100 100 'x':new y 100 100 'y'
+call 'sch' 0 'kw'
+call 'sch' 1 '%gbrw'
+call 'sch' 2 'kHCcw'
+call 'sch' 3 'kBbcw'
+call 'sch' 4 'kRryw'
+call 'sch' 5 'kGgew'
+call 'sch' 6 'BbwrR'
+call 'sch' 7 'BbwgG'
+call 'sch' 8 'GgwmM'
+call 'sch' 9 'UuwqR'
+call 'sch' 10 'QqwcC'
+call 'sch' 11 'CcwyY'
+call 'sch' 12 'bcwyr'
+call 'sch' 13 'bwr'
+call 'sch' 14 'wUrqy'
+call 'sch' 15 'UbcyqR'
+call 'sch' 16 'BbcyrR'
+call 'sch' 17 'bgr'
+call 'sch' 18 'BbcyrR|'
+call 'sch' 19 'b{g,0.3}r'
+stop
+func 'sch' 2
+subplot 2 10 $1 '<>_^' 0.2 0:surfa x y $2
+text 0.07+0.5*mod($1,2) 0.92-0.1*int($1/2) $2 'A'
+return
+
+

C++ code: +

void smgl_schemes(mglGraph *gr)	// Color table
+{
+	mglData a(256,2), b(256,2);	a.Fill(-1,1);	b.Fill(-1,1,'y');
+	gr->SubPlot(2,10,0,NULL,0.2);	gr->Dens(a,"kw");		gr->Puts(0.07, 0.92, "kw", "A");
+	gr->SubPlot(2,10,1,NULL,0.2);	gr->SurfA(a,b,"%gbrw");	gr->Puts(0.57, 0.92, "%gbrw", "A");
+	gr->SubPlot(2,10,2,NULL,0.2);	gr->Dens(a,"kHCcw");	gr->Puts(0.07, 0.82, "kHCcw", "A");
+	gr->SubPlot(2,10,3,NULL,0.2);	gr->Dens(a,"kBbcw");	gr->Puts(0.57, 0.82, "kBbcw", "A");
+	gr->SubPlot(2,10,4,NULL,0.2);	gr->Dens(a,"kRryw");	gr->Puts(0.07, 0.72, "kRryw", "A");
+	gr->SubPlot(2,10,5,NULL,0.2);	gr->Dens(a,"kGgew");	gr->Puts(0.57, 0.72, "kGgew", "A");
+	gr->SubPlot(2,10,6,NULL,0.2);	gr->Dens(a,"BbwrR");	gr->Puts(0.07, 0.62, "BbwrR", "A");
+	gr->SubPlot(2,10,7,NULL,0.2);	gr->Dens(a,"BbwgG");	gr->Puts(0.57, 0.62, "BbwgG", "A");
+	gr->SubPlot(2,10,8,NULL,0.2);	gr->Dens(a,"GgwmM");	gr->Puts(0.07, 0.52, "GgwmM", "A");
+	gr->SubPlot(2,10,9,NULL,0.2);	gr->Dens(a,"UuwqR");	gr->Puts(0.57, 0.52, "UuwqR", "A");
+	gr->SubPlot(2,10,10,NULL,0.2);	gr->Dens(a,"QqwcC");	gr->Puts(0.07, 0.42, "QqwcC", "A");
+	gr->SubPlot(2,10,11,NULL,0.2);	gr->Dens(a,"CcwyY");	gr->Puts(0.57, 0.42, "CcwyY", "A");
+	gr->SubPlot(2,10,12,NULL,0.2);	gr->Dens(a,"bcwyr");	gr->Puts(0.07, 0.32, "bcwyr", "A");
+	gr->SubPlot(2,10,13,NULL,0.2);	gr->Dens(a,"bwr");		gr->Puts(0.57, 0.32, "bwr", "A");
+	gr->SubPlot(2,10,14,NULL,0.2);	gr->Dens(a,"wUrqy");	gr->Puts(0.07, 0.22, "wUrqy", "A");
+	gr->SubPlot(2,10,15,NULL,0.2);	gr->Dens(a,"UbcyqR");	gr->Puts(0.57, 0.22, "UbcyqR", "A");
+	gr->SubPlot(2,10,16,NULL,0.2);	gr->Dens(a,"BbcyrR");	gr->Puts(0.07, 0.12, "BbcyrR", "A");
+	gr->SubPlot(2,10,17,NULL,0.2);	gr->Dens(a,"bgr");		gr->Puts(0.57, 0.12, "bgr", "A");
+	gr->SubPlot(2,10,18,NULL,0.2);	gr->Dens(a,"BbcyrR|");	gr->Puts(0.07, 0.02, "BbcyrR|", "A");
+	gr->SubPlot(2,10,19,NULL,0.2);	gr->Dens(a,"b{g,0.3}r");		gr->Puts(0.57, 0.02, "b\\{g,0.3\\}r", "A");
+}
+
Sample schemes +
+
+ + + +

10.104 Sample ‘section

+ + +

Example of section to separate data and join it back. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Section&Join sample'
+axis:box:line -1 0 1 0 'h:'
+# first lets demonstrate 'join'
+new aa 11 'x^2':new a1 3 '-x':new a2 15 'x^3'
+join aa a1:join aa a2
+# add x-coordinate
+new xx aa.nx 'x':join aa xx
+plot aa(:,1) aa(:,0) '2y'
+# now select 1-st (id=0) section between zeros
+section b1 aa 0 'x' 0
+plot b1(:,1) b1(:,0) 'bo'
+# next, select 3-d (id=2) section between zeros
+section b3 aa 2 'x' 0
+plot b3(:,1) b3(:,0) 'gs'
+# finally, select 2-nd (id=-2) section from the end
+section b4 aa -2 'x' 0
+plot b4(:,1) b4(:,0) 'r#o'
+
+

C++ code: +

void smgl_section(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Section&Join sample");
+	gr->Axis();	gr->Box();	gr->Line(mglPoint(-1,0),mglPoint(1,0),"h:");
+	// first lets demonstrate 'join'
+	mglData aa(11), a1(3), a2(15);
+	gr->Fill(aa,"x^2");	gr->Fill(a1,"-x");	gr->Fill(a2,"x^3");
+	aa.Join(a1);	aa.Join(a2);
+	// add x-coordinate
+	mglData xx(aa.nx);	gr->Fill(xx,"x");	aa.Join(xx);
+	gr->Plot(aa.SubData(-1,1), aa.SubData(-1,0), "2y");
+	// now select 1-st (id=0) section between zeros
+	mglData b1(aa.Section(0,'x',0));
+	gr->Plot(b1.SubData(-1,1), b1.SubData(-1,0), "bo");
+	// next, select 3-d (id=2) section between zeros
+	mglData b2(aa.Section(2,'x',0));
+	gr->Plot(b2.SubData(-1,1), b2.SubData(-1,0), "gs");
+	// finally, select 2-nd (id=-2) section from the end
+	mglData b3(aa.Section(-2,'x',0));
+	gr->Plot(b3.SubData(-1,1), b3.SubData(-1,0), "r#o");
+}
+
Sample section +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.105 Sample ‘several_light

+ + +

Example of using several light sources. +

+

MGL code: +

call 'prepare2d'
+title 'Several light sources':rotate 50 60:light on
+light 1 0 1 0 'c':light 2 1 0 0 'y':light 3 0 -1 0 'm'
+box:surf a 'h'
+
+

C++ code: +

void smgl_several_light(mglGraph *gr)	// several light sources
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Several light sources");
+	gr->Rotate(50,60);	gr->Light(true);	gr->AddLight(1,mglPoint(0,1,0),'c');
+	gr->AddLight(2,mglPoint(1,0,0),'y');	gr->AddLight(3,mglPoint(0,-1,0),'m');
+	gr->Box();	gr->Surf(a,"h");
+}
+
Sample several_light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.106 Sample ‘solve

+ + +

Example of solve for root finding. +

+

MGL code: +

zrange 0 1
+new x 20 30 '(x+2)/3*cos(pi*y)'
+new y 20 30 '(x+2)/3*sin(pi*y)'
+new z 20 30 'exp(-6*x^2-2*sin(pi*y)^2)'
+
+subplot 2 1 0:title 'Cartesian space':rotate 30 -40
+axis 'xyzU':box
+xlabel 'x':ylabel 'y'
+origin 1 1:grid 'xy'
+mesh x y z
+
+# section along 'x' direction
+solve u x 0.5 'x'
+var v u.nx 0 1
+evaluate yy y u v
+evaluate xx x u v
+evaluate zz z u v
+plot xx yy zz 'k2o'
+
+# 1st section along 'y' direction
+solve u1 x -0.5 'y'
+var v1 u1.nx 0 1
+evaluate yy y v1 u1
+evaluate xx x v1 u1
+evaluate zz z v1 u1
+plot xx yy zz 'b2^'
+
+# 2nd section along 'y' direction
+solve u2 x -0.5 'y' u1
+evaluate yy y v1 u2
+evaluate xx x v1 u2
+evaluate zz z v1 u2
+plot xx yy zz 'r2v'
+
+subplot 2 1 1:title 'Accompanied space'
+ranges 0 1 0 1:origin 0 0
+axis:box:xlabel 'i':ylabel 'j':grid2 z 'h'
+
+plot u v 'k2o':line 0.4 0.5 0.8 0.5 'kA'
+plot v1 u1 'b2^':line 0.5 0.15 0.5 0.3 'bA'
+plot v1 u2 'r2v':line 0.5 0.7 0.5 0.85 'rA'
+
+

C++ code: +

void smgl_solve(mglGraph *gr)	// solve and evaluate
+{
+	gr->SetRange('z',0,1);
+	mglData x(20,30), y(20,30), z(20,30), xx,yy,zz;
+	gr->Fill(x,"(x+2)/3*cos(pi*y)");
+	gr->Fill(y,"(x+2)/3*sin(pi*y)");
+	gr->Fill(z,"exp(-6*x^2-2*sin(pi*y)^2)");
+
+	gr->SubPlot(2,1,0);	gr->Title("Cartesian space");	gr->Rotate(30,-40);
+	gr->Axis("xyzU");	gr->Box();	gr->Label('x',"x");	gr->Label('y',"y");
+	gr->SetOrigin(1,1);	gr->Grid("xy");
+	gr->Mesh(x,y,z);
+
+	// section along 'x' direction
+	mglData u = x.Solve(0.5,'x');
+	mglData v(u.nx);	v.Fill(0,1);
+	xx = x.Evaluate(u,v);	yy = y.Evaluate(u,v);	zz = z.Evaluate(u,v);
+	gr->Plot(xx,yy,zz,"k2o");
+
+	// 1st section along 'y' direction
+	mglData u1 = x.Solve(-0.5,'y');
+	mglData v1(u1.nx);	v1.Fill(0,1);
+	xx = x.Evaluate(v1,u1);	yy = y.Evaluate(v1,u1);	zz = z.Evaluate(v1,u1);
+	gr->Plot(xx,yy,zz,"b2^");
+
+	// 2nd section along 'y' direction
+	mglData u2 = x.Solve(-0.5,'y',u1);
+	xx = x.Evaluate(v1,u2);	yy = y.Evaluate(v1,u2);	zz = z.Evaluate(v1,u2);
+	gr->Plot(xx,yy,zz,"r2v");
+
+	gr->SubPlot(2,1,1);	gr->Title("Accompanied space");
+	gr->SetRanges(0,1,0,1);	gr->SetOrigin(0,0);
+	gr->Axis();	gr->Box();	gr->Label('x',"i");	gr->Label('y',"j");
+	gr->Grid(z,"h");
+
+	gr->Plot(u,v,"k2o");	gr->Line(mglPoint(0.4,0.5),mglPoint(0.8,0.5),"kA");
+	gr->Plot(v1,u1,"b2^");	gr->Line(mglPoint(0.5,0.15),mglPoint(0.5,0.3),"bA");
+	gr->Plot(v1,u2,"r2v");	gr->Line(mglPoint(0.5,0.7),mglPoint(0.5,0.85),"rA");
+}
+
Sample solve +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.107 Sample ‘stem

+ + +

Function stem draw vertical bars. It is most attractive if markers are drawn too. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Stem plot (default)':box:stem y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:stem xc yc z 'rx'
+subplot 2 2 2 '':title '"!" style':box:stem y 'o!rgb'
+
+

C++ code: +

void smgl_stem(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Stem plot (default)");	}
+	gr->Box();	gr->Stem(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Stem(xc,yc,z,"rx");
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style");	gr->Box();	gr->Stem(y,"o!rgb");
+}
+
Sample stem +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.108 Sample ‘step

+ + +

Function step plot data as stairs. At this stairs can be centered if sizes are differ by 1. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Step plot (default)':box:step y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:step xc yc z 'r'
+subplot 2 2 2 '':title '"!" style':box:step y 's!rgb'
+
+

C++ code: +

void smgl_step(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Step plot (default)");	}
+	gr->Box();	gr->Step(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Step(xc,yc,z,"r");
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style");	gr->Box();	gr->Step(y,"s!rgb");
+}
+
Sample step +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.109 Sample ‘stereo

+ + +

Example of stereo image of surf. +

+

MGL code: +

call 'prepare2d'
+light on
+subplot 2 1 0:rotate 50 60+1:box:surf a
+subplot 2 1 1:rotate 50 60-1:box:surf a
+
+

C++ code: +

void smgl_stereo(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->Light(true);
+	gr->SubPlot(2,1,0);	gr->Rotate(50,60+1);
+	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,1,1);	gr->Rotate(50,60-1);
+	gr->Box();	gr->Surf(a);
+}
+
Sample stereo +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.110 Sample ‘stfa

+ + +

Example of stfa. +

+

MGL code: +

new a 2000:new b 2000
+fill a 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)'
+subplot 1 2 0 '<_':title 'Initial signal':plot a:axis:xlabel '\i t'
+subplot 1 2 1 '<_':title 'STFA plot':stfa a b 64:axis:ylabel '\omega' 0:xlabel '\i t'
+
+

C++ code: +

void smgl_stfa(mglGraph *gr)	// STFA sample
+{
+	mglData a(2000), b(2000);
+	gr->Fill(a,"cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+	cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)");
+	gr->SubPlot(1, 2, 0,"<_");	gr->Title("Initial signal");
+	gr->Plot(a);
+	gr->Axis();
+	gr->Label('x', "\\i t");
+
+	gr->SubPlot(1, 2, 1,"<_");	gr->Title("STFA plot");
+	gr->STFA(a, b, 64);
+	gr->Axis();
+	gr->Label('x', "\\i t");
+	gr->Label('y', "\\omega", 0);
+}
+
Sample stfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.111 Sample ‘style

+ + +

Example of colors and styles for plots. +

+

MGL code: +

+
+

C++ code: +

void smgl_style(mglGraph *gr)	// pen styles
+{
+	gr->SubPlot(2,2,0);
+	double d,x1,x2,x0,y=1.1, y1=1.15;
+	d=0.3, x0=0.2, x1=0.5, x2=0.6;
+	gr->Line(mglPoint(x0,y1-0*d),mglPoint(x1,y1-0*d),"k-");	gr->Puts(mglPoint(x2,y-0*d),"Solid '-'",":rL");
+	gr->Line(mglPoint(x0,y1-1*d),mglPoint(x1,y1-1*d),"k|");	gr->Puts(mglPoint(x2,y-1*d),"Long Dash '|'",":rL");
+	gr->Line(mglPoint(x0,y1-2*d),mglPoint(x1,y1-2*d),"k;");	gr->Puts(mglPoint(x2,y-2*d),"Dash ';'",":rL");
+	gr->Line(mglPoint(x0,y1-3*d),mglPoint(x1,y1-3*d),"k=");	gr->Puts(mglPoint(x2,y-3*d),"Small dash '='",":rL");
+	gr->Line(mglPoint(x0,y1-4*d),mglPoint(x1,y1-4*d),"kj");	gr->Puts(mglPoint(x2,y-4*d),"Dash-dot 'j'",":rL");
+	gr->Line(mglPoint(x0,y1-5*d),mglPoint(x1,y1-5*d),"ki");	gr->Puts(mglPoint(x2,y-5*d),"Small dash-dot 'i'",":rL");
+	gr->Line(mglPoint(x0,y1-6*d),mglPoint(x1,y1-6*d),"k:");	gr->Puts(mglPoint(x2,y-6*d),"Dots ':'",":rL");
+	gr->Line(mglPoint(x0,y1-7*d),mglPoint(x1,y1-7*d),"k ");	gr->Puts(mglPoint(x2,y-7*d),"None ' '",":rL");
+	gr->Line(mglPoint(x0,y1-8*d),mglPoint(x1,y1-8*d),"k{df090}");	gr->Puts(mglPoint(x2,y-8*d),"Manual '{df090}'",":rL");
+
+	d=0.25; x1=-1; x0=-0.8;	y = -0.05;
+	gr->Mark(mglPoint(x1,5*d),"k.");		gr->Puts(mglPoint(x0,y+5*d),"'.'",":rL");
+	gr->Mark(mglPoint(x1,4*d),"k+");		gr->Puts(mglPoint(x0,y+4*d),"'+'",":rL");
+	gr->Mark(mglPoint(x1,3*d),"kx");		gr->Puts(mglPoint(x0,y+3*d),"'x'",":rL");
+	gr->Mark(mglPoint(x1,2*d),"k*");		gr->Puts(mglPoint(x0,y+2*d),"'*'",":rL");
+	gr->Mark(mglPoint(x1,d),"ks");		gr->Puts(mglPoint(x0,y+d),"'s'",":rL");
+	gr->Mark(mglPoint(x1,0),"kd");		gr->Puts(mglPoint(x0,y),"'d'",":rL");
+	gr->Mark(mglPoint(x1,-d,0),"ko");	gr->Puts(mglPoint(x0,y-d),"'o'",":rL");
+	gr->Mark(mglPoint(x1,-2*d,0),"k^");	gr->Puts(mglPoint(x0,y-2*d),"'\\^'",":rL");
+	gr->Mark(mglPoint(x1,-3*d,0),"kv");	gr->Puts(mglPoint(x0,y-3*d),"'v'",":rL");
+	gr->Mark(mglPoint(x1,-4*d,0),"k<");	gr->Puts(mglPoint(x0,y-4*d),"'<'",":rL");
+	gr->Mark(mglPoint(x1,-5*d,0),"k>");	gr->Puts(mglPoint(x0,y-5*d),"'>'",":rL");
+
+	d=0.25; x1=-0.5; x0=-0.3;	y = -0.05;
+	gr->Mark(mglPoint(x1,5*d),"k#.");	gr->Puts(mglPoint(x0,y+5*d),"'\\#.'",":rL");
+	gr->Mark(mglPoint(x1,4*d),"k#+");	gr->Puts(mglPoint(x0,y+4*d),"'\\#+'",":rL");
+	gr->Mark(mglPoint(x1,3*d),"k#x");	gr->Puts(mglPoint(x0,y+3*d),"'\\#x'",":rL");
+	gr->Mark(mglPoint(x1,2*d),"k#*");	gr->Puts(mglPoint(x0,y+2*d),"'\\#*'",":rL");
+	gr->Mark(mglPoint(x1,d),"k#s");		gr->Puts(mglPoint(x0,y+d),"'\\#s'",":rL");
+	gr->Mark(mglPoint(x1,0),"k#d");		gr->Puts(mglPoint(x0,y),"'\\#d'",":rL");
+	gr->Mark(mglPoint(x1,-d,0),"k#o");	gr->Puts(mglPoint(x0,y-d),"'\\#o'",":rL");
+	gr->Mark(mglPoint(x1,-2*d,0),"k#^");	gr->Puts(mglPoint(x0,y-2*d),"'\\#\\^'",":rL");
+	gr->Mark(mglPoint(x1,-3*d,0),"k#v");	gr->Puts(mglPoint(x0,y-3*d),"'\\#v'",":rL");
+	gr->Mark(mglPoint(x1,-4*d,0),"k#<");	gr->Puts(mglPoint(x0,y-4*d),"'\\#<'",":rL");
+	gr->Mark(mglPoint(x1,-5*d,0),"k#>");	gr->Puts(mglPoint(x0,y-5*d),"'\\#>'",":rL");
+
+	gr->SubPlot(2,2,1);
+	double a=0.1,b=0.4,c=0.5;
+	gr->Line(mglPoint(a,1),mglPoint(b,1),"k-A");		gr->Puts(mglPoint(c,1),"Style 'A' or 'A\\_'",":rL");
+	gr->Line(mglPoint(a,0.8),mglPoint(b,0.8),"k-V");	gr->Puts(mglPoint(c,0.8),"Style 'V' or 'V\\_'",":rL");
+	gr->Line(mglPoint(a,0.6),mglPoint(b,0.6),"k-K");	gr->Puts(mglPoint(c,0.6),"Style 'K' or 'K\\_'",":rL");
+	gr->Line(mglPoint(a,0.4),mglPoint(b,0.4),"k-I");	gr->Puts(mglPoint(c,0.4),"Style 'I' or 'I\\_'",":rL");
+	gr->Line(mglPoint(a,0.2),mglPoint(b,0.2),"k-D");	gr->Puts(mglPoint(c,0.2),"Style 'D' or 'D\\_'",":rL");
+	gr->Line(mglPoint(a,0),mglPoint(b,0),"k-S");		gr->Puts(mglPoint(c,0),"Style 'S' or 'S\\_'",":rL");
+	gr->Line(mglPoint(a,-0.2),mglPoint(b,-0.2),"k-O");	gr->Puts(mglPoint(c,-0.2),"Style 'O' or 'O\\_'",":rL");
+	gr->Line(mglPoint(a,-0.4),mglPoint(b,-0.4),"k-T");	gr->Puts(mglPoint(c,-0.4),"Style 'T' or 'T\\_'",":rL");
+	gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"k-X");	gr->Puts(mglPoint(c,-0.6),"Style 'X' or 'X\\_'",":rL");
+	gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-_");	gr->Puts(mglPoint(c,-0.8),"Style '\\_' or none",":rL");
+	gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-AS");		gr->Puts(mglPoint(c,-1),"Style 'AS'",":rL");
+	gr->Line(mglPoint(a,-1.2),mglPoint(b,-1.2),"k-_A");	gr->Puts(mglPoint(c,-1.2),"Style '\\_A'",":rL");
+
+	a=-1;	b=-0.7;	c=-0.6;
+	gr->Line(mglPoint(a,1),mglPoint(b,1),"kAA");		gr->Puts(mglPoint(c,1),"Style 'AA'",":rL");
+	gr->Line(mglPoint(a,0.8),mglPoint(b,0.8),"kVV");	gr->Puts(mglPoint(c,0.8),"Style 'VV'",":rL");
+	gr->Line(mglPoint(a,0.6),mglPoint(b,0.6),"kKK");	gr->Puts(mglPoint(c,0.6),"Style 'KK'",":rL");
+	gr->Line(mglPoint(a,0.4),mglPoint(b,0.4),"kII");	gr->Puts(mglPoint(c,0.4),"Style 'II'",":rL");
+	gr->Line(mglPoint(a,0.2),mglPoint(b,0.2),"kDD");	gr->Puts(mglPoint(c,0.2),"Style 'DD'",":rL");
+	gr->Line(mglPoint(a,0),mglPoint(b,0),"kSS");		gr->Puts(mglPoint(c,0),"Style 'SS'",":rL");
+	gr->Line(mglPoint(a,-0.2),mglPoint(b,-0.2),"kOO");	gr->Puts(mglPoint(c,-0.2),"Style 'OO'",":rL");
+	gr->Line(mglPoint(a,-0.4),mglPoint(b,-0.4),"kTT");	gr->Puts(mglPoint(c,-0.4),"Style 'TT'",":rL");
+	gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"kXX");	gr->Puts(mglPoint(c,-0.6),"Style 'XX'",":rL");
+	gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-__");	gr->Puts(mglPoint(c,-0.8),"Style '\\_\\_'",":rL");
+	gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-VA");		gr->Puts(mglPoint(c,-1),"Style 'VA'",":rL");
+	gr->Line(mglPoint(a,-1.2),mglPoint(b,-1.2),"k-AV");	gr->Puts(mglPoint(c,-1.2),"Style 'AV'",":rL");
+
+	gr->SubPlot(2,2,2);
+	//#LENUQ
+	gr->FaceZ(mglPoint(-1,	-1), 0.4, 0.3, "L#");	gr->Puts(mglPoint(-0.8,-0.9), "L", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-1), 0.4, 0.3, "E#");	gr->Puts(mglPoint(-0.4,-0.9), "E", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-1), 0.4, 0.3, "N#");	gr->Puts(mglPoint(0,  -0.9), "N", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-1), 0.4, 0.3, "U#");	gr->Puts(mglPoint(0.4,-0.9), "U", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-1), 0.4, 0.3, "Q#");	gr->Puts(mglPoint(0.8,-0.9), "Q", "w:C", -1.4);
+	//#lenuq
+	gr->FaceZ(mglPoint(-1,	-0.7), 0.4, 0.3, "l#");	gr->Puts(mglPoint(-0.8,-0.6), "l", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-0.7), 0.4, 0.3, "e#");	gr->Puts(mglPoint(-0.4,-0.6), "e", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-0.7), 0.4, 0.3, "n#");	gr->Puts(mglPoint(0,  -0.6), "n", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-0.7), 0.4, 0.3, "u#");	gr->Puts(mglPoint(0.4,-0.6), "u", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-0.7), 0.4, 0.3, "q#");	gr->Puts(mglPoint(0.8,-0.6), "q", "k:C", -1.4);
+	//#CMYkP
+	gr->FaceZ(mglPoint(-1,	-0.4), 0.4, 0.3, "C#");	gr->Puts(mglPoint(-0.8,-0.3), "C", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-0.4), 0.4, 0.3, "M#");	gr->Puts(mglPoint(-0.4,-0.3), "M", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-0.4), 0.4, 0.3, "Y#");	gr->Puts(mglPoint(0,  -0.3), "Y", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-0.4), 0.4, 0.3, "k#");	gr->Puts(mglPoint(0.4,-0.3), "k", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-0.4), 0.4, 0.3, "P#");	gr->Puts(mglPoint(0.8,-0.3), "P", "w:C", -1.4);
+	//#cmywp
+	gr->FaceZ(mglPoint(-1,	-0.1), 0.4, 0.3, "c#");	gr->Puts(mglPoint(-0.8, 0), "c", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-0.1), 0.4, 0.3, "m#");	gr->Puts(mglPoint(-0.4, 0), "m", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-0.1), 0.4, 0.3, "y#");	gr->Puts(mglPoint(0,   0), "y", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-0.1), 0.4, 0.3, "w#");	gr->Puts(mglPoint(0.4, 0), "w", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-0.1), 0.4, 0.3, "p#");	gr->Puts(mglPoint(0.8, 0), "p", "k:C", -1.4);
+	//#BGRHW
+	gr->FaceZ(mglPoint(-1,	0.2), 0.4, 0.3, "B#");	gr->Puts(mglPoint(-0.8, 0.3), "B", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,0.2), 0.4, 0.3, "G#");	gr->Puts(mglPoint(-0.4, 0.3), "G", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,0.2), 0.4, 0.3, "R#");	gr->Puts(mglPoint(0,   0.3), "R", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	0.2), 0.4, 0.3, "H#");	gr->Puts(mglPoint(0.4, 0.3), "H", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	0.2), 0.4, 0.3, "W#");	gr->Puts(mglPoint(0.8, 0.3), "W", "w:C", -1.4);
+	//#bgrhw
+	gr->FaceZ(mglPoint(-1,	0.5), 0.4, 0.3, "b#");	gr->Puts(mglPoint(-0.8, 0.6), "b", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,0.5), 0.4, 0.3, "g#");	gr->Puts(mglPoint(-0.4, 0.6), "g", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,0.5), 0.4, 0.3, "r#");	gr->Puts(mglPoint(0,   0.6), "r", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	0.5), 0.4, 0.3, "h#");	gr->Puts(mglPoint(0.4, 0.6), "h", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	0.5), 0.4, 0.3, "w#");	gr->Puts(mglPoint(0.8, 0.6), "w", "k:C", -1.4);
+	//#brighted
+	gr->FaceZ(mglPoint(-1,	0.8), 0.4, 0.3, "{r1}#");	gr->Puts(mglPoint(-0.8, 0.9), "\\{r1\\}", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,0.8), 0.4, 0.3, "{r3}#");	gr->Puts(mglPoint(-0.4, 0.9), "\\{r3\\}", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,0.8), 0.4, 0.3, "{r5}#");	gr->Puts(mglPoint(0,   0.9), "\\{r5\\}", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	0.8), 0.4, 0.3, "{r7}#");	gr->Puts(mglPoint(0.4, 0.9), "\\{r7\\}", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	0.8), 0.4, 0.3, "{r9}#");	gr->Puts(mglPoint(0.8, 0.9), "\\{r9\\}", "k:C", -1.4);
+	// HEX
+	gr->FaceZ(mglPoint(-1, -1.3), 1, 0.3, "{xff9966}#");	gr->Puts(mglPoint(-0.5,-1.2), "\\{xff9966\\}", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0,  -1.3), 1, 0.3, "{x83CAFF}#");	gr->Puts(mglPoint( 0.5,-1.2), "\\{x83CAFF\\}", "k:C", -1.4);
+
+	gr->SubPlot(2,2,3);
+	char stl[3]="r1", txt[4]="'1'";
+	for(int i=0;i<10;i++)
+	{
+		txt[1]=stl[1]='0'+i;
+		gr->Line(mglPoint(-1,0.2*i-1),mglPoint(1,0.2*i-1),stl);
+		gr->Puts(mglPoint(1.05,0.2*i-1),txt,":L");
+	}
+}
+
Sample style +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.112 Sample ‘surf

+ + +

Function surf is most standard way to visualize 2D data array. Surf use color scheme for coloring (see Color scheme). You can use ‘#’ style for drawing black meshes on the surface. +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Surf plot (default)':rotate 50 60:light on:box:surf a
+subplot 2 2 1:title '"\#" style; meshnum 10':rotate 50 60:box:surf a '#'; meshnum 10
+subplot 2 2 2:title '"." style':rotate 50 60:box:surf a '.'
+new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+new z 50 40 '0.8*cos(pi*(y+1)/2)'
+subplot 2 2 3:title 'parametric form':rotate 50 60:box:surf x y z 'BbwrR'
+
+

C++ code: +

void smgl_surf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Surf3 plot (default)");	}
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3(c);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,"#");
+	gr->SubPlot(2,2,2);	gr->Title("'.' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,".");
+}
+
Sample surf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.113 Sample ‘surf3

+ + +

Function surf3 is one of most suitable (for my opinion) functions to visualize 3D data. It draw the isosurface(s) – surface(s) of constant amplitude (3D analogue of contour lines). You can draw wired isosurfaces if specify ‘#’ style. +

+

MGL code: +

call 'prepare3d'
+light on:alpha on
+subplot 2 2 0:title 'Surf3 plot (default)'
+rotate 50 60:box:surf3 c
+subplot 2 2 1:title '"\#" style'
+rotate 50 60:box:surf3 c '#'
+subplot 2 2 2:title '"." style'
+rotate 50 60:box:surf3 c '.'
+
+

C++ code: +

void smgl_surf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Surf3 plot (default)");	}
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3(c);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,"#");
+	gr->SubPlot(2,2,2);	gr->Title("'.' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,".");
+}
+
Sample surf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.114 Sample ‘surf3a

+ + +

Function surf3c is similar to surf3 but its transparency is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3A plot':rotate 50 60:light on:alpha on:box:surf3a c d
+
+

C++ code: +

void smgl_surf3a(mglGraph *gr)
+{
+	mglData c,d;	mgls_prepare3d(&c,&d);
+	if(big!=3)	gr->Title("Surf3A plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3A(c,d);
+}
+
Sample surf3a +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.115 Sample ‘surf3c

+ + +

Function surf3c is similar to surf3 but its coloring is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3C plot':rotate 50 60:light on:alpha on:box:surf3c c d
+
+

C++ code: +

void smgl_surf3c(mglGraph *gr)
+{
+	mglData c,d;	mgls_prepare3d(&c,&d);
+	if(big!=3)	gr->Title("Surf3C plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3C(c,d);
+}
+
Sample surf3c +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.116 Sample ‘surf3ca

+ + +

Function surf3c is similar to surf3 but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3CA plot':rotate 50 60:light on:alpha on:box:surf3ca c d c
+
+

C++ code: +

void smgl_surf3ca(mglGraph *gr)
+{
+	mglData c,d;	mgls_prepare3d(&c,&d);
+	if(big!=3)	gr->Title("Surf3CA plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3CA(c,d,c);
+}
+
Sample surf3ca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.117 Sample ‘surfa

+ + +

Function surfa is similar to surf but its transparency is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfA plot':rotate 50 60:light on:alpha on:box:surfa a b
+
+

C++ code: +

void smgl_surfa(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	gr->Title("SurfA plot");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->Light(true);	gr->Box();
+	gr->SurfA(a,b);
+}
+
Sample surfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.118 Sample ‘surfc

+ + +

Function surfc is similar to surf but its coloring is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfC plot':rotate 50 60:light on:box:surfc a b
+
+

C++ code: +

void smgl_surfc(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	gr->Title("SurfC plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Box();	gr->SurfC(a,b);
+}
+
Sample surfc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.119 Sample ‘surfca

+ + +

Function surfca is similar to surf but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare2d'
+title 'SurfCA plot':rotate 50 60:light on:alpha on:box:surfca a b a
+
+

C++ code: +

void smgl_surfca(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	gr->Title("SurfCA plot");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->Light(true);	gr->Box();
+	gr->SurfCA(a,b,a);
+}
+
Sample surfca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.120 Sample ‘table

+ + +

Function table draw table with data values. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+subplot 2 2 0:title 'Table sample':box
+table ys 'y_1\n{}y_2\n{}y_3'
+
+subplot 2 2 1:title 'no borders, colored'
+table ys 'y_1\n{}y_2\n{}y_3' 'r|'
+
+subplot 2 2 2:title 'no font decrease'
+table ys 'y_1\n{}y_2\n{}y_3' '#'
+
+subplot 2 2 3:title 'manual width and position':box
+table 0.5 0.95 ys 'y_1\n{}y_2\n{}y_3' '#';value 0.7
+
+

C++ code: +

void smgl_table(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Table plot");	}
+	gr->Table(ys,"y_1\ny_2\ny_3");	gr->Box();
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("no borders, colored");
+	gr->Table(ys,"y_1\ny_2\ny_3","r|");
+	gr->SubPlot(2,2,2);	gr->Title("no font decrease");
+	gr->Table(ys,"y_1\ny_2\ny_3","#");
+	gr->SubPlot(2,2,3);	gr->Title("manual width, position");
+	gr->Table(0.5, 0.95, ys,"y_1\ny_2\ny_3","#", "value 0.7");	gr->Box();
+}
+
Sample table +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.121 Sample ‘tape

+ + +

Function tape draw tapes which rotate around the curve as transverse orts of accompanied coordinates. +

+

MGL code: +

call 'prepare1d'
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x'
+subplot 2 2 0 '':title 'Tape plot (default)':box:tape y:plot y 'k'
+subplot 2 2 1:title '3d variant, 2 colors':rotate 50 60:light on
+box:plot xc yc z 'k':tape xc yc z 'rg'
+subplot 2 2 2:title '3d variant, x only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'xr':tape xc yc z 'xr#'
+subplot 2 2 3:title '3d variant, z only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'zg':tape xc yc z 'zg#'
+
+

C++ code: +

void smgl_tape(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);
+	mglData xc(50), yc(50), z(50);
+	yc.Modify("sin(pi*(2*x-1))");
+	xc.Modify("cos(pi*2*x-pi)");	z.Fill(-1,1);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Tape plot (default)");	}
+	gr->Box();	gr->Tape(y);	gr->Plot(y,"k");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("3d variant, 2 colors");	gr->Rotate(50,60);	gr->Light(true);
+	gr->Box();	gr->Plot(xc,yc,z,"k");	gr->Tape(xc,yc,z,"rg");
+	gr->SubPlot(2,2,2);	gr->Title("3d variant, x only");	gr->Rotate(50,60);
+	gr->Box();	gr->Plot(xc,yc,z,"k");	gr->Tape(xc,yc,z,"xr");	gr->Tape(xc,yc,z,"xr#");
+	gr->SubPlot(2,2,3);	gr->Title("3d variant, z only");	gr->Rotate(50,60);
+	gr->Box();	gr->Plot(xc,yc,z,"k");	gr->Tape(xc,yc,z,"zg");	gr->Tape(xc,yc,z,"zg#");
+}
+
Sample tape +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.122 Sample ‘tens

+ + +

Function tens is variant of plot with smooth coloring along the curves. At this, color is determined as for surfaces (see Color scheme). +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Tens plot (default)':box:tens y(:,0) y(:,1)
+subplot 2 2 2 '':title '" " style':box:tens y(:,0) y(:,1) 'o '
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:tens xc yc z z 's'
+
+

C++ code: +

void smgl_tens(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Tens plot (default)");	}
+	gr->Box();	gr->Tens(y.SubData(-1,0), y.SubData(-1,1));
+	if(big==3)	return;
+	gr->SubPlot(2,2,2,"");	gr->Title("' ' style");	gr->Box();	gr->Tens(y.SubData(-1,0), y.SubData(-1,1),"o ");
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Tens(xc,yc,z,z,"s");
+}
+
Sample tens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.123 Sample ‘ternary

+ + +

Example of ternary coordinates. +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+subplot 2 2 0:title 'Ordinary axis 3D':rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':zlabel 'Z'
+
+subplot 2 2 1:title 'Ternary axis (x+y+t=1)':ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y 'r2':plot rx ry 'q^ ':cont a:line 0.5 0 0 0.75 'g2'
+xlabel 'B':ylabel 'C':tlabel 'A'
+
+subplot 2 2 2:title 'Quaternary axis 3D':rotate 50 60:ternary 2
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'D'
+
+subplot 2 2 3:title 'Ternary axis 3D':rotate 50 60:ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'Z'
+
+

C++ code: +

void smgl_ternary(mglGraph *gr)	// flag #
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+	a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+	x.Modify("0.25*(1+cos(2*pi*x))");
+	y.Modify("0.25*(1+sin(2*pi*x))");
+	rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+	z.Modify("x");
+
+	gr->SubPlot(2,2,0);	gr->Title("Ordinary axis 3D");
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"BbcyrR#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('x',"B",1);	gr->Label('y',"C",1);	gr->Label('z',"Z",1);
+
+	gr->SubPlot(2,2,1);	gr->Title("Ternary axis (x+y+t=1)");
+	gr->Ternary(1);
+	gr->Plot(x,y,"r2");	gr->Plot(rx,ry,"q^ ");	gr->Cont(a);
+	gr->Line(mglPoint(0.5,0), mglPoint(0,0.75), "g2");
+	gr->Axis(); gr->Grid("xyz","B;");
+	gr->Label('x',"B");	gr->Label('y',"C");	gr->Label('t',"A");
+
+	gr->SubPlot(2,2,2);	gr->Title("Quaternary axis 3D");
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Ternary(2);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"BbcyrR#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('t',"A",1);	gr->Label('x',"B",1);
+	gr->Label('y',"C",1);	gr->Label('z',"D",1);
+
+	gr->SubPlot(2,2,3);	gr->Title("Ternary axis 3D");
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Ternary(1);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"BbcyrR#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('t',"A",1);	gr->Label('x',"B",1);
+	gr->Label('y',"C",1);	gr->Label('z',"Z",1);
+}
+
Sample ternary +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.124 Sample ‘text

+ + +

Example of text possibilities. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 ''
+text 0 1 'Text can be in ASCII and in Unicode'
+text 0 0.6 'It can be \wire{wire}, \big{big} or #r{colored}'
+text 0 0.2 'One can change style in string: \b{bold}, \i{italic, \b{both}}'
+text 0 -0.2 'Easy to \a{overline} or \u{underline}'
+text 0 -0.6 'Easy to change indexes ^{up} _{down} @{center}'
+text 0 -1 'It parse TeX: \int \alpha \cdot \
+\sqrt3{sin(\pi x)^2 + \gamma_{i_k}} dx'
+subplot 2 2 1 ''
+ text 0 0.5 '\sqrt{\frac{\alpha^{\gamma^2}+\overset 1{\big\infty}}{\sqrt3{2+b}}}' '@' -2
+text 0 -0.1 'More text position: \frac{a}{b}, \dfrac{a}{b}, [\stack{a}{bbb}], [\stackl{a}{bbb}], [\stackr{a}{bbb}], \sup{a}{sup}, \sub{a}{sub}'text 0 -0.5 'Text can be printed\n{}on several lines'
+text 0 -0.9 'or with color gradient' 'BbcyrR'
+subplot 2 2 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn above a curve' 'Tr'
+subplot 2 2 3 '':line -1 -1 1 -1 'rA':text 0 -1 1 -1 'Horizontal'
+line -1 -1 1 1 'rA':text 0 0 1 1 'At angle' '@'
+line -1 -1 -1 1 'rA':text -1 0 -1 1 'Vertical'
+
+

C++ code: +

void smgl_text(mglGraph *gr)	// text drawing
+{
+	if(big!=3)	gr->SubPlot(2,2,0,"");
+	gr->Putsw(mglPoint(0,1),L"Text can be in ASCII and in Unicode");
+	gr->Puts(mglPoint(0,0.6),"It can be \\wire{wire}, \\big{big} or #r{colored}");
+	gr->Puts(mglPoint(0,0.2),"One can change style in string: "
+	"\\b{bold}, \\i{italic, \\b{both}}");
+	gr->Puts(mglPoint(0,-0.2),"Easy to \\a{overline} or "
+	"\\u{underline}");
+	gr->Puts(mglPoint(0,-0.6),"Easy to change indexes ^{up} _{down} @{center}");
+	gr->Puts(mglPoint(0,-1),"It parse TeX: \\int \\alpha \\cdot "
+	"\\sqrt3{sin(\\pi x)^2 + \\gamma_{i_k}} dx");
+	if(big==3)	return;
+
+	gr->SubPlot(2,2,1,"");
+	gr->Puts(mglPoint(0,0.5), "\\sqrt{\\frac{\\alpha^{\\gamma^2}+\\overset 1{\\big\\infty}}{\\sqrt3{2+b}}}", "@", -2);
+	gr->Puts(mglPoint(0,-0.1),"More text position: \\frac{a}{b}, \\dfrac{a}{b}, [\\stack{a}{bbb}], [\\stackl{a}{bbb}], [\\stackr{a}{bbb}], \\sup{a}{sup}, \\sub{a}{sub}");
+	gr->Puts(mglPoint(0,-0.5),"Text can be printed\non several lines");
+	gr->Puts(mglPoint(0,-0.9),"or with col\bor gradient","BbcyrR");
+
+	gr->SubPlot(2,2,2,"");
+	mglData y;	mgls_prepare1d(&y);
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k");
+	gr->Text(y,"Another string drawn under a curve","Tr");
+
+	gr->SubPlot(2,2,3,"");
+	gr->Line(mglPoint(-1,-1),mglPoint(1,-1),"rA");	gr->Puts(mglPoint(0,-1),mglPoint(1,-1),"Horizontal");
+	gr->Line(mglPoint(-1,-1),mglPoint(1,1),"rA");	gr->Puts(mglPoint(0,0),mglPoint(1,1),"At angle","@");
+	gr->Line(mglPoint(-1,-1),mglPoint(-1,1),"rA");	gr->Puts(mglPoint(-1,0),mglPoint(-1,1),"Vertical");
+}
+
Sample text +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.125 Sample ‘text2

+ + +

Example of text along curve. +

+

MGL code: +

call 'prepare1d'
+subplot 1 3 0 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn under a curve' 'Tr'
+subplot 1 3 1 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:C'
+text y 'Another string drawn under a curve' 'Tr:C'
+subplot 1 3 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:R'
+text y 'Another string drawn under a curve' 'Tr:R'
+
+

C++ code: +

void smgl_text2(mglGraph *gr)	// text drawing
+{
+	mglData y;	mgls_prepare1d(&y);
+	if(big!=3)	gr->SubPlot(1,3,0,"");
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k");
+	gr->Text(y,"Another string drawn under a curve","Tr");
+	if(big==3)	return;
+
+	gr->SubPlot(1,3,1,"");
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k:C");
+	gr->Text(y,"Another string drawn under a curve","Tr:C");
+
+	gr->SubPlot(1,3,2,"");
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k:R");
+	gr->Text(y,"Another string drawn under a curve","Tr:R");
+}
+
Sample text2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.126 Sample ‘textmark

+ + +

Function textmark is similar to mark but draw text instead of markers. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'TextMark plot (default)':box:textmark y y1 '\gamma' 'r'
+
+

C++ code: +

void smgl_textmark(mglGraph *gr)
+{
+	mglData y,y1;	mgls_prepare1d(&y,&y1);
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("TextMark plot (default)");	}
+	gr->Box();	gr->TextMark(y,y1,"\\gamma","r");
+}
+
Sample textmark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.127 Sample ‘ticks

+ + +

Example of axis ticks. +

+

MGL code: +

subplot 3 3 0:title 'Usual axis with ":" style'
+axis ':'
+
+subplot 3 3 1:title 'Too big/small range'
+ranges -1000 1000 0 0.001:axis
+
+subplot 3 3 2:title 'LaTeX-like labels'
+axis 'F!'
+
+subplot 3 3 3:title 'Too narrow range'
+ranges 100 100.1 10 10.01:axis
+
+subplot 3 3 4:title 'No tuning, manual "+"'
+axis '+!'
+# for version <2.3 you can use
+#tuneticks off:axis
+
+subplot 3 3 5:title 'Template for ticks'
+xtick 'xxx:%g':ytick 'y:%g'
+axis
+
+xtick '':ytick '' # switch it off for other plots
+
+subplot 3 3 6:title 'No tuning, higher precision'
+axis '!4'
+
+subplot 3 3 7:title 'Manual ticks'
+ranges -pi pi 0 2
+xtick pi 3 '\pi'
+xtick 0.886 'x^*' on # note this will disable subticks drawing
+# or you can use
+#xtick -pi '\pi' -pi/2 '-\pi/2' 0 '0' 0.886 'x^*' pi/2 '\pi/2' pi 'pi'
+list v 0 0.5 1 2:ytick v '0
+0.5
+1
+2'
+axis:grid:fplot '2*cos(x^2)^2' 'r2'
+
+subplot 3 3 8:title 'Time ticks'
+xrange 0 3e5:ticktime 'x':axis
+
+

C++ code: +

void smgl_ticks(mglGraph *gr)
+{
+	gr->SubPlot(3,3,0);	gr->Title("Usual axis with ':' style");	gr->Axis(":");
+	gr->SubPlot(3,3,1);	gr->Title("Too big/small range");
+	gr->SetRanges(-1000,1000,0,0.001);	gr->Axis();
+	gr->SubPlot(3,3,2);	gr->Title("LaTeX-like labels");
+	gr->Axis("F!");
+	gr->SubPlot(3,3,3);	gr->Title("Too narrow range");
+	gr->SetRanges(100,100.1,10,10.01);	gr->Axis();
+	gr->SubPlot(3,3,4);	gr->Title("No tuning, manual '+'");
+	// for version<2.3 you need first call gr->SetTuneTicks(0);
+	gr->Axis("+!");
+	gr->SubPlot(3,3,5);	gr->Title("Template for ticks");
+	gr->SetTickTempl('x',"xxx:%g");	gr->SetTickTempl('y',"y:%g");
+	gr->Axis();
+	// now switch it off for other plots
+	gr->SetTickTempl('x',"");	gr->SetTickTempl('y',"");
+	gr->SubPlot(3,3,6);	gr->Title("No tuning, higher precision");
+	gr->Axis("!4");
+	gr->SubPlot(3,3,7);	gr->Title("Manual ticks");	gr->SetRanges(-M_PI,M_PI, 0, 2);
+	gr->SetTicks('x',M_PI,0,0,"\\pi");	gr->AddTick('x',0.886,"x^*");
+	// alternatively you can use following lines
+	double val[]={0, 0.5, 1, 2};
+	gr->SetTicksVal('y', mglData(4,val), "0\n0.5\n1\n2");
+	gr->Axis();	gr->Grid();	gr->FPlot("2*cos(x^2)^2", "r2");
+	gr->SubPlot(3,3,8);	gr->Title("Time ticks");	gr->SetRange('x',0,3e5);
+	gr->SetTicksTime('x',0);	gr->Axis();
+}
+
Sample ticks +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.128 Sample ‘tile

+ + +

Function tile draw surface by tiles. +

+

MGL code: +

call 'prepare2d'
+title 'Tile plot':rotate 50 60:box:tile a
+
+

C++ code: +

void smgl_tile(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Tile plot");
+	gr->Rotate(40,60);	gr->Box();	gr->Tile(a);
+}
+
Sample tile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.129 Sample ‘tiles

+ + +

Function tiles is similar to tile but tile sizes is determined by another data. This allows one to simulate transparency of the plot. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Tiles plot':box:tiles a b
+
+

C++ code: +

void smgl_tiles(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("TileS plot");}
+	gr->Box();	gr->TileS(a,b);
+}
+
Sample tiles +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.130 Sample ‘torus

+ + +

Function torus draw surface of the curve rotation. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0:title 'Torus plot (default)':light on:rotate 50 60:box:torus y1 y2
+subplot 2 2 1:title '"x" style':light on:rotate 50 60:box:torus y1 y2 'x'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:torus y1 y2 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:torus y1 y2 '#'
+
+

C++ code: +

void smgl_torus(mglGraph *gr)
+{
+	mglData y1,y2;	mgls_prepare1d(0,&y1,&y2);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Torus plot (default)");	}
+	gr->Light(true);	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'x' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"x");
+	gr->SubPlot(2,2,2);	gr->Title("'z' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"z");
+	gr->SubPlot(2,2,3);	gr->Title("'\\#' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"#");
+}
+
Sample torus +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.131 Sample ‘traj

+ + +

Function traj is 1D analogue of vect. It draw vectors from specified points. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Traj plot':box:plot x1 y:traj x1 y y1 y2
+
+

C++ code: +

void smgl_traj(mglGraph *gr)
+{
+	mglData x,y,y1,y2;	mgls_prepare1d(&y,&y1,&y2,&x);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("Traj plot");}
+	gr->Box();	gr->Plot(x,y);	gr->Traj(x,y,y1,y2);
+}
+
Sample traj +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.132 Sample ‘triangulation

+ + +

Example of use triangulate for arbitrary placed points. +

+

MGL code: +

new x 100 '2*rnd-1':new y 100 '2*rnd-1':copy z x^2-y^2
+new g 30 30:triangulate d x y
+title 'Triangulation'
+rotate 50 60:box:light on
+triplot d x y z:triplot d x y z '#k'
+datagrid g x y z:mesh g 'm'
+
+

C++ code: +

void smgl_triangulation(mglGraph *gr)	// surface triangulation
+{
+	mglData x(100), y(100), z(100);
+	gr->Fill(x,"2*rnd-1");	gr->Fill(y,"2*rnd-1");	gr->Fill(z,"v^2-w^2",x,y);
+	mglData d = mglTriangulation(x,y), g(30,30);
+
+	if(big!=3)	gr->Title("Triangulation");
+	gr->Rotate(40,60);	gr->Box();	gr->Light(true);
+	gr->TriPlot(d,x,y,z);	gr->TriPlot(d,x,y,z,"#k");
+
+	gr->DataGrid(g,x,y,z);	gr->Mesh(g,"m");
+}
+
Sample triangulation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.133 Sample ‘triplot

+ + +

Functions triplot and quadplot draw set of triangles (or quadrangles, correspondingly) for irregular data arrays. Note, that you have to provide not only vertexes, but also the indexes of triangles or quadrangles. I.e. perform triangulation by some other library. See also triangulate. +

+

MGL code: +

list q 0 1 2 3 | 4 5 6 7 | 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7
+list xq -1 1 -1 1 -1 1 -1 1
+list yq -1 -1 1 1 -1 -1 1 1
+list zq -1 -1 -1 -1 1 1 1 1
+light on
+subplot 2 2 0:title 'QuadPlot sample':rotate 50 60
+quadplot q xq yq zq 'yr'
+quadplot q xq yq zq '#k'
+subplot 2 2 2:title 'QuadPlot coloring':rotate 50 60
+quadplot q xq yq zq yq 'yr'
+quadplot q xq yq zq '#k'
+list t 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0
+list yt -1 -1 1 0
+list zt -1 -1 -1 1
+subplot 2 2 1:title 'TriPlot sample':rotate 50 60
+triplot t xt yt zt 'b'
+triplot t xt yt zt '#k'
+subplot 2 2 3:title 'TriPlot coloring':rotate 50 60
+triplot t xt yt zt yt 'cb'
+triplot t xt yt zt '#k'
+tricont t xt yt zt 'B'
+
+

C++ code: +

void smgl_triplot(mglGraph *gr)
+{
+	double q[] = {0,1,2,3, 4,5,6,7, 0,2,4,6, 1,3,5,7, 0,4,1,5, 2,6,3,7};
+	double xc[] = {-1,1,-1,1,-1,1,-1,1}, yc[] = {-1,-1,1,1,-1,-1,1,1}, zc[] = {-1,-1,-1,-1,1,1,1,1};
+	mglData qq(6,4,q), xx(8,xc), yy(8,yc), zz(8,zc);
+	gr->Light(true);	//gr->Alpha(true);
+	gr->SubPlot(2,2,0);	gr->Title("QuadPlot sample");	gr->Rotate(50,60);
+	gr->QuadPlot(qq,xx,yy,zz,"yr");
+	gr->QuadPlot(qq,xx,yy,zz,"k#");
+	gr->SubPlot(2,2,2);	gr->Title("QuadPlot coloring");	gr->Rotate(50,60);
+	gr->QuadPlot(qq,xx,yy,zz,yy,"yr");
+	gr->QuadPlot(qq,xx,yy,zz,"k#");
+
+	double t[] = {0,1,2, 0,1,3, 0,2,3, 1,2,3};
+	double xt[] = {-1,1,0,0}, yt[] = {-1,-1,1,0}, zt[] = {-1,-1,-1,1};
+	mglData tt(4,3,t), uu(4,xt), vv(4,yt), ww(4,zt);
+	gr->SubPlot(2,2,1);	gr->Title("TriPlot sample");	gr->Rotate(50,60);
+	gr->TriPlot(tt,uu,vv,ww,"b");
+	gr->TriPlot(tt,uu,vv,ww,"k#");
+	gr->SubPlot(2,2,3);	gr->Title("TriPlot coloring");	gr->Rotate(50,60);
+	gr->TriPlot(tt,uu,vv,ww,vv,"cb");
+	gr->TriPlot(tt,uu,vv,ww,"k#");
+	gr->TriCont(tt,uu,vv,ww,"B");
+}
+
Sample triplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.134 Sample ‘tube

+ + +

Function tube draw tube with variable radius. +

+

MGL code: +

call 'prepare1d'
+light on
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x':divto y1 20
+subplot 2 2 0 '':title 'Tube plot (default)':box:tube y 0.05
+subplot 2 2 1 '':title 'variable radius':box:tube y y1
+subplot 2 2 2 '':title '"\#" style':box:tube y 0.05 '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:tube xc yc z y2 'r'
+
+

C++ code: +

void smgl_tube(mglGraph *gr)
+{
+	mglData y,y1,y2;	mgls_prepare1d(&y,&y1,&y2);	y1/=20;
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Tube plot (default)");	}
+	gr->Light(true);	gr->Box();	gr->Tube(y,0.05);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("variable radius");	gr->Box();	gr->Tube(y,y1);
+	gr->SubPlot(2,2,2,"");	gr->Title("'\\#' style");	gr->Box();	gr->Tube(y,0.05,"#");
+	mglData yc(50), xc(50), z(50);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();	gr->Tube(xc,yc,z,y2,"r");
+}
+
Sample tube +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.135 Sample ‘type0

+ + +

Example of ordinary transparency (transptype=0). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 0:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+

C++ code: +

void smgl_type0(mglGraph *gr)	// TranspType = 0
+{
+	gr->Alpha(true);	gr->Light(true);
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetTranspType(0);	gr->Clf();
+	gr->SubPlot(2,2,0);	gr->Rotate(50,60);	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,1);	gr->Rotate(50,60);	gr->Dens(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Rotate(50,60);	gr->Cont(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Rotate(50,60);	gr->Axial(a);	gr->Box();
+}
+
Sample type0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.136 Sample ‘type1

+ + +

Example of glass-like transparency (transptype=1). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 1:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+

C++ code: +

void smgl_type1(mglGraph *gr)	// TranspType = 1
+{
+	gr->Alpha(true);	gr->Light(true);
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetTranspType(1);	gr->Clf();
+	gr->SubPlot(2,2,0);	gr->Rotate(50,60);	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,1);	gr->Rotate(50,60);	gr->Dens(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Rotate(50,60);	gr->Cont(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Rotate(50,60);	gr->Axial(a);	gr->Box();
+}
+
Sample type1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.137 Sample ‘type2

+ + +

Example of lamp-like transparency (transptype=2). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 2:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+

C++ code: +

void smgl_type2(mglGraph *gr)	// TranspType = 2
+{
+	gr->Alpha(true);	gr->Light(true);
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetTranspType(2);	gr->Clf();
+	gr->SubPlot(2,2,0);	gr->Rotate(50,60);	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,1);	gr->Rotate(50,60);	gr->Dens(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Rotate(50,60);	gr->Cont(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Rotate(50,60);	gr->Axial(a);	gr->Box();
+}
+
Sample type2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.138 Sample ‘vect

+ + +

Function vect is most standard way to visualize vector fields – it draw a lot of arrows or hachures for each data cell. It have a lot of options which can be seen on the figure (and in the sample code), and use color scheme for coloring (see Color scheme). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 3 2 0 '':title 'Vect plot (default)':box:vect a b
+subplot 3 2 1 '':title '"." style; "=" style':box:vect a b '.='
+subplot 3 2 2 '':title '"f" style':box:vect a b 'f'
+subplot 3 2 3 '':title '">" style':box:vect a b '>'
+subplot 3 2 4 '':title '"<" style':box:vect a b '<'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:vect ex ey ez
+
+

C++ code: +

void smgl_vect3(mglGraph *gr)
+{
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	if(big!=3)	{	gr->SubPlot(2,1,0);	gr->Title("Vect3 sample");	}
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"x");	gr->Vect3(ex,ey,ez);	gr->Vect3(ex,ey,ez,"z");
+	if(big==3)	return;
+	gr->SubPlot(2,1,1);	gr->Title("'f' style");
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"fx");	gr->Vect3(ex,ey,ez,"f");	gr->Vect3(ex,ey,ez,"fz");
+	gr->Grid3(ex,"Wx");	gr->Grid3(ex,"W");	gr->Grid3(ex,"Wz");
+}
+
Sample vect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.139 Sample ‘vect3

+ + +

Function vect3 draw ordinary vector field plot but at slices of 3D data. +

+

MGL code: +

call 'prepare3v'
+subplot 2 1 0:title 'Vect3 sample':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'x':vect3 ex ey ez:vect3 ex ey ez 'z'
+subplot 2 1 1:title '"f" style':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'fx':vect3 ex ey ez 'f':vect3 ex ey ez 'fz'
+grid3 ex 'Wx':grid3 ex 'W':grid3 ex 'Wz'
+
+

C++ code: +

void smgl_vect3(mglGraph *gr)
+{
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	if(big!=3)	{	gr->SubPlot(2,1,0);	gr->Title("Vect3 sample");	}
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"x");	gr->Vect3(ex,ey,ez);	gr->Vect3(ex,ey,ez,"z");
+	if(big==3)	return;
+	gr->SubPlot(2,1,1);	gr->Title("'f' style");
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"fx");	gr->Vect3(ex,ey,ez,"f");	gr->Vect3(ex,ey,ez,"fz");
+	gr->Grid3(ex,"Wx");	gr->Grid3(ex,"W");	gr->Grid3(ex,"Wz");
+}
+
Sample vect3 +
+
+ +
+

+Previous: , Up: All samples   [Contents][Index]

+
+ +

10.140 Sample ’venn’

+ + +

Example of venn-like diagram. +

+

MGL code: +

list x -0.3 0 0.3:list y 0.3 -0.3 0.3:list e 0.7 0.7 0.7
+subplot 1 1 0:title 'Venn-like diagram'
+transptype 1:alpha on:error x y e e '!rgb@#o';alpha 0.1
+
+

C++ code: +

void smgl_venn(mglGraph *gr)
+{
+	double xx[3]={-0.3,0,0.3}, yy[3]={0.3,-0.3,0.3}, ee[3]={0.7,0.7,0.7};
+	mglData x(3,xx), y(3,yy), e(3,ee);
+	gr->SubPlot(1,1,0);	gr->Title("Venn-like diagram");
+	gr->SetTranspType(1);	gr->Alpha(true);	gr->Error(x,y,e,e,"!rgb@#o","alpha 0.1");
+}
+
Sample venn +
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix A Symbols and hot-keys

+ + +

This appendix contain the full list of symbols (characters) used by MathGL for setting up plot. Also it contain sections for full list of hot-keys supported by mglview tool and by UDAV program. +

+ + + + + + + +
+ + + +

A.1 Symbols for styles

+ + +

Below is full list of all characters (symbols) which MathGL use for setting up the plot. +

+
+
space ' '
+

empty line style (see Line styles); +

+

empty color in chart. +

+
+
!
+

set to use new color from palette for each point (not for each curve, as default) in 1D plotting; +

+

set to disable ticks tuning in axis and colorbar; +

+

set to draw grid lines at subticks coordinates too; +

+

define complex variable/expression in MGL script if placed at beginning. +

+
+
#
+

set to use solid marks (see Line styles) or solid error boxes; +

+

set to draw wired plot for axial, surf3, surf3a, surf3c, triplot, quadplot, area, region, bars, barh, tube, tape, cone, boxs and draw boundary only for circle, ellipse, rhomb; +

+

set to draw also mesh lines for surf, surfc, surfa, dens, densx, densy, densz, dens3, or boundary for chart, facex, facey, facez, rect; +

+

set to draw boundary and box for legend, title, or grid lines for table; +

+

set to draw grid for radar; +

+

set to start flow threads and pipes from edges only for flow, pipe; +

+

set to use whole are for axis range in subplot, inplot; +

+

change text color inside a string (see Font styles); +

+

start comment in MGL scripts or in Command options. +

+
+
$
+

denote parameter of MGL scripts. +

+
+
%
+

set color scheme along 2 coordinates Color scheme; +

+

operation in Textual formulas. +

+
+
&
+
+

set to pass long integer number in tick template xtick, ytick, ztick, ctick; +

+

specifier of drawing user-defined symbols as mark (see Line styles); +

+

operation in Textual formulas. +

+
+
+

denote string in MGL scripts or in Command options. +

+
+
*
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to start flow threads from 2d array inside data (see flow); +

+

operation in Textual formulas. +

+
+
+
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

set to print ‘+’ for positive numbers in axis, label, table; +

+

operation of increasing last character value in MGL strings; +

+

operation in Textual formulas. +

+
+
,
+

separator for color positions (see Color styles) or items in a list +

+

concatenation of MGL string with another string or numerical value. +

+
+
-
+

solid line style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

place entries horizontally in legend; +

+

set to use usual ‘-’ for negative numbers in axis, label, table; +

+

operation in Textual formulas. +

+
+
.
+

one of marks (see Line styles) or kind of error boxes; +

+

set to draw hachures instead of arrows for vect, vect3; +

+

set to use dots instead of faces for cloud, torus, axial, surf3, surf3a, surf3c, surf, surfa, surfc, dens, map; +

+

delimiter of fractional parts for numbers. +

+
+
/
+

operation in Textual formulas. +

+
+
:
+

line dashing style (see Line styles); +

+

stop color scheme parsing (see Color scheme); +

+

range operation in MGL scripts; +

+

style for axis; +

+

separator of commands in MGL scripts. +

+
+
;
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

start of an option in MGL scripts or in Command options; +

+

separator of equations in ode; +

+

separator of labels in iris. +

+
+
<
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align left in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+ +
+
>
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align right in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
=
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to use equidistant columns for table; +

+

set to use color gradient for vect, vect3; +

+

operation in Textual formulas. +

+
+
@
+

set to draw box around text for text and similar functions; +

+

set to draw boundary and fill it for circle, ellipse, rhomb; +

+

set to fill faces for box; +

+

set to draw large semitransparent mark instead of error box for error; +

+

set to draw edges for cone; +

+

set to draw filled boxes for boxs; +

+

reduce text size inside a string (see Font styles); +

+

operation in Textual formulas. +

+
+
^
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set outer position for legend; +

+

inverse default position for axis; +

+

switch to upper index inside a string (see Font styles); +

+

align center in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
_
+

empty arrow style (see Line styles); +

+

disable drawing of tick labels for axis; +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set to draw contours at bottom for cont, contf, contd, contv, tricont; +

+

switch to lower index inside a string (see Font styles). +

+
+
[]
+

contain symbols excluded from color scheme parsing (see Color scheme); +

+

operation of getting n-th character from MGL string. +

+
+
{}
+

contain extended specification of color (see Color styles), dashing (see Line styles) or mask (see Color scheme); +

+

denote special operation in MGL scripts; +

+

denote ’meta-symbol’ for LaTeX like string parsing (see Font styles). +

+
+
|
+

line dashing style (see Line styles); +

+

set to use sharp color scheme (see Color scheme); +

+

set to limit width by subplot width for table; +

+

delimiter in list command; +

+

operation in Textual formulas. +

+
+
\
+

string continuation symbol on next line for MGL scripts. +

+
+
~
+

disable drawing of tick labels for axis and colorbar; +

+

disable first segment in lamerey; +

+

reduce number of segments in plot and tens; +

+

one of mask for face filling (see Color scheme). +

+
+
0,1,2,3,4,5,6,7,8,9
+

line width (see Line styles); +

+

brightness of a color (see Color styles); +

+

precision of numbers in axis, label, table; +

+

kind of smoothing (for digits 1,3,5) in smooth; +

+

digits for a value. +

+
+
4,6,8
+

set to draw square, hex- or octo-pyramids instead of cones in cone, cones. +

+
+
A,B,C,D,E,F,a,b,c,d,e,f
+

can be hex-digit for color specification if placed inside {} (see Color styles). +

+
+
A
+

arrow style (see Line styles); +

+

set to use absolute position in whole picture for text, colorbar, legend. +

+
+
a
+

set to use absolute position in subplot for text; +

+

style of plot, radar, tens, area, region to draw segments between points outside of axis range; +

+

style of bars, barh, cones. +

+
+
B
+

dark blue color (see Color styles). +

+
+
b
+

blue color (see Color styles); +

+

bold font face if placed after ‘:’ (see Font styles). +

+
+
C
+

dark cyan color (see Color styles); +

+

align text to center if placed after ‘:’ (see Font styles). +

+
+
c
+

cyan color (see Color styles); +

+

name of color axis; +

+

cosine transform for transform. +

+
+
D
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
d
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-dash description if placed inside {} (see Line styles). +

+
+
E
+

dark green-yellow color (see Color styles). +

+
+
e
+

green-yellow color (see Color styles). +

+
+
F
+
+

set fixed bar widths in bars, barh; +

+

set LaTeX-like format for numbers in axis, label, table. +

+
+
f
+

style of bars, barh; +

+

style of vect, vect3; +

+

set fixed format for numbers in axis, label, table; +

+

Fourier transform for transform. +

+
+
G
+

dark green color (see Color styles). +

+
+
g
+

green color (see Color styles). +

+
+
H
+

dark gray color (see Color styles). +

+
+
h
+

gray color (see Color styles); +

+

Hankel transform for transform. +

+
+
I
+

arrow style (see Line styles); +

+

set colorbar position near boundary. +

+
+
i
+

line dashing style (see Line styles); +

+

italic font face if placed after ‘:’ (see Font styles). +

+

set to use inverse values for cloud, pipe, dew; +

+

set to fill only area with y1<y<y2 for region; +

+

inverse Fourier transform for transform, transforma, fourier. +

+
+
j
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
K
+

arrow style (see Line styles). +

+
+
k
+

black color (see Color styles). +

+
+
L
+

dark green-blue color (see Color styles); +

+

align text to left if placed after ‘:’ (see Font styles). +

+
+
l
+

green-blue color (see Color styles). +

+
+
M
+

dark magenta color (see Color styles). +

+
+
m
+

magenta color (see Color styles). +

+
+
N
+

dark sky-blue color (see Color styles). +

+
+
n
+

sky-blue color (see Color styles). +

+
+
O
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
o
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

over-line text if placed after ‘:’ (see Font styles). +

+
+
P
+

dark purple color (see Color styles). +

+
+
p
+

purple color (see Color styles). +

+
+
Q
+

dark orange or brown color (see Color styles). +

+
+
q
+

orange color (see Color styles). +

+
+
R
+

dark red color (see Color styles); +

+

align text to right if placed after ‘:’ (see Font styles). +

+
+
r
+

red color (see Color styles). +

+
+
S
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
s
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-mask description if placed inside {} (see Color scheme); +

+

sine transform for transform. +

+
+
t
+

draw tubes instead of cones in cone, cones; +

+
+
T
+

arrow style (see Line styles); +

+

place text under the curve for text, cont, cont3. +

+
+
t
+

set to draw text labels for cont, cont3; +

+

name of t-axis (one of ternary axis); +

+

variable in Textual formulas, which usually is varied in range [0,1]. +

+
+
U
+

dark blue-violet color (see Color styles); +

+

disable rotation of tick labels for axis. +

+
+
u
+

blue-violet color (see Color styles); +

+

under-line text if placed after ‘:’ (see Font styles); +

+

name of u-axis (one of ternary axis); +

+

variable in Textual formulas, which usually denote array itself. +

+
+
V
+

arrow style (see Line styles); +

+

place text centering on vertical direction for text. +

+
+
v
+

one of marks (see Line styles); +

+

set to draw vectors on flow threads for flow and on segments for lamerey. +

+
+
W
+

bright gray color (see Color styles). +

+
+
w
+

white color (see Color styles); +

+

wired text if placed after ‘:’ (see Font styles); +

+

name of w-axis (one of ternary axis); +

+
+
X
+

arrow style (see Line styles). +

+
+
x
+
+

name of x-axis or x-direction or 1st dimension of a data array; +

+

start hex-color description if placed inside {} (see Color styles); +

+

one of marks (see Line styles) or kind of error boxes; +

+

tiles orientation perpendicular to x-axis in tile, tiles; +

+

style of tape. +

+
+
Y
+

dark yellow or gold color (see Color styles). +

+
+
y
+

yellow color (see Color styles); +

+

name of y-axis or y-direction or 2nd dimension of a data array; +

+

tiles orientation perpendicular to y-axis in tile, tiles. +

+
+
z
+
+

name of z-axis or z-direction or 3d dimension of a data array; +

+

style of tape. +

+
+
+ + + +
+ + + +

A.2 Hot-keys for mglview

+ + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-POpen printer dialog and print graphics.
Ctrl-WClose window.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop drawing and script execution.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Shift-GCopy graphics to clipboard.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + +
+ + + +

A.3 Hot-keys for UDAV

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-NCreate new window with empty script. Note, all scripts share variables. So, second window can be used to see some additional information of existed variables.
Ctrl-OOpen and execute/show script or data from file. You may switch off automatic exection in UDAV properties
Ctrl-SSave script to a file.
Ctrl-POpen printer dialog and print graphics.
Ctrl-ZUndo changes in script editor.
Ctrl-Shift-ZRedo changes in script editor.
Ctrl-XCut selected text into clipboard.
Ctrl-CCopy selected text into clipboard.
Ctrl-VPaste selected text from clipboard.
Ctrl-ASelect all text in editor.
Ctrl-FShow dialog for text finding.
F3Find next occurrence of the text.
Win-C or Meta-CShow dialog for new command and put it into the script.
Win-F or Meta-FInsert last fitted formula with found coefficients.
Win-S or Meta-SShow dialog for styles and put it into the script. Styles define the plot view (color scheme, marks, dashing and so on).
Win-O or Meta-OShow dialog for options and put it into the script. Options are used for additional setup the plot.
Win-N or Meta-NReplace selected expression by its numerical value.
Win-P or Meta-PSelect file and insert its file name into the script.
Win-G or Meta-GShow dialog for plot setup and put resulting code into the script. This dialog setup axis, labels, lighting and other general things.
Ctrl-Shift-OLoad data from file. Data will be deleted only at exit but UDAV will not ask to save it.
Ctrl-Shift-SSave data to a file.
Ctrl-Shift-CCopy range of numbers to clipboard.
Ctrl-Shift-VPaste range of numbers from clipboard.
Ctrl-Shift-NRecreate the data with new sizes and fill it by zeros.
Ctrl-Shift-RResize (interpolate) the data to specified sizes.
Ctrl-Shift-TTransform data along dimension(s).
Ctrl-Shift-MMake another data.
Ctrl-Shift-HFind histogram of data.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-GSwitch on/off grid of absolute coordinates.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop script execution and drawing.
F8Show/hide tool window with list of hidden plots.
F9Restore status for ’once’ command and reload data.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-WOpen dialog with slideshow options.
Ctrl-Shift-GCopy graphics to clipboard.
F1Show help on MGL commands
F2Show/hide tool window with messages and information.
F4Show/hide calculator which evaluate and help to type textual formulas. Textual formulas may contain data variables too.
Meta-Shift-Up, Meta-Shift-DownChange view angle \theta.
Meta-Shift-Left, Meta-Shift-RightChange view angle \phi.
Alt-Minus, Alt-EqualZoom in/out whole image.
Alt-Up, Alt-Down, Alt-Right, Alt-LeftShift whole image.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix B File formats

+ + +

This appendix contain description of file formats used by MathGL. +

+ + + + + + + + +
+ +
+

+Next: , Up: File formats   [Contents][Index]

+
+ +

B.1 Font files

+ + +

Starting from v.1.6 the MathGL library uses new font files. The font is defined in 4 files with suffixes ‘*.vfm’, ‘*_b.vfm’, ‘*_i.vfm’, ‘*_bi.vfm’. These files are text files containing the data for roman font, bold font, italic font and bold italic font. The files (or some symbols in the files) for bold, italic or bold italic fonts can be absent. In this case the roman glyph will be used for them. By analogy, if the bold italic font is absent but the bold font is present then bold glyph will be used for bold italic. You may create these font files by yourself from *.ttf, *.otf files with the help of program font_tools. This program can be found at MathGL home site. +

+

The format of font files (*.vfm – vector font for MathGL) is the following. +

    +
  1. First string contains human readable comment and is always ignored. +
  2. Second string contains 3 numbers, delimited by space or tabulation. The order of numbers is the following: numg – the number of glyphs in the file (integer), fact – the factor for glyph sizing (mreal), size – the size of buffer for glyph description (integer). +
  3. After it numg-th strings with glyphs description are placed. Each string contains 6 positive numbers, delimited by space of tabulation. The order of numbers is the following: Unicode glyph ID, glyph width, number of lines in glyph, position of lines coordinates in the buffer (length is 2*number of lines), number of triangles in glyph, position of triangles coordinates in the buffer (length is 6*number of triangles). +
  4. The end of file contains the buffer with point coordinates at lines or triangles vertexes. The size of buffer (the number of integer) is size. +
+ +

Each font file can be compressed by gzip. +

+

Note: the closing contour line is done automatically (so the last segment may be absent). For starting new contour use a point with coordinates {0x3fff, 0x3fff}. +

+ + +
+ +
+

+Next: , Previous: , Up: File formats   [Contents][Index]

+
+ +

B.2 MGLD format

+ + +

MGLD is textual file, which contain all required information for drawing 3D image, i.e. it contain vertexes with colors and normales, primitives with all properties, textures, and glyph descriptions. MGLD file can be imported or viewed separately, without parsing data files itself. +

+

MGLD file start from string +

MGLD npnts nprim ntxtr nglfs # optional description
+

which contain signature ‘MGLD’ and number of points npnts, number of primitives nprim, number of textures ntxtr, number of glyph descriptions nglfs, and optional description. Empty strings and string with ‘#’ are ignored. +

+

Next, file contain npnts strings with points coordinates and colors. The format of each string is +

x y z c t ta u v w r g b a
+

Here x, y, z are coordinates, c, t are color indexes in texture, ta is normalized t according to current alpha setting, u, v, w are coordinates of normal vector (can be NAN if disabled), r, g, b, a are RGBA color values. +

+

Next, file contain nprim strings with properties of primitives. The format of each string is +

type n1 n2 n3 n4 id s w p
+

Here type is kind of primitive (0 - mark, 1 - line, 2 - triangle, 3 - quadrangle, 4 - glyph), n1...n4 is index of point for vertexes, id is primitive identification number, s and w are size and width if applicable, p is scaling factor for glyphs. +

+

Next, file contain ntxtr strings with descriptions of textures. The format of each string is +

smooth alpha colors
+

Here smooth set to enable smoothing between colors, alpha set to use half-transparent texture, colors contain color scheme itself as it described in Color scheme. +

+

Finally, file contain nglfs entries with description of each glyph used in the figure. The format of entries are +

nT nL
+xA yA xB yB xC yC ...
+xP yP ...
+

Here nT is the number of triangles; nL is the number of line vertexes; xA, yA, xB, yB, xC, yC are coordinates of triangles; and xP, yP, xQ, yQ are coordinates of lines. Line coordinate xP=0x3fff, yP=0x3fff denote line breaking. +

+ +
+ +
+

+Next: , Previous: , Up: File formats   [Contents][Index]

+
+ +

B.3 JSON format

+ + +

MathGL can save points and primitives of 3D object. It contain a set of variables listed below. +

+
+
width
+

width of the image; +

+
height
+

height of the image +

+
depth
+

depth of the image, usually =sqrt(width*height); +

+
+
npnts
+

number of points (vertexes); +

+
pnts
+

array of coordinates of points (vertexes), each element is array in form [x, y, z]; +

+
+
nprim
+

number of primitives; +

+
prim
+

array of primitives, each element is array in form [type, n1, n2, n3, n4, id, s, w, p, z, color]. +

+

Here type is kind of primitive (0 - mark, 1 - line, 2 - triangle, 3 - quadrangle, 4 - glyph), n1...n4 is index of point for vertexes and n2 can be index of glyph coordinate, s and w are size and width if applicable, z is average z-coordinate, id is primitive identification number, p is scaling factor for glyphs. +

+
+
ncoor
+

number of glyph positions +

+
coor
+

array of glyph positions, each element is array in form [dx,dy] +

+
+
nglfs
+

number of glyph descriptions +

+
glfs
+

array of glyph descriptions, each element is array in form [nL, [xP0, yP0, xP1, yP1 ...]]. Here nL is the number of line vertexes; and xP, yP, xQ, yQ are coordinates of lines. Line coordinate xP=0x3fff, yP=0x3fff denote line breaking. +

+
+
+ + +
+ +
+

+Previous: , Up: File formats   [Contents][Index]

+
+ +

B.4 IFS format

+ + +

MathGL can read IFS fractal parameters (see ifsfile) from a IFS file. Let remind IFS file format. File may contain several records. Each record contain the name of fractal (‘binary’ in the example below) and the body of fractal, which is enclosed in curly braces {}. Symbol ‘;’ start the comment. If the name of fractal contain ‘(3D)’ or ‘(3d)’ then the 3d IFS fractal is specified. The sample below contain two fractals: ‘binary’ – usual 2d fractal, and ‘3dfern (3D)’ – 3d fractal. +

+
 binary
+ { ; comment allowed here
+  ; and here
+  .5  .0 .0 .5 -2.563477 -0.000003 .333333   ; also comment allowed here
+  .5  .0 .0 .5  2.436544 -0.000003 .333333
+  .0 -.5 .5 .0  4.873085  7.563492 .333333
+  }
+
+ 3dfern (3D) {
+   .00  .00 0 .0 .18 .0 0  0.0 0.00 0 0.0 0 .01
+   .85  .00 0 .0 .85 .1 0 -0.1 0.85 0 1.6 0 .85
+   .20 -.20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  -.20  .20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  }
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix C Plotting time

+ +

Table below show plotting time in seconds for all samples in file examples/samples.cpp. The test was done in my laptop (i5-2430M) with 64-bit Debian. +

+

Few words about the speed. Firstly, direct bitmap drawing (Quality=4,5,6) is faster than buffered one (Quality=0,1,2), but sometimes it give incorrect result (see cloud) and don’t allow to export in vector or 3d formats (like EPS, SVG, PDF ...). Secondly, lower quality is faster than high one generally, i.e. Quality=1 is faster than Quality=2, and Quality=0 is faster than Quality=1. However, if plot contain a lot of faces (like cloud, surf3, pipe, dew) then Quality=0 may become slow, especially for small images. Finally, smaller images are drawn faster than larger ones. +

+

Results for image size 800*600 (default one). +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nameq=0q=1q=2q=4q=5q=6q=8
3wave0.03220.06270.07210.04250.110.1360.0271
alpha0.08920.1080.1130.04730.1240.1450.0297
apde48.247.447.647.447.848.447.9
area0.03760.07280.07520.0330.1410.1650.0186
aspect0.04420.05720.05510.0310.09990.1030.0146
axial0.6390.9170.9260.1950.5250.5520.119
axis0.06830.1070.1080.04660.1960.2020.0169
barh0.02850.05470.06030.02920.1010.1150.0114
bars0.04140.07030.08430.10.1850.1840.0295
belt0.02860.05320.05770.03840.07350.10.0131
bifurcation0.5890.6350.6090.5310.5720.5790.512
box0.06820.08050.08280.03140.1240.1210.0169
boxplot0.01020.03170.03470.020.04990.05540.0167
boxs0.2390.3630.40.07980.2160.2340.0721
candle0.02860.05490.0530.02630.04830.05640.0109
chart0.4160.6130.7070.261.071.590.191
cloud0.03124.154.110.03060.7150.9240.0168
colorbar0.1080.1720.1770.07870.2580.2660.0452
combined0.360.3360.3320.1980.3160.330.196
cones0.1450.1390.140.09370.2480.2760.0363
cont0.09870.1410.1410.05850.2070.1940.0455
cont30.03230.0580.05870.03040.07260.08370.0162
cont_xyz0.04170.05850.06120.04170.08330.08450.0294
contd0.1910.2450.2360.1040.1890.2010.0902
contf0.1620.1790.1820.07890.1660.1770.067
contf30.1230.120.1340.0650.1230.1550.0538
contf_xyz0.07510.09220.1110.07560.08790.09560.0462
contv0.09470.1230.1360.07570.1630.180.0469
correl0.03390.06290.05990.02880.1150.1380.0165
curvcoor0.1120.1640.1710.08640.2960.2980.0739
cut0.6950.4650.4840.3030.3850.3710.316
dat_diff0.04570.0790.08250.03460.1360.1580.0186
dat_extra0.1750.1810.1730.08770.1630.1730.0463
data12.391.761.751.331.381.371.4
data21.421.261.281.171.241.291.14
dens0.08670.1220.1310.06150.1450.1680.032
dens30.07220.07690.09370.04370.09470.1510.0797
dens_xyz0.05990.08750.09610.04630.0890.08970.0315
detect0.1330.1510.1760.08610.1160.1380.0721
dew1.481.070.9710.4730.5370.4160.195
diffract0.08780.1270.1390.06070.2190.2370.0274
dilate0.07780.1280.1380.05920.2420.2320.0298
dots0.06850.10.1010.06940.1340.1290.0261
earth0.01470.0330.02180.01680.01680.01910.00177
error0.03120.07070.07090.02880.1350.1370.016
error20.05810.09640.09580.05950.1730.1870.0444
export0.1160.1580.1670.07990.1320.1330.0685
fall0.0350.0510.05770.0180.05850.07090.0142
fexport1.521.761.780.2780.6040.6061.35
fit0.03710.06530.06660.02770.0810.08370.014
flame2d5.375.545.53.043.213.091.13
flow0.3680.4510.4440.360.50.480.352
fog0.04060.06450.06880.03790.07930.08940.0156
fonts0.04770.09260.1120.03470.05180.05190.0413
grad0.06070.1040.1290.07150.1030.120.0633
hist0.1250.1480.1590.09190.1160.1290.0372
ifs2d0.5940.6230.620.3150.3490.330.109
ifs3d0.7870.7770.7840.2940.3530.3660.117
indirect0.02860.05170.05430.0310.06120.1040.0144
inplot0.06870.09790.09930.06220.1810.1950.0444
iris0.008460.0250.01980.003490.01720.01820.0018
label0.02850.0450.0580.02670.05250.06180.014
lamerey0.03050.03720.04550.0190.06040.06330.0024
legend0.07640.2020.2070.04550.1380.1480.0162
light0.09030.1290.1220.05730.1320.1440.021
loglog0.1030.1680.160.08060.2280.2350.0802
map0.03030.06530.07210.03370.08210.08660.015
mark0.01910.03240.03680.02610.05330.0450.0072
mask0.04420.09640.1010.03430.2050.2110.0115
mesh0.0340.07740.06820.01920.07650.07420.0145
mirror0.0920.1280.1420.06070.1740.1760.0312
molecule0.08270.08420.08590.04430.09970.1460.0115
ode0.1490.2020.2020.1470.2820.3160.133
ohlc0.00590.02780.02710.01520.05170.0450.0152
param10.1610.2520.260.09410.3010.3410.0466
param20.5350.580.5390.260.4520.4750.189
param31.752.372.320.6770.8990.9070.758
paramv1.211.391.360.7880.9740.9680.69
parser0.03460.05820.06870.03170.1080.110.0275
pde0.3290.3580.3730.2720.3110.3640.264
pendelta0.06530.05250.06480.05170.05310.05220.0653
pipe0.5980.7370.7380.3820.4930.5050.34
plot0.03970.06420.1140.04440.1230.1180.0194
pmap0.09130.1150.1250.05720.09990.1130.0469
primitives0.05810.1080.1280.06490.1810.210.00928
projection0.130.2640.2860.07040.3510.3490.0683
projection50.1170.2070.2150.07170.30.3120.0437
pulse0.02730.03950.04130.01830.05760.06350.0023
qo2d0.2180.2460.2740.1980.2430.2550.177
quality00.08590.09020.0870.08080.08080.08230.0796
quality10.1890.1660.1710.1750.170.1730.166
quality20.1830.1830.1750.1720.1710.1830.184
quality40.0820.07130.07280.06360.08430.06510.0592
quality50.3660.3590.3630.3660.3540.3560.357
quality60.3730.3670.3650.3660.3680.3830.366
quality80.01930.0190.02890.02980.01650.02440.0229
radar0.01930.03690.05450.01580.05250.05320.0115
refill0.1530.1680.1660.07460.2390.2580.0467
region0.03960.07230.08590.03420.1330.1590.017
scanfile0.03150.0360.04970.01690.04860.0530.014
schemes0.07030.1140.1170.0620.2040.210.019
section0.02940.04830.0540.02210.08040.08210.00568
several_light0.04410.05410.07010.02990.06020.08150.0117
solve0.04610.1090.1050.04620.180.1910.0184
stem0.04180.05990.05910.03080.1260.1390.015
step0.03990.06140.05540.03150.09580.1130.0145
stereo0.05690.06520.08110.0310.08070.0930.0163
stfa0.04250.1170.1110.04160.1150.1210.0157
style0.08920.1970.2040.05960.3490.3690.0158
surf0.1090.1330.1570.06570.160.1580.0315
surf31.792.62.570.9492.362.440.625
surf3a0.4310.2810.2970.1760.2350.2520.178
surf3c0.4230.2850.3010.1750.2020.2650.177
surf3ca0.4280.3030.310.1760.2030.2650.19
surfa0.04090.05770.07140.02650.0620.07250.0154
surfc0.04220.04530.0580.02820.06280.07490.0161
surfca0.04160.05980.0580.02540.05410.06710.015
table0.1030.2130.2140.04840.1120.1170.0156
tape0.04090.07840.08360.03470.1240.1380.0164
tens0.03290.04850.04410.02790.08050.07570.00561
ternary0.1040.2180.2140.06340.3930.4250.0352
text0.08270.1560.150.02610.1140.1270.015
text20.07190.120.1310.1150.1290.1370.016
textmark0.04030.07490.07880.02230.06070.06530.014
ticks0.08680.1930.1950.06110.2590.2490.0275
tile0.03490.04440.05970.03080.05460.05470.0111
tiles0.03930.05850.05340.02050.06480.05970.0174
torus0.1140.1970.1930.07130.3940.4570.0306
traj0.02510.04130.0430.01780.06280.09680.0129
triangulation0.03280.06590.07920.03190.09660.08880.0155
triplot0.03020.07050.1020.01980.09730.1270.0143
tube0.0770.1430.1920.05930.1910.210.0197
type00.1770.1720.1980.06730.1410.20.0576
type10.1740.1730.20.06480.1530.170.0571
type20.1880.1980.1970.07730.1860.1930.0647
vect0.1290.3360.1940.06080.1740.1770.043
vect30.03170.07810.08690.03660.1550.1590.0174
venn0.01530.05030.07870.01150.06650.0750.00249
+ +

Results for image size 1920*1440 (print quality) +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nameq=0q=1q=2q=4q=5q=6q=8
3wave0.07630.1340.1570.07640.1980.2070.0598
alpha0.1110.1760.2540.1040.2440.2720.0591
apde4847.647.547.147.247.747
area0.07830.1690.2450.1070.2770.3350.0408
aspect0.06220.1050.1290.06380.1850.2340.0478
axial0.6811.381.610.2970.8781.120.141
axis0.08630.1530.170.07730.2740.2970.0479
barh0.06310.1180.1340.06610.2180.2590.049
bars0.06540.1260.1530.08030.280.3180.0479
belt0.06240.110.1330.06140.2280.3540.0454
bifurcation0.6040.6960.7580.6020.6560.6920.572
box0.0810.1520.2110.07540.2040.2380.0516
boxplot0.04580.0720.1080.04930.1060.120.0329
boxs0.2760.6230.8230.1310.3870.520.0935
candle0.05660.10.1130.0590.1260.1540.0435
chart0.461.081.780.3772.573.840.19
cloud0.06185.786.760.0611.492.720.0441
colorbar0.1440.2590.2970.1420.3830.4550.075
combined0.4290.4570.5560.2860.4740.5640.245
cones0.170.2260.2720.1570.5210.6670.0624
cont0.09890.1930.2350.09520.2850.3040.0637
cont30.06450.110.1220.06290.130.1520.0479
cont_xyz0.06760.1050.1290.06280.1340.1480.0523
contd0.2370.3070.3680.1510.2940.3460.106
contf0.1930.2620.3050.1360.2740.3220.0921
contf30.1690.2060.30.1170.2320.3530.0796
contf_xyz0.1180.180.2060.1030.1770.2310.0661
contv0.1310.2260.2590.1140.2820.3340.0753
correl0.05780.1080.1150.06160.1930.2160.0463
curvcoor0.1250.2030.2190.120.4540.5040.0933
cut0.7680.6610.730.430.530.6690.431
dat_diff0.09220.1510.1930.0920.2350.2740.0439
dat_extra0.2020.2360.2630.1320.2540.2920.0747
data12.622.072.141.431.691.831.56
data21.511.411.491.221.431.441.24
dens0.1150.2360.320.1340.2710.3270.0746
dens30.1010.1540.2140.09810.1730.2440.0429
dens_xyz0.1020.1790.2420.1190.1640.220.0495
detect0.170.2830.3570.1290.2170.2930.0927
dew1.631.11.190.5570.7970.8810.288
diffract0.09610.2530.3460.1140.3820.430.0508
dilate0.0980.2310.2590.1010.3470.4040.0539
dots0.09860.1390.1670.1060.240.2210.223
earth0.04550.05320.06590.04480.04040.05920.0294
error0.07640.1280.1340.07580.2030.2270.076
error20.07390.1660.1880.09340.3740.4160.0608
export0.1770.2730.3820.1310.2440.3120.0968
fall0.04810.1270.1140.0510.1150.1250.0442
fexport2.332.692.811.121.431.522.19
fit0.0720.1120.1210.06570.1540.1660.0442
flame2d6.166.346.313.713.913.751.26
flow0.430.5290.5570.4030.5820.5990.372
fog0.06510.1460.2090.070.1720.2420.0466
fonts0.08420.130.1350.06690.09690.09650.0696
grad0.1110.2230.3180.1330.2160.2840.0783
hist0.1850.2270.250.1360.2340.2530.0632
ifs2d0.70.7770.7620.3960.4570.4430.133
ifs3d0.8270.8350.8930.3690.450.4840.127
indirect0.05790.09040.1160.05990.1280.1520.0316
inplot0.09310.1510.190.1070.320.3290.0601
iris0.04460.05440.07510.04680.04570.05780.0371
label0.04840.08790.1050.06010.1120.1640.078
lamerey0.07230.07280.09780.06110.1040.1540.0522
legend0.1230.2820.30.07960.2320.3110.041
light0.120.1860.4480.1040.220.4170.0528
loglog0.1360.2520.2520.1250.4050.4810.0956
map0.07680.1570.1950.07340.1680.2320.0471
mark0.06590.09090.08810.07180.2390.1510.0372
mask0.08780.2070.3260.09440.2790.3470.0511
mesh0.07190.1310.1630.06830.1470.1810.0418
mirror0.1350.2170.2590.1050.2960.3080.0548
molecule0.09790.1460.2370.09530.2410.3610.044
ode0.1930.280.290.1910.4190.4360.163
ohlc0.04820.0710.09360.05740.1090.1210.0447
param10.1860.3480.4240.150.5450.8450.0861
param20.570.7320.8060.3130.6980.8270.23
param31.912.562.930.7671.171.580.844
paramv1.291.551.50.8161.121.110.718
parser0.06310.1120.140.06430.2090.2320.0467
pde0.370.5110.5540.3180.4290.4550.284
pendelta0.1080.1150.1020.1080.1150.1040.105
pipe0.6610.9221.040.4140.6690.8280.36
plot0.09610.1160.1420.09320.220.2370.0457
pmap0.1370.1840.2160.09940.1650.210.0737
primitives0.09780.1910.2890.09710.3040.3530.0386
projection0.1660.4030.4840.1240.5780.6260.078
projection50.1490.3230.360.1170.4960.5460.0722
pulse0.04880.07510.09110.05030.1120.130.0347
qo2d0.2520.3890.4550.2440.3540.4140.208
quality00.1120.1120.1190.1190.110.1230.114
quality10.2390.2540.240.240.2520.260.232
quality20.2760.2730.2720.2770.2750.2740.278
quality40.1070.1040.1030.1040.1040.1120.107
quality50.4550.4480.460.4660.450.450.456
quality60.4890.4780.480.4890.480.4790.492
quality80.05750.04670.04530.04390.0470.04620.0486
radar0.0580.06750.08720.070.09690.1230.0284
refill0.1860.2320.2780.1290.3560.3890.07
region0.07060.1660.210.08030.2740.30.0442
scanfile0.05630.07690.08840.04690.08910.1060.0341
schemes0.1210.2270.2830.1890.2840.3380.0454
section0.05930.09480.09740.06220.1590.1750.0417
several_light0.0760.1090.2440.06970.1230.2460.0442
solve0.09250.1880.1950.1080.3440.3340.0485
stem0.06330.1290.1450.08270.2030.2120.0407
step0.06320.1020.1140.1120.1830.1940.0447
stereo0.09010.1260.2060.08070.1510.2370.0441
stfa0.09250.2450.2910.08010.2140.2990.0438
style0.1140.2710.3210.1020.440.4680.0451
surf0.1490.2410.3030.120.240.3190.0498
surf32.013.413.441.413.343.330.667
surf3a0.5140.3970.5370.240.3970.740.205
surf3c0.4820.40.5330.2350.4230.7280.208
surf3ca0.4940.4010.5360.260.4020.7090.243
surfa0.06430.1050.1810.05720.1220.1920.0456
surfc0.06440.1110.1840.06090.1280.1990.0399
surfca0.06450.1060.1810.06960.1280.2010.044
table0.1280.2630.290.08130.1760.1970.0481
tape0.07790.1430.1670.07880.2240.2420.0463
tens0.06050.09560.09350.06990.1460.1620.046
ternary0.130.3340.3570.1160.5890.650.061
text0.110.2140.2250.06780.1720.190.0438
text20.08090.1750.1890.07970.220.2350.0425
textmark0.07420.1290.140.05740.1260.1430.0438
ticks0.1260.2520.2740.1110.3290.3590.0488
tile0.0620.0910.1350.06050.110.1560.0613
tiles0.060.1190.1580.06040.1290.1630.0466
torus0.1480.2770.3910.1210.8171.190.0653
traj0.04760.08990.1080.05590.1530.1620.0336
triangulation0.06220.1590.2180.06670.1730.2440.0451
triplot0.04940.1810.3710.06080.1810.320.0308
tube0.1080.2860.3730.1040.3110.3790.0493
type00.2380.3260.50.1440.3140.4790.108
type10.2370.340.5310.1370.3170.50.102
type20.2430.3350.5090.1480.3170.4840.115
vect0.110.2480.3280.1270.3540.3250.0732
vect30.06920.1530.1730.08840.5260.3660.0356
venn0.04940.1940.2890.06640.1580.2360.044
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix D TeX-like symbols

+ + +

The full list of TeX-like commands recognizable by MathGL is shown below. If command is not recognized then it will be printed as is by ommitting ‘\’ symbol. For example, ‘\#’ produce “#”, ‘\\’ produce “\”, ‘\qq’ produce “qq”. +

+

Change case: _, ^, @. +

+

Text style: \big, \b, \textbf, \i, \textit, \bi, \r, \textrm, \a, \overline, \u, \underline, \w, \wire, #, \color[wkrgbcymhRGBCYMHWlenupqLENUPQ] +

+

Roots: \sqrt, \sqrt3, \sqrt4 +

+

Fractions: \frac, \dfrac, \stack, \overset, \underset, \stackr, \stackl +

+

Accents: \hat, \tilde, \dot, \ddot, \dddot, \ddddot, \acute, \check, \grave, \vec, \bar, \breve +

+

Special symbols: +

+

\# (#), \% (%), \& (&), \^ (^). +

+

\AA (Å), \AE (Æ), \APLboxquestion (⍰), \APLboxupcaret (⍓), \APLnotbackslash (⍀), \APLnotslash (⌿), \Alpha (Α), \And (&), \Angstrom (Å), \Barv (⫧), \BbbC (ℂ), \BbbGamma (ℾ), \BbbH (ℍ), \BbbN (ℕ), \BbbP (ℙ), \BbbPi (ℿ), \BbbQ (ℚ), \BbbR (ℝ), \BbbZ (ℤ), \Bbbgamma (ℽ), \Bbbpi (ℼ), \Bbbsum (⅀), \Beta (Β), \Bumpeq (≎), \Cap (⋒), \Chi (Χ), \Colon (∷), \Coloneq (⩴), \Cup (⋓), \DDownarrow (⟱), \DH (Ð), \DJ (Đ), \DashV (⫥), \DashVDash (⟚), \Dashv (⫤), \Ddownarrow (⤋), \Delta (Δ), \Digamma (Ϝ), \Doteq (≑), \Downarrow (⇓), \Epsilon (Ε), \Equiv (≣), \Eta (Η), \Eulerconst (ℇ), \Exclam (‼), \Finv (Ⅎ), \Game (⅁), \Gamma (Γ), \Gt (⪢), \Hermaphrodite (⚥), \Im (ℑ), \Iota (Ι), \Kappa (Κ), \Koppa (Ϟ), \L (Ł), \LLeftarrow (⭅), \Lambda (Λ), \Lbrbrak (⟬), \Ldsh (↲), \Leftarrow (⇐), \Leftrightarrow (⇔), \Lleftarrow (⇚), \Longleftarrow (⟸), \Longleftrightarrow (⟺), \Longmapsfrom (⟽), \Longmapsto (⟾), \Longrightarrow (⟹), \Lparengtr (⦕), \Lsh (↰), \Lt (⪡), \Lvzigzag (⧚), \Mapsfrom (⤆), \Mapsto (⤇), \Mu (Μ), \NG (Ŋ), \Nearrow (⇗), \Not (⫬), \Nu (Ν), \Nwarrow (⇖), \O (Ø), \OE (Œ), \Ohorn (Ơ), \Omega (Ω), \Omicron (Ο), \Otimes (⨷), \P (¶), \Phi (Φ), \Pi (Π), \Planckconst (ℎ), \Prec (⪻), \PropertyLine (⅊), \Psi (Ψ), \QED (∎), \Question (⁇), \RRightarrow (⭆), \Rbrbrak (⟭), \Rdsh (↳), \Re (ℜ), \Rho (Ρ), \Rightarrow (⇒), \Rparenless (⦖), \Rrightarrow (⇛), \Rsh (↱), \Rvzigzag (⧛), \S (§), \Sc (⪼), \Searrow (⇘), \Sigma (Σ), \Sqcap (⩎), \Sqcup (⩏), \Stigma (Ϛ), \Subset (⋐), \Supset (⋑), \Swarrow (⇙), \TH (Þ), \Tau (Τ), \Theta (Θ), \UUparrow (⟰), \Uhorn (Ư), \Uparrow (⇑), \Updownarrow (⇕), \Uuparrow (⤊), \VDash (⊫), \Vbar (⫫), \Vdash (⊩), \Vee (⩔), \Vert (‖), \Vvdash (⊪), \Vvert (⦀), \Wedge (⩓), \XBox (☒), \Xi (Ξ), \Yup (⅄), \Zbar (Ƶ), \Zeta (Ζ). +

+

\aa (å), \ac (∾), \accurrent (⏦), \acidfree (♾), \acwcirclearrow (⥀), \acwgapcirclearrow (⟲), \acwleftarcarrow (⤹), \acwopencirclearrow (↺), \acwoverarcarrow (⤺), \acwundercurvearrow (⤻), \adots (⋰), \ae (æ), \aleph (ℵ), \alpha (α), \amalg (⨿), \angdnr (⦟), \angle (∠), \angles (⦞), \angleubar (⦤), \approx (≈), \approxeq (≊), \approxeqq (⩰), \approxident (≋), \arceq (≘), \aries (♈), \assert (⊦), \ast (∗), \asteq (⩮), \astrosun (☉), \asymp (≍), \awint (⨑). +

+

\bNot (⫭), \backcong (≌), \backdprime (‶), \backepsilon (϶), \backprime (‵), \backsim (∽), \backsimeq (⋍), \backslash (\), \backtrprime (‷), \bagmember (⋿), \barV (⫪), \barcap (⩃), \barcup (⩂), \bardownharpoonleft (⥡), \bardownharpoonright (⥝), \barleftarrow (⇤), \barleftarrowrightarrowbar (↹), \barleftharpoondown (⥖), \barleftharpoonup (⥒), \barovernorthwestarrow (↸), \barrightarrowdiamond (⤠), \barrightharpoondown (⥟), \barrightharpoonup (⥛), \baruparrow (⤒), \barupharpoonleft (⥘), \barupharpoonright (⥔), \barvee (⊽), \barwedge (⊼), \bbrktbrk (⎶), \bdHrule (═), \bdVrule (║), \bdbVbH (╬), \bdbVbh (╫), \bdbVlH (╣), \bdbVlh (╢), \bdbVrH (╠), \bdbVrh (╟), \bdbvbH (╪), \bdbvbh (┼), \bdbvlH (╡), \bdbvlh (┤), \bdbvrH (╞), \bdbvrh (├), \bddVbH (╦), \bddVbh (╥), \bddVlH (╗), \bddVlh (╖), \bddVrH (╔), \bddVrh (╓), \bddvbH (╤), \bddvbh (┬), \bddvlH (╕), \bddvlh (┐), \bddvrH (╒), \bddvrh (┌), \bdhrule (─), \bdnesw (╱), \bdnwse (╲), \bdquadhdash (┈), \bdquadvdash (┊), \bdtriplevdash (┆), \bduVbH (╩), \bduVbh (╨), \bduVlH (╝), \bduVlh (╜), \bduVrH (╚), \bduVrh (╙), \bduvbH (╧), \bduvbh (┴), \bduvlH (╛), \bduvlh (┘), \bduvrH (╘), \bduvrh (└), \bdvrule (│), \because (∵), \benzenr (⏣), \beta (β), \beth (ℶ), \between (≬), \bigblacktriangledown (▼), \bigblacktriangleup (▲), \bigbot (⟘), \bigcap (⋂), \bigcup (⋃), \bigslopedvee (⩗), \bigslopedwedge (⩘), \bigstar (★), \bigtop (⟙), \bigtriangledown (▽), \bigtriangleup (△), \bigvee (⋁), \bigwedge (⋀), \bigwhitestar (☆), \blackcircledownarrow (⧭), \blackcircledrightdot (⚈), \blackcircledsanseight (➑), \blackcircledsansfive (➎), \blackcircledsansfour (➍), \blackcircledsansnine (➒), \blackcircledsansone (➊), \blackcircledsansseven (➐), \blackcircledsanssix (➏), \blackcircledsansten (➓), \blackcircledsansthree (➌), \blackcircledsanstwo (➋), \blackcircledtwodots (⚉), \blackcircleulquadwhite (◕), \blackdiamonddownarrow (⧪), \blackhourglass (⧗), \blackinwhitediamond (◈), \blackinwhitesquare (▣), \blacklefthalfcircle (◖), \blackpointerleft (◄), \blackpointerright (►), \blackrighthalfcircle (◗), \blacksmiley (☻), \blacktriangle (▴), \blacktriangledown (▾), \blacktriangleleft (◀), \blacktriangleright (▶), \blkhorzoval (⬬), \blkvertoval (⬮), \blockfull (█), \blockhalfshaded (▒), \blocklefthalf (▌), \blocklowhalf (▄), \blockqtrshaded (░), \blockrighthalf (▐), \blockthreeqtrshaded (▓), \blockuphalf (▀), \bot (⊥), \botsemicircle (◡), \bowtie (⋈), \box (◻), \boxast (⧆), \boxbar (◫), \boxbox (⧈), \boxbslash (⧅), \boxcircle (⧇), \boxdiag (⧄), \boxdot (⊡), \boxminus (⊟), \boxonbox (⧉), \boxplus (⊞), \boxtimes (⊠), \bsimilarleftarrow (⭁), \bsimilarrightarrow (⭇), \bsolhsub (⟈), \btimes (⨲), \bullet (∙), \bullseye (◎), \bumpeq (≏), \bumpeqq (⪮). +

+

\calB (ℬ), \calE (ℰ), \calF (ℱ), \calH (ℋ), \calM (ℳ), \calR (ℛ), \cap (∩), \capdot (⩀), \capwedge (⩄), \caretinsert (‸), \carreturn (⏎), \carriagereturn (↵), \ccwundercurvearrow (⤿), \cdot (⋅), \cdotp (·), \cdots (⋯), \cdprime (ʺ), \checkmark (✓), \chi (χ), \cirE (⧃), \cirbot (⟟), \circ (∘), \circeq (≗), \circfint (⨐), \circlebottomhalfblack (◒), \circledA (Ⓐ), \circledB (Ⓑ), \circledC (Ⓒ), \circledD (Ⓓ), \circledE (Ⓔ), \circledF (Ⓕ), \circledG (Ⓖ), \circledH (Ⓗ), \circledI (Ⓘ), \circledJ (Ⓙ), \circledK (Ⓚ), \circledL (Ⓛ), \circledM (Ⓜ), \circledN (Ⓝ), \circledO (Ⓞ), \circledP (Ⓟ), \circledQ (Ⓠ), \circledR (Ⓡ), \circledS (Ⓢ), \circledT (Ⓣ), \circledU (Ⓤ), \circledV (Ⓥ), \circledW (Ⓦ), \circledX (Ⓧ), \circledY (Ⓨ), \circledZ (Ⓩ), \circleda (ⓐ), \circledast (⊛), \circledb (ⓑ), \circledbullet (⦿), \circledc (ⓒ), \circledcirc (⊚), \circledd (ⓓ), \circleddash (⊝), \circlede (ⓔ), \circledeight (⑧), \circledequal (⊜), \circledf (ⓕ), \circledfive (⑤), \circledfour (④), \circledg (ⓖ), \circledh (ⓗ), \circledi (ⓘ), \circledj (ⓙ), \circledk (ⓚ), \circledl (ⓛ), \circledm (ⓜ), \circledn (ⓝ), \circlednine (⑨), \circledo (ⓞ), \circledone (①), \circledownarrow (⧬), \circledp (ⓟ), \circledparallel (⦷), \circledq (ⓠ), \circledr (ⓡ), \circledrightdot (⚆), \circleds (ⓢ), \circledsanseight (➇), \circledsansfive (➄), \circledsansfour (➃), \circledsansnine (➈), \circledsansone (➀), \circledsansseven (➆), \circledsanssix (➅), \circledsansten (➉), \circledsansthree (➂), \circledsanstwo (➁), \circledseven (⑦), \circledsix (⑥), \circledstar (✪), \circledt (ⓣ), \circledthree (③), \circledtwo (②), \circledtwodots (⚇), \circledu (ⓤ), \circledv (ⓥ), \circledvert (⦶), \circledw (ⓦ), \circledwhitebullet (⦾), \circledx (ⓧ), \circledy (ⓨ), \circledz (ⓩ), \circledzero (⓪), \circlehbar (⦵), \circlelefthalfblack (◐), \circlellquad (◵), \circlelrquad (◶), \circleonleftarrow (⬰), \circleonrightarrow (⇴), \circlerighthalfblack (◑), \circletophalfblack (◓), \circleulquad (◴), \circleurquad (◷), \circleurquadblack (◔), \circlevertfill (◍), \cirmid (⫯), \cirscir (⧂), \clangle (〈), \closedvarcap (⩍), \closedvarcup (⩌), \closedvarcupsmashprod (⩐), \closure (⁐), \cloverleaf (⌘), \clubsuit (♣), \colon (:), \colon (∶), \coloneq (≔), \commaminus (⨩), \complement (∁), \concavediamond (⟡), \concavediamondtickleft (⟢), \concavediamondtickright (⟣), \cong (≅), \congdot (⩭), \conictaper (⌲), \conjunction (☌), \coprod (∐), \cprime (ʹ), \crangle (〉), \csub (⫏), \csube (⫑), \csup (⫐), \csupe (⫒), \cuberoot (∛), \cup (∪), \cupdot (⊍), \cupleftarrow (⊌), \cupvee (⩅), \curlyeqprec (⋞), \curlyeqsucc (⋟), \curlyvee (⋎), \curlywedge (⋏), \curvearrowleft (↶), \curvearrowleftplus (⤽), \curvearrowright (↷), \curvearrowrightminus (⤼), \cwcirclearrow (⥁), \cwgapcirclearrow (⟳), \cwopencirclearrow (↻), \cwrightarcarrow (⤸), \cwundercurvearrow (⤾), \cylcty (⌭). +

+

\dag (†), \dagger (†), \daleth (ℸ), \danger (☡), \dashV (⫣), \dashVdash (⟛), \dashcolon (∹), \dashleftharpoondown (⥫), \dashrightharpoondown (⥭), \dashv (⊣), \dbkarow (⤏), \ddag (‡), \ddagger (‡), \ddots (⋱), \ddotseq (⩷), \delta (δ), \dh (ð), \diameter (⌀), \diamond (◇), \diamondbotblack (⬙), \diamondcdot (⟐), \diamondleftarrow (⤝), \diamondleftarrowbar (⤟), \diamondleftblack (⬖), \diamondrightblack (⬗), \diamondsuit (♢), \diamondtopblack (⬘), \dicei (⚀), \diceii (⚁), \diceiii (⚂), \diceiv (⚃), \dicev (⚄), \dicevi (⚅), \digamma (ϝ), \dingasterisk (✽), \dircurrent (⎓), \disin (⋲), \div (÷), \divideontimes (⋇), \dj (đ), \dlcrop (⌍), \doteq (≐), \dotequiv (⩧), \dotminus (∸), \dotplus (∔), \dots (…), \dotsim (⩪), \dotsminusdots (∺), \dottedcircle (◌), \dottedsquare (⬚), \dottimes (⨰), \doublebarvee (⩢), \doublebarwedge (⩞), \doubleplus (⧺), \downarrow (↓), \downarrowbar (⤓), \downarrowbarred (⤈), \downdasharrow (⇣), \downdownarrows (⇊), \downfishtail (⥿), \downharpoonleft (⇃), \downharpoonleftbar (⥙), \downharpoonright (⇂), \downharpoonrightbar (⥕), \downharpoonsleftright (⥥), \downrightcurvedarrow (⤵), \downtriangleleftblack (⧨), \downtrianglerightblack (⧩), \downuparrows (⇵), \downupharpoonsleftright (⥯), \downwhitearrow (⇩), \downzigzagarrow (↯), \dprime (″), \draftingarrow (➛), \drbkarow (⤐), \drcrop (⌌), \dsol (⧶), \dsub (⩤), \dualmap (⧟). +

+

\earth (♁), \egsdot (⪘), \eighthnote (♪), \elinters (⏧), \ell (ℓ), \elsdot (⪗), \emdash (—), \emptyset (∅), \emptysetoarr (⦳), \emptysetoarrl (⦴), \emptysetobar (⦱), \emptysetocirc (⦲), \endash (–), \enleadertwodots (‥), \envelope (✉), \eparsl (⧣), \epsilon (ϵ), \eqcirc (≖), \eqcolon (≕), \eqdef (≝), \eqdot (⩦), \eqeq (⩵), \eqeqeq (⩶), \eqgtr (⋝), \eqless (⋜), \eqqgtr (⪚), \eqqless (⪙), \eqqplus (⩱), \eqqsim (⩳), \eqqslantgtr (⪜), \eqqslantless (⪛), \eqsim (≂), \eqslantgtr (⪖), \eqslantless (⪕), \equalleftarrow (⭀), \equalparallel (⋕), \equalrightarrow (⥱), \equiv (≡), \equivDD (⩸), \equivVert (⩨), \equivVvert (⩩), \eqvparsl (⧥), \errbarblackcircle (⧳), \errbarblackdiamond (⧱), \errbarblacksquare (⧯), \errbarcircle (⧲), \errbardiamond (⧰), \errbarsquare (⧮), \eta (η), \euro (€), \exists (∃). +

+

\fallingdotseq (≒), \fbowtie (⧓), \fcmp (⨾), \fdiagovnearrow (⤯), \fdiagovrdiag (⤬), \female (♀), \figdash (‒), \fint (⨏), \fisheye (◉), \flat (♭), \fltns (⏥), \forall (∀), \forks (⫝̸), \forksnot (⫝), \forkv (⫙), \fourthroot (∜), \fourvdots (⦙), \fracfiveeighths (⅝), \fracfivesixths (⅚), \fracfourfifths (⅘), \fraconeeighth (⅛), \fraconefifth (⅕), \fraconesixth (⅙), \fraconethird (⅓), \fracseveneights (⅞), \fracslash (⁄), \fracthreeeighths (⅜), \fracthreefifths (⅗), \fractwofifths (⅖), \fractwothirds (⅔), \frakC (ℭ), \frakH (ℌ), \frakZ (ℨ), \frown (⌢), \frownie (☹), \fullouterjoin (⟗). +

+

\gamma (γ), \ge (≥), \geq (≥), \geqq (≧), \geqslant (⩾), \gescc (⪩), \gesdot (⪀), \gesdoto (⪂), \gesdotol (⪄), \gesles (⪔), \gets (←), \gg (≫), \ggg (⋙), \gggnest (⫸), \gimel (ℷ), \glE (⪒), \gla (⪥), \gleichstark (⧦), \glj (⪤), \gnapprox (⪊), \gneq (⪈), \gneqq (≩), \gnsim (⋧), \greater (>), \gsime (⪎), \gsiml (⪐), \gtcc (⪧), \gtcir (⩺), \gtlpar (⦠), \gtquest (⩼), \gtrapprox (⪆), \gtrarr (⥸), \gtrdot (⋗), \gtreqless (⋛), \gtreqqless (⪌), \gtrless (≷), \gtrsim (≳), \guillemotleft («), \guillemotright (»), \guilsinglleft (‹), \guilsinglright (›). +

+

\harrowextender (⎯), \hatapprox (⩯), \hbar (ℏ), \heartsuit (♡), \hermitmatrix (⊹), \hexagon (⎔), \hexagonblack (⬣), \hiraganano (の), \hknearrow (⤤), \hknwarrow (⤣), \hksearow (⤥), \hkswarow (⤦), \hookleftarrow (↩), \hookrightarrow (↪), \horizbar (―), \hourglass (⧖), \house (⌂), \hrectangle (▭), \hrectangleblack (▬), \hslash (ℏ), \hyphenbullet (⁃), \hzigzag (〰). +

+

\iiiint (⨌), \iiint (∭), \iinfin (⧜), \iint (∬), \imageof (⊷), \in (∈), \incare (℅), \increment (∆), \infty (∞), \int (∫), \intBar (⨎), \intbar (⨍), \intbottom (⌡), \intcap (⨙), \intclockwise (∱), \intcup (⨚), \intercal (⊺), \interleave (⫴), \intextender (⎮), \intlharhk (⨗), \intprod (⨼), \intprodr (⨽), \inttop (⌠), \intx (⨘), \inversebullet (◘), \inversewhitecircle (◙), \invnot (⌐), \invwhitelowerhalfcircle (◛), \invwhiteupperhalfcircle (◚), \iota (ι), \ipasupgamma (ˠ), \ipasupl (ˡ), \ipasuprerglotstpp (ˤ), \ipasups (ˢ), \ipasupx (ˣ), \ipaunaspirated (˭), \ipavoicing (ˬ), \isinE (⋹), \isindot (⋵), \isinobar (⋷), \isins (⋴), \isinvb (⋸), \itBbbD (ⅅ), \itBbbd (ⅆ), \itBbbe (ⅇ), \itBbbi (ⅈ), \itBbbj (ⅉ). +

+

\jupiter (♃), \kappa (κ), \kernelcontraction (∻), \koppa (ϟ). +

+

\l (ł), \lAngle (⟪), \lBrace (⦃), \lBrack (⟦), \lParen (⦅), \lambda (λ), \lambdabar (ƛ), \langle (⟨), \langledot (⦑), \laplac (⧠), \lasp (ʽ), \lat (⪫), \late (⪭), \lbag (⟅), \lblkbrbrak (⦗), \lbrace ({), \lbracelend (⎩), \lbracemid (⎨), \lbraceuend (⎧), \lbrack ([), \lbrackextender (⎢), \lbracklend (⎣), \lbracklltick (⦏), \lbrackubar (⦋), \lbrackuend (⎡), \lbrackultick (⦍), \lbrbrak (❲), \lceil (⌈), \lcurvyangle (⧼), \ldasharrhead (⇠), \le (≤), \leadsto (↝), \leftarrow (←), \leftarrowapprox (⭊), \leftarrowbackapprox (⭂), \leftarrowbsimilar (⭋), \leftarrowless (⥷), \leftarrowonoplus (⬲), \leftarrowplus (⥆), \leftarrowshortrightarrow (⥃), \leftarrowsimilar (⥳), \leftarrowsubset (⥺), \leftarrowtail (↢), \leftarrowtriangle (⇽), \leftarrowx (⬾), \leftbkarrow (⤌), \leftcurvedarrow (⬿), \leftdasharrow (⇠), \leftdasharrowhead (⇡), \leftdbkarrow (⤎), \leftdbltail (⤛), \leftdotarrow (⬸), \leftdowncurvedarrow (⤶), \leftfishtail (⥼), \leftharpoondown (↽), \leftharpoondownbar (⥞), \leftharpoonsupdown (⥢), \leftharpoonup (↼), \leftharpoonupbar (⥚), \leftharpoonupdash (⥪), \leftleftarrows (⇇), \leftmoon (☾), \leftouterjoin (⟕), \leftrightarrow (↔), \leftrightarrowcircle (⥈), \leftrightarrows (⇆), \leftrightarrowtriangle (⇿), \leftrightharpoondowndown (⥐), \leftrightharpoondownup (⥋), \leftrightharpoons (⇋), \leftrightharpoonsdown (⥧), \leftrightharpoonsup (⥦), \leftrightharpoonupdown (⥊), \leftrightharpoonupup (⥎), \leftrightsquigarrow (↭), \leftsquigarrow (↜), \leftsquigarrow (⇜), \lefttail (⤙), \leftthreearrows (⬱), \leftthreetimes (⋋), \leftwhitearrow (⇦), \leq (≤), \leqq (≦), \leqqslant (⫹), \leqqslant (⫺), \leqslant (⩽), \lescc (⪨), \lesdot (⩿), \lesdoto (⪁), \lesdotor (⪃), \lesges (⪓), \less (<), \lessapprox (⪅), \lessdot (⋖), \lesseqgtr (⋚), \lesseqqgtr (⪋), \lessgtr (≶), \lesssim (≲), \lfbowtie (⧑), \lfloor (⌊), \lftimes (⧔), \lgE (⪑), \lgblkcircle (⬤), \lgblksquare (⬛), \lgwhtcircle (◯), \lgwhtsquare (⬜), \lhd (⊲), \linefeed (↴), \ll (≪), \llangle (⦉), \llarc (◟), \llblacktriangle (◣), \llcorner (⌞), \lll (⋘), \lllnest (⫷), \llparenthesis (⦇), \lltriangle (◺), \lmoustache (⎰), \lnapprox (⪉), \lneq (⪇), \lneqq (≨), \lnsim (⋦), \longdashv (⟞), \longdivision (⟌), \longleftarrow (⟵), \longleftrightarrow (⟷), \longleftsquigarrow (⬳), \longmapsfrom (⟻), \longmapsto (⟼), \longrightarrow (⟶), \longrightsquigarrow (⟿), \looparrowleft (↫), \looparrowright (↬), \lowint (⨜), \lozenge (◊), \lozengeminus (⟠), \lparenextender (⎜), \lparenlend (⎝), \lparenless (⦓), \lparenuend (⎛), \lq (‘), \lrarc (◞), \lrblacktriangle (◢), \lrcorner (⌟), \lrtriangle (◿), \lrtriangleeq (⧡), \lsime (⪍), \lsimg (⪏), \lsqhook (⫍), \ltcc (⪦), \ltcir (⩹), \ltimes (⋉), \ltlarr (⥶), \ltquest (⩻), \ltrivb (⧏), \lvboxline (⎸), \lvzigzag (⧘). +

+

\male (♂), \maltese (✠), \mapsdown (↧), \mapsfrom (↤), \mapsto (↦), \mapsup (↥), \mdblkdiamond (⬥), \mdblklozenge (⬧), \mdblkrcl (⚫), \mdblksquare (◼), \mdlgblkcircle (●), \mdlgblkdiamond (◆), \mdlgblklozenge (⧫), \mdlgblksquare (■), \mdlgwhtcircle (○), \mdlgwhtdiamond (◇), \mdlgwhtsquare (□), \mdsmblkcircle (⦁), \mdsmblksquare (◾), \mdsmwhtcircl (⚬), \mdsmwhtsquare (◽), \mdwhtcircl (⚪), \mdwhtdiamond (⬦), \mdwhtlozenge (⬨), \mdwhtsquare (◻), \measangledltosw (⦯), \measangledrtose (⦮), \measangleldtosw (⦫), \measanglelutonw (⦩), \measanglerdtose (⦪), \measanglerutone (⦨), \measangleultonw (⦭), \measangleurtone (⦬), \measeq (≞), \measuredangle (∡), \measuredangleleft (⦛), \measuredrightangle (⊾), \medblackstar (⭑), \medmathspace ( ), \medwhitestar (⭐), \mercury (☿), \mho (℧), \mid (∣), \midbarvee (⩝), \midbarwedge (⩜), \midcir (⫰), \minus (−), \minusdot (⨪), \minusfdots (⨫), \minusrdots (⨬), \mlcp (⫛), \models (⊧), \mp (∓), \mu (μ), \multimap (⊸), \multimapinv (⟜). +

+

\nHdownarrow (⇟), \nHuparrow (⇞), \nLeftarrow (⇍), \nLeftrightarrow (⇎), \nRightarrow (⇏), \nVDash (⊯), \nVdash (⊮), \nVleftarrow (⇺), \nVleftarrowtail (⬺), \nVleftrightarrow (⇼), \nVrightarrow (⇻), \nVrightarrowtail (⤕), \nVtwoheadleftarrow (⬵), \nVtwoheadleftarrowtail (⬽), \nVtwoheadrightarrow (⤁), \nVtwoheadrightarrowtail (⤘), \nabla (∇), \napprox (≉), \nasymp (≭), \natural (♮), \ncong (≇), \ne (≠), \nearrow (↗), \neg (¬), \neovnwarrow (⤱), \neovsearrow (⤮), \neptune (♆), \neq (≠), \nequiv (≢), \neswarrow (⤢), \neuter (⚲), \nexists (∄), \ng (ŋ), \ngeq (≱), \ngtr (≯), \ngtrless (≹), \ngtrsim (≵), \nhVvert (⫵), \nhpar (⫲), \ni (∋), \niobar (⋾), \nis (⋼), \nisd (⋺), \nleftarrow (↚), \nleftrightarrow (↮), \nleq (≰), \nless (≮), \nlessgtr (≸), \nlesssim (≴), \nmid (∤), \nni (∌), \nobreakhyphen (‑), \notin (∉), \nparallel (∦), \npolint (⨔), \nprec (⊀), \npreccurlyeq (⋠), \nrightarrow (↛), \nsim (≁), \nsime (≄), \nsqsubseteq (⋢), \nsqsupseteq (⋣), \nsubset (⊄), \nsubseteq (⊈), \nsucc (⊁), \nsucccurlyeq (⋡), \nsupset (⊅), \nsupseteq (⊉), \ntriangleleft (⋪), \ntrianglelefteq (⋬), \ntriangleright (⋫), \ntrianglerighteq (⋭), \nu (ν), \nvDash (⊭), \nvLeftarrow (⤂), \nvLeftrightarrow (⤄), \nvRightarrow (⤃), \nvdash (⊬), \nvinfty (⧞), \nvleftarrow (⇷), \nvleftarrowtail (⬹), \nvleftrightarrow (⇹), \nvrightarrow (⇸), \nvrightarrowtail (⤔), \nvtwoheadleftarrow (⬴), \nvtwoheadleftarrowtail (⬼), \nvtwoheadrightarrow (⤀), \nvtwoheadrightarrowtail (⤗), \nwarrow (↖), \nwovnearrow (⤲), \nwsearrow (⤡). +

+

\o (ø), \obar (⌽), \obot (⦺), \obrbrak (⏠), \obslash (⦸), \odiv (⨸), \odot (⊙), \odotslashdot (⦼), \oe (œ), \ogreaterthan (⧁), \ohorn (ơ), \oiiint (∰), \oiint (∯), \oint (∮), \ointctrclockwise (∳), \olcross (⦻), \oldKoppa (Ϙ), \oldkoppa (ϙ), \olessthan (⧀), \omega (ω), \omicron (ο), \ominus (⊖), \operp (⦹), \oplus (⊕), \opluslhrim (⨭), \oplusrhrim (⨮), \origof (⊶), \oslash (⊘), \otimes (⊗), \otimeshat (⨶), \otimeslhrim (⨴), \otimesrhrim (⨵), \overbrace (⏞), \overbracket (⎴), \overline (‾), \overparen (⏜), \owns (∋). +

+

\parallel (∥), \parallelogram (▱), \parallelogramblack (▰), \parsim (⫳), \partial (∂), \partialmeetcontraction (⪣), \pentagon (⬠), \pentagonblack (⬟), \perp (⟂), \perps (⫡), \phi (ϕ), \phone (☎), \pi (π), \pitchfork (⋔), \plusdot (⨥), \pluseqq (⩲), \plushat (⨣), \plussim (⨦), \plussubtwo (⨧), \plustrif (⨨), \pluto (♇), \pm (±), \pointnt (⨕), \postalmark (〒), \prec (≺), \precapprox (⪷), \preccurlyeq (≼), \preceq (⪯), \preceqq (⪳), \precnapprox (⪹), \precneq (⪱), \precneqq (⪵), \precnsim (⋨), \precsim (≾), \prime (′), \prod (∏), \profalar (⌮), \profline (⌒), \profsurf (⌓), \propto (∝), \prurel (⊰), \psi (ψ), \pullback (⟓), \pushout (⟔). +

+

\qprime (⁗), \quarternote (♩), \questeq (≟), \quotdblbase („), \quotdblright (‟), \quotsinglbase (‚), \quotsinglright (‛). +

+

\rAngle (⟫), \rBrace (⦄), \rBrack (⟧), \rParen (⦆), \rangle (⟩), \rangledot (⦒), \rangledownzigzagarrow (⍼), \rasp (ʼ), \rbag (⟆), \rblkbrbrak (⦘), \rbrace (}), \rbracelend (⎭), \rbracemid (⎬), \rbraceuend (⎫), \rbrack (]), \rbrackextender (⎥), \rbracklend (⎦), \rbracklrtick (⦎), \rbrackubar (⦌), \rbrackuend (⎤), \rbrackurtick (⦐), \rbrbrak (❳), \rceil (⌉), \rcurvyangle (⧽), \rdiagovfdiag (⤫), \rdiagovsearrow (⤰), \recorder (⌕), \revangle (⦣), \revangleubar (⦥), \revemptyset (⦰), \revnmid (⫮), \rfbowtie (⧒), \rfloor (⌋), \rftimes (⧕), \rhd (⊳), \rho (ρ), \righarrowbsimilar (⭌), \rightangle (∟), \rightanglemdot (⦝), \rightanglesqr (⦜), \rightarrow (→), \rightarrowapprox (⥵), \rightarrowbackapprox (⭈), \rightarrowbar (⇥), \rightarrowdiamond (⤞), \rightarrowgtr (⭃), \rightarrowonoplus (⟴), \rightarrowplus (⥅), \rightarrowshortleftarrow (⥂), \rightarrowsimilar (⥴), \rightarrowsupset (⭄), \rightarrowtail (↣), \rightarrowtriangle (⇾), \rightarrowx (⥇), \rightbkarrow (⤍), \rightcurvedarrow (⤳), \rightdasharrow (⇢), \rightdbltail (⤜), \rightdotarrow (⤑), \rightdowncurvedarrow (⤷), \rightfishtail (⥽), \rightharpoondown (⇁), \rightharpoondownbar (⥗), \rightharpoonsupdown (⥤), \rightharpoonup (⇀), \rightharpoonupbar (⥓), \rightharpoonupdash (⥬), \rightimply (⥰), \rightleftarrows (⇄), \rightleftharpoons (⇌), \rightleftharpoonsdown (⥩), \rightleftharpoonsup (⥨), \rightmoon (☽), \rightouterjoin (⟖), \rightpentagon (⭔), \rightpentagonblack (⭓), \rightrightarrows (⇉), \rightsquigarrow (↝), \rightsquigarrow (⇝), \righttail (⤚), \rightthreearrows (⇶), \rightthreetimes (⋌), \rightwhitearrow (⇨), \ringplus (⨢), \risingdotseq (≓), \rmoustache (⎱), \rparenextender (⎟), \rparengtr (⦔), \rparenlend (⎠), \rparenuend (⎞), \rppolint (⨒), \rq (’), \rrangle (⦊), \rrparenthesis (⦈), \rsolbar (⧷), \rsqhook (⫎), \rsub (⩥), \rtimes (⋊), \rtriltri (⧎), \ruledelayed (⧴), \rvboxline (⎹), \rvzigzag (⧙). +

+

\sampi (ϡ), \sansLmirrored (⅃), \sansLturned (⅂), \saturn (♄), \scissors (✂), \scpolint (⨓), \scrB (ℬ), \scrE (ℰ), \scrF (ℱ), \scrH (ℋ), \scrI (ℐ), \scrL (ℒ), \scrM (ℳ), \scrR (ℛ), \scre (ℯ), \scrg (ℊ), \scro (ℴ), \scurel (⊱), \searrow (↘), \seovnearrow (⤭), \setminus (∖), \setminus (⧵), \sharp (♯), \shortdowntack (⫟), \shortleftarrow (←), \shortlefttack (⫞), \shortrightarrow (→), \shortrightarrowleftarrow (⥄), \shortuptack (⫠), \shuffle (⧢), \sigma (σ), \silon (υ), \silon (ϒ), \sim (∼), \simeq (≃), \simgE (⪠), \simgtr (⪞), \similarleftarrow (⭉), \similarrightarrow (⥲), \simlE (⪟), \simless (⪝), \simminussim (⩬), \simneqq (≆), \simplus (⨤), \simrdots (⩫), \sinewave (∿), \slash (∕), \smallblacktriangleleft (◂), \smallblacktriangleright (▸), \smalldiamond (⋄), \smallin (∊), \smallint (∫), \smallni (∍), \smallsetminus (∖), \smalltriangleleft (◃), \smalltriangleright (▹), \smashtimes (⨳), \smblkdiamond (⬩), \smblklozenge (⬪), \smblksquare (▪), \smeparsl (⧤), \smile (⌣), \smiley (☺), \smt (⪪), \smte (⪬), \smwhitestar (⭒), \smwhtcircle (◦), \smwhtlozenge (⬫), \smwhtsquare (▫), \spadesuit (♠), \sphericalangle (∢), \sphericalangleup (⦡), \sqcap (⊓), \sqcup (⊔), \sqint (⨖), \sqlozenge (⌑), \sqrt (√), \sqrt3 (∛), \sqrt4 (∜), \sqrtbottom (⎷), \sqsubset (⊏), \sqsubseteq (⊑), \sqsubsetneq (⋤), \sqsupset (⊐), \sqsupseteq (⊒), \sqsupsetneq (⋥), \squarecrossfill (▩), \squaregrayfill (▩), \squarehfill (▤), \squarehvfill (▦), \squareleftblack (◧), \squareleftblack (◨), \squarellblack (⬕), \squarellquad (◱), \squarelrblack (◪), \squarelrquad (◲), \squareneswfill (▨), \squarenwsefill (▧), \squareulblack (◩), \squareulquad (◰), \squareurblack (⬔), \squareurquad (◳), \squarevfill (▥), \squoval (▢), \ss (ß), \star (⋆), \stareq (≛), \sterling (£), \stigma (ϛ), \strns (⏤), \subedot (⫃), \submult (⫁), \subrarr (⥹), \subset (⊂), \subsetapprox (⫉), \subsetcirc (⟃), \subsetdot (⪽), \subseteq (⊆), \subseteqq (⫅), \subsetneq (⊊), \subsetneqq (⫋), \subsetplus (⪿), \subsim (⫇), \subsub (⫕), \subsup (⫓), \succ (≻), \succapprox (⪸), \succcurlyeq (≽), \succeq (⪰), \succeqq (⪴), \succnapprox (⪺), \succneq (⪲), \succneqq (⪶), \succnsim (⋩), \succsim (≿), \sum (∑), \sumbottom (⎳), \sumint (⨋), \sumtop (⎲), \sun (☼), \supdsub (⫘), \supedot (⫄), \suphsol (⟉), \suphsub (⫗), \suplarr (⥻), \supmult (⫂), \supn (ⁿ), \supset (⊃), \supsetapprox (⫊), \supsetcirc (⟄), \supsetdot (⪾), \supseteq (⊇), \supseteqq (⫆), \supsetneq (⊋), \supsetneqq (⫌), \supsetplus (⫀), \supsim (⫈), \supsub (⫔), \supsup (⫖), \surd (√), \swarrow (↙). +

+

\talloblong (⫾), \target (⌖), \tau (τ), \taurus (♉), \testhookx (ᶍ), \textAsterisks (⁑), \textacute (ˊ), \textadvanced (˖), \textain (Ê¿), \textasciiacute (´), \textasciicircum (^), \textasciidieresis (¨), \textasciigrave (‘), \textasciimacron (¯), \textasciitilde (~), \textasterisklow (⁎), \textbackdprime (‶), \textbackprime (‵), \textbacktrprime (‷), \textbardotlessj (ɟ), \textbardotlessjvar (ʄ), \textbarglotstop (Ê¡), \textbari (ɨ), \textbarl (ƚ), \textbaro (ɵ), \textbarrevglotstop (Ê¢), \textbaru (ʉ), \textbeltl (ɬ), \textbenttailyogh (ƺ), \textbreve (˘), \textbrokenbar (¦), \textbullet (•), \textbullseye (ʘ), \textcent (¢), \textcircledP (℗), \textcloseepsilon (ʚ), \textcloseomega (É·), \textcloserevepsilon (ɞ), \textcopyright (©), \textcrb (ƀ), \textcrh (ħ), \textcrinvglotstop (ƾ), \textcrlambda (ƛ), \textcrtwo (Æ»), \textctc (ɕ), \textctd (È¡), \textctesh (ʆ), \textctj (ʝ), \textctl (È´), \textctn (ȵ), \textctt (ȶ), \textctyogh (ʓ), \textctz (ʑ), \textcurrency (¤), \textdctzlig (Ê¥), \textdegree (°), \textdiscount (⁒), \textdollar ($), \textdotaccent (˙), \textdotlessj (È·), \textdoubleacute (˝), \textdoublebarpipe (ǂ), \textdoublepipe (ǁ), \textdprime (″), \textdptr (˅), \textdyoghlig (ʤ), \textdzlig (Ê£), \textepsilon (ɛ), \textesh (ʃ), \textestimated (℮), \textexclam (ǃ), \textexclamdown (¡), \textfishhookr (ɾ), \textflorin (ƒ), \textfranc (₣), \textgamma (É£), \textglotstop (ʔ), \textgrave (ˋ), \texthalflength (ˑ), \texthamza (ʾ), \texthen (ꜧ), \textheng (ꜧ), \texthooks (ᶊ), \texthookz (ᶎ), \texthtb (ɓ), \texthtc (ƈ), \texthtd (ɗ), \texthtg (É ), \texthth (ɦ), \texththeng (ɧ), \texthtk (ƙ), \texthtp (Æ¥), \texthtq (Ê ), \texthtscg (ʛ), \texthtt (Æ­), \texthvlig (ƕ), \texthyphen (‐), \textinvglotstop (ʖ), \textinvscr (ʁ), \textiota (É©), \textlengthmark (ː), \textlhalfring (˓), \textlhookd (ᶁ), \textlhookk (ᶄ), \textlhookl (ᶅ), \textlhookt (Æ«), \textlhti (É¿), \textlira (₤), \textlonglegr (ɼ), \textlongy (Ê®), \textlongy (ʯ), \textlooptoprevesh (ƪ), \textlowacute (ˏ), \textlowered (˕), \textlowgrave (ˎ), \textlowmacron (ˍ), \textlptr (˂), \textltailm (ɱ), \textltailn (ɲ), \textltilde (É«), \textlyoghlig (É®), \textmacron (ˉ), \textmu (µ), \textnumero (№), \textogonek (˛), \textohm (Ω), \textonehalf (½), \textonequarter (¼), \textonesuperior (¹), \textopeno (ɔ), \textordfeminine (ª), \textordmasculine (º), \textovercross (˟), \textoz (℥), \textpertenthousand (‱), \textperthousand (‰), \textpesetas (₧), \textphi (ɸ), \textpipe (ǀ), \textprime (′), \textprimstress (ˈ), \textqprime (⁗), \textquestiondown (¿), \textquotedbl ("), \textquotedblleft (“), \textquotedblright (”), \textraised (˔), \textraiseglotstop (ˀ), \textraiserevglotstop (ˁ), \textramshorns (ɤ), \textrecipe (℞), \textreferencemark (※), \textregistered (®), \textretracted (˗), \textreve (ɘ), \textrevepsilon (ɜ), \textrevglotstop (ʕ), \textrhalfring (˒), \textrhookrevepsilon (ɝ), \textrhookschwa (ɚ), \textrhoticity (˞), \textringaccent (˚), \textrptr (˃), \textrtaild (ɖ), \textrtaill (É­), \textrtailn (ɳ), \textrtailr (ɽ), \textrtails (ʂ), \textrtailt (ʈ), \textrtailz (ʐ), \textsca (ᴀ), \textscb (ʙ), \textsce (ᴇ), \textscg (É¢), \textsch (ʜ), \textschwa (ə), \textsci (ɪ), \textscl (ʟ), \textscn (É´), \textscoelig (ɶ), \textscr (ʀ), \textscripta (ɑ), \textscriptg (É¡), \textscriptv (ʋ), \textscu (ᴜ), \textscy (ʏ), \textsecstress (ˌ), \textsemicolonreversed (⁏), \textsilon (Î¥), \textsmalltilde (˜), \textstretchcvar (ʗ), \textsubw (w), \textsuph (ʰ), \textsuphth (ʱ), \textsupinvscr (ʶ), \textsupj (ʲ), \textsupr (ʳ), \textsupturnr (Ê´), \textsupturnrrtail (ʵ), \textsupw (Ê·), \textsupy (ʸ), \texttctctlig (ʧ), \texttctctlig (ʨ), \textthreequarters (¾), \textthreesuperior (³), \texttrademark (™), \texttrprime (‴), \texttslig (ʦ), \textturna (ɐ), \textturncomma (Ê»), \textturnh (É¥), \textturnk (ʞ), \textturnlonglegr (ɺ), \textturnm (ɯ), \textturnmrleg (ɰ), \textturnr (ɹ), \textturnrrtail (É»), \textturnscripta (ɒ), \textturnt (ʇ), \textturnv (ʌ), \textturnw (ʍ), \textturny (ʎ), \texttwosuperior (²), \textupsilon (ʊ), \textuptr (˄), \textvibyi (ʅ), \textvisiblespace (␣), \textyogh (ʒ), \th (þ), \therefore (∴), \thermod (â§§), \theta (θ), \thickapprox (≈), \thicksim (∼), \threedangle (⟀), \threedotcolon (â«¶), \tieconcat (⁀), \tieinfty (⧝), \times (×), \timesbar (⨱), \tminus (â§¿), \to (→), \toea (⤨), \tona (⤧), \tonebarextrahigh (Ë¥), \tonebarextralow (Ë©), \tonebarhigh (˦), \tonebarlow (˨), \tonebarmid (˧), \top (⊤), \topbot (⌶), \topcir (⫱), \topfork (⫚), \topsemicircle (◠), \tosa (⤩), \towa (⤪), \tplus (â§¾), \trapezium (⏢), \trianglecdot (◬), \triangledown (▿), \triangleexclam (⚠), \triangleleft (◁), \triangleleftblack (◭), \trianglelefteq (⊴), \triangleminus (⨺), \triangleodot (⧊), \triangleplus (⨹), \triangleq (≜), \triangleright (▷), \trianglerightblack (◮), \trianglerighteq (⊵), \triangles (⧌), \triangleserifs (⧍), \triangletimes (⨻), \triangleubar (⧋), \tripleplus (â§»), \trprime (‴), \turnangle (⦢), \turnediota (℩), \turnednot (⌙), \twocaps (⩋), \twocups (⩊), \twoheaddownarrow (↡), \twoheadleftarrow (↞), \twoheadleftarrowtail (⬻), \twoheadleftdbkarrow (⬷), \twoheadmapsfrom (⬶), \twoheadmapsto (⤅), \twoheadrightarrow (↠), \twoheadrightarrowtail (⤖), \twoheaduparrow (↟), \twoheaduparrowcircle (⥉), \twolowline (‗), \twonotes (♫), \typecolon (⦂). +

+

\ubrbrak (⏡), \uhorn (ư), \ularc (◜), \ulblacktriangle (◤), \ulcorner (⌜), \ulcrop (⌏), \ultriangle (◸), \uminus (⩁), \underbrace (⏟), \underbracket (⎵), \underparen (⏝), \unlhd (⊴), \unrhd (⊵), \upand (⅋), \uparrow (↑), \uparrowbarred (⤉), \uparrowoncircle (⦽), \updasharrow (⇢), \updownarrow (↕), \updownarrowbar (↨), \updownarrows (⇅), \updownharpoonleftleft (⥑), \updownharpoonleftright (⥍), \updownharpoonrightleft (⥌), \updownharpoonrightright (⥏), \updownharpoonsleftright (⥮), \upfishtail (⥾), \upharpoonleft (↿), \upharpoonleftbar (⥠), \upharpoonright (↾), \upharpoonrightbar (⥜), \upharpoonsleftright (⥣), \upin (⟒), \upint (⨛), \uplus (⊎), \uprightcurvearrow (⤴), \upuparrows (⇈), \upwhitearrow (⇧), \urarc (◝), \urblacktriangle (◥), \urcorner (⌝), \urcrop (⌎), \urtriangle (◹). +

+

\v (ˇ), \vBar (⫨), \vBarv (⫩), \vDash (⊨), \vDdash (⫢), \varTheta (ϴ), \varVdash (⫦), \varbarwedge (⌅), \varbeta (ϐ), \varclubsuit (♧), \vardiamondsuit (♦), \vardoublebarwedge (⌆), \varepsilon (ε), \varheartsuit (♥), \varhexagon (⬡), \varhexagonblack (⬢), \varhexagonlrbonds (⌬), \varin (∈), \varisinobar (⋶), \varisins (⋳), \varkappa (ϰ), \varlrtriangle (⊿), \varni (∋), \varniobar (⋽), \varnis (⋻), \varnothing (∅), \varointclockwise (∲), \varphi (φ), \varpi (ϖ), \varpropto (∝), \varrho (ϱ), \varrowextender (⏐), \varsigma (ς), \varspadesuit (♤), \varstar (✶), \vartheta (ϑ), \vartriangle (▵), \vartriangleleft (⊲), \vartriangleright (⊳), \varveebar (⩡), \vbraceextender (⎪), \vbrtri (⧐), \vdash (⊢), \vdots (⋮), \vectimes (⨯), \vee (∨), \veebar (⊻), \veedot (⟇), \veedoublebar (⩣), \veeeq (≚), \veemidvert (⩛), \veeodot (⩒), \veeonvee (⩖), \veeonwedge (⩙), \vert (|), \viewdata (⌗), \vlongdash (⟝), \vrectangle (▯), \vrectangleblack (▮), \vysmlblksquare (⬝), \vysmlwhtsquare (⬞), \vzigzag (⦚). +

+

\watchicon (⌚), \wedge (∧), \wedgebar (⩟), \wedgedot (⟑), \wedgedoublebar (⩠), \wedgemidvert (⩚), \wedgeodot (⩑), \wedgeonwedge (⩕), \wedgeq (≙), \whitearrowupfrombar (⇪), \whiteinwhitetriangle (⟁), \whitepointerleft (◅), \whitepointerright (▻), \whitesquaretickleft (⟤), \whitesquaretickright (⟥), \whthorzoval (⬭), \whtvertoval (⬯), \wideangledown (⦦), \wideangleup (⦧), \wp (℘), \wr (≀). +

+

\xbsol (⧹), \xi (ξ), \xsol (⧸), \yen (¥), \zeta (ζ), \zpipe (⨠), +

+

IF ANYBODY WILL CHECK WHETHER ALL NAMES CORRESPOND TO RIGHT TEX SYMBOLS I SHALL APPRECIATE IT GREATLY. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix E GNU Free Documentation License

+
Version 1.2, November 2002 +
+ +
+
Copyright © 2000,2001,2002 Free Software Foundation, Inc.
+51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+ +
    +
  1. PREAMBLE + +

    The purpose of this License is to make a manual, textbook, or other +functional and useful document free in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. +

    +

    This License is a kind of “copyleft”, which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. +

    +

    We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. +

    +
  2. APPLICABILITY AND DEFINITIONS + +

    This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The “Document”, below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as “you”. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. +

    +

    A “Modified Version” of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. +

    +

    A “Secondary Section” is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document’s overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. +

    +

    The “Invariant Sections” are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. +

    +

    The “Cover Texts” are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. +

    +

    A “Transparent” copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not “Transparent” is called “Opaque”. +

    +

    Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input +format, SGML or XML using a publicly available +DTD, and standard-conforming simple HTML, +PostScript or PDF designed for human modification. Examples +of transparent image formats include PNG, XCF and +JPG. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, SGML or +XML for which the DTD and/or processing tools are +not generally available, and the machine-generated HTML, +PostScript or PDF produced by some word processors for +output purposes only. +

    +

    The “Title Page” means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, “Title Page” means +the text near the most prominent appearance of the work’s title, +preceding the beginning of the body of the text. +

    +

    A section “Entitled XYZ” means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as “Acknowledgements”, +“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” +of such a section when you modify the Document means that it remains a +section “Entitled XYZ” according to this definition. +

    +

    The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. +

    +
  3. VERBATIM COPYING + +

    You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. +

    +

    You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +

    +
  4. COPYING IN QUANTITY + +

    If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document’s license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. +

    +

    If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. +

    +

    If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. +

    +

    It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. +

    +
  5. MODIFICATIONS + +

    You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: +

    +
      +
    1. Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +
    2. List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +
    3. State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +
    4. Preserve all the copyright notices of the Document. + +
    5. Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +
    6. Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +
    7. Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document’s license notice. + +
    8. Include an unaltered copy of this License. + +
    9. Preserve the section Entitled “History”, Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled “History” in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +
    10. Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the “History” section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +
    11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +
    12. Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +
    13. Delete any section Entitled “Endorsements”. Such a section +may not be included in the Modified Version. + +
    14. Do not retitle any existing section to be Entitled “Endorsements” or +to conflict in title with any Invariant Section. + +
    15. Preserve any Warranty Disclaimers. +
    + +

    If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version’s license notice. +These titles must be distinct from any other section titles. +

    +

    You may add a section Entitled “Endorsements”, provided it contains +nothing but endorsements of your Modified Version by various +parties—for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. +

    +

    You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. +

    +

    The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +

    +
  6. COMBINING DOCUMENTS + +

    You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. +

    +

    The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. +

    +

    In the combination, you must combine any sections Entitled “History” +in the various original documents, forming one section Entitled +“History”; likewise combine any sections Entitled “Acknowledgements”, +and any sections Entitled “Dedications”. You must delete all +sections Entitled “Endorsements.” +

    +
  7. COLLECTIONS OF DOCUMENTS + +

    You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. +

    +

    You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. +

    +
  8. AGGREGATION WITH INDEPENDENT WORKS + +

    A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an “aggregate” if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation’s users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. +

    +

    If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document’s Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. +

    +
  9. TRANSLATION + +

    Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. +

    +

    If a section in the Document is Entitled “Acknowledgements”, +“Dedications”, or “History”, the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. +

    +
  10. TERMINATION + +

    You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. +

    +
  11. FUTURE REVISIONS OF THIS LICENSE + +

    The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. +

    +

    Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License “or any later version” applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +

+ + +

ADDENDUM: How to use this License for your documents

+ +

To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: +

+
+
  Copyright (C)  year  your name.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.2
+  or any later version published by the Free Software Foundation;
+  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+  Texts.  A copy of the license is included in the section entitled ``GNU
+  Free Documentation License''.
+
+ +

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the “with…Texts.” line with this: +

+
+
    with the Invariant Sections being list their titles, with
+    the Front-Cover Texts being list, and with the Back-Cover Texts
+    being list.
+
+ +

If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. +

+

If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. +

+ + +
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

Index

+ +
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

A
AddLegend: Legend
AddLight: Lighting
AddTick: Ticks
Adjust: Ticks
alpha: Command options
Alpha: Transparency
alphadef: Command options
AlphaDef: Transparency
Ambient: Lighting
Area: 1D plotting
Arrows: Line styles
ArrowSize: Default sizes
ask: Program flow commands
Aspect: Subplots and rotation
AutoCorrel: Make another data
Axial: 2D plotting
Axis: Curved coordinates
Axis: Axis and Colorbar
AxisStl: Ticks

B
Ball: Primitives
Barh: 1D plotting
Bars: 1D plotting
BarWidth: Default sizes
Beam: 3D plotting
Belt: 2D plotting
Box: Axis and Colorbar
BoxPlot: 1D plotting
Boxs: 2D plotting

C
call: Program flow commands
Candle: 1D plotting
Chart: 1D plotting
chdir: Program flow commands
Clean: Data resizing
ClearLegend: Legend
Clf: Background
CloseGIF: Frames/Animation
Cloud: 3D plotting
Color scheme: Color scheme
Colorbar: Axis and Colorbar
Column: Make another data
ColumnPlot: Subplots and rotation
Combine: Parallelization
Combine: Make another data
Cone: Primitives
Cones: 1D plotting
Cont: 2D plotting
Cont3: 3D plotting
ContD: 2D plotting
ContF: 2D plotting
ContF3: 3D plotting
ContFXYZ: Other plotting
ContXYZ: Other plotting
CopyFont: Font settings
Correl: Make another data
CosFFT: Data changing
CRange: Ranges (bounding box)
Create: Data resizing
Crop: Data resizing
Crust: Other plotting
CTick: Ticks
CumSum: Data changing
Curve: Primitives
cut: Command options
Cut: Cutting
CutOff: Cutting

D
DataGrid: Data manipulation
defchr: Program flow commands
define: Program flow commands
defnum: Program flow commands
Delete: Data resizing
Dens: 2D plotting
Dens3: 3D plotting
DensXYZ: Other plotting
Dew: Vector fields
Diff: Data changing
Diff2: Data changing
do: Program flow commands
Dots: Other plotting
Drop: Primitives

E
else: Program flow commands
elseif: Program flow commands
EndFrame: Frames/Animation
endif: Program flow commands
Envelop: Data changing
Error: Primitives
Error: 1D plotting
Evaluate: Make another data
Export: File I/O
Extend: Data resizing

F
Face: Primitives
FaceX: Primitives
FaceY: Primitives
FaceZ: Primitives
Fall: 2D plotting
fgets: Text printing
Fill: Data manipulation
Fill: Data filling
Find: Data information
FindAny: Data information
Fit: Nonlinear fitting
Fit2: Nonlinear fitting
Fit3: Nonlinear fitting
FitS: Nonlinear fitting
Flow: Vector fields
FlowP: Vector fields
Fl_MathGL: Widget classes
Fl_MathGL: Fl_MathGL class
Fog: Fog
Font: Font settings
Font styles: Font styles
fontsize: Command options
for: Program flow commands
FPlot: Other plotting
FSurf: Other plotting
func: Program flow commands

G
GetNumFrame: Frames/Animation
GetNx: Data information
GetNy: Data information
GetNz: Data information
GetWarn: Error handling
Glyph: Primitives
Grad: 2D plotting
Grid: Axis and Colorbar
Grid: 2D plotting
Grid3: 3D plotting

H
Hankel: Data changing
Hist: Data manipulation
Hist: Make another data

I
if: Program flow commands
Import: File I/O
InPlot: Subplots and rotation
Insert: Data resizing
Integral: Data changing

J
Join: Data resizing

L
Label: Text printing
Label: Axis and Colorbar
Label: 1D plotting
Last: Data information
legend: Command options
Legend: Legend
Light: Lighting
Line: Primitives
Line style: Line styles
Linear: Interpolation
Linear1: Interpolation
Linear1: Interpolation
List: Data filling
load: Program flow commands
LoadBackground: Background
LoadFont: Font settings

M
Map: Dual plotting
Mark: Primitives
Mark: 1D plotting
Mark style: Line styles
MarkSize: Default sizes
MathGL overview: Overview
MathGL setup: Graphics setup
Max: Make another data
Maximal: Data information
Mesh: 2D plotting
meshnum: Command options
MeshNum: Default sizes
Message: Error handling
mglColor: mglColor class
mglData: Data constructor
mglDraw: mglDraw class
mglExpr: Evaluate expression
mglExprC: Evaluate expression
mglFitPnts: Nonlinear fitting
mglGLUT: Widget classes
mglGraph: MathGL core
mglParse: mglParse class
mglPoint: mglPoint class
mglWnd: Widget classes
mglWnd: mglWnd class
Min: Make another data
Minimal: Data information
Mirror: Data changing
Modify: Data filling
Momentum: Make another data
Momentum: Data information
MPI_Recv: Parallelization
MPI_Send: Parallelization
MultiPlot: Subplots and rotation

N
NeedStop: Stop drawing
NewFrame: Frames/Animation
next: Program flow commands
Norm: Data changing
NormSl: Data changing

O
once: Program flow commands
Origin: Ranges (bounding box)

P
Palette: Palette and colors
Perspective: Subplots and rotation
Pipe: Vector fields
Plot: 1D plotting
Pop: Subplots and rotation
PrintInfo: Data information
Push: Subplots and rotation
Puts: Text printing
PutsFit: Nonlinear fitting
Putsw: Text printing

Q
QMathGL: Widget classes
QMathGL: QMathGL class
QuadPlot: Other plotting

R
Radar: 1D plotting
Ranges: Ranges (bounding box)
Rasterize: Background
Read: File I/O
ReadAll: File I/O
ReadHDF: File I/O
ReadMat: File I/O
ReadRange: File I/O
Rearrange: Data resizing
Refill: Data filling
Region: 1D plotting
ResetFrames: Frames/Animation
Resize: Make another data
RestoreFont: Font settings
return: Program flow commands
rkstep: Program flow commands
Roll: Data changing
Roots: Make another data
Rotate: Subplots and rotation
RotateN: Subplots and rotation
RotateText: Font settings

S
Save: File I/O
SaveHDF: File I/O
Set: Data filling
SetAlphaDef: Transparency
SetAmbient: Lighting
SetArrowSize: Default sizes
SetAxisStl: Ticks
SetBarWidth: Default sizes
SetCoor: Curved coordinates
SetCut: Cutting
SetCutBox: Cutting
SetEventFunc: Stop drawing
SetFontDef: Font settings
SetFontSize: Font settings
SetFontSizeCM: Font settings
SetFontSizeIN: Font settings
SetFontSizePT: Font settings
SetFunc: Curved coordinates
SetLegendBox: Legend
SetLegendMarks: Legend
SetMarkSize: Default sizes
SetMask: Masks
SetMaskAngle: Masks
SetMeshNum: Default sizes
SetOrigin: Ranges (bounding box)
SetOriginTick: Ticks
SetPalette: Palette and colors
SetPlotId: Default sizes
SetRange: Ranges (bounding box)
SetRanges: Ranges (bounding box)
SetRotatedText: Font settings
SetSize: Export picture
SetTickLen: Ticks
SetTickRotate: Ticks
SetTicks: Ticks
SetTickSkip: Ticks
SetTicksVal: Ticks
SetTickTempl: Ticks
SetTickTime: Ticks
SetTranspType: Transparency
SetTuneTicks: Ticks
SetWarn: Error handling
Sew: Data changing
ShowImage: Export to file
SinFFT: Data changing
Smooth: Data changing
Sort: Data resizing
Sphere: Primitives
Spline: Interpolation
Spline1: Interpolation
Spline1: Interpolation
Squeeze: Data resizing
StartGIF: Frames/Animation
Stem: 1D plotting
Step: 1D plotting
STFA: Dual plotting
StickPlot: Subplots and rotation
Stop: Stop drawing
stop: Program flow commands
SubData: Make another data
SubPlot: Subplots and rotation
Sum: Make another data
Surf: 2D plotting
Surf3: 3D plotting
Surf3A: Dual plotting
Surf3C: Dual plotting
SurfA: Dual plotting
SurfC: Dual plotting
Swap: Data changing

T
Tape: 1D plotting
Tens: 1D plotting
Ternary: Curved coordinates
Text: Text printing
TextMark: 1D plotting
Textual formulas: Textual formulas
TickLen: Ticks
Tile: 2D plotting
TileS: Dual plotting
Title: Subplots and rotation
Torus: 1D plotting
Trace: Make another data
Traj: Vector fields
Transpose: Data resizing
TranspType: Transparency
TriCont: Other plotting
TriPlot: Other plotting
Tube: 1D plotting

V
value: Command options
Var: Data filling
variant: Program flow commands
Vect: Vector fields
View: Subplots and rotation

W
while: Program flow commands
widgets: Using MathGL window
widgets: Widget classes
widgets: Fl_MathGL class
widgets: QMathGL class
widgets: wxMathGL class
window: Using MathGL window
window: Widget classes
window: mglWnd class
Write: Export to file
WriteBMP: Export to file
WriteBPS: Export to file
WriteEPS: Export to file
WriteFrame: Export to file
WriteGIF: Export to file
WriteJPEG: Export to file
WriteOBJ: Export to file
WritePNG: Export to file
WritePRC: Export to file
WriteSVG: Export to file
WriteTEX: Export to file
WriteTGA: Export to file
WriteWGL: Export to file
wxMathGL: wxMathGL class

X
xrange: Command options
XRange: Ranges (bounding box)
XTick: Ticks

Y
yrange: Command options
YRange: Ranges (bounding box)
YTick: Ticks

Z
zrange: Command options
ZRange: Ranges (bounding box)
ZTick: Ticks

+
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +
+ +
+ + + +
+ diff --git a/website/mathgl_ru.html b/website/mathgl_ru.html new file mode 100644 index 0000000..6ee6144 --- /dev/null +++ b/website/mathgl_ru.html @@ -0,0 +1,21340 @@ + + + + + + +MathGL 2.4.3 + + + + + + + + + + + + + + + +
+

MathGL 2.4.3

+ + + + + +

Table of Contents

+ +
+ + +
+ + + +
+

+Next: , Up: (dir)   [Contents][Index]

+
+ +

MathGL

+ +

Это документация для MathGL (версии 2.4.3) – библиотеки классов и функций для построения научной графики. Пожалуйста сообщайте о любых ошибках в этом руководстве на mathgl.abalakin@gmail.org. Дополнительную информацию о MathGL можно найти на домашней странице проекта http://mathgl.sourceforge.net/. +

+

Copyright © 2008-2012 Alexey A. Balakin. +

+
+

Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 +or any later version published by the Free Software Foundation; +with no Invariant Sections, no Front-Cover Texts, and no Back-Cover +Texts. A copy of the license is included in the section entitled “GNU +Free Documentation License.” +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

1 Обзор MathGL

+ + + + +

MathGL это ... +

    +
  • библиотека для создания высококачественной научной графики под Linux и Windows; +
  • библиотека для быстрого обработки и отображения больших массивов данных; +
  • библиотека для работы в оконном и консольном режимах; +
  • библиотека с большим набором базовых типов графиков. +
+ + + + + + + + + + + + +
+ +
+

+Next: , Up: Overview   [Contents][Index]

+
+ +

1.1 Что такое MathGL?

+ + +

Код для создания качественной научной графики на различных платформах. Код для быстрой обработки и отображения больших массивов данных. Код для работы в графическом и консольном режимах и легкого интегрирования в другие программы. Код с большим обновляемым набором графиков и инструментами обработки данных. Именно такого кода мне не хватало в последние годы при работе на персональных компьютерах и на кластерах. И именно такой код я постарался создать в библиотеке MathGL. +

+

На данный момент (версия 2.4.3) MathGL это более 50 основных типов графиков для одно-, двух- и трехмерных массивов, возможность экспорта в растровые и векторные (EPS или SVG) файлы, интерфейс для OpenGL и возможность запуска в консольном режиме, функции для обработки данных и даже простейший командный (интерпретируемый) язык MGL для упрощения построения графиков. Кроме того, есть несколько типов прозрачности, гладкое освещение, векторные шрифты, TeX-ие команды в надписях, произвольные криволинейные системы координат и прочие полезные мелочи (см. раздел pictures на домашней странице). Ну, и, естественно, полная переносимость библиотеки и ее свободное распространение под лицензией GPL v.2.0 или более поздней. +

+ +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.2 Возможности MathGL

+ + +

Библиотека MathGL позволяет строить широкий класс графиков, включая: +

    +
  • рисование одномерных массивов (Plot, Area, Bars, Step, Stem, Torus, Chart, Error, Tube, Mark, see 1D plotting); + +
  • рисование двумерных массивов (Mesh, Surf, Dens, Cont, ContF, Boxs, Axial, Fall, Belt, Tile, see 2D plotting); + +
  • рисование трехмерных массивов (Surf3, Dens3, Cont3, ContF3, Cloud-like, see 3D plotting); + +
  • рисование нескольких связанных массивов: векторные поля Vect, линии тока Flow, точечное отображение Map, поверхности с прозрачностью или цветом, определяемым другим массивом SurfA, SurfC, Surf3A, Surf3C (see Dual plotting); + +
  • и другие (см. see MathGL core). +
+ +

Фактически, я постарался реализовать все известные мне типы научных графиков. Список графиков постоянно пополняется, и если Вам нужен какой-то новый вариант, пишите на e-mail, и в новой версии библиотеки этот график появится. +

+

Я постарался сделать графики максимально красивыми – поверхности могут быть прозрачными и освещены произвольно расположенными источниками света (максимальное их количество 10). Большинство функций рисования имеет два варианта: простой для быстрого построения картинки и более сложный для детальной настройки отображения, включающего в том числе возможность параметрического задания всех массивов. Получившееся изображение можно сохранить в растровом формате PNG, JPEG, GIF, TGA или BMP; в векторном EPS, SVG или TeX формате, или в 3D формате OBJ, OFF, STL, или в PRC формате, который может быть конвертирован U3D. +

+

Все надписи выводятся векторным шрифтом, что обеспечивает их хорошую масштабируемость и переносимость. Текст может содержать команды для большинства ТеХ-их символов, изменения положения (верхний и нижний индексы) и стиля шрифта внутри строки текста (see Font styles). Текст меток поворачивается вместе с осями. На график можно вывести описание кривых (легенду) и поместить надпись в произвольную точку экрана или пустить ее вдоль кривой. Поддерживаются произвольные кодировки текста (с помощью стандартной функции setlocale()) и текст в кодировке UTF-16. +

+

Для представления данных используется специальный класс mglData (see Data processing). Помимо безопасного создания и удаления массивов, он включает функции по их обработке (дифференцированию, интегрированию, сглаживанию, интерполяции и т.д.) и чтению текстового файла с автоматическим определением размеров данных. Класс mglData позволяет работать с массивами размерности вплоть до 3 (массивы, зависящие от трех независимых индексов a_{ijk}). Использование массивов с большим числом размерностей нецелесообразно, поскольку я не представляю, как их можно отобразить на экране. Заполнение или изменение значений массива можно выполнить как вручную, так и по формуле, заданной текстовой строкой. +

+

Для быстрого вычисления значения выражения, заданного текстовой строкой (see Textual formulas). Он основан на компиляции строки в древоподобную структуру при создании экземпляра класса. На этапе вычисления происходит быстрый обход дерева с выдачей результата для конкретных значений переменных. Помимо изменения значений массива данных, текстовые формулы используются для рисования в произвольной криволинейной системе координат. Набор таких координат ограничивается только фантазией пользователя, а не фиксированным числом (типа полярной, параболической, цилиндрической и т.д.). +

+ +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.3 Установка MathGL

+ + +

Установка библиотеки возможна 4-мя способами. +

    +
  1. Скомпилировать библиотеку непосредственно из исходных файлов. С библиотекой поставляется файлы для системы сборки CMake. Для его запуска достаточно в командной строке выполнить 3 команды: сначала cmake . дважды, далее make и, наконец, с правами суперпользователя make install. Иногда после компиляции библиотеки может потребоваться обновление списка библиотека в системе – выполните команду ldconfig с правами суперпользователя. + +

    Есть несколько дополнительных опций, которые по умолчанию отключены. К их числу относятся: enable-fltk, enable-glut, enable-qt4, enable-qt5 для поддержки FLTK, GLUT и/или Qt окон; enable-jpeg, enable-gif, enable-hdf5 для поддержки соответствующих форматов; enable-all для включения всех возможностей. Для использования типа double для внутреннего хранения данных используйте опцию enable-double. Для создания интерфейсов к другим языкам (кроме С/Фортран/MGL) используйте опции enable-python, enable-octave или enable-all-swig для всех поддерживаемых языков. Вы можете воспользоваться WYSIWYG утилитой (cmake-gui) для просмотра и изменения всех опций, или выполнить cmake -D enable-all=on -D enable-all-widgets=on -D enable-all-swig=on . в командной строке для включения всех опций. +

    +

    При сборке с помощью MinGW необходимо дополнительно установить опцию сборки -fopenmp (т.е. CMAKE_EXE_LINKER_FLAGS:STRING='-fopenmp' и CMAKE_SHARED_LINKER_FLAGS:STRING='-fopenmp') если включена поддержка OpenMP (enable-openmp=ON). +

    + +
  2. Использовать предварительно скомпилированные файлы – с библиотекой поставляются файлы для MinGW (платформа Win32). В скомпилированной версии достаточно распаковать заголовочные файлы в папку с заголовочными файлами и библиотеку libmgl.a в папку с библиотеками. По умолчанию, скомпилированная версия включают поддержку GSL (www.gsl.org), PNG, GIF и JPEG. Соответственно, при сборке программы эти библиотеки должны быть установлены (их можно найти на http://gnuwin32.sourceforge.net/packages.html). +
  3. Установить из стандартных пакетов (RPM, deb, DevPak и пр.). +
+ +

Последнюю версию (которая может быть не стабильна) можно загрузить с sourceforge.net SVN с помощью команды +

svn checkout http://svn.code.sf.net/p/mathgl/code/mathgl-2x mathgl-code
+
+

ВАЖНО! MathGL использует набор defines, определяемых на этапе конфигурирования библиотеки. Это MGL_SYS_NAN, MGL_HAVE_TYPEOF, MGL_HAVE_PTHREAD, MGL_HAVE_ATTRIBUTE, MGL_HAVE_C99_COMPLEX, MGL_HAVE_RVAL. Они могут отличаться при использовании бинарников скомпилированных другим компилятором (например при использовании скомпилированных MinGW бинарников в VisualStudio). Я специально устанавливаю их в 0 для компиляторов Borland и Microsoft из соображений совместимости. Кроме того, настройки по умолчанию подходят для компиляторов GNU (gcc, mingw) и clang. Однако, для прочих компиляторов может потребоваться ручная установка defines в 0 в файле include/mgl2/config.h если вы используете предварительно скомпилированные файлы. +

+ + + +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.4 Quick guide

+ + +

There are 3 steps to prepare the plot in MathGL: (1) prepare data to be plotted, (2) setup plot, (3) plot data. Let me show this on the example of surface plotting. +

+

First we need the data. MathGL use its own class mglData to handle data arrays (see Data processing). This class give ability to handle data arrays by more or less format independent way. So, create it +

    int main()
+    {
+        mglData dat(30,40);	// data to for plotting
+        for(long i=0;i<30;i++)   for(long j=0;j<40;j++)
+            dat.a[i+30*j] = 1/(1+(i-15)*(i-15)/225.+(j-20)*(j-20)/400.);
+

Here I create matrix 30*40 and initialize it by formula. Note, that I use long type for indexes i, j because data arrays can be really large and long type will automatically provide proper indexing. +

+

Next step is setup of the plot. The only setup I need is axis rotation and lighting. +

        mglGraph gr;		// class for plot drawing
+        gr.Rotate(50,60);	// rotate axis
+        gr.Light(true);		// enable lighting
+
+

Everything is ready. And surface can be plotted. +

        gr.Surf(dat);		// plot surface
+

Basically plot is done. But I decide to add yellow (‘y’ color, see Color styles) contour lines on the surface. To do it I can just add: +

        gr.Cont(dat,"y");	// plot yellow contour lines
+

This demonstrate one of base MathGL concept (see, General concepts) – “new drawing never clears things drawn already”. So, you can just consequently call different plotting functions to obtain “combined” plot. For example, if one need to draw axis then he can just call one more plotting function +

        gr.Axis();			// draw axis
+
+

Now picture is ready and we can save it in a file. +

        gr.WriteFrame("sample.png");	// save it
+    }
+
+

To compile your program, you need to specify the linker option -lmgl. +

+

This is enough for a compilation of console program or with external (non-MathGL) window library. If you want to use FLTK or Qt windows provided by MathGL then you need to add the option -lmgl-wnd. +

+

При использовании фортрана необходимо также включить библиотеку -lstdc++. Кроме того, если библиотека была собрана с опцией enable-double=ON (по умолчанию в версии 2.1 и более поздних), то все вещественные числа должны быть типа real*8. Это можно включить по умолчанию опцией -fdefault-real-8. +

+ +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.5 Changes from v.1.*

+ + +

There are a lot of changes for v.2. Here I denote only main of them. +

    +
  • mglGraph class is single plotter class instead of mglGraphZB, mglGraphPS and so on. +
  • Text style and text color positions are swapped. I.e. text style ‘r:C’ give red centered text, but not roman dark cyan text as for v.1.*. +
  • ColumnPlot() indexing is reverted. +
  • Move most of arguments of plotting functions into the string parameter and/or options. +
  • “Bright” colors (like {b8}) can be used in color schemes and line styles. +
  • Intensively use pthread internally for parallelization of drawing and data processing. +
  • Add tick labels rotation and skipping. Add ticks in time/date format. +
  • New kinds of plots (Tape(), Label(), Cones(), ContV()). Extend existing plots. New primitives (Circle(), Ellipse(), Rhomb(), ...). New plot positioning (MultiPlot(), GridPlot()) +
  • Improve MGL scripts. Add ’ask’ command and allow string concatenation from different lines. +
  • Export to LaTeX and to 3D formats (OBJ, OFF, STL). +
  • Add pipes support in utilities (mglconv, mglview). +
+ + +
+ +
+

+Next: , Previous: , Up: Overview   [Contents][Index]

+
+ +

1.6 Utilities for parsing MGL

+ + +

MathGL library provides several tools for parsing MGL scripts. There is tools saving it to bitmap or vectorial images (mglconv). Tool mglview show MGL script and allow to rotate and setup the image. Another feature of mglview is loading *.mgld files (see ExportMGLD()) for quick viewing 3d pictures. +

+

Both tools have similar set of arguments. They can be name of script file or options. You can use ‘-’ as script name for using standard input (i.e. pipes). Options are: +

    +
  • -1 str +set str as argument $1 for script; +
  • ... +... +
  • -9 str +set str as argument $9 for script; +
  • -L loc +set locale to loc; +
  • -s fname +set MGL script for setting up the plot; +
  • -h +print help message. +
+

Additionally mglconv have following options: +

    +
  • -A val +add val into the list of animation parameters; +
  • -C v1:v2[:dv] +add values from v1 ot v2 with step dv (default is 1) into the list of animation parameters; +
  • -o name +set output file name; +
  • -n +disable default output (script should save results by itself); +
  • -S val +set set scaling factor for setsize; +
  • -q val +set quality for output (val=0...9). +
+ +

Also you can create animated GIF file or a set of JPEG files with names ‘frameNNNN.jpg’ (here ‘NNNN’ is frame index). Values of the parameter $0 for making animation can be specified inside the script by comment ##a val for each value val (one comment for one value) or by option(s) ‘-A val’. Also you can specify a cycle for animation by comment ##c v1 v2 dv or by option -C v1:v2:dv. In the case of found/specified animation parameters, tool will execute script several times – once for each value of $0. +

+ +

MathGL also provide another simple tool mgl.cgi which parse MGL script from CGI request and send back produced PNG file. Usually this program should be placed in /usr/lib/cgi-bin/. But you need to put this program by yourself due to possible security issues and difference of Apache server settings. +

+ +
+ +
+

+Previous: , Up: Overview   [Contents][Index]

+
+ +

1.7 Благодарности

+ + + +
    +
  • Моя специальная благодарность моей жене за терпение во время написания библиотеки. +
  • Я благодарен моим соавторам Д. Кулагину и М. Видассову за помощь в разработке MathGL. +
  • Я благодарен Diego Sejas Viscarra за разработку mgltex, вклад в генерацию фракталов и продуктивные предложения и обсуждения. +
  • Я благодарен D. Eftaxiopoulos, D. Haley, В. Липатову и С. Плису за создание бинарных пакетов для Linux. +
  • Я благодарен С. Скобелеву, К. Михайленко, М. Вейсману, A. Прохорову, A. Короткевичу, В. Онучину, С. Плису, Р. Киселеву, A. Иванову, Н. Троицкому and В. Липатову за продуктивные предложения и обсуждения. +
  • Я благодарен спонсорам М. Вейсману (ОИВТ РАН) и A. Прохорову (DATADVANCE). +
+ +

Javascript интерфейс был разработан при поддержке компании DATADVANCE. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

2 Примеры MathGL

+ + +

В данной главе рассмотрены базовые и продвинутые возможности MathGL, даны советы по использованию и примеры для всех типов графиков. Я рекомендую прочитать вначале первые 2 раздела и посмотреть на раздел Hints. Также рекомендую прочитать General concepts и FAQ. +

+

Отмечу, что MathGL v.2.* имеет только пользовательских 2 интерфейса: один для языков подобных C или Fortran (не поддерживающих классы), другой для языков подобных C++/Python/Octave, которые поддерживают классы. При этом все классы являются "оберткой" С-ого интерфейсы, а функции-члены классов – inline вызовами функций С. Поэтому, в большинстве примеров в этой главе я буду приводить только один вариант кода, который после минимальных изменений синтаксиса может быть применен для других языков. Например, код на языке C++ +

#include <mgl2/mgl.h>
+int main()
+{
+  mglGraph gr;
+  gr.FPlot("sin(pi*x)");
+  gr.WriteFrame("test.png");
+}
+

на Python будет выглядеть как +

from mathgl import *
+gr = mglGraph();
+gr.FPlot("sin(pi*x)");
+gr.WriteFrame("test.png");
+

в Octave он будет почти тем же (в новых версиях надо предварительно выполнить mathgl;) +

gr = mglGraph();
+gr.FPlot("sin(pi*x)");
+gr.WriteFrame("test.png");
+

в C необходимо будет найти С-ые аналоги функций (из документации) и указать все их аргументы явно +

#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);
+}
+

в Fortran помимо этого придется определить функции возвращающие указатели на объекты как функции возвращающие целое +

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);
+

и т.д. +

+ + + + + + + + + + + + +
+ +
+

+Next: , Up: Examples   [Contents][Index]

+
+ +

2.1 Основы использования

+ + +

Библиотеку MathGL можно использовать несколькими способами, каждый из которых имеет свои достоинства и недостатки: +

    +
  • Использовать возможности MathGL для создания графического окна (требуется FLTK, Qt или GLUT библиотеки). + +

    Положительная сторона состоит в возможности сразу увидеть график и быстро его мышкой поправить (повернуть, приблизить, выключить прозрачность или освещение и т.д.). Однако, в этом случае требуется наличие графической системы (нельзя запускать на удаленной машине), и работать можно только с одним набором данных одновременно. +

    +
  • Прямой вывод в файл в растровом или векторном формате, без создания графического окна. + +

    Достоинства такого подхода: пакетная обработка похожих данных (например, набора расчетных файлов при различных условиях), возможность запуска из консольной программы (включая запуск на удаленном компьютере/сервере/кластере), более быстрая и автоматизированная отрисовка, сохранение графиков для последующего анализа непосредственно во время расчета. К недостаткам подхода можно отнести: использование внешней программы просмотра для построенных графиков, необходимость заранее представить картинку (углы просмотра, освещение и пр.). Я рекомендую вначале использовать графическое окно для выбора оптимальных параметров графика, а потом использовать их для пакетной обработки. +

    +
  • Рисовать график в памяти с последующим выводом на экран другой графической программой. + +

    В этом случае программист имеет максимум свободы в выборе графической библиотеки (не только FLTK, Qt или GLUT), в расположении и выборе элементов управления графиком и т.д. Я рекомендую этот вариант для "самодостаточного" приложения. +

    +
  • Использовать FLTK или Qt виджеты, предоставляемые MathGL + +

    Вы также можете использовать ряд элементов управления (виджетов), которые позволяют отобразить график, сохранить его в файл в различных форматах или скопировать в буфер обмена, обработать движение/клики мышкой и пр. +

+ +

Графики MathGL могут быть созданы не только с помощью объектно-ориентированных языков (например, C++ или Python), но и на C или Fortran подобных языках. Использование последних в основном идентичны использованию классов (за исключением различных имен функций). Различие состоит в обязательном предварительном создании (и удалении после использования) объектов типа HMGL (для графики) и/или HMDT (для данных). Пользователи Fortran могут считать эти переменные целочисленными с достаточной разрядностью для используемой операционной системы. +

+

Рассмотрим вышесказанное подробно. +

+ + + + + + + + + + + + + + +
+ +
+

+Next: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.1 Использование окон MathGL

+ + + + +

“Интерактивный” способ использования MathGL состоит в создании окна с помощью классов mglQT, mglFLTK или mglGLUT (см. Widget classes) и последующем рисовании в этом окне. Соответствующий код выглядит так: +

#include <mgl2/qt.h>
+int sample(mglGraph *gr)
+{
+  gr->Rotate(60,40);
+  gr->Box();
+  return 0;
+}
+//-----------------------------------------------------
+int main(int argc,char **argv)
+{
+  mglQT gr(sample,"MathGL examples");
+  return gr.Run();
+}
+

Здесь используется callback функция sample, выполняющая собственно рисование. Функция main – точка входа в программу – создает окно (объект gr типа mglQT) и запускает цикл обработки сообщений (вызов gr.Run()). Для компиляции достаточно выполнить команду +

gcc test.cpp -lmgl-qt5 -lmgl
+

Вы можете использовать "-lmgl-qt4" вместо "-lmgl-qt5", если установлен Qt4. +

+

Альтернативный способ состоит в использовании класса, производного от mglDraw с переопределенной функцией Draw(): +

#include <mgl2/qt.h>
+class Foo : public mglDraw
+{
+public:
+  int Draw(mglGraph *gr);
+};
+//-----------------------------------------------------
+int Foo::Draw(mglGraph *gr)
+{
+  gr->Rotate(60,40);
+  gr->Box();
+  return 0;
+}
+//-----------------------------------------------------
+int main(int argc,char **argv)
+{
+  Foo foo;
+  mglQT gr(&foo,"MathGL examples");
+  return gr.Run();
+}
+

Или в использовании функций С: +

#include <mgl2/mgl_cf.h>
+int sample(HMGL gr, void *)
+{
+  mgl_rotate(gr,60,40,0);
+  mgl_box(gr);
+}
+int main(int argc,char **argv)
+{
+  HMGL gr;
+  gr = mgl_create_graph_qt(sample,"MathGL examples",0,0);
+  return mgl_qt_run();
+/* generally I should call mgl_delete_graph() here,
+ * but I omit it in main() function. */
+}
+
+

Похожий код получается и при использовании окон mglFLTK, mglGLUT (функция sample() та же): +

#include <mgl2/glut.h>
+int main(int argc,char **argv)
+{
+  mglGLUT gr(sample,"MathGL examples");
+  return 0;
+}
+
+

The rotation, shift, zooming, switching on/off transparency and lighting can be done with help of tool-buttons (for mglWindow) or by hot-keys: ‘a’, ‘d’, ‘w’, ‘s’ for plot rotation, ‘r’ and ‘f’ switching on/off transparency and lighting. Press ‘x’ for exit (or closing the window). +

+

In this example function sample rotates axes (Rotate(), see Subplots and rotation) and draws the bounding box (Box()). Drawing is placed in separate function since it will be used on demand when window canvas needs to be redrawn. +

+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.2 Drawing to file

+ + +

Another way of using MathGL library is the direct writing of the picture to the file. It is most usable for plot creation during long calculation or for using of small programs (like Matlab or Scilab scripts) for visualizing repetitive sets of data. But the speed of drawing is much higher in comparison with a script language. +

+

The following code produces a bitmap PNG picture: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  gr.Alpha(true);   gr.Light(true);
+  sample(&gr);              // The same drawing function.
+  gr.WritePNG("test.png");  // Don't forget to save the result!
+  return 0;
+}
+

For compilation, you need only libmgl library not the one with widgets +

gcc test.cpp -lmgl
+

This can be important if you create a console program in computer/cluster where X-server (and widgets) is inaccessible. +

+

The only difference from the previous variant (using windows) is manual switching on the transparency Alpha and lightning Light, if you need it. The usage of frames (see Animation) is not advisable since the whole image is prepared each time. If function sample contains frames then only last one will be saved to the file. In principle, one does not need to separate drawing functions in case of direct file writing in consequence of the single calling of this function for each picture. However, one may use the same drawing procedure to create a plot with changeable parameters, to export in different file types, to emphasize the drawing code and so on. So, in future I will put the drawing in the separate function. +

+

The code for export into other formats (for example, into vector EPS file) looks the same: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  gr.Light(true);
+  sample(&gr);              // The same drawing function.
+  gr.WriteEPS("test.eps");  // Don't forget to save the result!
+  return 0;
+}
+

The difference from the previous one is using other function WriteEPS() for EPS format instead of function WritePNG(). Also, there is no switching on of the plot transparency Alpha since EPS format does not support it. +

+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.3 Animation

+ + +

Widget classes (mglWindow, mglGLUT) support a delayed drawing, when all plotting functions are called once at the beginning of writing to memory lists. Further program displays the saved lists faster. Resulting redrawing will be faster but it requires sufficient memory. Several lists (frames) can be displayed one after another (by pressing ‘,’, ‘.’) or run as cinema. To switch these feature on one needs to modify function sample: +

int sample(mglGraph *gr)
+{
+  gr->NewFrame();             // the first frame
+  gr->Rotate(60,40);
+  gr->Box();
+  gr->EndFrame();             // end of the first frame
+  gr->NewFrame();             // the second frame
+  gr->Box();
+  gr->Axis("xy");
+  gr->EndFrame();             // end of the second frame
+  return gr->GetNumFrame();   // returns the frame number
+}
+

First, the function creates a frame by calling NewFrame() for rotated axes and draws the bounding box. The function EndFrame() must be called after the frame drawing! The second frame contains the bounding box and axes Axis("xy") in the initial (unrotated) coordinates. Function sample returns the number of created frames GetNumFrame(). +

+

Note, that animation can be also done as visualization of running calculations (see Draw and calculate). +

+

Pictures with animation can be saved in file(s) as well. You can: export in animated GIF, or save each frame in separate file (usually JPEG) and convert these files into the movie (for example, by help of ImageMagic). Let me show both methods. +

+

The simplest methods is making animated GIF. There are 3 steps: (1) open GIF file by StartGIF() function; (2) create the frames by calling NewFrame() before and EndFrame() after plotting; (3) close GIF by CloseGIF() function. So the simplest code for “running” sinusoid will look like this: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  mglData dat(100);
+  char str[32];
+  gr.StartGIF("sample.gif");
+  for(int i=0;i<40;i++)
+  {
+    gr.NewFrame();     // start frame
+    gr.Box();          // some plotting
+    for(int j=0;j<dat.nx;j++)
+      dat.a[j]=sin(M_PI*j/dat.nx+M_PI*0.05*i);
+    gr.Plot(dat,"b");
+    gr.EndFrame();     // end frame
+  }
+  gr.CloseGIF();
+  return 0;
+}
+
+

The second way is saving each frame in separate file (usually JPEG) and later make the movie from them. MathGL have special function for saving frames – it is WriteFrame(). This function save each frame with automatic name ‘frame0001.jpg, frame0002.jpg’ and so on. Here prefix ‘frame’ is defined by PlotId variable of mglGraph class. So the similar code will look like this: +

#include <mgl2/mgl.h>
+int main(int ,char **)
+{
+  mglGraph gr;
+  mglData dat(100);
+  char str[32];
+  for(int i=0;i<40;i++)
+  {
+    gr.NewFrame();     // start frame
+    gr.Box();          // some plotting
+    for(int j=0;j<dat.nx;j++)
+      dat.a[j]=sin(M_PI*j/dat.nx+M_PI*0.05*i);
+    gr.Plot(dat,"b");
+    gr.EndFrame();     // end frame
+    gr.WriteFrame();   // save frame
+  }
+  return 0;
+}
+
+

Created files can be converted to movie by help of a lot of programs. For example, you can use ImageMagic (command ‘convert frame*.jpg movie.mpg’), MPEG library, GIMP and so on. +

+

Finally, you can use mglconv tool for doing the same with MGL scripts (see Utilities). +

+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.4 Drawing in memory

+ + +

The last way of MathGL using is the drawing in memory. Class mglGraph allows one to create a bitmap picture in memory. Further this picture can be displayed in window by some window libraries (like wxWidgets, FLTK, Windows GDI and so on). For example, the code for drawing in wxWidget library looks like: +

void MyForm::OnPaint(wxPaintEvent& event)
+{
+  int w,h,x,y;
+  GetClientSize(&w,&h);   // size of the picture
+  mglGraph gr(w,h);
+
+  gr.Alpha(true);         // draws something using MathGL
+  gr.Light(true);
+  sample(&gr,NULL);
+
+  wxImage img(w,h,gr.GetRGB(),true);
+  ToolBar->GetSize(&x,&y);    // gets a height of the toolbar if any
+  wxPaintDC dc(this);         // and draws it
+  dc.DrawBitmap(wxBitmap(img),0,y);
+}
+

The drawing in other libraries is most the same. +

+

For example, FLTK code will look like +

void Fl_MyWidget::draw()
+{
+  mglGraph gr(w(),h());
+  gr.Alpha(true);         // draws something using MathGL
+  gr.Light(true);
+  sample(&gr,NULL);
+  fl_draw_image(gr.GetRGB(), x(), y(), gr.GetWidth(), gr.GetHeight(), 3);
+}
+

Qt code will look like +

void MyWidget::paintEvent(QPaintEvent *)
+{
+  mglGraph gr(w(),h());
+
+  gr.Alpha(true);         // draws something using MathGL
+  gr.Light(true);         gr.Light(0,mglPoint(1,0,-1));
+  sample(&gr,NULL);
+
+  // Qt don't support RGB format as is. So, let convert it to BGRN.
+  long w=gr.GetWidth(), h=gr.GetHeight();
+  unsigned char *buf = new uchar[4*w*h];
+  gr.GetBGRN(buf, 4*w*h)
+  QPixmap pic = QPixmap::fromImage(QImage(*buf, w, h, QImage::Format_RGB32));
+
+  QPainter paint;
+  paint.begin(this);  paint.drawPixmap(0,0,pic);  paint.end();
+  delete []buf;
+}
+
+ +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.5 Draw and calculate

+ + +

MathGL can be used to draw plots in parallel with some external calculations. The simplest way for this is the usage of mglDraw class. At this you should enable pthread for widgets by setting enable-pthr-widget=ON at configure stage (it is set by default). +First, you need to inherit you class from mglDraw class, define virtual members Draw() and Calc() which will draw the plot and proceed calculations. You may want to add the pointer mglWnd *wnd; to window with plot for interacting with them. Finally, you may add any other data or member functions. The sample class is shown below +

class myDraw : public mglDraw
+{
+	mglPoint pnt;	// some variable for changeable data
+	long i;			// another variable to be shown
+	mglWnd *wnd;	// external window for plotting
+public:
+	myDraw(mglWnd *w=0) : mglDraw()	{	wnd=w;	}
+	void SetWnd(mglWnd *w)	{	wnd=w;	}
+	int Draw(mglGraph *gr)
+	{
+		gr->Line(mglPoint(),pnt,"Ar2");
+		char str[16];	snprintf(str,15,"i=%ld",i);
+		gr->Puts(mglPoint(),str);
+		return 0;
+	}
+	void Calc()
+	{
+		for(i=0;;i++)	// do calculation
+		{
+			long_calculations();// which can be very long
+			Check();	// check if need pause
+			pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
+			if(wnd)	wnd->Update();
+		}
+	}
+} dr;
+

There is only one issue here. Sometimes you may want to pause calculations to view result carefully, or save state, or change something. So, you need to provide a mechanism for pausing. Class mglDraw provide function Check(); which check if toolbutton with pause is pressed and wait until it will be released. This function should be called in a "safety" places, where you can pause the calculation (for example, at the end of time step). Also you may add call exit(0); at the end of Calc(); function for closing window and exit after finishing calculations. +Finally, you need to create a window itself and run calculations. +

int main(int argc,char **argv)
+{
+	mglFLTK gr(&dr,"Multi-threading test");	// create window
+	dr.SetWnd(&gr);	// pass window pointer to yours class
+	dr.Run();	// run calculations
+	gr.Run();	// run event loop for window
+	return 0;
+}
+
+

Note, that you can reach the similar functionality without using mglDraw class (i.e. even for pure C code). +

mglFLTK *gr=NULL;	// pointer to window
+void *calc(void *)	// function with calculations
+{
+	mglPoint pnt;	// some data for plot
+	for(long i=0;;i++)		// do calculation
+	{
+		long_calculations();	// which can be very long
+		pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
+		if(gr)
+		{
+			gr->Clf();			// make new drawing
+			// draw something
+			gr->Line(mglPoint(),pnt,"Ar2");
+			char str[16];	snprintf(str,15,"i=%ld",i);
+			gr->Puts(mglPoint(),str);
+			// don't forgot to update window
+			gr->Update();
+		}
+	}
+}
+int main(int argc,char **argv)
+{
+	static pthread_t thr;
+	pthread_create(&thr,0,calc,0);	// create separate thread for calculations
+	pthread_detach(thr);			// and detach it
+	gr = new mglFLTK;	// now create window
+	gr->Run();			// and run event loop
+	return 0;
+}
+

This sample is exactly the same as one with mglDraw class, but it don’t have functionality for pausing calculations. If you need it then you have to create global mutex (like pthread_mutex_t *mutex = pthread_mutex_init(&mutex,NULL);), set it to window (like gr->SetMutex(mutex);) and periodically check it at calculations (like pthread_mutex_lock(&mutex); pthread_mutex_unlock(&mutex);). +

+

Finally, you can put the event-handling loop in separate instead of yours code by using RunThr() function instead of Run() one. Unfortunately, such method work well only for FLTK windows and only if pthread support was enabled. Such limitation come from the Qt requirement to be run in the primary thread only. The sample code will be: +

int main(int argc,char **argv)
+{
+	mglFLTK gr("test");
+	gr.RunThr();	// <-- need MathGL version which use pthread for widgets
+	mglPoint pnt;	// some data
+	for(int i=0;i<10;i++)	// do calculation
+	{
+		long_calculations();// which can be very long
+		pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
+		gr.Clf();			// make new drawing
+		gr.Line(mglPoint(),pnt,"Ar2");
+		char str[10] = "i=0";	str[3] = '0'+i;
+		gr->Puts(mglPoint(),str);
+		gr.Update();		// update window
+	}
+	return 0;	// finish calculations and close the window
+}
+
+ + +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.6 Using QMathGL

+ + +

MathGL have several interface widgets for different widget libraries. There are QMathGL for Qt, Fl_MathGL for FLTK. These classes provide control which display MathGL graphics. Unfortunately there is no uniform interface for widget classes because all libraries have slightly different set of functions, features and so on. However the usage of MathGL widgets is rather simple. Let me show it on the example of QMathGL. +

+

First of all you have to define the drawing function or inherit a class from mglDraw class. After it just create a window and setup QMathGL instance as any other Qt widget: +

#include <QApplication>
+#include <QMainWindow>
+#include <QScrollArea>
+#include <mgl2/qmathgl.h>
+int main(int argc,char **argv)
+{
+  QApplication a(argc,argv);
+  QMainWindow *Wnd = new QMainWindow;
+  Wnd->resize(810,610);  // for fill up the QMGL, menu and toolbars
+  Wnd->setWindowTitle("QMathGL sample");
+  // here I allow to scroll QMathGL -- the case
+  // then user want to prepare huge picture
+  QScrollArea *scroll = new QScrollArea(Wnd);
+
+  // Create and setup QMathGL
+  QMathGL *QMGL = new QMathGL(Wnd);
+//QMGL->setPopup(popup); // if you want to setup popup menu for QMGL
+  QMGL->setDraw(sample);
+  // or use QMGL->setDraw(foo); for instance of class Foo:public mglDraw
+  QMGL->update();
+
+  // continue other setup (menu, toolbar and so on)
+  scroll->setWidget(QMGL);
+  Wnd->setCentralWidget(scroll);
+  Wnd->show();
+  return a.exec();
+}
+
+ + + +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.7 OpenGL output

+ + +

MathGL have possibility to draw resulting plot using OpenGL. This produce resulting plot a bit faster, but with some limitations (especially at use of transparency and lighting). Generally, you need to prepare OpenGL window and call MathGL functions to draw it. There is GLUT interface (see Widget classes) to do it by simple way. Below I show example of OpenGL usage basing on Qt libraries (i.e. by using QGLWidget widget). +

+

First, one need to define widget class derived from QGLWidget and implement a few methods: resizeGL() called after each window resize, paintGL() for displaying the image on the screen, and initializeGL() for initializing OpenGL. The header file looks as following. +

#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QGLWidget>
+#include <mgl2/mgl.h>
+
+class MainWindow : public QGLWidget
+{
+  Q_OBJECT
+protected:
+  mglGraph *gr;         // pointer to MathGL core class
+  void resizeGL(int nWidth, int nHeight);   // Method called after each window resize
+  void paintGL();       // Method to display the image on the screen
+  void initializeGL();  // Method to initialize OpenGL
+public:
+  MainWindow(QWidget *parent = 0);
+  ~MainWindow();
+};
+#endif // MAINWINDOW_H
+
+

The class implementation is rather straightforward. One need to recreate the instance of mglGraph at initializing OpenGL, and ask MathGL to use OpenGL output (set argument 1 in mglGraph constructor). Of course, the mglGraph object should be deleted at destruction. The method resizeGL() just pass new sizes to OpenGL and update viewport sizes. All plotting functions are located in the method paintGL(). At this, one need to add 2 calls: gr->Clf() at beginning for clearing previous OpenGL primitives; and swapBuffers() for showing output on the screen. The source file looks as following. +

#include "qgl_example.h"
+#include <QApplication>
+//#include <QtOpenGL>
+//-----------------------------------------------------------------------------
+MainWindow::MainWindow(QWidget *parent) : QGLWidget(parent)	{	gr=0;	}
+//-----------------------------------------------------------------------------
+MainWindow::~MainWindow()	{	if(gr)	delete gr;	}
+//-----------------------------------------------------------------------------
+void MainWindow::initializeGL()	// recreate instance of MathGL core
+{
+	if(gr)	delete gr;
+	gr = new mglGraph(1);	// use '1' for argument to force OpenGL output in MathGL
+}
+//-----------------------------------------------------------------------------
+void MainWindow::resizeGL(int w, int h) // standard resize replace
+{
+	QGLWidget::resizeGL(w, h);
+	glViewport (0, 0, w, h);
+}
+//-----------------------------------------------------------------------------
+void MainWindow::paintGL()	// main drawing function
+{
+	gr->Clf();	// clear previous OpenGL primitives
+	gr->SubPlot(1,1,0);
+	gr->Rotate(40,60);
+	gr->Light(true);
+	gr->AddLight(0,mglPoint(0,0,10),mglPoint(0,0,-1));
+	gr->Axis();
+	gr->Box();
+	gr->FPlot("sin(pi*x)","i2");
+	gr->FPlot("cos(pi*x)","|");
+	gr->FSurf("cos(2*pi*(x^2+y^2))");
+	gr->Finish();
+	swapBuffers();	// show output on the screen
+}
+//-----------------------------------------------------------------------------
+int main(int argc, char *argv[])	// create application
+{
+	mgl_textdomain(argv?argv[0]:NULL,"");
+	QApplication a(argc, argv);
+	MainWindow w;
+	w.show();
+	return a.exec();
+}
+//-----------------------------------------------------------------------------
+
+ + +
+ +
+

+Next: , Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.8 MathGL and PyQt

+ + +

Generally SWIG based classes (including the Python one) are the same as C++ classes. However, there are few tips for using MathGL with PyQt. Below I place a very simple python code which demonstrate how MathGL can be used with PyQt. This code is mostly written by Prof. Dr. Heino Falcke. You can just copy it to a file mgl-pyqt-test.py and execute it from python shell by command execfile("mgl-pyqt-test.py") +

+
from PyQt4 import QtGui,QtCore
+from mathgl import *
+import sys
+app = QtGui.QApplication(sys.argv)
+qpointf=QtCore.QPointF()
+
+class hfQtPlot(QtGui.QWidget):
+    def __init__(self, parent=None):
+        QtGui.QWidget.__init__(self, parent)
+        self.img=(QtGui.QImage())
+    def setgraph(self,gr):
+        self.buffer='\t'
+        self.buffer=self.buffer.expandtabs(4*gr.GetWidth()*gr.GetHeight())
+        gr.GetBGRN(self.buffer,len(self.buffer))
+        self.img=QtGui.QImage(self.buffer, gr.GetWidth(),gr.GetHeight(),QtGui.QImage.Format_ARGB32)
+        self.update()
+    def paintEvent(self, event):
+        paint = QtGui.QPainter()
+        paint.begin(self)
+        paint.drawImage(qpointf,self.img)
+        paint.end()
+
+BackgroundColor=[1.0,1.0,1.0]
+size=100
+gr=mglGraph()
+y=mglData(size)
+#y.Modify("((0.7*cos(2*pi*(x+.2)*500)+0.3)*(rnd*0.5+0.5)+362.135+10000.)")
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+x=mglData(size)
+x.Modify("x^2");
+
+def plotpanel(gr,x,y,n):
+    gr.SubPlot(2,2,n)
+    gr.SetXRange(x)
+    gr.SetYRange(y)
+    gr.AdjustTicks()
+    gr.Axis()
+    gr.Box()
+    gr.Label("x","x-Axis",1)
+    gr.Label("y","y-Axis",1)
+    gr.ClearLegend()
+    gr.AddLegend("Legend: "+str(n),"k")
+    gr.Legend()
+    gr.Plot(x,y)
+
+
+gr.Clf(BackgroundColor[0],BackgroundColor[1],BackgroundColor[2])
+gr.SetPlotFactor(1.5)
+plotpanel(gr,x,y,0)
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+plotpanel(gr,x,y,1)
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+plotpanel(gr,x,y,2)
+y.Modify("(cos(2*pi*x*10)+1.1)*1000.*rnd-501")
+plotpanel(gr,x,y,3)
+
+gr.WritePNG("test.png","Test Plot")
+
+qw = hfQtPlot()
+qw.show()
+qw.setgraph(gr)
+qw.raise_()
+
+ + + +
+ +
+

+Previous: , Up: Basic usage   [Contents][Index]

+
+ +

2.1.9 MathGL and MPI

+ + +

For using MathGL in MPI program you just need to: (1) plot its own part of data for each running node; (2) collect resulting graphical information in a single program (for example, at node with rank=0); (3) save it. The sample code below demonstrate this for very simple sample of surface drawing. +

+

First you need to initialize MPI +

#include <stdio.h>
+#include <mgl2/mpi.h>
+#include <mpi.h>
+
+int main(int argc, char *argv[])
+{
+  // initialize MPI
+  int rank=0, numproc=1;
+  MPI_Init(&argc, &argv);
+  MPI_Comm_size(MPI_COMM_WORLD,&numproc);
+  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
+  if(rank==0) printf("Use %d processes.\n", numproc);
+
+

Next step is data creation. For simplicity, I create data arrays with the same sizes for all nodes. At this, you have to create mglGraph object too. +

+
  // initialize data similarly for all nodes
+  mglData a(128,256);
+  mglGraphMPI gr;
+
+

Now, data should be filled by numbers. In real case, it should be some kind of calculations. But I just fill it by formula. +

+
  // do the same plot for its own range
+  char buf[64];
+  sprintf(buf,"xrange %g %g",2.*rank/numproc-1,2.*(rank+1)/numproc-1);
+  gr.Fill(a,"sin(2*pi*x)",buf);
+
+

It is time to plot the data. Don’t forget to set proper axis range(s) by using parametric form or by using options (as in the sample). +

+
  // plot data in each node
+  gr.Clf();   // clear image before making the image
+  gr.Rotate(40,60);
+  gr.Surf(a,"",buf);
+
+

Finally, let send graphical information to node with rank=0. +

+
  // collect information
+  if(rank!=0) gr.MPI_Send(0);
+  else for(int i=1;i<numproc;i++)  gr.MPI_Recv(i);
+
+

Now, node with rank=0 have whole image. It is time to save the image to a file. Also, you can add a kind of annotations here – I draw axis and bounding box in the sample. +

+
  if(rank==0)
+  {
+    gr.Box();   gr.Axis();   // some post processing
+    gr.WritePNG("test.png"); // save result
+  }
+
+

In my case the program is done, and I finalize MPI. In real program, you can repeat the loop of data calculation and data plotting as many times as you need. +

+
  MPI_Finalize();
+  return 0;
+}
+
+

You can type ‘mpic++ test.cpp -lmgl-mpi -lmgl && mpirun -np 8 ./a.out’ for compilation and running the sample program on 8 nodes. Note, that you have to set enable-mpi=ON at MathGL configure to use this feature. +

+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.2 Advanced usage

+ + +

Now I show several non-obvious features of MathGL: several subplots in a single picture, curvilinear coordinates, text printing and so on. Generally you may miss this section at first reading. +

+ + + + + + + + + + + + + +
+ + + +

2.2.1 Subplots

+ + +

Let me demonstrate possibilities of plot positioning and rotation. MathGL has a set of functions: subplot, inplot, title, aspect and rotate and so on (see Subplots and rotation). The order of their calling is strictly determined. First, one changes the position of plot in image area (functions subplot, inplot and multiplot). Secondly, you can add the title of plot by title function. After that one may rotate the plot (function rotate). Finally, one may change aspects of axes (function aspect). The following code illustrates the aforesaid it: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Box();
+  gr->Puts(mglPoint(-1,1.1),"Just box",":L");
+  gr->InPlot(0.2,0.5,0.7,1,false);  gr->Box();
+  gr->Puts(mglPoint(0,1.2),"InPlot example");
+  gr->SubPlot(2,2,1); gr->Title("Rotate only");
+  gr->Rotate(50,60);  gr->Box();
+  gr->SubPlot(2,2,2); gr->Title("Rotate and Aspect");
+  gr->Rotate(50,60);  gr->Aspect(1,1,2);  gr->Box();
+  gr->SubPlot(2,2,3); gr->Title("Shear");
+  gr->Box("c"); gr->Shear(0.2,0.1); gr->Box();
+  return 0;
+}
+

Here I used function Puts for printing the text in arbitrary position of picture (see Text printing). Text coordinates and size are connected with axes. However, text coordinates may be everywhere, including the outside the bounding box. I’ll show its features later in Text features. +

+
Example of several subplots on the single picture. +
+

More complicated sample show how to use most of positioning functions: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(3,2,0); gr->Title("StickPlot");
+  gr->StickPlot(3, 0, 20, 30);  gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->StickPlot(3, 1, 20, 30);  gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->StickPlot(3, 2, 20, 30);  gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  gr->SubPlot(3,2,3,"");  gr->Title("ColumnPlot");
+  gr->ColumnPlot(3, 0); gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->ColumnPlot(3, 1); gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->ColumnPlot(3, 2); gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  gr->SubPlot(3,2,4,"");  gr->Title("GridPlot");
+  gr->GridPlot(2, 2, 0);  gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->GridPlot(2, 2, 1);  gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->GridPlot(2, 2, 2);  gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  gr->GridPlot(2, 2, 3);  gr->Box("m"); gr->Puts(mglPoint(0),"3","m");
+  gr->SubPlot(3,2,5,"");  gr->Title("InPlot");  gr->Box();
+  gr->InPlot(0.4, 1, 0.6, 1, true); gr->Box("r");
+  gr->MultiPlot(3,2,1, 2, 1,"");  gr->Title("MultiPlot and ShearPlot"); gr->Box();
+  gr->ShearPlot(3, 0, 0.2, 0.1);  gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
+  gr->ShearPlot(3, 1, 0.2, 0.1);  gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
+  gr->ShearPlot(3, 2, 0.2, 0.1);  gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
+  return 0;
+}
+
+
Example for most of positioning functions. +
+ + +
+ + + +

2.2.2 Axis and ticks

+ + +

MathGL library can draw not only the bounding box but also the axes, grids, labels and so on. The ranges of axes and their origin (the point of intersection) are determined by functions SetRange(), SetRanges(), SetOrigin() (see Ranges (bounding box)). Ticks on axis are specified by function SetTicks, SetTicksVal, SetTicksTime (see Ticks). But usually +

+

Function axis draws axes. Its textual string shows in which directions the axis or axes will be drawn (by default "xyz", function draws axes in all directions). Function grid draws grid perpendicularly to specified directions. Example of axes and grid drawing is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Title("Axis origin, Grid"); gr->SetOrigin(0,0);
+  gr->Axis(); gr->Grid(); gr->FPlot("x^3");
+
+  gr->SubPlot(2,2,1); gr->Title("2 axis");
+  gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1,-1,-1);  // first axis
+  gr->Axis(); gr->Label('y',"axis 1",0);  gr->FPlot("sin(pi*x)");
+  gr->SetRanges(0,1,0,1);   gr->SetOrigin(1,1,1);   // second axis
+  gr->Axis(); gr->Label('y',"axis 2",0);  gr->FPlot("cos(pi*x)");
+
+  gr->SubPlot(2,2,3); gr->Title("More axis");
+  gr->SetOrigin(NAN,NAN); gr->SetRange('x',-1,1);
+  gr->Axis(); gr->Label('x',"x",0); gr->Label('y',"y_1",0);
+  gr->FPlot("x^2","k");
+  gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1.3,-1); // second axis
+  gr->Axis("y","r");  gr->Label('y',"#r{y_2}",0.2);
+  gr->FPlot("x^3","r");
+
+  gr->SubPlot(2,2,2); gr->Title("4 segments, inverted axis");
+  gr->SetOrigin(0,0);
+  gr->InPlot(0.5,1,0.5,1);  gr->SetRanges(0,10,0,2);  gr->Axis();
+  gr->FPlot("sqrt(x/2)");   gr->Label('x',"W",1); gr->Label('y',"U",1);
+  gr->InPlot(0,0.5,0.5,1);  gr->SetRanges(1,0,0,2); gr->Axis("x");
+  gr->FPlot("sqrt(x)+x^3"); gr->Label('x',"\\tau",-1);
+  gr->InPlot(0.5,1,0,0.5);  gr->SetRanges(0,10,4,0);  gr->Axis("y");
+  gr->FPlot("x/4"); gr->Label('y',"L",-1);
+  gr->InPlot(0,0.5,0,0.5);  gr->SetRanges(1,0,4,0); gr->FPlot("4*x^2");
+  return 0;
+}
+
+

Note, that MathGL can draw not only single axis (which is default). But also several axis on the plot (see right plots). The idea is that the change of settings does not influence on the already drawn graphics. So, for 2-axes I setup the first axis and draw everything concerning it. Then I setup the second axis and draw things for the second axis. Generally, the similar idea allows one to draw rather complicated plot of 4 axis with different ranges (see bottom left plot). +

+

At this inverted axis can be created by 2 methods. First one is used in this sample – just specify minimal axis value to be large than maximal one. This method work well for 2D axis, but can wrongly place labels in 3D case. Second method is more general and work in 3D case too – just use aspect function with negative arguments. For example, following code will produce exactly the same result for 2D case, but 2nd variant will look better in 3D. +

// variant 1
+gr->SetRanges(0,10,4,0);  gr->Axis();
+
+// variant 2
+gr->SetRanges(0,10,0,4);  gr->Aspect(1,-1);   gr->Axis();
+
+
Example of axis. +
+

Another MathGL feature is fine ticks tunning. By default (if it is not changed by SetTicks function), MathGL try to adjust ticks positioning, so that they looks most human readable. At this, MathGL try to extract common factor for too large or too small axis ranges, as well as for too narrow ranges. Last one is non-common notation and can be disabled by SetTuneTicks function. +

+

Also, one can specify its own ticks with arbitrary labels by help of SetTicksVal function. Or one can set ticks in time format. In last case MathGL will try to select optimal format for labels with automatic switching between years, months/days, hours/minutes/seconds or microseconds. However, you can specify its own time representation using formats described in http://www.manpagez.com/man/3/strftime/. Most common variants are ‘%X’ for national representation of time, ‘%x’ for national representation of date, ‘%Y’ for year with century. +

+

The sample code, demonstrated ticks feature is +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(3,2,0); gr->Title("Usual axis");  gr->Axis();
+  gr->SubPlot(3,2,1); gr->Title("Too big/small range");
+  gr->SetRanges(-1000,1000,0,0.001);  gr->Axis();
+  gr->SubPlot(3,2,3); gr->Title("Too narrow range");
+  gr->SetRanges(100,100.1,10,10.01);  gr->Axis();
+  gr->SubPlot(3,2,4); gr->Title("Disable ticks tuning");
+  gr->SetTuneTicks(0);  gr->Axis();
+
+  gr->SubPlot(3,2,2); gr->Title("Manual ticks");  gr->SetRanges(-M_PI,M_PI, 0, 2);
+  mreal val[]={-M_PI, -M_PI/2, 0, 0.886, M_PI/2, M_PI};
+  gr->SetTicksVal('x', mglData(6,val), "-\\pi\n-\\pi/2\n0\nx^*\n\\pi/2\n\\pi");
+  gr->Axis(); gr->Grid(); gr->FPlot("2*cos(x^2)^2", "r2");
+
+  gr->SubPlot(3,2,5); gr->Title("Time ticks");  gr->SetRange('x',0,3e5);
+  gr->SetTicksTime('x',0);  gr->Axis();
+  return 0;
+}
+
+
Features of axis ticks. +
+

The last sample I want to show in this subsection is Log-axis. From MathGL’s point of view, the log-axis is particular case of general curvilinear coordinates. So, we need first define new coordinates (see also Curvilinear coordinates) by help of SetFunc or SetCoor functions. At this one should wary about proper axis range. So the code looks as following: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"<_");  gr->Title("Semi-log axis");
+  gr->SetRanges(0.01,100,-1,1); gr->SetFunc("lg(x)","");
+  gr->Axis(); gr->Grid("xy","g"); gr->FPlot("sin(1/x)");
+  gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0);
+
+  gr->SubPlot(2,2,1,"<_");  gr->Title("Log-log axis");
+  gr->SetRanges(0.01,100,0.1,100);  gr->SetFunc("lg(x)","lg(y)");
+  gr->Axis(); gr->Grid("!","h=");   gr->Grid();
+  gr->FPlot("sqrt(1+x^2)"); gr->Label('x',"x",0);
+  gr->Label('y', "y = \\sqrt{1+x^2}",0);
+
+  gr->SubPlot(2,2,2,"<_");  gr->Title("Minus-log axis");
+  gr->SetRanges(-100,-0.01,-100,-0.1);  gr->SetFunc("-lg(-x)","-lg(-y)");
+  gr->Axis(); gr->FPlot("-sqrt(1+x^2)");
+  gr->Label('x',"x",0); gr->Label('y', "y = -\\sqrt{1+x^2}",0);
+
+  gr->SubPlot(2,2,3,"<_");  gr->Title("Log-ticks");
+  gr->SetRanges(0.1,100,0,100); gr->SetFunc("sqrt(x)","");
+  gr->Axis(); gr->FPlot("x");
+  gr->Label('x',"x",1); gr->Label('y', "y = x",0);
+  return 0;
+}
+
+
Features of axis ticks. +
+

You can see that MathGL automatically switch to log-ticks as we define log-axis formula (in difference from v.1.*). Moreover, it switch to log-ticks for any formula if axis range will be large enough (see right bottom plot). Another interesting feature is that you not necessary define usual log-axis (i.e. when coordinates are positive), but you can define “minus-log” axis when coordinate is negative (see left bottom plot). +

+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.3 Curvilinear coordinates

+ + +

As I noted in previous subsection, MathGL support curvilinear coordinates. In difference from other plotting programs and libraries, MathGL uses textual formulas for connection of the old (data) and new (output) coordinates. This allows one to plot in arbitrary coordinates. The following code plots the line y=0, z=0 in Cartesian, polar, parabolic and spiral coordinates: +

int sample(mglGraph *gr)
+{
+  gr->SetOrigin(-1,1,-1);
+
+  gr->SubPlot(2,2,0); gr->Title("Cartesian"); gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+
+  gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)",0);
+  gr->SubPlot(2,2,1); gr->Title("Cylindrical"); gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+
+  gr->SetFunc("2*y*x","y*y - x*x",0);
+  gr->SubPlot(2,2,2); gr->Title("Parabolic"); gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+
+  gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)","x+z");
+  gr->SubPlot(2,2,3); gr->Title("Spiral");  gr->Rotate(50,60);
+  gr->FPlot("2*t-1","0.5","0","r2");
+  gr->Axis(); gr->Grid();
+  gr->SetFunc(0,0,0); // set to default Cartesian
+  return 0;
+}
+
+
Example of curvilinear coordinates +
+ + +
+ + + +

2.2.4 Colorbars

+ + +

MathGL handle colorbar as special kind of axis. So, most of functions for axis and ticks setup will work for colorbar too. Colorbars can be in log-scale, and generally as arbitrary function scale; common factor of colorbar labels can be separated; and so on. +

+

But of course, there are differences – colorbars usually located out of bounding box. At this, colorbars can be at subplot boundaries (by default), or at bounding box (if symbol ‘I’ is specified). Colorbars can handle sharp colors. And they can be located at arbitrary position too. The sample code, which demonstrate colorbar features is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Title("Colorbar out of box"); gr->Box();
+  gr->Colorbar("<");  gr->Colorbar(">");
+  gr->Colorbar("_");  gr->Colorbar("^");
+
+  gr->SubPlot(2,2,1); gr->Title("Colorbar near box");   gr->Box();
+  gr->Colorbar("<I"); gr->Colorbar(">I");
+  gr->Colorbar("_I"); gr->Colorbar("^I");
+
+  gr->SubPlot(2,2,2); gr->Title("manual colors");
+  mglData a,v;  mgls_prepare2d(&a,0,&v);
+  gr->Box();  gr->ContD(v,a);
+  gr->Colorbar(v,"<");  gr->Colorbar(v,">");
+  gr->Colorbar(v,"_");  gr->Colorbar(v,"^");
+
+  gr->SubPlot(2,2,3);   gr->Title(" ");
+  gr->Puts(mglPoint(-0.5,1.55),"Color positions",":C",-2);
+  gr->Colorbar("bwr>",0.25,0);  gr->Puts(mglPoint(-0.9,1.2),"Default");
+  gr->Colorbar("b{w,0.3}r>",0.5,0); gr->Puts(mglPoint(-0.1,1.2),"Manual");
+
+  gr->Puts(mglPoint(1,1.55),"log-scale",":C",-2);
+  gr->SetRange('c',0.01,1e3);
+  gr->Colorbar(">",0.75,0);  gr->Puts(mglPoint(0.65,1.2),"Normal scale");
+  gr->SetFunc("","","","lg(c)");
+  gr->Colorbar(">");    gr->Puts(mglPoint(1.35,1.2),"Log scale");
+  return 0;
+}
+
+
Example of colorbars +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.5 Bounding box

+ + +

Box around the plot is rather useful thing because it allows one to: see the plot boundaries, and better estimate points position since box contain another set of ticks. MathGL provide special function for drawing such box – box function. By default, it draw black or white box with ticks (color depend on transparency type, see Types of transparency). However, you can change the color of box, or add drawing of rectangles at rear faces of box. Also you can disable ticks drawing, but I don’t know why anybody will want it. The sample code, which demonstrate box features is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0); gr->Title("Box (default)"); gr->Rotate(50,60);
+  gr->Box();
+  gr->SubPlot(2,2,1); gr->Title("colored");   gr->Rotate(50,60);
+  gr->Box("r");
+  gr->SubPlot(2,2,2); gr->Title("with faces");  gr->Rotate(50,60);
+  gr->Box("@");
+  gr->SubPlot(2,2,3); gr->Title("both");  gr->Rotate(50,60);
+  gr->Box("@cm");
+  return 0;
+}
+
+
Example of Box() +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.6 Ternary axis

+ + +

There are another unusual axis types which are supported by MathGL. These are ternary and quaternary axis. Ternary axis is special axis of 3 coordinates a, b, c which satisfy relation a+b+c=1. Correspondingly, quaternary axis is special axis of 4 coordinates a, b, c, d which satisfy relation a+b+c+d=1. +

+

Generally speaking, only 2 of coordinates (3 for quaternary) are independent. So, MathGL just introduce some special transformation formulas which treat a as ‘x’, b as ‘y’ (and c as ‘z’ for quaternary). As result, all plotting functions (curves, surfaces, contours and so on) work as usual, but in new axis. You should use ternary function for switching to ternary/quaternary coordinates. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(0,1,0,1,0,1);
+  mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+  a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+  x.Modify("0.25*(1+cos(2*pi*x))");
+  y.Modify("0.25*(1+sin(2*pi*x))");
+  rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+  z.Modify("x");
+
+  gr->SubPlot(2,2,0); gr->Title("Ordinary axis 3D");
+  gr->Rotate(50,60);    gr->Light(true);
+  gr->Plot(x,y,z,"r2"); gr->Surf(a,"BbcyrR#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('x',"B",1); gr->Label('y',"C",1); gr->Label('z',"Z",1);
+
+  gr->SubPlot(2,2,1); gr->Title("Ternary axis (x+y+t=1)");
+  gr->Ternary(1);
+  gr->Plot(x,y,"r2"); gr->Plot(rx,ry,"q^ ");  gr->Cont(a,"BbcyrR");
+  gr->Line(mglPoint(0.5,0), mglPoint(0,0.75), "g2");
+  gr->Axis(); gr->Grid("xyz","B;");
+  gr->Label('x',"B"); gr->Label('y',"C"); gr->Label('t',"A");
+
+  gr->SubPlot(2,2,2); gr->Title("Quaternary axis 3D");
+  gr->Rotate(50,60);    gr->Light(true);
+  gr->Ternary(2);
+  gr->Plot(x,y,z,"r2"); gr->Surf(a,"BbcyrR#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('t',"A",1); gr->Label('x',"B",1);
+  gr->Label('y',"C",1); gr->Label('z',"D",1);
+
+  gr->SubPlot(2,2,3); gr->Title("Ternary axis 3D");
+  gr->Rotate(50,60);    gr->Light(true);
+  gr->Ternary(1);
+  gr->Plot(x,y,z,"r2"); gr->Surf(a,"BbcyrR#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('t',"A",1); gr->Label('x',"B",1);
+  gr->Label('y',"C",1); gr->Label('z',"Z",1);
+  return 0;
+}
+
+
Example of colorbars +
+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.7 Text features

+ + +

MathGL prints text by vector font. There are functions for manual specifying of text position (like Puts) and for its automatic selection (like Label, Legend and so on). MathGL prints text always in specified position even if it lies outside the bounding box. The default size of font is specified by functions SetFontSize* (see Font settings). However, the actual size of output string depends on subplot size (depends on functions SubPlot, InPlot). The switching of the font style (italic, bold, wire and so on) can be done for the whole string (by function parameter) or inside the string. By default MathGL parses TeX-like commands for symbols and indexes (see Font styles). +

+

Text can be printed as usual one (from left to right), along some direction (rotated text), or along a curve. Text can be printed on several lines, divided by new line symbol ‘\n’. +

+

Example of MathGL font drawing is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"");
+  gr->Putsw(mglPoint(0,1),L"Text can be in ASCII and in Unicode");
+  gr->Puts(mglPoint(0,0.6),"It can be \\wire{wire}, \\big{big} or #r{colored}");
+  gr->Puts(mglPoint(0,0.2),"One can change style in string: "
+  "\\b{bold}, \\i{italic, \\b{both}}");
+  gr->Puts(mglPoint(0,-0.2),"Easy to \\a{overline} or "
+  "\\u{underline}");
+  gr->Puts(mglPoint(0,-0.6),"Easy to change indexes ^{up} _{down} @{center}");
+  gr->Puts(mglPoint(0,-1),"It parse TeX: \\int \\alpha \\cdot "
+  "\\sqrt3{sin(\\pi x)^2 + \\gamma_{i_k}} dx");
+
+  gr->SubPlot(2,2,1,"");
+  gr->Puts(mglPoint(0,0.5), "\\sqrt{\\frac{\\alpha^{\\gamma^2}+\\overset 1{\\big\\infty}}{\\sqrt3{2+b}}}", "@", -4);
+  gr->Puts(mglPoint(0,-0.5),"Text can be printed\non several lines");
+
+  gr->SubPlot(2,2,2,"");
+  mglData y;  mgls_prepare1d(&y);
+  gr->Box();  gr->Plot(y.SubData(-1,0));
+  gr->Text(y,"This is very very long string drawn along a curve",":k");
+  gr->Text(y,"Another string drawn under a curve","T:r");
+
+  gr->SubPlot(2,2,3,"");
+  gr->Line(mglPoint(-1,-1),mglPoint(1,-1),"rA");
+  gr->Puts(mglPoint(0,-1),mglPoint(1,-1),"Horizontal");
+  gr->Line(mglPoint(-1,-1),mglPoint(1,1),"rA");
+  gr->Puts(mglPoint(0,0),mglPoint(1,1),"At angle","@");
+  gr->Line(mglPoint(-1,-1),mglPoint(-1,1),"rA");
+  gr->Puts(mglPoint(-1,0),mglPoint(-1,1),"Vertical");
+  return 0;
+}
+
+
Example of text printing +
+

You can change font faces by loading font files by function loadfont. Note, that this is long-run procedure. Font faces can be downloaded from MathGL website or from here. The sample code is: +

int sample(mglGraph *gr)
+{
+  double h=1.1, d=0.25;
+  gr->LoadFont("STIX");     gr->Puts(mglPoint(0,h), "default font (STIX)");
+  gr->LoadFont("adventor"); gr->Puts(mglPoint(0,h-d), "adventor font");
+  gr->LoadFont("bonum");    gr->Puts(mglPoint(0,h-2*d), "bonum font");
+  gr->LoadFont("chorus");   gr->Puts(mglPoint(0,h-3*d), "chorus font");
+  gr->LoadFont("cursor");   gr->Puts(mglPoint(0,h-4*d), "cursor font");
+  gr->LoadFont("heros");    gr->Puts(mglPoint(0,h-5*d), "heros font");
+  gr->LoadFont("heroscn");  gr->Puts(mglPoint(0,h-6*d), "heroscn font");
+  gr->LoadFont("pagella");  gr->Puts(mglPoint(0,h-7*d), "pagella font");
+  gr->LoadFont("schola");   gr->Puts(mglPoint(0,h-8*d), "schola font");
+  gr->LoadFont("termes");   gr->Puts(mglPoint(0,h-9*d), "termes font");
+  return 0;
+}
+
+
Example of font faces +
+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.8 Legend sample

+ + +

Legend is one of standard ways to show plot annotations. Basically you need to connect the plot style (line style, marker and color) with some text. In MathGL, you can do it by 2 methods: manually using addlegend function; or use ‘legend’ option (see Command options), which will use last plot style. In both cases, legend entries will be added into internal accumulator, which later used for legend drawing itself. clearlegend function allow you to remove all saved legend entries. +

+

There are 2 features. If plot style is empty then text will be printed without indent. If you want to plot the text with indent but without plot sample then you need to use space ‘ ’ as plot style. Such style ‘ ’ will draw a plot sample (line with marker(s)) which is invisible line (i.e. nothing) and print the text with indent as usual one. +

+

Function legend draw legend on the plot. The position of the legend can be selected automatic or manually. You can change the size and style of text labels, as well as setup the plot sample. The sample code demonstrating legend features is: +

int sample(mglGraph *gr)
+{
+  gr->AddLegend("sin(\\pi {x^2})","b");
+  gr->AddLegend("sin(\\pi x)","g*");
+  gr->AddLegend("sin(\\pi \\sqrt{x})","rd");
+  gr->AddLegend("just text"," ");
+  gr->AddLegend("no indent for this","");
+
+  gr->SubPlot(2,2,0,""); gr->Title("Legend (default)");
+  gr->Box();  gr->Legend();
+
+  gr->Legend(3,"A#");
+  gr->Puts(mglPoint(0.75,0.65),"Absolute position","A");
+
+  gr->SubPlot(2,2,2,"");  gr->Title("coloring");  gr->Box();
+  gr->Legend(0,"r#"); gr->Legend(1,"Wb#");  gr->Legend(2,"ygr#");
+
+  gr->SubPlot(2,2,3,"");  gr->Title("manual position"); gr->Box();
+  gr->Legend(0.5,1);  gr->Puts(mglPoint(0.5,0.55),"at x=0.5, y=1","a");
+  gr->Legend(1,"#-"); gr->Puts(mglPoint(0.75,0.25),"Horizontal legend","a");
+  return 0;
+}
+
+
Example of legend +
+ +
+ +
+

+Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

2.2.9 Cutting sample

+ + +

The last common thing which I want to show in this section is how one can cut off points from plot. There are 4 mechanism for that. +

    +
  • You can set one of coordinate to NAN value. All points with NAN values will be omitted. + +
  • You can enable cutting at edges by SetCut function. As result all points out of bounding box will be omitted. + +
  • You can set cutting box by SetCutBox function. All points inside this box will be omitted. + +
  • You can define cutting formula by SetCutOff function. All points for which the value of formula is nonzero will be omitted. Note, that this is the slowest variant. +
+ +

Below I place the code which demonstrate last 3 possibilities: +

int sample(mglGraph *gr)
+{
+  mglData a,c,v(1); mgls_prepare2d(&a); mgls_prepare3d(&c); v.a[0]=0.5;
+  gr->SubPlot(2,2,0); gr->Title("Cut on (default)");
+  gr->Rotate(50,60);  gr->Light(true);
+  gr->Box();  gr->Surf(a,"","zrange -1 0.5");
+
+  gr->SubPlot(2,2,1); gr->Title("Cut off");   gr->Rotate(50,60);
+  gr->Box();  gr->Surf(a,"","zrange -1 0.5; cut off");
+
+  gr->SubPlot(2,2,2); gr->Title("Cut in box");  gr->Rotate(50,60);
+  gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+  gr->Alpha(true);  gr->Box();  gr->Surf3(c);
+  gr->SetCutBox(mglPoint(0), mglPoint(0));  // switch it off
+
+  gr->SubPlot(2,2,3); gr->Title("Cut by formula");  gr->Rotate(50,60);
+  gr->CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)");
+  gr->Box();  gr->Surf3(c); gr->CutOff(""); // switch it off
+  return 0;
+}
+
+
Example of point cutting +
+ + + +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.3 Data handling

+ + +

Class mglData contains all functions for the data handling in MathGL (see Data processing). There are several matters why I use class mglData but not a single array: it does not depend on type of data (mreal or double), sizes of data arrays are kept with data, memory working is simpler and safer. +

+ + + + + + + +
+ +
+

+Next: , Up: Data handling   [Contents][Index]

+
+ +

2.3.1 Array creation

+ + +

There are many ways in MathGL how data arrays can be created and filled. +

+

One can put the data in mglData instance by several ways. Let us do it for sinus function: +

    +
  • one can create external array, fill it and put to mglData variable +
      double *a = new double[50];
    +  for(int i=0;i<50;i++)   a[i] = sin(M_PI*i/49.);
    +
    +  mglData y;
    +  y.Set(a,50);
    +
    +
  • another way is to create mglData instance of the desired size and then to work directly with data in this variable +
      mglData y(50);
    +  for(int i=0;i<50;i++)   y.a[i] = sin(M_PI*i/49.);
    +
    +
  • next way is to fill the data in mglData instance by textual formula with the help of Modify() function +
      mglData y(50);
    +  y.Modify("sin(pi*x)");
    +
    +
  • or one may fill the array in some interval and modify it later +
      mglData y(50);
    +  y.Fill(0,M_PI);
    +  y.Modify("sin(u)");
    +
    +
  • finally it can be loaded from file +
      FILE *fp=fopen("sin.dat","wt");   // create file first
    +  for(int i=0;i<50;i++)   fprintf(fp,"%g\n",sin(M_PI*i/49.));
    +  fclose(fp);
    +
    +  mglData y("sin.dat");             // load it
    +

    At this you can use textual or HDF files, as well as import values from bitmap image (PNG is supported right now). +

    +
  • at this one can read only part of data +
      FILE *fp-fopen("sin.dat","wt");   // create large file first
    +  for(int i=0;i<70;i++)   fprintf(fp,"%g\n",sin(M_PI*i/49.));
    +  fclose(fp);
    +
    +  mglData y;
    +  y.Read("sin.dat",50);             // load it
    +
+ +

Creation of 2d- and 3d-arrays is mostly the same. But one should keep in mind that class mglData uses flat data representation. For example, matrix 30*40 is presented as flat (1d-) array with length 30*40=1200 (nx=30, ny=40). The element with indexes {i,j} is a[i+nx*j]. So for 2d array we have: +

  mglData z(30,40);
+  for(int i=0;i<30;i++)   for(int j=0;j<40;j++)
+    z.a[i+30*j] = sin(M_PI*i/29.)*sin(M_PI*j/39.);
+

or by using Modify() function +

  mglData z(30,40);
+  z.Modify("sin(pi*x)*cos(pi*y)");
+
+

The only non-obvious thing here is using multidimensional arrays in C/C++, i.e. arrays defined like mreal dat[40][30];. Since, formally these elements dat[i] can address the memory in arbitrary place you should use the proper function to convert such arrays to mglData object. For C++ this is functions like mglData::Set(mreal **dat, int N1, int N2);. For C this is functions like mgl_data_set_mreal2(HMDT d, const mreal **dat, int N1, int N2);. At this, you should keep in mind that nx=N2 and ny=N1 after conversion. +

+ +
+ +
+

+Next: , Previous: , Up: Data handling   [Contents][Index]

+
+ +

2.3.2 Linking array

+ + +

Sometimes the data arrays are so large, that one couldn’t’ copy its values to another array (i.e. into mglData). In this case, he can define its own class derived from mglDataA (see mglDataA class) or can use Link function. +

+

In last case, MathGL just save the link to an external data array, but not copy it. You should provide the existence of this data array for whole time during which MathGL can use it. Another point is that MathGL will automatically create new array if you’ll try to modify data values by any of mglData functions. So, you should use only function with const modifier if you want still using link to the original data array. +

+

Creating the link is rather simple – just the same as using Set function +

  double *a = new double[50];
+  for(int i=0;i<50;i++)   a[i] = sin(M_PI*i/49.);
+
+  mglData y;
+  y.Link(a,50);
+
+ +
+ +
+

+Previous: , Up: Data handling   [Contents][Index]

+
+ +

2.3.3 Change data

+ + +

MathGL has functions for data processing: differentiating, integrating, smoothing and so on (for more detail, see Data processing). Let us consider some examples. The simplest ones are integration and differentiation. The direction in which operation will be performed is specified by textual string, which may contain symbols ‘x’, ‘y’ or ‘z’. For example, the call of Diff("x") will differentiate data along ‘x’ direction; the call of Integral("xy") perform the double integration of data along ‘x’ and ‘y’ directions; the call of Diff2("xyz") will apply 3d Laplace operator to data and so on. Example of this operations on 2d array a=x*y is presented in code: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(0,1,0,1,0,1);
+  mglData a(30,40); a.Modify("x*y");
+  gr->SubPlot(2,2,0); gr->Rotate(60,40);
+  gr->Surf(a);    gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"a(x,y)");
+  gr->SubPlot(2,2,1); gr->Rotate(60,40);
+  a.Diff("x");    gr->Surf(a);  gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"da/dx");
+  gr->SubPlot(2,2,2); gr->Rotate(60,40);
+  a.Integral("xy"); gr->Surf(a);  gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"\\int da/dx dxdy");
+  gr->SubPlot(2,2,3); gr->Rotate(60,40);
+  a.Diff2("y"); gr->Surf(a);  gr->Box();
+  gr->Puts(mglPoint(0.7,1,1.2),"\\int {d^2}a/dxdy dx");
+  return 0;
+}
+
+
Example of data differentiation and integration +
+

Data smoothing (function smooth) is more interesting and important. This function has single argument which define type of smoothing and its direction. Now 3 methods are supported: ‘3’ – linear averaging by 3 points, ‘5’ – linear averaging by 5 points, and default one – quadratic averaging by 5 points. +

+

MathGL also have some amazing functions which is not so important for data processing as useful for data plotting. There are functions for finding envelope (useful for plotting rapidly oscillating data), for data sewing (useful to removing jumps on the phase), for data resizing (interpolation). Let me demonstrate it: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"");  gr->Title("Envelop sample");
+  mglData d1(1000); gr->Fill(d1,"exp(-8*x^2)*sin(10*pi*x)");
+  gr->Axis();     gr->Plot(d1, "b");
+  d1.Envelop('x');  gr->Plot(d1, "r");
+
+  gr->SubPlot(2,2,1,"");  gr->Title("Smooth sample");
+  mglData y0(30),y1,y2,y3;
+  gr->SetRanges(0,1,0,1);
+  gr->Fill(y0, "0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd");
+
+  y1=y0;  y1.Smooth("x3");
+  y2=y0;  y2.Smooth("x5");
+  y3=y0;  y3.Smooth("x");
+
+  gr->Plot(y0,"{m7}:s", "legend 'none'"); //gr->AddLegend("none","k");
+  gr->Plot(y1,"r", "legend ''3' style'");
+  gr->Plot(y2,"g", "legend ''5' style'");
+  gr->Plot(y3,"b", "legend 'default'");
+  gr->Legend();   gr->Box();
+
+  gr->SubPlot(2,2,2);   gr->Title("Sew sample");
+  mglData d2(100, 100); gr->Fill(d2, "mod((y^2-(1-x)^2)/2,0.1)");
+  gr->Rotate(50, 60);   gr->Light(true);  gr->Alpha(true);
+  gr->Box();            gr->Surf(d2, "b");
+  d2.Sew("xy", 0.1);  gr->Surf(d2, "r");
+
+  gr->SubPlot(2,2,3);   gr->Title("Resize sample (interpolation)");
+  mglData x0(10), v0(10), x1, v1;
+  gr->Fill(x0,"rnd");     gr->Fill(v0,"rnd");
+  x1 = x0.Resize(100);    v1 = v0.Resize(100);
+  gr->Plot(x0,v0,"b+ ");  gr->Plot(x1,v1,"r-");
+  gr->Label(x0,v0,"%n");
+  return 0;
+}
+
+
Example of data smoothing +
+

Also one can create new data arrays on base of the existing one: extract slice, row or column of data (subdata), summarize along a direction(s) (sum), find distribution of data elements (hist) and so on. +

+

Another interesting feature of MathGL is interpolation and root-finding. There are several functions for linear and cubic spline interpolation (see Interpolation). Also there is a function evaluate which do interpolation of data array for values of each data element of index data. It look as indirect access to the data elements. +

+

This function have inverse function solve which find array of indexes at which data array is equal to given value (i.e. work as root finding). But solve function have the issue – usually multidimensional data (2d and 3d ones) have an infinite number of indexes which give some value. This is contour lines for 2d data, or isosurface(s) for 3d data. So, solve function will return index only in given direction, assuming that other index(es) are the same as equidistant index(es) of original data. If data have multiple roots then second (and later) branches can be found by consecutive call(s) of solve function. Let me demonstrate this on the following sample. +

+
int sample(mglGraph *gr)
+{
+  gr->SetRange('z',0,1);
+  mglData x(20,30), y(20,30), z(20,30), xx,yy,zz;
+  gr->Fill(x,"(x+2)/3*cos(pi*y)");
+  gr->Fill(y,"(x+2)/3*sin(pi*y)");
+  gr->Fill(z,"exp(-6*x^2-2*sin(pi*y)^2)");
+
+  gr->SubPlot(2,1,0); gr->Title("Cartesian space");   gr->Rotate(30,-40);
+  gr->Axis("xyzU");   gr->Box();  gr->Label('x',"x"); gr->Label('y',"y");
+  gr->SetOrigin(1,1); gr->Grid("xy");
+  gr->Mesh(x,y,z);
+
+  // section along 'x' direction
+  mglData u = x.Solve(0.5,'x');
+  mglData v(u.nx);  v.Fill(0,1);
+  xx = x.Evaluate(u,v);   yy = y.Evaluate(u,v);   zz = z.Evaluate(u,v);
+  gr->Plot(xx,yy,zz,"k2o");
+
+  // 1st section along 'y' direction
+  mglData u1 = x.Solve(-0.5,'y');
+  mglData v1(u1.nx);  v1.Fill(0,1);
+  xx = x.Evaluate(v1,u1); yy = y.Evaluate(v1,u1); zz = z.Evaluate(v1,u1);
+  gr->Plot(xx,yy,zz,"b2^");
+
+  // 2nd section along 'y' direction
+  mglData u2 = x.Solve(-0.5,'y',u1);
+  xx = x.Evaluate(v1,u2); yy = y.Evaluate(v1,u2); zz = z.Evaluate(v1,u2);
+  gr->Plot(xx,yy,zz,"r2v");
+
+  gr->SubPlot(2,1,1); gr->Title("Accompanied space");
+  gr->SetRanges(0,1,0,1); gr->SetOrigin(0,0);
+  gr->Axis(); gr->Box();  gr->Label('x',"i"); gr->Label('y',"j");
+  gr->Grid(z,"h");
+
+  gr->Plot(u,v,"k2o");    gr->Line(mglPoint(0.4,0.5),mglPoint(0.8,0.5),"kA");
+  gr->Plot(v1,u1,"b2^");  gr->Line(mglPoint(0.5,0.15),mglPoint(0.5,0.3),"bA");
+  gr->Plot(v1,u2,"r2v");  gr->Line(mglPoint(0.5,0.7),mglPoint(0.5,0.85),"rA");
+}
+
+
Example of data interpolation and root finding +
+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.4 Data plotting

+ + +

Let me now show how to plot the data. Next section will give much more examples for all plotting functions. Here I just show some basics. MathGL generally has 2 types of plotting functions. Simple variant requires a single data array for plotting, other data (coordinates) are considered uniformly distributed in axis range. Second variant requires data arrays for all coordinates. It allows one to plot rather complex multivalent curves and surfaces (in case of parametric dependencies). Usually each function have one textual argument for plot style and another textual argument for options (see Command options). +

+

Note, that the call of drawing function adds something to picture but does not clear the previous plots (as it does in Matlab). Another difference from Matlab is that all setup (like transparency, lightning, axis borders and so on) must be specified before plotting functions. +

+

Let start for plots for 1D data. Term “1D data” means that data depend on single index (parameter) like curve in parametric form {x(i),y(i),z(i)}, i=1...n. The textual argument allow you specify styles of line and marks (see Line styles). If this parameter is NULL or empty then solid line with color from palette is used (see Palette and colors). +

+

Below I shall show the features of 1D plotting on base of plot function. Let us start from sinus plot: +

int sample(mglGraph *gr)
+{
+  mglData y0(50); 	y0.Modify("sin(pi*(2*x-1))");
+  gr->SubPlot(2,2,0);
+  gr->Plot(y0);   	gr->Box();
+

Style of line is not specified in plot function. So MathGL uses the solid line with first color of palette (this is blue). Next subplot shows array y1 with 2 rows: +

  gr->SubPlot(2,2,1);
+  mglData y1(50,2);
+  y1.Modify("sin(pi*2*x-pi)");
+  y1.Modify("cos(pi*2*x-pi)/2",1);
+  gr->Plot(y1);   	gr->Box();
+

As previously I did not specify the style of lines. As a result, MathGL again uses solid line with next colors in palette (there are green and red). Now let us plot a circle on the same subplot. The circle is parametric curve x=cos(\pi t), y=sin(\pi t). I will set the color of the circle (dark yellow, ‘Y’) and put marks ‘+’ at point position: +

  mglData x(50);  	x.Modify("cos(pi*2*x-pi)");
+  gr->Plot(x,y0,"Y+");
+

Note that solid line is used because I did not specify the type of line. The same picture can be achieved by plot and subdata functions. Let us draw ellipse by orange dash line: +

  gr->Plot(y1.SubData(-1,0),y1.SubData(-1,1),"q|");
+
+

Drawing in 3D space is mostly the same. Let us draw spiral with default line style. Now its color is 4-th color from palette (this is cyan): +

  gr->SubPlot(2,2,2);	gr->Rotate(60,40);
+  mglData z(50);  	z.Modify("2*x-1");
+  gr->Plot(x,y0,z);	gr->Box();
+

Functions plot and subdata make 3D curve plot but for single array. Use it to put circle marks on the previous plot: +

  mglData y2(10,3);	y2.Modify("cos(pi*(2*x-1+y))");
+  y2.Modify("2*x-1",2);
+  gr->Plot(y2.SubData(-1,0),y2.SubData(-1,1),y2.SubData(-1,2),"bo ");
+

Note that line style is empty ‘ ’ here. Usage of other 1D plotting functions looks similar: +

  gr->SubPlot(2,2,3);	gr->Rotate(60,40);
+  gr->Bars(x,y0,z,"r");	gr->Box();
+  return 0;
+}
+
+

Surfaces surf and other 2D plots (see 2D plotting) are drown the same simpler as 1D one. The difference is that the string parameter specifies not the line style but the color scheme of the plot (see Color scheme). Here I draw attention on 4 most interesting color schemes. There is gray scheme where color is changed from black to white (string ‘kw’) or from white to black (string ‘wk’). Another scheme is useful for accentuation of negative (by blue color) and positive (by red color) regions on plot (string ‘"BbwrR"’). Last one is the popular “jet” scheme (string ‘"BbcyrR"’). +

+

Now I shall show the example of a surface drawing. At first let us switch lightning on +

int sample(mglGraph *gr)
+{
+  gr->Light(true);	gr->Light(0,mglPoint(0,0,1));
+

and draw the surface, considering coordinates x,y to be uniformly distributed in axis range +

  mglData a0(50,40);
+  a0.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))");
+  gr->SubPlot(2,2,0);	gr->Rotate(60,40);
+  gr->Surf(a0);		gr->Box();
+

Color scheme was not specified. So previous color scheme is used. In this case it is default color scheme (“jet”) for the first plot. Next example is a sphere. The sphere is parametrically specified surface: +

  mglData x(50,40),y(50,40),z(50,40);
+  x.Modify("0.8*sin(2*pi*x)*sin(pi*y)");
+  y.Modify("0.8*cos(2*pi*x)*sin(pi*y)");
+  z.Modify("0.8*cos(pi*y)");
+  gr->SubPlot(2,2,1);	gr->Rotate(60,40);
+  gr->Surf(x,y,z,"BbwrR");gr->Box();
+

I set color scheme to "BbwrR" that corresponds to red top and blue bottom of the sphere. +

+

Surfaces will be plotted for each of slice of the data if nz>1. Next example draws surfaces for data arrays with nz=3: +

  mglData a1(50,40,3);
+  a1.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))");
+  a1.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*sin(3*pi*(x*y))",1);
+  a1.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))",2);
+  gr->SubPlot(2,2,2);	gr->Rotate(60,40);
+  gr->Alpha(true);
+  gr->Surf(a1);		gr->Box();
+

Note, that it may entail a confusion. However, if one will use density plot then the picture will look better: +

  gr->SubPlot(2,2,3);	gr->Rotate(60,40);
+  gr->Dens(a1);		gr->Box();
+  return 0;
+}
+
+

Drawing of other 2D plots is analogous. The only peculiarity is the usage of flag ‘#’. By default this flag switches on the drawing of a grid on plot (grid or mesh for plots in plain or in volume). However, for isosurfaces (including surfaces of rotation axial) this flag switches the face drawing off. Figure becomes wired. The following code gives example of flag ‘#’ using (compare with normal function drawing as in its description): +

int sample(mglGraph *gr)
+{
+  gr->Alpha(true);	gr->Light(true);	gr->Light(0,mglPoint(0,0,1));
+  mglData a(30,20);
+  a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))");
+
+  gr->SubPlot(2,2,0);	gr->Rotate(40,60);
+  gr->Surf(a,"BbcyrR#");		gr->Box();
+  gr->SubPlot(2,2,1);	gr->Rotate(40,60);
+  gr->Dens(a,"BbcyrR#");		gr->Box();
+  gr->SubPlot(2,2,2);	gr->Rotate(40,60);
+  gr->Cont(a,"BbcyrR#");		gr->Box();
+  gr->SubPlot(2,2,3);	gr->Rotate(40,60);
+  gr->Axial(a,"BbcyrR#");		gr->Box();
+  return 0;
+}
+
+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

2.5 Hints

+ + +

In this section I’ve included some small hints and advices for the improving of the quality of plots and for the demonstration of some non-trivial features of MathGL library. In contrast to previous examples I showed mostly the idea but not the whole drawing function. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

2.5.1 “Compound” graphics

+ + +

As I noted above, MathGL functions (except the special one, like Clf()) do not erase the previous plotting but just add the new one. It allows one to draw “compound” plots easily. For example, popular Matlab command surfc can be emulated in MathGL by 2 calls: +

  Surf(a);
+  Cont(a, "_");     // draw contours at bottom
+

Here a is 2-dimensional data for the plotting, -1 is the value of z-coordinate at which the contour should be plotted (at the bottom in this example). Analogously, one can draw density plot instead of contour lines and so on. +

+

Another nice plot is contour lines plotted directly on the surface: +

  Light(true);       // switch on light for the surface
+  Surf(a, "BbcyrR"); // select 'jet' colormap for the surface
+  Cont(a, "y");      // and yellow color for contours
+

The possible difficulties arise in black&white case, when the color of the surface can be close to the color of a contour line. In that case I may suggest the following code: +

  Light(true);   // switch on light for the surface
+  Surf(a, "kw"); // select 'gray' colormap for the surface
+  CAxis(-1,0);   // first draw for darker surface colors
+  Cont(a, "w");  // white contours
+  CAxis(0,1);    // now draw for brighter surface colors
+  Cont(a, "k");  // black contours
+  CAxis(-1,1);   // return color range to original state
+

The idea is to divide the color range on 2 parts (dark and bright) and to select the contrasting color for contour lines for each of part. +

+

Similarly, one can plot flow thread over density plot of vector field amplitude (this is another amusing plot from Matlab) and so on. The list of compound graphics can be prolonged but I hope that the general idea is clear. +

+

Just for illustration I put here following sample code: +

int sample(mglGraph *gr)
+{
+  mglData a,b,d;  mgls_prepare2v(&a,&b);  d = a;
+  for(int i=0;i<a.nx*a.ny;i++)  d.a[i] = hypot(a.a[i],b.a[i]);
+  mglData c;  mgls_prepare3d(&c);
+  mglData v(10);  v.Fill(-0.5,1);
+
+  gr->SubPlot(2,2,1,"");  gr->Title("Flow + Dens");
+  gr->Flow(a,b,"br"); gr->Dens(d,"BbcyrR"); gr->Box();
+
+  gr->SubPlot(2,2,0); gr->Title("Surf + Cont"); gr->Rotate(50,60);
+  gr->Light(true);  gr->Surf(a);  gr->Cont(a,"y");  gr->Box();
+
+  gr->SubPlot(2,2,2); gr->Title("Mesh + Cont"); gr->Rotate(50,60);
+  gr->Box();  gr->Mesh(a);  gr->Cont(a,"_");
+
+  gr->SubPlot(2,2,3); gr->Title("Surf3 + ContF3");gr->Rotate(50,60);
+  gr->Box();  gr->ContF3(v,c,"z",0);  gr->ContF3(v,c,"x");  gr->ContF3(v,c);
+  gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+  gr->ContF3(v,c,"z",c.nz-1); gr->Surf3(-0.5,c);
+  return 0;
+}
+
+
Example of “combined” plots +
+ +
+ + + +

2.5.2 Transparency and lighting

+ + +

Here I want to show how transparency and lighting both and separately change the look of a surface. So, there is code and picture for that: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->SubPlot(2,2,0); gr->Title("default"); gr->Rotate(50,60);
+  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,1); gr->Title("light on");  gr->Rotate(50,60);
+  gr->Box();  gr->Light(true);  gr->Surf(a);
+
+  gr->SubPlot(2,2,3); gr->Title("alpha on; light on");  gr->Rotate(50,60);
+  gr->Box();  gr->Alpha(true);  gr->Surf(a);
+
+  gr->SubPlot(2,2,2); gr->Title("alpha on");  gr->Rotate(50,60);
+  gr->Box();  gr->Light(false); gr->Surf(a);
+  return 0;
+}
+
+
Example of transparency and lightings +
+ +
+ + + +

2.5.3 Types of transparency

+ + +

MathGL library has advanced features for setting and handling the surface transparency. The simplest way to add transparency is the using of function alpha. As a result, all further surfaces (and isosurfaces, density plots and so on) become transparent. However, their look can be additionally improved. +

+

The value of transparency can be different from surface to surface. To do it just use SetAlphaDef before the drawing of the surface, or use option alpha (see Command options). If its value is close to 0 then the surface becomes more and more transparent. Contrary, if its value is close to 1 then the surface becomes practically non-transparent. +

+

Also you can change the way how the light goes through overlapped surfaces. The function SetTranspType defines it. By default the usual transparency is used (‘0’) – surfaces below is less visible than the upper ones. A “glass-like” transparency (‘1’) has a different look – each surface just decreases the background light (the surfaces are commutable in this case). +

+

A “neon-like” transparency (‘2’) has more interesting look. In this case a surface is the light source (like a lamp on the dark background) and just adds some intensity to the color. At this, the library sets automatically the black color for the background and changes the default line color to white. +

+

As example I shall show several plots for different types of transparency. The code is the same except the values of SetTranspType function: +

int sample(mglGraph *gr)
+{
+  gr->Alpha(true);  gr->Light(true);
+  mglData a;  mgls_prepare2d(&a);
+  gr->SetTranspType(0); gr->Clf();
+  gr->SubPlot(2,2,0); gr->Rotate(50,60);  gr->Surf(a);  gr->Box();
+  gr->SubPlot(2,2,1); gr->Rotate(50,60);  gr->Dens(a);  gr->Box();
+  gr->SubPlot(2,2,2); gr->Rotate(50,60);  gr->Cont(a);  gr->Box();
+  gr->SubPlot(2,2,3); gr->Rotate(50,60);  gr->Axial(a); gr->Box();
+  return 0;
+}
+
+
Example of SetTranspType(0). +
Example of SetTranspType(1). +
Example of SetTranspType(2). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.4 Axis projection

+ + +

You can easily make 3D plot and draw its x-,y-,z-projections (like in CAD) by using ternary function with arguments: 4 for Cartesian, 5 for Ternary and 6 for Quaternary coordinates. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(0,1,0,1,0,1);
+  mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+  a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+  x.Modify("0.25*(1+cos(2*pi*x))");
+  y.Modify("0.25*(1+sin(2*pi*x))");
+  rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+  z.Modify("x");
+
+  gr->Title("Projection sample");
+  gr->Ternary(4);
+  gr->Rotate(50,60);      gr->Light(true);
+  gr->Plot(x,y,z,"r2");   gr->Surf(a,"#");
+  gr->Axis(); gr->Grid(); gr->Box();
+  gr->Label('x',"X",1);   gr->Label('y',"Y",1);   gr->Label('z',"Z",1);
+}
+
+
Example of axis projections +
Example of ternary axis projections +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.5 Adding fog

+ + +

MathGL can add a fog to the image. Its switching on is rather simple – just use fog function. There is the only feature – fog is applied for whole image. Not to particular subplot. The sample code is: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->Title("Fog sample");
+  gr->Light(true);  gr->Rotate(50,60);  gr->Fog(1); gr->Box();
+  gr->Surf(a);  gr->Cont(a,"y");
+  return 0;
+}
+
+
Example of Fog(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.6 Lighting sample

+ + +

In contrast to the most of other programs, MathGL supports several (up to 10) light sources. Moreover, the color each of them can be different: white (this is usual), yellow, red, cyan, green and so on. The use of several light sources may be interesting for the highlighting of some peculiarities of the plot or just to make an amusing picture. Note, each light source can be switched on/off individually. The sample code is: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->Title("Several light sources");
+  gr->Rotate(50,60);  gr->Light(true);
+  gr->AddLight(1,mglPoint(0,1,0),'c');
+  gr->AddLight(2,mglPoint(1,0,0),'y');
+  gr->AddLight(3,mglPoint(0,-1,0),'m');
+  gr->Box();  gr->Surf(a,"h");
+  return 0;
+}
+
+
Example of several light sources. +
+

Additionally, you can use local light sources and set to use diffuse reflection instead of specular one (by default) or both kinds. Note, I use attachlight command to keep light settings relative to subplot. +

int sample(mglGraph *gr)
+{
+  gr->Light(true);  gr->AttachLight(true);
+  gr->SubPlot(2,2,0); gr->Title("Default"); gr->Rotate(50,60);
+  gr->Line(mglPoint(-1,-0.7,1.7),mglPoint(-1,-0.7,0.7),"BA"); gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,1); gr->Title("Local");   gr->Rotate(50,60);
+  gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1));
+  gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,2); gr->Title("no diffuse"); gr->Rotate(50,60);
+  gr->SetDiffuse(0);
+  gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,2,3); gr->Title("diffusive only");  gr->Rotate(50,60);
+  gr->SetDiffuse(0.5);
+  gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1),'w',0);
+  gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");  gr->Box();  gr->Surf(a);
+}
+
+
Example of different types of lighting. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.7 Using primitives

+ + +

MathGL provide a set of functions for drawing primitives (see Primitives). Primitives are low level object, which used by most of plotting functions. Picture below demonstrate some of commonly used primitives. +

+
Primitives in MathGL. +
+

Generally, you can create arbitrary new kind of plot using primitives. For example, MathGL don’t provide any special functions for drawing molecules. However, you can do it using only one type of primitives drop. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->Alpha(true);  gr->Light(true);
+
+  gr->SubPlot(2,2,0,"");  gr->Title("Methane, CH_4");
+  gr->StartGroup("Methane");
+  gr->Rotate(60,120);
+  gr->Sphere(mglPoint(0,0,0),0.25,"k");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0,0,1),0.35,"h",1,2);
+  gr->Sphere(mglPoint(0,0,0.7),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(-0.94,0,-0.33),0.35,"h",1,2);
+  gr->Sphere(mglPoint(-0.66,0,-0.23),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.47,0.82,-0.33),0.35,"h",1,2);
+  gr->Sphere(mglPoint(0.33,0.57,-0.23),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.47,-0.82,-0.33),0.35,"h",1,2);
+  gr->Sphere(mglPoint(0.33,-0.57,-0.23),0.25,"g");
+  gr->EndGroup();
+
+  gr->SubPlot(2,2,1,"");  gr->Title("Water, H_{2}O");
+  gr->StartGroup("Water");
+  gr->Rotate(60,100);
+  gr->StartGroup("Water_O");
+  gr->Sphere(mglPoint(0,0,0),0.25,"r");
+  gr->EndGroup();
+  gr->StartGroup("Water_Bond_1");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.3,0.5,0),0.3,"m",1,2);
+  gr->EndGroup();
+  gr->StartGroup("Water_H_1");
+  gr->Sphere(mglPoint(0.3,0.5,0),0.25,"g");
+  gr->EndGroup();
+  gr->StartGroup("Water_Bond_2");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.3,-0.5,0),0.3,"m",1,2);
+  gr->EndGroup();
+  gr->StartGroup("Water_H_2");
+  gr->Sphere(mglPoint(0.3,-0.5,0),0.25,"g");
+  gr->EndGroup();
+  gr->EndGroup();
+
+  gr->SubPlot(2,2,2,"");  gr->Title("Oxygen, O_2");
+  gr->StartGroup("Oxygen");
+  gr->Rotate(60,120);
+  gr->Drop(mglPoint(0,0.5,0),mglPoint(0,-0.3,0),0.3,"m",1,2);
+  gr->Sphere(mglPoint(0,0.5,0),0.25,"r");
+  gr->Drop(mglPoint(0,-0.5,0),mglPoint(0,0.3,0),0.3,"m",1,2);
+  gr->Sphere(mglPoint(0,-0.5,0),0.25,"r");
+  gr->EndGroup();
+
+  gr->SubPlot(2,2,3,"");  gr->Title("Ammonia, NH_3");
+  gr->StartGroup("Ammonia");
+  gr->Rotate(60,120);
+  gr->Sphere(mglPoint(0,0,0),0.25,"b");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.33,0.57,0),0.32,"n",1,2);
+  gr->Sphere(mglPoint(0.33,0.57,0),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(0.33,-0.57,0),0.32,"n",1,2);
+  gr->Sphere(mglPoint(0.33,-0.57,0),0.25,"g");
+  gr->Drop(mglPoint(0,0,0),mglPoint(-0.65,0,0),0.32,"n",1,2);
+  gr->Sphere(mglPoint(-0.65,0,0),0.25,"g");
+  gr->EndGroup();
+  return 0;
+}
+
+
Example of molecules drawing. +
+

Moreover, some of special plots can be more easily produced by primitives rather than by specialized function. For example, Venn diagram can be produced by Error plot: +

int sample(mglGraph *gr)
+{
+  double xx[3]={-0.3,0,0.3}, yy[3]={0.3,-0.3,0.3}, ee[3]={0.7,0.7,0.7};
+  mglData x(3,xx), y(3,yy), e(3,ee);
+  gr->Title("Venn-like diagram"); gr->Alpha(true);
+  gr->Error(x,y,e,e,"!rgb@#o");
+  return 0;
+}
+

You see that you have to specify and fill 3 data arrays. The same picture can be produced by just 3 calls of circle function: +

int sample(mglGraph *gr)
+{
+  gr->Title("Venn-like diagram"); gr->Alpha(true);
+  gr->Circle(mglPoint(-0.3,0.3),0.7,"rr@");
+  gr->Circle(mglPoint(0,-0.3),0.7,"gg@");
+  gr->Circle(mglPoint( 0.3,0.3),0.7,"bb@");
+  return 0;
+}
+

Of course, the first variant is more suitable if you need to plot a lot of circles. But for few ones the usage of primitives looks easy. +

+
Example of Venn diagram. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.8 STFA sample

+ + +

Short-time Fourier Analysis (stfa) is one of informative method for analyzing long rapidly oscillating 1D data arrays. It is used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. +

+

MathGL can find and draw STFA result. Just to show this feature I give following sample. Initial data arrays is 1D arrays with step-like frequency. Exactly this you can see at bottom on the STFA plot. The sample code is: +

int sample(mglGraph *gr)
+{
+  mglData a(2000), b(2000);
+  gr->Fill(a,"cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+  cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)");
+  gr->SubPlot(1, 2, 0,"<_");  gr->Title("Initial signal");
+  gr->Plot(a);
+  gr->Axis();
+  gr->Label('x', "\\i t");
+
+  gr->SubPlot(1, 2, 1,"<_");  gr->Title("STFA plot");
+  gr->STFA(a, b, 64);
+  gr->Axis();
+  gr->Label('x', "\\i t");
+  gr->Label('y', "\\omega", 0);
+  return 0;
+}
+
+
Example of STFA(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.9 Mapping visualization

+ + +

Sometime ago I worked with mapping and have a question about its visualization. Let me remember you that mapping is some transformation rule for one set of number to another one. The 1d mapping is just an ordinary function – it takes a number and transforms it to another one. The 2d mapping (which I used) is a pair of functions which take 2 numbers and transform them to another 2 ones. Except general plots (like surfc, surfa) there is a special plot – Arnold diagram. It shows the area which is the result of mapping of some initial area (usually square). +

+

I tried to make such plot in map. It shows the set of points or set of faces, which final position is the result of mapping. At this, the color gives information about their initial position and the height describes Jacobian value of the transformation. Unfortunately, it looks good only for the simplest mapping but for the real multivalent quasi-chaotic mapping it produces a confusion. So, use it if you like :). +

+

The sample code for mapping visualization is: +

int sample(mglGraph *gr)
+{
+  mglData a(50, 40), b(50, 40);
+  gr->Puts(mglPoint(0, 0), "\\to", ":C", -1.4);
+  gr->SetRanges(-1,1,-1,1,-2,2);
+
+  gr->SubPlot(2, 1, 0);
+  gr->Fill(a,"x");  gr->Fill(b,"y");
+  gr->Puts(mglPoint(0, 1.1), "\\{x, y\\}", ":C", -2);   gr->Box();
+  gr->Map(a, b, "brgk");
+
+  gr->SubPlot(2, 1, 1);
+  gr->Fill(a,"(x^3+y^3)/2");  gr->Fill(b,"(x-y)/2");
+  gr->Puts(mglPoint(0, 1.1), "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", ":C", -2);
+  gr->Box();
+  gr->Map(a, b, "brgk");
+  return 0;
+}
+
+
Example of Map(). +
+ +
+ + + +

2.5.10 Data interpolation

+ + +

There are many functions to get interpolated values of a data array. Basically all of them can be divided by 3 categories: +

    +
  1. functions which return single value at given point (see Interpolation and mglGSpline() in Global functions); +
  2. functions subdata and evaluate for indirect access to data elements; +
  3. functions refill, gspline and datagrid which fill regular (rectangular) data array by interpolated values. +
+ +

The usage of first category is rather straightforward and don’t need any special comments. +

+

There is difference in indirect access functions. Function subdata use use step-like interpolation to handle correctly single nan values in the data array. Contrary, function evaluate use local spline interpolation, which give smoother output but spread nan values. So, subdata should be used for specific data elements (for example, for given column), and evaluate should be used for distributed elements (i.e. consider data array as some field). Following sample illustrates this difference: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(1,1,0,"");  gr->Title("SubData vs Evaluate");
+  mglData in(9), arg(99), e, s;
+  gr->Fill(in,"x^3/1.1"); gr->Fill(arg,"4*x+4");
+  gr->Plot(in,"ko ");     gr->Box();
+  e = in.Evaluate(arg,false); gr->Plot(e,"b.","legend 'Evaluate'");
+  s = in.SubData(arg);    gr->Plot(s,"r.","legend 'SubData'");
+  gr->Legend(2);
+}
+
+
Example of indirect data access. +
+

Example of datagrid usage is done in Making regular data. Here I want to show the peculiarities of refill and gspline functions. Both functions require argument(s) which provide coordinates of the data values, and return rectangular data array which equidistantly distributed in axis range. So, in opposite to evaluate function, refill and gspline can interpolate non-equidistantly distributed data. At this both functions refill and gspline provide continuity of 2nd derivatives along coordinate(s). However, refill is slower but give better (from human point of view) result than global spline gspline due to more advanced algorithm. Following sample illustrates this difference: +

int sample(mglGraph *gr)
+{
+  mglData x(10), y(10), r(100);
+  x.Modify("0.5+rnd");  x.CumSum("x");  x.Norm(-1,1);
+  y.Modify("sin(pi*v)/1.5",x);
+  gr->SubPlot(2,2,0,"<_");  gr->Title("Refill sample");
+  gr->Axis();  gr->Box(); gr->Plot(x,y,"o ");
+  gr->Refill(r,x,y);  // or you can use r.Refill(x,y,-1,1);
+  gr->Plot(r,"r");  gr->FPlot("sin(pi*x)/1.5","B:");
+  gr->SubPlot(2,2,1,"<_");gr->Title("Global spline");
+  gr->Axis();  gr->Box(); gr->Plot(x,y,"o ");
+  r.RefillGS(x,y,-1,1);   gr->Plot(r,"r");
+  gr->FPlot("sin(pi*x)/1.5","B:");
+
+  gr->Alpha(true);  gr->Light(true);
+  mglData z(10,10), xx(10,10), yy(10,10), rr(100,100);
+  y.Modify("0.5+rnd");  y.CumSum("x");  y.Norm(-1,1);
+  for(int i=0;i<10;i++) for(int j=0;j<10;j++)
+    z.a[i+10*j] = sin(M_PI*x.a[i]*y.a[j])/1.5;
+  gr->SubPlot(2,2,2); gr->Title("2d regular");  gr->Rotate(40,60);
+  gr->Axis();  gr->Box(); gr->Mesh(x,y,z,"k");
+  gr->Refill(rr,x,y,z); gr->Surf(rr);
+
+  gr->Fill(xx,"(x+1)/2*cos(y*pi/2-1)");
+  gr->Fill(yy,"(x+1)/2*sin(y*pi/2-1)");
+  for(int i=0;i<10*10;i++)
+    z.a[i] = sin(M_PI*xx.a[i]*yy.a[i])/1.5;
+  gr->SubPlot(2,2,3); gr->Title("2d non-regular");  gr->Rotate(40,60);
+  gr->Axis();  gr->Box();  gr->Plot(xx,yy,z,"ko ");
+  gr->Refill(rr,xx,yy,z);  gr->Surf(rr);
+}
+
+
Example of non-equidistant data interpolation. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.11 Making regular data

+ + +

Sometimes, one have only unregular data, like as data on triangular grids, or experimental results and so on. Such kind of data cannot be used as simple as regular data (like matrices). Only few functions, like dots, can handle unregular data as is. +

+

However, one can use built in triangulation functions for interpolating unregular data points to a regular data grids. There are 2 ways. First way, one can use triangulation function to obtain list of vertexes for triangles. Later this list can be used in functions like triplot or tricont. Second way consist in usage of datagrid function, which fill regular data grid by interpolated values, assuming that coordinates of the data grid is equidistantly distributed in axis range. Note, you can use options (see Command options) to change default axis range as well as in other plotting functions. +

int sample(mglGraph *gr)
+{
+  mglData x(100), y(100), z(100);
+  gr->Fill(x,"2*rnd-1"); gr->Fill(y,"2*rnd-1"); gr->Fill(z,"v^2-w^2",x,y);
+  // first way - plot triangular surface for points
+  mglData d = mglTriangulation(x,y);
+  gr->Title("Triangulation");
+  gr->Rotate(40,60);	gr->Box();	gr->Light(true);
+  gr->TriPlot(d,x,y,z);	gr->TriPlot(d,x,y,z,"#k");
+  // second way - make regular data and plot it
+  mglData g(30,30);
+  gr->DataGrid(g,x,y,z);	gr->Mesh(g,"m");
+}
+
+
Example of triangulation. +
+ +
+ + + +

2.5.12 Making histogram

+ + +

Using the hist function(s) for making regular distributions is one of useful fast methods to process and plot irregular data. Hist can be used to find some momentum of set of points by specifying weight function. It is possible to create not only 1D distributions but also 2D and 3D ones. Below I place the simplest sample code which demonstrate hist usage: +

int sample(mglGraph *gr)
+{
+  mglData x(10000), y(10000), z(10000);  gr->Fill(x,"2*rnd-1");
+  gr->Fill(y,"2*rnd-1"); gr->Fill(z,"exp(-6*(v^2+w^2))",x,y);
+  mglData xx=gr->Hist(x,z), yy=gr->Hist(y,z);	xx.Norm(0,1);
+  yy.Norm(0,1);
+  gr->MultiPlot(3,3,3,2,2,"");   gr->SetRanges(-1,1,-1,1,0,1);
+  gr->Box();  gr->Dots(x,y,z,"wyrRk");
+  gr->MultiPlot(3,3,0,2,1,"");   gr->SetRanges(-1,1,0,1);
+  gr->Box();  gr->Bars(xx);
+  gr->MultiPlot(3,3,5,1,2,"");   gr->SetRanges(0,1,-1,1);
+  gr->Box();  gr->Barh(yy);
+  gr->SubPlot(3,3,2);
+  gr->Puts(mglPoint(0.5,0.5),"Hist and\nMultiPlot\nsample","a",-6);
+  return 0;
+}
+
+
Example of Hist(). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.13 Nonlinear fitting hints

+ + +

Nonlinear fitting is rather simple. All that you need is the data to fit, the approximation formula and the list of coefficients to fit (better with its initial guess values). Let me demonstrate it on the following simple example. First, let us use sin function with some random noise: +

  mglData dat(100), in(100); //data to be fitted and ideal data
+  gr->Fill(dat,"0.4*rnd+0.1+sin(2*pi*x)");
+  gr->Fill(in,"0.3+sin(2*pi*x)");
+

and plot it to see that data we will fit +

  gr->Title("Fitting sample");
+  gr->SetRange('y',-2,2); gr->Box();  gr->Plot(dat, "k. ");
+  gr->Axis(); gr->Plot(in, "b");
+  gr->Puts(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "b");
+
+

The next step is the fitting itself. For that let me specify an initial values ini for coefficients ‘abc’ and do the fitting for approximation formula ‘a+b*sin(c*x)’ +

  mreal ini[3] = {1,1,3};
+  mglData Ini(3,ini);
+  mglData res = gr->Fit(dat, "a+b*sin(c*x)", "abc", Ini);
+

Now display it +

  gr->Plot(res, "r");
+  gr->Puts(mglPoint(-0.9, -1.3), "fitted:", "r:L");
+  gr->PutsFit(mglPoint(0, -1.8), "y = ", "r");
+
+

NOTE! the fitting results may have strong dependence on initial values for coefficients due to algorithm features. The problem is that in general case there are several local "optimums" for coefficients and the program returns only first found one! There are no guaranties that it will be the best. Try for example to set ini[3] = {0, 0, 0} in the code above. +

+

The full sample code for nonlinear fitting is: +

int sample(mglGraph *gr)
+{
+  mglData dat(100), in(100);
+  gr->Fill(dat,"0.4*rnd+0.1+sin(2*pi*x)");
+  gr->Fill(in,"0.3+sin(2*pi*x)");
+  mreal ini[3] = {1,1,3};
+  mglData Ini(3,ini);
+
+  mglData res = gr->Fit(dat, "a+b*sin(c*x)", "abc", Ini);
+
+  gr->Title("Fitting sample");
+  gr->SetRange('y',-2,2); gr->Box();  gr->Plot(dat, "k. ");
+  gr->Axis();   gr->Plot(res, "r"); gr->Plot(in, "b");
+  gr->Puts(mglPoint(-0.9, -1.3), "fitted:", "r:L");
+  gr->PutsFit(mglPoint(0, -1.8), "y = ", "r");
+  gr->Puts(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "b");
+  return 0;
+}
+
+
Example of nonlinear fitting. +
+ +
+ + + +

2.5.14 PDE solving hints

+ + +

Solving of Partial Differential Equations (PDE, including beam tracing) and ray tracing (or finding particle trajectory) are more or less common task. So, MathGL have several functions for that. There are ray for ray tracing, pde for PDE solving, qo2d for beam tracing in 2D case (see Global functions). Note, that these functions take “Hamiltonian” or equations as string values. And I don’t plan now to allow one to use user-defined functions. There are 2 reasons: the complexity of corresponding interface; and the basic nature of used methods which are good for samples but may not good for serious scientific calculations. +

+

The ray tracing can be done by ray function. Really ray tracing equation is Hamiltonian equation for 3D space. So, the function can be also used for finding a particle trajectory (i.e. solve Hamiltonian ODE) for 1D, 2D or 3D cases. The function have a set of arguments. First of all, it is Hamiltonian which defined the media (or the equation) you are planning to use. The Hamiltonian is defined by string which may depend on coordinates ‘x’, ‘y’, ‘z’, time ‘t’ (for particle dynamics) and momentums ‘p’=p_x, ‘q’=p_y, ‘v’=p_z. Next, you have to define the initial conditions for coordinates and momentums at ‘t’=0 and set the integrations step (default is 0.1) and its duration (default is 10). The Runge-Kutta method of 4-th order is used for integration. +

  const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+  mglData r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+

This example calculate the reflection from linear layer (media with Hamiltonian ‘p^2+q^2-x-1’=p_x^2+p_y^2-x-1). This is parabolic curve. The resulting array have 7 columns which contain data for {x,y,z,p,q,v,t}. +

+

The solution of PDE is a bit more complicated. As previous you have to specify the equation as pseudo-differential operator \hat H(x, \nabla) which is called sometime as “Hamiltonian” (for example, in beam tracing). As previously, it is defined by string which may depend on coordinates ‘x’, ‘y’, ‘z’ (but not time!), momentums ‘p’=(d/dx)/i k_0, ‘q’=(d/dy)/i k_0 and field amplitude ‘u’=|u|. The evolutionary coordinate is ‘z’ in all cases. So that, the equation look like du/dz = ik_0 H(x,y,\hat p, \hat q, |u|)[u]. Dependence on field amplitude ‘u’=|u| allows one to solve nonlinear problems too. For example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". Also you may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)" or ham = "p^2 + i1*x*(x>0)". +

+

Next step is specifying the initial conditions at ‘z’ equal to minimal z-axis value. The function need 2 arrays for real and for imaginary part. Note, that coordinates x,y,z are supposed to be in specified axis range. So, the data arrays should have corresponding scales. Finally, you may set the integration step and parameter k0=k_0. Also keep in mind, that internally the 2 times large box is used (for suppressing numerical reflection from boundaries) and the equation should well defined even in this extended range. +

+

Final comment is concerning the possible form of pseudo-differential operator H. At this moment, simplified form of operator H is supported – all “mixed” terms (like ‘x*p’->x*d/dx) are excluded. For example, in 2D case this operator is effectively H = f(p,z) + g(x,z,u). However commutable combinations (like ‘x*q’->x*d/dy) are allowed for 3D case. +

+

So, for example let solve the equation for beam deflected from linear layer and absorbed later. The operator will have the form ‘"p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)"’ that correspond to equation 1/ik_0 * du/dz + d^2 u/dx^2 + d^2 u/dy^2 + x * u + i (x+z)/2 * u = 0. This is typical equation for Electron Cyclotron (EC) absorption in magnetized plasmas. For initial conditions let me select the beam with plane phase front exp(-48*(x+0.7)^2). The corresponding code looks like this: +

int sample(mglGraph *gr)
+{
+  mglData a,re(128),im(128);
+  gr->Fill(re,"exp(-48*(x+0.7)^2)");
+  a = gr->PDE("p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, 0.01, 30);
+  a.Transpose("yxz");
+  gr->SubPlot(1,1,0,"<_"); gr->Title("PDE solver");
+  gr->SetRange('c',0,1);  gr->Dens(a,"wyrRk");
+  gr->Axis(); gr->Label('x', "\\i x");  gr->Label('y', "\\i z");
+  gr->FPlot("-x", "k|");
+  gr->Puts(mglPoint(0, 0.85), "absorption: (x+z)/2 for x+z>0");
+  gr->Puts(mglPoint(0,1.1),"Equation: ik_0\\partial_zu + \\Delta u + x\\cdot u + i \\frac{x+z}{2}\\cdot u = 0");
+  return 0;
+}
+
+
Example of PDE solving. +
+

The next example is example of beam tracing. Beam tracing equation is special kind of PDE equation written in coordinates accompanied to a ray. Generally this is the same parameters and limitation as for PDE solving but the coordinates are defined by the ray and by parameter of grid width w in direction transverse the ray. So, you don’t need to specify the range of coordinates. BUT there is limitation. The accompanied coordinates are well defined only for smooth enough rays, i.e. then the ray curvature K (which is defined as 1/K^2 = (|r''|^2 |r'|^2 - (r'', r'')^2)/|r'|^6) is much large then the grid width: K>>w. So, you may receive incorrect results if this condition will be broken. +

+

You may use following code for obtaining the same solution as in previous example: +

int sample(mglGraph *gr)
+{
+  mglData r, xx, yy, a, im(128), re(128);
+  const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+  r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+  gr->SubPlot(1,1,0,"<_"); gr->Title("Beam and ray tracing");
+  gr->Plot(r.SubData(0), r.SubData(1), "k");
+  gr->Axis(); gr->Label('x', "\\i x");  gr->Label('y', "\\i z");
+
+  // now start beam tracing
+  gr->Fill(re,"exp(-48*x^2)");
+  a = mglQO2d(ham, re, im, r, xx, yy, 1, 30);
+  gr->SetRange('c',0, 1);
+  gr->Dens(xx, yy, a, "wyrRk");
+  gr->FPlot("-x", "k|");
+  gr->Puts(mglPoint(0, 0.85), "absorption: (x+y)/2 for x+y>0");
+  gr->Puts(mglPoint(0.7, -0.05), "central ray");
+  return 0;
+}
+
+
Example of beam tracing. +
+

Note, the pde is fast enough and suitable for many cases routine. However, there is situations then media have both together: strong spatial dispersion and spatial inhomogeneity. In this, case the pde will produce incorrect result and you need to use advanced PDE solver apde. For example, a wave beam, propagated in plasma, described by Hamiltonian exp(-x^2-p^2), will have different solution for using of simplification and advanced PDE solver: +

int sample(mglGraph *gr)
+{
+  gr->SetRanges(-1,1,0,2,0,2);
+  mglData ar(256), ai(256);	gr->Fill(ar,"exp(-2*x^2)");
+
+  mglData res1(gr->APDE("exp(-x^2-p^2)",ar,ai,0.01));	res1.Transpose();
+  gr->SubPlot(1,2,0,"_");	gr->Title("Advanced PDE solver");
+  gr->SetRanges(0,2,-1,1);	gr->SetRange('c',res1);
+  gr->Dens(res1);	gr->Axis();	gr->Box();
+  gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+  gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u = exp(-\\i x^2+\\partial_x^2)[\\i u]","y");
+
+  mglData res2(gr->PDE("exp(-x^2-p^2)",ar,ai,0.01));
+  gr->SubPlot(1,2,1,"_");	gr->Title("Simplified PDE solver");
+  gr->Dens(res2);	gr->Axis();	gr->Box();
+  gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+  gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u \\approx\\ exp(-\\i x^2)\\i u+exp(\\partial_x^2)[\\i u]","y");
+  return 0;
+}
+
+
Comparison of simplified and advanced PDE solvers. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.15 Drawing phase plain

+ + +

Here I want say a few words of plotting phase plains. Phase plain is name for system of coordinates x, x', i.e. a variable and its time derivative. Plot in phase plain is very useful for qualitative analysis of an ODE, because such plot is rude (it topologically the same for a range of ODE parameters). Most often the phase plain {x, x'} is used (due to its simplicity), that allows to analyze up to the 2nd order ODE (i.e. x''+f(x,x')=0). +

+

The simplest way to draw phase plain in MathGL is using flow function(s), which automatically select several points and draw flow threads. If the ODE have an integral of motion (like Hamiltonian H(x,x')=const for dissipation-free case) then you can use cont function for plotting isolines (contours). In fact. isolines are the same as flow threads, but without arrows on it. Finally, you can directly solve ODE using ode function and plot its numerical solution. +

+

Let demonstrate this for ODE equation x''-x+3*x^2=0. This is nonlinear oscillator with square nonlinearity. It has integral H=y^2+2*x^3-x^2=Const. Also it have 2 typical stationary points: saddle at {x=0, y=0} and center at {x=1/3, y=0}. Motion at vicinity of center is just simple oscillations, and is stable to small variation of parameters. In opposite, motion around saddle point is non-stable to small variation of parameters, and is very slow. So, calculation around saddle points are more difficult, but more important. Saddle points are responsible for solitons, stochasticity and so on. +

+

So, let draw this phase plain by 3 different methods. First, draw isolines for H=y^2+2*x^3-x^2=Const – this is simplest for ODE without dissipation. Next, draw flow threads – this is straightforward way, but the automatic choice of starting points is not always optimal. Finally, use ode to check the above plots. At this we need to run ode in both direction of time (in future and in the past) to draw whole plain. Alternatively, one can put starting points far from (or at the bounding box as done in flow) the plot, but this is a more complicated. The sample code is: +

int sample(mglGraph *gr)
+{
+  gr->SubPlot(2,2,0,"<_");  gr->Title("Cont");  gr->Box();
+  gr->Axis();  gr->Label('x',"x");  gr->Label('y',"\\dot{x}");
+  mglData f(100,100);   gr->Fill(f,"y^2+2*x^3-x^2-0.5");
+  gr->Cont(f);
+  gr->SubPlot(2,2,1,"<_");  gr->Title("Flow");  gr->Box();
+  gr->Axis();  gr->Label('x',"x");  gr->Label('y',"\\dot{x}");
+  mglData fx(100,100), fy(100,100);
+  gr->Fill(fx,"x-3*x^2");  gr->Fill(fy,"y");
+  gr->Flow(fy,fx,"v","value 7");
+  gr->SubPlot(2,2,2,"<_");  gr->Title("ODE");   gr->Box();
+  gr->Axis();  gr->Label('x',"x");  gr->Label('y',"\\dot{x}");
+  for(double x=-1;x<1;x+=0.1)
+  {
+    mglData in(2), r;   in.a[0]=x;
+    r = mglODE("y;x-3*x^2","xy",in);
+    gr->Plot(r.SubData(0), r.SubData(1));
+    r = mglODE("-y;-x+3*x^2","xy",in);
+    gr->Plot(r.SubData(0), r.SubData(1));
+  }
+}
+
+
Example of ODE solving and phase plain drawing. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.16 Pulse properties

+ + +

There is common task in optics to determine properties of wave pulses or wave beams. MathGL provide special function pulse which return the pulse properties (maximal value, center of mass, width and so on). Its usage is rather simple. Here I just illustrate it on the example of Gaussian pulse, where all parameters are obvious. +

void sample(mglGraph *gr)
+{
+  gr->SubPlot(1,1,0,"<_");  gr->Title("Pulse sample");
+  // first prepare pulse itself
+  mglData a(100); gr->Fill(a,"exp(-6*x^2)");
+  // get pulse parameters
+  mglData b(a.Pulse('x'));
+  // positions and widths are normalized on the number of points. So, set proper axis scale.
+  gr->SetRanges(0, a.nx-1, 0, 1);
+  gr->Axis(); gr->Plot(a);  // draw pulse and axis
+  // now visualize found pulse properties
+  double m = b[0];  // maximal amplitude
+  // approximate position of maximum
+  gr->Line(mglPoint(b[1],0), mglPoint(b[1],m),"r=");
+  // width at half-maximum (so called FWHM)
+  gr->Line(mglPoint(b[1]-b[3]/2,0), mglPoint(b[1]-b[3]/2,m),"m|");
+  gr->Line(mglPoint(b[1]+b[3]/2,0), mglPoint(b[1]+b[3]/2,m),"m|");
+  gr->Line(mglPoint(0,m/2), mglPoint(a.nx-1,m/2),"h");
+  // parabolic approximation near maximum
+  char func[128];	sprintf(func,"%g*(1-((x-%g)/%g)^2)",b[0],b[1],b[2]);
+  gr->FPlot(func,"g");
+}
+
+
Example of determining of pulse properties. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.17 Using MGL parser

+ + +

Sometimes you may prefer to use MGL scripts in yours code. It is simpler (especially in comparison with C/Fortran interfaces) and provide faster way to plot the data with annotations, labels and so on. Class mglParse (see mglParse class parse MGL scripts in C++. It have also the corresponding interface for C/Fortran. +

+

The key function here is mglParse::Parse() (or mgl_parse() for C/Fortran) which execute one command per string. At this the detailed information about the possible errors or warnings is passed as function value. Or you may execute the whole script as long string with lines separated by ‘\n’. Functions mglParse::Execute() and mgl_parse_text() perform it. Also you may set the values of parameters ‘$0’...‘$9’ for the script by functions mglParse::AddParam() or mgl_add_param(), allow/disable picture resizing, check “once” status and so on. The usage is rather straight-forward. +

+

The only non-obvious thing is data transition between script and yours program. There are 2 stages: add or find variable; and set data to variable. In C++ you may use functions mglParse::AddVar() and mglParse::FindVar() which return pointer to mglData. In C/Fortran the corresponding functions are mgl_add_var(), mgl_find_var(). This data pointer is valid until next Parse() or Execute() call. Note, you must not delete or free the data obtained from these functions! +

+

So, some simple example at the end. Here I define a data array, create variable, put data into it and plot it. The C++ code looks like this: +

int sample(mglGraph *gr)
+{
+  gr->Title("MGL parser sample");
+  mreal a[100];   // let a_i = sin(4*pi*x), x=0...1
+  for(int i=0;i<100;i++)a[i]=sin(4*M_PI*i/99);
+  mglParse *parser = new mglParse;
+  mglData *d = parser->AddVar("dat");
+  d->Set(a,100); // set data to variable
+  parser->Execute(gr, "plot dat; xrange 0 1\nbox\naxis");
+  // you may break script at any line do something
+  // and continue after that
+  parser->Execute(gr, "xlabel 'x'\nylabel 'y'\nbox");
+  // also you may use cycles or conditions in script
+  parser->Execute(gr, "for $0 -1 1 0.1\nline 0 0 -1 $0 'r'\nnext");
+  delete parser;
+  return 0;
+}
+

The code in C/Fortran looks practically the same: +

int sample(HMGL gr)
+{
+  mgl_title(gr, "MGL parser sample", "", -2);
+  double a[100];   // let a_i = sin(4*pi*x), x=0...1
+  int i;
+  for(i=0;i<100;i++)  a[i]=sin(4*M_PI*i/99);
+  HMPR parser = mgl_create_parser();
+  HMDT d = mgl_parser_add_var(parser, "dat");
+  mgl_data_set_double(d,a,100,1,1);    // set data to variable
+  mgl_parse_text(gr, parser, "plot dat; xrange 0 1\nbox\naxis");
+  // you may break script at any line do something
+  // and continue after that
+  mgl_parse_text(gr, parser, "xlabel 'x'\nylabel 'y'");
+  // also you may use cycles or conditions in script
+  mgl_parse_text(gr, parser, "for $0 -1 1 0.1\nif $0<0\n"
+    "line 0 0 -1 $0 'r':else:line 0 0 -1 $0 'g'\n"
+    "endif\nnext");
+  mgl_write_png(gr, "test.png", "");  // don't forgot to save picture
+  return 0;
+}
+
+
Example of MGL script parsing. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.18 Using options

+ + +

Command options allow the easy setup of the selected plot by changing global settings only for this plot. Often, options are used for specifying the range of automatic variables (coordinates). However, options allows easily change plot transparency, numbers of line or faces to be drawn, or add legend entries. The sample function for options usage is: +

void template(mglGraph *gr)
+{
+  mglData a(31,41);
+  gr->Fill(a,"-pi*x*exp(-(y+1)^2-4*x^2)");
+
+  gr->SubPlot(2,2,0);	gr->Title("Options for coordinates");
+  gr->Alpha(true);	gr->Light(true);
+  gr->Rotate(40,60);    gr->Box();
+  gr->Surf(a,"r","yrange 0 1"); gr->Surf(a,"b","yrange 0 -1");
+  if(mini)	return;
+  gr->SubPlot(2,2,1);   gr->Title("Option 'meshnum'");
+  gr->Rotate(40,60);    gr->Box();
+  gr->Mesh(a,"r","yrange 0 1"); gr->Mesh(a,"b","yrange 0 -1; meshnum 5");
+  gr->SubPlot(2,2,2);   gr->Title("Option 'alpha'");
+  gr->Rotate(40,60);    gr->Box();
+  gr->Surf(a,"r","yrange 0 1; alpha 0.7");
+  gr->Surf(a,"b","yrange 0 -1; alpha 0.3");
+  gr->SubPlot(2,2,3,"<_");  gr->Title("Option 'legend'");
+  gr->FPlot("x^3","r","legend 'y = x^3'");
+  gr->FPlot("cos(pi*x)","b","legend 'y = cos \\pi x'");
+  gr->Box();    gr->Axis(); gr->Legend(2,"");
+}
+
+
Example of options usage. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.19 “Templates”

+ + +

As I have noted before, the change of settings will influence only for the further plotting commands. This allows one to create “template” function which will contain settings and primitive drawing for often used plots. Correspondingly one may call this template-function for drawing simplification. +

+

For example, let one has a set of points (experimental or numerical) and wants to compare it with theoretical law (for example, with exponent law \exp(-x/2), x \in [0, 20]). The template-function for this task is: +

void template(mglGraph *gr)
+{
+  mglData  law(100);      // create the law
+  law.Modify("exp(-10*x)");
+  gr->SetRanges(0,20, 0.0001,1);
+  gr->SetFunc(0,"lg(y)",0);
+  gr->Plot(law,"r2");
+  gr->Puts(mglPoint(10,0.2),"Theoretical law: e^x","r:L");
+  gr->Label('x',"x val."); gr->Label('y',"y val.");
+  gr->Axis(); gr->Grid("xy","g;"); gr->Box();
+}
+

At this, one will only write a few lines for data drawing: +

  template(gr);     // apply settings and default drawing from template
+  mglData dat("fname.dat"); // load the data
+  // and draw it (suppose that data file have 2 columns)
+  gr->Plot(dat.SubData(0),dat.SubData(1),"bx ");
+

A template-function can also contain settings for font, transparency, lightning, color scheme and so on. +

+

I understand that this is obvious thing for any professional programmer, but I several times receive suggestion about “templates” ... So, I decide to point out it here. +

+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.20 Stereo image

+ + +

One can easily create stereo image in MathGL. Stereo image can be produced by making two subplots with slightly different rotation angles. The corresponding code looks like this: +

int sample(mglGraph *gr)
+{
+  mglData a;  mgls_prepare2d(&a);
+  gr->Light(true);
+
+  gr->SubPlot(2,1,0); gr->Rotate(50,60+1);
+  gr->Box();  gr->Surf(a);
+
+  gr->SubPlot(2,1,1); gr->Rotate(50,60-1);
+  gr->Box();  gr->Surf(a);
+  return 0;
+}
+
+
Example of stereo image. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.21 Reduce memory usage

+ + +

By default MathGL save all primitives in memory, rearrange it and only later draw them on bitmaps. Usually, this speed up drawing, but may require a lot of memory for plots which contain a lot of faces (like cloud, dew). You can use quality function for setting to use direct drawing on bitmap and bypassing keeping any primitives in memory. This function also allow you to decrease the quality of the resulting image but increase the speed of the drawing. +

+

The code for lowest memory usage looks like this: +

int sample(mglGraph *gr)
+{
+  gr->SetQuality(6);   // firstly, set to draw directly on bitmap
+  for(i=0;i<1000;i++)
+    gr->Sphere(mglPoint(mgl_rnd()*2-1,mgl_rnd()*2-1),0.05);
+  return 0;
+}
+
+ +
+ + + +

2.5.22 Scanning file

+ + +

MathGL have possibilities to write textual information into file with variable values. In MGL script you can use save command for that. However, the usual printf(); is simple in C/C++ code. For example, lets create some textual file +

FILE *fp=fopen("test.txt","w");
+fprintf(fp,"This is test: 0 -> 1 q\n");
+fprintf(fp,"This is test: 1 -> -1 q\n");
+fprintf(fp,"This is test: 2 -> 0 q\n");
+fclose(fp);
+

It contents look like +

This is test: 0 -> 1 q
+This is test: 1 -> -1 q
+This is test: 2 -> 0 q
+
+

Let assume now that you want to read this values (i.e. [[0,1],[1,-1],[2,0]]) from the file. You can use scanfile for that. The desired values was written using template "This is test: %g -> %g q\n". So, just use +

mglData a;
+a.ScanFile("test.txt","This is test: %g -> %g");
+

and plot it to for assurance +

gr->SetRanges(a.SubData(0), a.SubData(1));
+gr->Axis();	gr->Plot(a.SubData(0),a.SubData(1),"o");
+
+

Note, I keep only the leading part of template (i.e. "This is test: %g -> %g" instead of "This is test: %g -> %g q\n"), because there is no important for us information after the second number in the line. +

+ + +
+ +
+

+Previous: , Up: Hints   [Contents][Index]

+
+ +

2.5.23 Mixing bitmap and vector output

+ + +

Sometimes output plots contain surfaces with a lot of points, and some vector primitives (like axis, text, curves, etc.). Using vector output formats (like EPS or SVG) will produce huge files with possible loss of smoothed lighting. Contrary, the bitmap output may cause the roughness of text and curves. Hopefully, MathGL have a possibility to combine bitmap output for surfaces and vector one for other primitives in the same EPS file, by using rasterize command. +

+

The idea is to prepare part of picture with surfaces or other "heavy" plots and produce the background image from them by help of rasterize command. Next, we draw everything to be saved in vector form (text, curves, axis and etc.). Note, that you need to clear primitives (use clf command) after rasterize if you want to disable duplication of surfaces in output files (like EPS). Note, that some of output formats (like 3D ones, and TeX) don’t support the background bitmap, and use clf for them will cause the loss of part of picture. +

+

The sample code is: +

// first draw everything to be in bitmap output
+gr->FSurf("x^2+y^2", "#", "value 10");
+
+gr->Rasterize();  // set above plots as bitmap background
+gr->Clf();        // clear primitives, to exclude them from file
+
+// now draw everything to be in vector output
+gr->Axis(); gr->Box();
+
+// and save file
+gr->WriteFrame("fname.eps");
+
+ +
+ +
+

+Previous: , Up: Examples   [Contents][Index]

+
+ +

2.6 FAQ

+ + +
+
График не рисуется?!
+

Проверьте, что точки графика находятся внутри ограничивающего параллелепипеда, при необходимости увеличьте его с помощью функции Axis(). Проверьте, что размерность массива правильная для выбранного типа графика. Убедитесь, что функция Finish() была вызвана после построения графика (или график был сохранен в файл). Иногда отражение света от плоских поверхностей (типа, Dens()) может выглядеть как отсутствие графика. +

+
+
Не нашел нужного графика?!
+

Многие “новые” графики можно строить, используя уже существующие функции. Например, поверхность вращения кривой относительно оси можно построить, используя специальную функцию Torus(), а можно построить как параметрически заданную поверхность Surf(). См. также Hints и Examples MathGL. Если же нужного типа графика все равно нет, то пишите мне e-mail и в следующей версии этот график появится. +

+
+
Требуется ли знание сторонних библиотек (например, OpenGL) для использования библиотеки MathGL?
+

Нет. Библиотека MathGL самодостаточна и не требует знания сторонних библиотек. +

+
+
На каком языке написана библиотека? Для каких языков у нее есть интерфейсы?
+

Ядро библиотеки написано на С++. Кроме него, есть интерфейсы для чистого С, фортрана, паскаля, форта и собственный командный язык MGL. Также есть поддержка большого числа интерпретируемых языков (Python, Java, ALLEGROCL, CHICKEN, Lisp, CFFI, C#, Guile, Lua, Modula 3, Mzscheme, Ocaml, Octave, Perl, PHP, Pike, R, Ruby, Tcl). Эти интерфейсы написаны с помощью SWIG (и функции чистого С и классы). Однако на данный момент только интерфейсы для Python и Octave включены в скрипты сборки. Причина в том, что я не знаю других языков, чтобы проверить качество интерфейса :(. Замечу, что большинство прочих языков могут использовать С функции напрямую. +

+
+
Как мне использовать MathGL с Фортраном?
+

Библиотеку MathGL можно использовать как есть с компилятором gfortran поскольку он использует по умолчанию AT&T нотацию для внешних функций. Для других компиляторов (например, Visual Fortran) необходимо включить использование AT&T нотации вручную. AT&T нотация требует, чтобы имя функции завершалось символом ‘_’, аргументы функции передавались по указателю и длины строк передавались в конце списка аргументов. Например: +

+

C функцияvoid mgl_fplot(HMGL graph, const char *fy, const char *stl, int n); +

+

AT&T функцияvoid mgl_fplot_(uintptr_t *graph, const char *fy, const char *stl, int *n, int ly, int ls); +

+

При использовании фортрана необходимо также включить библиотеку -lstdc++. Кроме того, если библиотека была собрана с опцией enable-double=ON (по умолчанию в версии 2.1 и более поздних), то все вещественные числа должны быть типа real*8. Это можно включить по умолчанию опцией -fdefault-real-8. +

+
+
У меня есть класс Foo и в нем метод рисования Foo::draw(mglGraph *gr). Как мне нарисовать что-то в окне FLTK, GLUT или Qt?
+

Функции-члены класса в С++ имеют “скрытый” параметр – указатель на экземпляр класса и их прямое использование невозможно. Решением будет определение интерфейсной функции: +

+
int foo_draw(mglGraph *gr, void *par)
+{   ((Foo *)foo)->draw(gr);    }
+
+

и подстановка именно ее в вызов функции Window(): +

+
gr->Window(argc,argv,foo_draw,"Title",this);
+
+ +

Можно также наследовать Ваш класс от класса mglDraw и использовать функцию типа gr->Window(argc, argv, foo, "Title");. +

+
+
Как мне вывести текст на русском/испанском/арабском/японском и т.д.?
+

Стандартный путь состоит в использовании кодировки UTF-8 для вывода текста. Кроме того, все функции вывода текста имеют интерфейс для 8-битных (char *) строк. Однако в последнем случае Вам может потребоваться установить используемую в исходном тексте локаль. Например, для русского языка в кодировке CP1251 можно использовать setlocale(LC_CTYPE, "ru_RU.cp1251"); (под MS Windows имена локали другие – setlocale(LC_CTYPE, "russian_russia.1251")). Настоятельно не рекомендую использовать константу LC_ALL, поскольку при этом меняется и формат чисел (в частности, десятичная точка), что может, например, вызвать сложности (неудобство) при написании формул и чтении текстовых файлов. Например, программа ожидает ‘,’ в качестве разделителя целой и дробной части, а пользователь вводит ‘.’. +

+
+
Как мне вырезать (исключить из рисования) точку или область на графике?
+

Есть три основных способа. Во-первых, можно вырезать точку, задав одну из ее координат равной NAN. Во-вторых, можно воспользоваться функцией SetCutBox() или CutOff() для удаления точек из некоторой области (see Cutting). Наконец, можно сделать эти точки прозрачными (невидимыми) с помощью функций SurfA(), Surf3A() (see Dual plotting). В последнем случае обеспечивается еще и плавность включения прозрачности. +

+
+
Я использую VisualStudio, CBuilder или другой компилятор (не MinGW/gcc). Как мне подключить библиотеку MathGL?
+

Начиная с версии 2.0, рекомендуемый к использованию класс mglGraph (заголовочный файл #include <mgl2/mgl.h>) содержbn только с inline функции и может использоваться с любым компилятором без перекомпиляции бинарной версии библиотеки. Однако, если Вы планируете использовать низкоуровневые возможности (т.е. классы mglBase, mglCanvas и т.д.), то Вам следует перекомпилировать библиотеку MathGL с использованием Вашего компилятора. +

+

Отмечу, что использование предоставляемых динамических библиотек *.dll требует создания библиотек импорта (import library *.lib). Эта процедура зависит от используемого компилятора – обратитесь к документации по Вашему компилятору. Например для VisualStudio это можно сделать командой lib.exe /DEF:libmgl.def /OUT:libmgl.lib. +

+
+
Как мне собрать MathGL под Windows?
+

Простейший путь – использование комбинации CMake и MinGW. Также Вам может потребоваться дополнительные библиотеки, такие как GSL, PNG, JPEG и пр. Все они могут быть найдены на http://gnuwin32.sourceforge.net/packages.html. После установки всех компонент, просто запустите конфигуратор CMake и соберите MathGL командой make. +

+
+
Как создать окно FLTK/GLUT/Qt с текущими результатами параллельно с выполнением основных вычислений?
+

Следует создать отдельный поток для обработки сообщений в окно. Обновление данных в окне можно выполнить вызовом функции Update(). Подробнее см. Animation. +

+
+
Сколько человек участвовало в создании библиотеки?
+

Большую часть библиотеки написал один человек. Это результат примерно года работы на написание ядра библиотеки и базовых функций (в основном вечерами и по выходным). Процесс усовершенствования продолжается и теперь :). Скрипты сборки в основном написаны Д.Кулагиным, а экспорт в PRC/PDF написан М.Видассовым. +

+
+
Как мне показать растровую картинку на рисунке?
+

Можно импортировать ее в экземпляр mglData и построить с помощью функции Dens(). Например, для черно-белого рисунка можно использовать код: mglData bmp; bmp.Import("fname.png","wk"); gr->Dens(bmp,"wk");. +

+
+
Как использовать MathGL в Qt, FLTK, wxWidgets ...?
+

Есть специальные классы (виджеты) для этих библиотек: QMathGL для Qt, Fl_MathGL для FLTK и т.д. Если Вы не нашли подходящий класс, то можете создать свой собственный виджет, рисующий растровое изображение из mglCanvas::GetBits(). +

+
+
Как мне создать 3D в PDF?
+

Используйте функцию WritePRC(), которая создаст PDF файл если MathGL был собран с enable-pdf=ON. +

+
+
Как мне создать TeX рисунок?
+

Используйте функцию WriteTEX(), которая создаст LaTeX файлы с собственно рисунком ‘fname.tex’, с цветами MathGL ‘mglcolors.tex’ и основной файл ‘mglmain.tex’, который может использоваться для просмотра изображения и/или генерации PDF с помощью команды типа pdflatex mglmain.tex. +

+
+
Можно ли использовать MathGL в JavaScript?
+

Да, пример JavaScript файла находится в папке texinfo/ исходных текстов. Для его работы необходимо предоставить JSON данные с 3d изображением (можно создать с помощью WriteJSON() функции). Скрипт позволяет выполнять базовые операции: приближение/удаление, вращение и сдвиг. Примеры использования JavaScript можно найти в http://mathgl.sf.net/json.html. +

+ + +
+
Как сменить шрифт (семейство шрифтов)?
+

Во-первых, надо загрузить файлы отсюда или отсюда. Далее, в экземпляре mglGraph загружаем шрифты: gr->LoadFont(fontname,path);. Здесь fontname – базовое имя шрифта, например ‘STIX’, и path – путь к папке с файлами шрифтов. Вызовите gr->RestoreFont(); для использования шрифта по умолчанию. +

+
+
Как нарисовать метки оси снаружи от графика?
+

Просто используйте отрицательные значения длины меток, например gr->SetTickLen(-0.1);. +

+
+
Как нарисовать одинаковые оси координат для прямоугольного (не квадратного) рисунка?
+

Просто используйте Aspect(NAN,NAN) для каждого подграфика, или в начале рисования. +

+
+
Как задать полупрозрачный фон?
+

Просто используйте код типа Clf("r{A5}"); или подготовьте PNG файл и задайте его в качестве фона рисунка LoadBackground("fname.png");. +

+
+
Как уменьшить поля вокруг графика?
+

Простейший путь состоит в использовании стилей subplot. Однако, вы должны быть осторожны в изменении стиля subplot если вы планируете добавлять colorbar или вращать график – часть графика может стать невидимой. +

+
+
Can I combine bitmap and vector output in EPS?
+

Yes. Sometimes you may have huge surface and a small set of curves and/or text on the plot. You can use function rasterize just after making surface plot. This will put all plot to bitmap background. At this later plotting will be in vector format. For example, you can do something like following: +

gr->Surf(x, y, z);
+gr->Rasterize(); // make surface as bitmap
+gr->Axis();
+gr->WriteFrame("fname.eps");
+
+
+
Почему у меня не получается использовать имя ‘I’ для переменной?
+

MathGL поддерживает стандарт C99, в котором имя ‘I’ зарезервированно для мнимой единицы. Если Вам все таки нужно это имя для переменной, то поместите +

#undef I
+

сразу после включения заголовочных файлов MathGL. +

+
+
Как мне создать MPEG видео по графикам?
+

Вам следует сохранить каждый кадр в файл JPEG с именем типа ‘frame0001.jpg’, ‘frame0002.jpg’, ... Далее используйте ImageMagic для конвертации этих файлов в видео формата MPEG с помощью команды convert frame*.jpg movie.mpg. См. также MPEG. +

+
+
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 Основные принципы

+ + +

Возможности библиотеки MathGL довольно богаты – число только основных типов графиков превышает 50 видов. Кроме того, есть функции для обработки данных, настройки вида графика и пр. и пр. Тем не менее, я старался придерживаться единого стиля в порядке аргументов функций и способе их “настройки”. В основном все ниже сказанное относится к функциям рисования различных графиков. +

+

Всего основных концепций (базисных идей) шесть: +

    +
  1. Все рисунки создаются в памяти. Это могут быть как растровые картинки (для SetQuality(MGL_DRAW_LMEM) или quality 6), так и векторные списки примитивов (по умолчанию). Дальнейшая судьба рисунков определяется пользователем: можно сохранить в файл, вывести на экран, создать анимацию/кино, дополнительно отредактировать и т.д. Такой подход обеспечивает высокую переносимость библиотеки – один и тот же программный код создаст в точности одинаковый рисунок на любой операционной системе. Кроме того, при таком подходе рисунки можно создавать непосредственно в консольной программе – графическое окно не нужно! +
  2. Все настройки графиков (стиль линий, цветовые схемы поверхностей, стиль и цвет текста) задаются строками. Это обеспечивает: удобство для пользователя – короткую строку легче читать и здесь тяжелее ошибиться, чем в большом списке параметров; переносимость – строки выглядят одинаково на всех платформах и не надо заботиться о типе и числе аргументов. +
  3. Все функции имеют “упрощенный” и “продвинутый” варианты. Сделано опять из-за удобства. В “упрощенном” варианте для построения графика нужны только один-два массив(а) данных, которые автоматически равнораспределяются в заданном диапазоне осей координат. В “продвинутой” версии можно не только указать явно диапазон построения графика, но и задать его параметрически. Последнее позволяет легко строить довольно сложные кривые и поверхности. В обоих вариантах функций порядок аргументов стандартен: сначала идут массивы данных, потом необязательный строковый параметр стиля графика, а далее строка опций для более точной настройки графика. +
  4. Все данные передаются через экземпляры класса mglData(A). Такой подход позволяет избежать ошибок при работе с памятью и единообразно передавать данные разных типов (float, double, данные из файла, заполненных пользователем и пр.) в функции рисования. +
  5. Все элементы рисунков векторные. Изначально библиотека MathGL была ориентированна на работу с научными данными, которые по своей природе векторные (линии, грани, матрицы и т.д.). Поэтому векторность используется во всех рисунках! Причем иногда даже в ущерб производительности (например, при выводе шрифтов). Помимо всего прочего, векторность позволяет легко масштабировать рисунок – измените размер картинки в 2 раза, и рисунок пропорционально растянется. +
  6. Новые графики не удаляют уже нарисованное. Этот, в чем-то неожиданный, подход позволяет создавать огромное количество “комбинированных” графиков. Например, поверхность с наложенными линиями уровня строится двумя последовательными вызовами функций рисования поверхности и линий уровня (в любом порядке). И совершенно не надо писать специальную функцию (как в Matlab и некоторых других программах) для рисования этого графика. +
+ +

Кроме основных концепций я хотел бы остановиться на нескольких, как оказалось, нетривиальных моментах – способе указания положения графика, осей координат и строковых параметров линий, поверхностей, текста. +

+ + + + + + + + + + + + +
+ + + +

3.1 Оси координат

+ + +

Представление системы координат в MathGL состоит из двух частей. Вначале координаты нормируются в диапазон изменения осей координат (see Axis settings). Если флаг SetCut() установлен, то точки вне интервала отбрасываются, в противном случае, они проецируются на ограничивающий параллелепипед (см. Cutting). Кроме того, отбрасываются точки внутри границ, определенных переменными CutMinxCutMax и точки, для которых значение функции CutOff() не равно нулю. После этого формулы перехода в криволинейную систему координат SetFunc()применяются к каждой точке. Наконец, точка данных отображается с помощью одной из графических функций. +

+

Диапазон изменения x, y, z-координат задается функциями SetRange() или ranges. Точка пересечения осей координат задается функцией SetOrigin(). При этом можно использовать NAN значения для автоматического выбора положения оси. +

+

Кроме привычных осей x, y, z есть еще одна ось – цветовая шкала – ось c. Она используется при окрашивании поверхностей и задает границы изменения функции при окрашивании. Ее границы автоматически устанавливаются равными диапазону z-оси при вызове ranges. Возможно и ручное изменение границ цветового интервала посредством вызова SetRange('c', ...). Используйте colorbar для отображения цветовой шкалы. +

+

Вид меток по осям определяется функцией SetTicks() (see Ticks). Функция SetTuneTicks включает/выключает выделение общего множителя (большого или малого факторов в диапазоне) для меток осей координат. Наконец, если стандартный вид меток не устраивает пользователя, то их шаблон можно задать явно (можно использовать и ТеХ символы), воспользовавшись функцией SetTickTempl(). Кроме того, в качестве меток можно вывести произвольный текст использовав функцию SetTicksVal(). +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.2 Цвета

+ + +

Base colors are defined by one of symbol ‘wkrgbcymhRGBCYMHWlenupqLENUPQ’. +

Символы цвета: ‘k’ – черный, ‘r’ – красный, ‘R’ – темно красный, ‘g’ – зеленый, ‘G’ – темно зеленый, ‘b’ – синий, ‘B’ – темно синий, ‘c’ – голубой, ‘C’ – темно голубой, ‘m’ – пурпурный, ‘M’ – темно пурпурный, ‘y’ – желтый, ‘Y’ – темно желтый (золотой), ‘h’ – серый, ‘H’ – темно серый, ‘w’ – белый, ‘W’ – светло серый, ‘l’ – сине-зеленый, ‘L’ – темно сине-зеленый, ‘e’ – желто-зеленый, ‘E’ – темно желто-зеленый, ‘n’ – небесно-синий, ‘N’ – темно небесно-синий, ‘u’ – сине-фиолетовый, ‘U’ – темно сине-фиолетовый, ‘p’ – фиолетовый, ‘P’ – темно фиолетовый, ‘q’ – оранжевый, ‘Q’ – темно оранжевый (коричневый).

+

+

В цветовой схеме можно использовать тональные (“подсвеченные”) цвета. Тональный цвет задается двумя символами в фигурных скобках ‘{cN}’: первый – обычный цвет, второй – его яркость цифрой. Цифра может быть в диапазоне ‘1’...‘9’. При этом ‘5’ соответствует нормальному цвету, ‘1’ – очень темная версия цвета (почти черный), ‘9’ – очень светлая версия цвета (почти белый). Например, цвета могут быть ‘{b2}’ ‘{b7}’ ‘{r7}’ и т.д. +

+

Наконец, можно указать явно RGB или RGBA значения цвета, используя формат ‘{xRRGGBB}’ или ‘{xRRGGBBAA}’ соответственно. Например, ‘{xFF9966}’ даст цвет +дыни. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.3 Стиль линий

+ + + + + + +

Стиль линии задается строкой, которая может содержать символ цвета (‘wkrgbcymhRGBCYMHWlenupqLENUPQ’), тип пунктира (‘-|;:ji’ или пробел), ширину линии (‘0123456789’) и тип маркера (‘o+xsd.^v’ и модификатор ‘#’). Если пропущен цвет или тип пунктира, то используется значение по умолчанию с последним указанным цветом или значение из палитры (для see 1D plotting). +По умолчанию палитры содержит следующие цвета: темно серыйH’, синийb’, зеленыйg’, красныйr’, голубойc’, пурпурныйm’, yellowy’, серыйh’, сине-зеленыйl’, небесно-синийn’, оранжевыйq’, желто-зеленыйe’, сине-фиолетовыйu’, фиолетовыйp’. + +

Тип пунктира: пробел – нет линии (для рисования только маркеров), ‘-’ – сплошная линия (■■■■■■■■■■■■■■■■), ‘|’ – длинный пунктир (■■■■■■■■□□□□□□□□), ‘;’ – пунктир (■■■■□□□□■■■■□□□□), ‘=’ – короткий пунктир (■■□□■■□□■■□□■■□□), ‘:’ – точки (■□□□■□□□■□□□■□□□), ‘j’ – пунктир с точками (■■■■■■■□□□□■□□□□), ‘i’ – мелкий пунктир с точками (■■■□□■□□■■■□□■□□), ‘{dNNNN}’ – заданный вручную стиль (для v.2.3 и поздних, например ‘{df090}’ для (■■■■□□□□■□□■□□□□)).

+

+

Типы маркеров: ‘o’ – окружность, ‘+’ – крест, ‘x’ – косой крест, ‘s’ – квадрат, ‘d’ - ромб, ‘.’ – точка, ‘^’ – треугольник вверх, ‘v’ – треугольник вниз, ‘<’ – треугольник влево, ‘>’ – треугольник вправо, ‘#*’ – знак Y, ‘#+’ – крест в квадрате, ‘#x’ – косой крест в квадрате, ‘#.’ – точка в окружности. Если в строке присутствует символ ‘#’, то используются символы с заполнением. +

+

Вы можете определить собственные символы (см. addsymbol) для рисования маркеров при использовании стиля ‘&’. В частности, ‘&*’, ‘&o’, ‘&+’, ‘&x’, ‘&s’, ‘&d’, ‘&.’, ‘&^’, ‘&v’, ‘&<’, ‘&>’ нарисует определенный пользователем символ с именем ‘*o+xsd.^v<>’ соответственно; и +‘&#o’, ‘&#+’, ‘&#x’, ‘&#s’, ‘&#d’, ‘&#.’, ‘&#^’, ‘&#v’, ‘&#<’, ‘&#>’ нарисует определенный пользователем символ с именем ‘YOPXSDCTVLR’ соответственно. Замечу, что будет нарисован только контур определенного пользователем символа если задан отрицательный размер маркера (см. marksize или опцию size в Command options). +

+

На конце и в начале линии можно выводить специальный символ (стрелку), если в строке указать один из символов: ‘A’ – стрелка наружу, ‘V’ – стрелка внутрь, ‘I’ – поперечная черта, ‘K’ – стрелка с чертой, ‘T’ – треугольник, ‘S’ – квадрат, ‘D’ – ромб, ‘O’ – круг, ‘X’ – косой крест, ‘_’ – нет стрелки (по умолчанию). При этом действует следующее правило: первый символ определяет стрелку на конце линии, второй символ – стрелку в начале линии. Например, ‘r-A’ – красная сплошная линия со стрелкой на конце, ‘b|AI’ – синий пунктир со стрелкой на конце и чертой вначале, ‘_O’ – линия с текущим стилем и кружком вначале. Эти стили действуют и при построении графиков (например, 1D plotting). +

+
Color and line styles. +
+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.4 Цветовая схема

+ + + + +

Цветовая схема используется для определения цвета поверхностей, линий уровня и пр. Цветовая схема задается строкой s, которая содержит символы цвета (see Line styles) или символы ‘#:|’. Символ ‘#’ переключает рисование поверхности на сетчатое (для трехмерных поверхностей) или включает рисование сетки на поверхности. Символ ‘|’ отключает интерполяцию цвета в цветовой схеме. Это может быть полезно для “резких” цветов, например, при рисовании матриц. Если в строке встречается символ ‘:’, то он принудительно заканчивает разбор строки для стиля поверхности. После этого символа могут идти описание стиля текста или оси вращения кривой/линий уровня. Цветовая схема может содержать до 32 значений цвета. +

+

При определении цвета по амплитуде (наиболее часто используется) окончательный цвет определяется путем линейной интерполяции массива цветов. Массив цветов формируется из цветов, указанных в строке спецификации. Аргумент – амплитуда, нормированная на диапазон изменения цвета (см. Axis settings). Например, строка из 4 символов ‘bcyr’ соответствует изменению цвета от синего (минимальное значение) через голубой и желтый (промежуточные значения) к красному (максимальное значение). Строка ‘kw’ соответствует изменению цвета от черного (минимальное значение) к белому (максимальное значение). Строка из одного символа (например, ‘g’) соответствует однотонному цвету (в данному случае зеленому). +

+

Специальная двуосная цветовая схема (как в графике map) задается символом ‘%’. В ней второе направление (прозрачность) используется как вторая координата для цвета. При этом можно указать до 4 цветов для углов: {c1,a1}, {c2,a1}, {c1,a2}, {c2,a2}. Здесь диапазоны цвета и прозрачности равны {c1,c2} и {a1,a2}. Если указано меньше 4 цветов, то черный используется для угла {c1,a1}. Если задано только 2 цвета, то их сумма используется для угла {c2,a2}. +

+

Есть несколько полезных цветовых схем. Строка ‘kw’ дает обычную серую (черно-белую) схему, когда большие значения светлее. Строка ‘wk’ представляет обратную серую схему, когда большие значения темнее. Строки ‘kRryw’, ‘kGgw’, ‘kBbcw’ представляют собой хорошо известные схемы hot, summer и winter. Строки ‘BbwrR’ и ‘bBkRr’ позволяют рисовать двухцветные фигуры на белом или черном фоне, когда отрицательные значения показаны синим цветом, а положительные – красным. Строка ‘BbcyrR’ дает цветовую схему, близкую к хорошо известной схеме jet. +

+

Для более точно раскрашивания поверхностей можно изменить равномерное (по умолчанию) положение цветов в цветовой схеме. Формат следующий: ‘{CN,pos}’, ‘{CN,pos}’ или ‘{xRRGGBB,pos}’. Здесь значение pos положения цвета должно быть в диапазоне [0, 1]. Отмечу, что альтернативным механизмом тонкой настройки цветовой схемы может служить использование формул для цветовой координаты (см. Curved coordinates). +

+
Most popular color schemes. +
+

При определении цвета по положению точки в пространстве (используется в map) окончательный цвет определяется по формуле c=x*c[1] + y*c[2]. Здесь c[1], c[2] – первые три цвета в цветовом массиве; x, y – координаты точки, нормированные в диапазон изменения осей координат. +

+ +

Дополнительно, MathGL может наложить маску при закраске граней для создания растрового изображения. Тип маски задается одним из символов ‘-+=;oOsS~<>jdD*^’ в цветовой схеме. Маску можно повернуть на произвольный угол командой mask или на один из улов +45, -45 или 90 градусов, используя символы ‘\/I’ соответственно. Примеры масок по умолчанию показаны на рисунке ниже. +

+
Example of masks for face coloring. +
+

Однако, вы можете задать собственную маску (как матрицу 8*8) для любого из этих символов, используя второй аргумент команды mask. Например, маска на правом нижнем подрисунке получается кодом
+gr->SetMask('+', "ff00182424f80000"); gr->Dens(a,"3+");
+или использовать явное задание маски (для v.2.3 и более поздних)
+gr->Dens(a,"3{s00ff00182424f800}"); +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.5 Стиль текста

+ + + + +

Стиль текста задается строкой, которая может содержать цвет текста ‘wkrgbcymhRGBCYMHW’ (см. Color styles), а также тип шрифта (‘ribwou’) и/или выравнивания (‘LRC’) после символа ‘:’. Например, ‘r:iCb’ соответствует жирному (‘b’) курсиву (‘i’) с выравниванием по центру (‘C’ красного цвета (‘r’). Начиная с MathGL версии 2.3, вы можете использовать не только один цвет для всего текста, но и задать цветовой градиент для выводимой строки (см. Color scheme). +

+

Начертания шрифта: ‘r’ – прямой шрифт, ‘i’ – курсив, ‘b’ – жирный. По умолчанию используется прямой шрифт. Типы выравнивания текста: ‘L’ – по левому краю (по умолчанию), ‘C’ – по центру, ‘R’ – по правому краю, ‘T’ – под текстом, ‘V’ – по центру вертикально. Дополнительные эффекты шрифта: ‘w’ – контурный, ‘o’ – надчеркнутый, ‘u’ – подчеркнутый. +

+

Синтаксический разбор LaTeX-их команд по умолчанию включен. Это команды смены стиля текста (например, \b для жирного текста): \a или \overline – надчеркивание, \b или \textbf – жирный, \i или \textit – курсив, \r или \textrm – прямой (отменяет стили жирного и курсива), \u или \underline – подчеркнутый, \w или \wire – контурный, \big – большего размера, @ – меньшего размера. Нижний и верхний индексы задаются символами ‘_’ и ‘^’. При этом изменение стиля применяется только к следующему символу или к символам в фигурных скобках {}, которые понимаются как единый блок. Например, сравните строки ‘sin (x^{2^3})’ и ‘sin (x^2^3)’. Можно также менять цвет текста внутри строки с помощью команд #? или \color?, где ‘?’ – символ цвета (see Line styles). Например, слова ‘Blue’ и ‘red’ будут окрашены в соответствующий цвет в строке ‘#b{Blue} and \colorr{red} text’. Большинство функций понимает символ новой строки ‘\n’ и позволяет выводить много строчный текст. Наконец, можно использовать символы с произвольным UTF кодом с помощью команды \utf0x????. Например, \utf0x3b1 даст символ +α. +

+

Распознаются также большинство символов TeX и AMSTeX, команды смены стиля текста (\textrm, \textbf, \textit, \textsc, \overline, \underline), акценты (\hat, \tilde, \dot, \ddot, \acute, \check, \grave, \bar, \breve) и корни (\sqrt, \sqrt3, \sqrt4). Полный список содержит около 2000 символов. Отмечу, что первый пробел (пробел, табуляция и пр.) после команды игнорируется, а все остальные пробелы печатаются обычным образом. Например, следующие строки дают одинаковый результат \tilde a: ‘\tilde{a}’; ‘\tilde a’; ‘\tilde{}a’. +

+В частности, распознаются греческие буквы: α – \alpha, β – \beta, γ – \gamma, δ – \delta, ε – \epsilon, η – \eta, ι – \iota, χ – \chi, κ – \kappa, λ – \lambda, μ – \mu, ν – \nu, o – \o, ω – \omega, ϕ – \phi, π – \pi, ψ – \psi, ρ – \rho, σ – \sigma, θ – \theta, τ – \tau, υ – \upsilon, ξ – \xi, ζ – \zeta, ς – \varsigma, ɛ – \varepsilon, ϑ – \vartheta, φ – \varphi, ϰ – \varkappa; A – \Alpha, B – \Beta, Γ – \Gamma, Δ – \Delta, E – \Epsilon, H – \Eta, I – \Iota, C – \Chi, K – \Kappa, Λ – \Lambda, M – \Mu, N – \Nu, O – \O, Ω – \Omega, Φ – \Phi, Π – \Pi, Ψ – \Psi, R – \Rho, Σ – \Sigma, Θ – \Theta, T – \Tau, Υ – \Upsilon, Ξ – \Xi, Z – \Zeta. + +

Еще примеры наиболее общеупотребительных TeX-их символов: ∠ – \angle, ⋅ – \cdot, ♣ – \clubsuit, ✓ – \checkmark, ∪ – \cup, ∩ – \cap, ♢ – \diamondsuit, ◇ – \diamond, ÷ + – \div, +↓ – \downarrow, † – \dag, ‡ – \ddag, ≡ – \equiv, ∃ – \exists, ⌢ – \frown, ♭ – \flat, ≥ – \ge, ≥ – \geq, ≧ – \geqq, ← – \gets, ♡ – \heartsuit, ∞ – \infty, ∫ – \int, \Int, ℑ – \Im, ♢ – \lozenge, ⟨ – \langle, ≤ – \le, ≤ – \leq, ≦ – \leqq, ← – \leftarrow, ∓ – \mp, ∇ – \nabla, ≠ – \ne, ≠ – \neq, ♮ – \natural, ∮ – \oint, ⊙ – \odot, ⊕ – \oplus, ∂ – \partial, ∥ – \parallel, ⊥ –\perp, ± – \pm, ∝ – \propto, ∏ – \prod, ℜ – \Re, → – \rightarrow, ⟩ – \rangle, ♠ – \spadesuit, ~ – \sim, ⌣ – \smile, ⊂ – \subset, ⊃ – \supset, √ – \sqrt or \surd, § – \S, ♯ – \sharp, ∑ – \sum, × – \times, → – \to, ∴ – \therefore, ↑ – \uparrow, ℘ – \wp.

+ +

Размер текста может быть задан явно (если size>0) или относительно базового размера шрифта для рисунка |size|*FontSize при size<0. Значение size=0 указывает, что соответствующая строка выводиться не будет. Базовый размер шрифта измеряется во внутренних единицах. Специальные функции SetFontSizePT(), SetFontSizeCM(), SetFontSizeIN() позволяют задавать его в более “привычных” единицах. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.6 Текстовые формулы

+ + + +

MathGL имеет быстрый парсер текстовых формул +(see Evaluate expression) +, понимающий большое число функций и операций. Базовые операции: ‘+’ – сложение, ‘-’ – вычитание, ‘*’ – умножение, ‘/’ – деление, ‘%’ – остаток от деления, ‘^’ – возведение в целосичленную степень. Также есть логические операции: ‘<’ – истина если if x<y, ‘>’ – истина если x>y, ‘=’ – истина если x=y, ‘&’ – истина если x и y оба не равны нулю, ‘|’ – истина если x или y не нуль. Логические операции имеют наинизший приоритет и возвращают 1 если истина или 0 если ложно. +

+

Базовые функции: ‘sqrt(x)’ – квадратный корень из x, ‘pow(x,y)’ – x в степени y, ‘ln(x)’ – натуральный логарифм x, ‘lg(x)’ – десятичный логарифм x, ‘log(a,x)’ – логарифм по основанию a от x, ‘abs(x)’ – модуль x, ‘sign(x)’ – знак x, ‘mod(x,y)’ – остаток от деления x на y, ‘step(x)’ – ступенчатая функция, ‘int(x)’ – целая часть x, ‘rnd’ – случайное число, ‘random(x)’ – матрица случайный чисел размером как x, ‘hypot(x,y)’=sqrt(x^2+y^2) – гипотенуза, ‘cmplx(x,y)’=x+i*y – комплексное число, ‘pi’ – число +π = 3.1415926…, inf=∞ +

+

Функции для работы с комплексными числами ‘real(x)’, ‘imag(x)’, ‘abs(x)’, ‘arg(x)’, ‘conj(x)’. +

+

Тригонометрические функции: ‘sin(x)’, ‘cos(x)’, ‘tan(x)’ (или ‘tg(x)’). Обратные тригонометрические функции: ‘asin(x)’, ‘acos(x)’, ‘atan(x)’. Гиперболические функции: ‘sinh(x)’ (или ‘sh(x)’), ‘cosh(x)’ (или ‘ch(x)’), ‘tanh(x)’ (или ‘th(x)’). Обратные гиперболические функции: ‘asinh(x)’, ‘acosh(x)’, ‘atanh(x)’. +

+

Специальные функции: ‘gamma(x)’ – гамма функция Γ(x) = ∫0 tx-1 exp(-t) dt, ‘gamma_inc(x,y)’ – неполная гамма функция Γ(x,y) = ∫y tx-1 exp(-t) dt, ‘psi(x)’ – дигамма функция ψ(x) = Γ′(x)/Γ(x) для x≠0, ‘ai(x)’ – Эйри функция Ai(x), ‘bi(x)’ – Эйри функция Bi(x), ‘cl(x)’ – функция Клаузена, ‘li2(x)’ (или ‘dilog(x)’) – дилогарифм Li2(x) = -ℜ∫0xds log(1-s)/s, ‘sinc(x)’ – функция sinc(x) = sin(πx)/(πx) для любых x, ‘zeta(x)’ – зета функция Римана ζ(s) = ∑k=1k-s для s≠1, ‘eta(x)’ – эта функция η(s) = (1 - 21-s)ζ(s) для произвольного s, ‘lp(l,x)’ – полином Лежандра Pl(x), (|x|≤1, l≥0), ‘w0(x)’, ‘w1(x)’ – функции Ламберта W. Функции W(x) определены как решение уравнения: W exp(W) = x.

+ +

Экспоненциальные интегралы: ‘ci(x)’ – cos-интеграл Ci(x) = ∫0xdt cos(t)/t, ‘si(x)’ – sin-интеграл Si(x) = ∫0xdt sin(t)/t, ‘erf(x)’ – функция ошибки erf(x) = (2/√π) ∫0xdt exp(-t2) , ‘ei(x)’ – интеграл Ei(x) = -PV(∫-xdt exp(-t)/t) (где PV обозначает главное значение), ‘e1(x)’ – интеграл E1(x) = ℜ∫1dt exp(-xt)/t, ‘e2(x)’ – интеграл E2(x) = ℜ∫1∞dt exp(-xt)/t2, ‘ei3(x)’ – интеграл Ei3(x) = ∫0xdt exp(-t3) для x≥0.

+ +

Функции Бесселя: ‘j(nu,x)’ – функция Бесселя первого рода, ‘y(nu,x)’ – функция Бесселя второго рода, ‘i(nu,x)’ – модифицированная функция Бесселя первого рода, ‘k(nu,x)’ – модифицированная функция Бесселя второго рода.

+ +

Эллиптические интегралы: ‘ee(k)’ – полный эллиптический интеграл E(k) = E(π/2,k), ‘ek(k)’ – полный эллиптический интеграл K(k) = F(π/2,k), ‘e(phi,k)’ – эллиптический интеграл E(φ,k) = ∫0φdt √(1 - k2sin2(t)), ‘f(phi,k)’ – эллиптический интеграл F(φ,k) = ∫0φdt 1/√(1 - k2sin2(t))

+ +

Функции Якоби: ‘sn(u,m)’, ‘cn(u,m)’, ‘dn(u,m)’, ‘sc(u,m)’, ‘sd(u,m)’, ‘ns(u,m)’, ‘cs(u,m)’, ‘cd(u,m)’, ‘nc(u,m)’, ‘ds(u,m)’, ‘dc(u,m)’, ‘nd(u,m)’. +

+

Некоторые из функций могут быть недоступны если не была включена поддержка GSL при компиляции библиотеки MathGL. +

+

При разборе формул нет различия между верхним и нижним регистром. Если аргумент лежит вне области определения функции, то возвращается NaN. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.7 Опции команд

+ + +

Опции команд позволяют легко настроить вид отдельного графика не меняя глобальных настроек для все рисунка. Каждая опция отделяется от предыдущей символом ‘;’. Опции работают так, что запоминают текущие настройки рисунка, применяют собственные настройки, выполняют команду и возвращают глобальные настройки обратно. Поэтому использование опций для команд обработки данных или настройки графика бесполезно. +

+

Наиболее часто используемые опции – xrange, yrange, zrange, устанавливают границы изменения осей координат (и тем самым автоматических массивов). Например, команда Plot(y,"","xrange 0.1 0.9"); или plot y; xrange 0.1 0.9 построит кривую с x-координатой равно распределенной в интервале 0.1 ... 0.9, а не вдоль текущей оси x. См. раздел Using options, для примеров кода и графика. +

+

Полный список опций: + + +

+
Опция MGL: alpha val
+

Задает величину прозрачности поверхности. Значение должно быть в диапазоне [0, 1]. См. также alphadef +

+ + +
+
Опция MGL: xrange val1 val2
+

Задает границы изменения координаты x. См. также xrange +

+ +
+
Опция MGL: yrange val1 val2
+

Задает границы изменения координаты y. См. также yrange +

+ +
+
Опция MGL: zrange val1 val2
+

Задает границы изменения координаты z. См. также zrange +

+ + +
+
Опция MGL: cut val
+

Задает обрезание точек за пределами осей координат. См. также cut. +

+ +
+
Опция MGL: size val
+

Задает размер текста, маркеров и стрелок. См. также font, marksize, arrowsize. +

+ +
+
Опция MGL: meshnum val
+

Задает ориентировочное число линий, стрелок, ячеек и пр. См. также meshnum +

+ + +
+
Опция MGL: legend 'txt'
+

Добавляет строку ’txt’ во внутренний массив записей легенды. Стиль линии и маркера аргумента последней вызванной команды построения 1D plotting. См. также legend +

+ +
+
MGL option: value val
+

Задает значение, которое будет использовано как дополнительный числовой параметр при построении графика. +

+ + + + +
+ +
+

+Previous: , Up: General concepts   [Contents][Index]

+
+ +

3.8 Интерфейсы

+ + + + +

Библиотека MathGL имеет интерфейсы к ряду языков программирования. Большинство из них основано на С интерфейсе с использованием SWIG. Это Python, Java, Octave, Lisp, C#, Guile, Lua, Modula 3, Ocaml, Perl, PHP, Pike, R, Ruby, и Tcl интерфейсы. Также есть Fortran интерфейс, который имеет схожий набор функций, но слегка различающиеся типы аргументов (целые вместо указателей). Эти функции отмечены как [C function]. +

+

Некоторые языки поддерживают классы (подобно C++ или Python). Имена функций для них такие же как в С++ (см. MathGL core и Data processing) и отмечены, например, так [Method on mglGraph]. +

+

Наконец, специальный командный язык MGL (см. MGL scripts) был создан для быстрого доступа к функциям рисования. Соответствующие скрипты могут быть выполнены самостоятельно (с помощью UDAV, mglconv, mglview и т.д.) или из программы на языке C/C++/Python/... (см. mglParse class). +

+ + + + + + +
+ +
+

+Next: , Up: Interfaces   [Contents][Index]

+
+ +

3.8.1 C/Fortran интерфейс

+ + +

C интерфейс – основа для многих других интерфейсов. Он содержит функции С для всех методов MathGL. В отличие от C++ классов, C функции содержат обязательный(ые) аргумент(ы) типа HMGL (для графики) и/или HCDT/HMDT/HADT (для массивов данных), который указывают на объект для рисования или изменения. Поэтому перед использованием их необходимо создать с помощью функции mgl_create_*(), и удалить после использования (или в конце программы) с помощью функции mgl_delete_*(). +

+

Все C функции описаны в заголовочном файле #include <mgl2/mgl_cf.h> и используют переменные следующих типов: +

    +
  • HMGL — Указатель на класс mglGraph (см. MathGL core). +
  • HCDT — Указатель на класс const mglDataA (см. Data processing) — неизменяемые массивы данных. +
  • HMDT — Указатель на класс mglData (см. Data processing) — массивы данных с действительными числами. +
  • HADT — Указатель на класс mglDataC (см. Data processing) — массивы данных с комплексными числами. +
  • HMPR — Указатель на класс mglParse (см. mglParse class) — выполнение MGL скриптов. +
  • HMEX — Указатель на класс mglExpr (см. Evaluate expression) — текстовые формулы для действительных чисел. +
  • HMAX — Указатель на класс mglExprC (см. Evaluate expression) — текстовые формулы для комплексных чисел. +
+ +

Фортрановские функции и подпрограммы имеют такие же имена как функции С. Однако есть отличие. Переменные типов HMGL, HCDT, HMDT, ... должны быть целыми с достаточной разрядностью (integer*4 для 32-битной операционной системы или integer*8 для 64-битной). Все C функции типа void — подпрограммы на Фортране и должны вызываться оператором call. Прочие функции, возвращающие тип HMGL или HMDT и т.п. должны быть объявлены в Фортране как возвращающие целое нужной разрядности. Также необходимо иметь в виду, что строки в Фортране отделяются символом ', а не ". +

+ +
+ +
+

+Previous: , Up: Interfaces   [Contents][Index]

+
+ +

3.8.2 C++/Python интерфейс

+ + +

MathGL имеет интерфейс на основе классов (объектов с членами-функциями) с использованием библиотеки SWIG. Типичный пример – Python, имя которого использовано в заголовке раздела. В точности те же классы используются и в C++ API. Отмечу, что С++ классы содержат только inline члены-функции, что делает С++ API независимым от компилятора даже для бинарной версии. +

+

Есть 3 основных класса: +

    +
  • mglGraph +– обеспечивает вывод графики (см. MathGL core). +
  • mglData +– обеспечивает обработку данных (см. Data processing). Класс имеет возможность прямого доступа к данным с помощью конструкции вида: dat[i]=sth; или sth=dat[i], где используется "плоское" представление данных (т.е., i может быть в диапазоне 0...nx*nx*nz-1). Также можно импортировать массивы NumPy в Python: mgl_dat = mglData(numpy_dat);. +
  • mglParse +– обеспечивает выполнение скриптов MGL (см. MGL scripts). +
+ + +

Для использования в Python достаточно выполнить ‘import mathgl’. Простейший пример имеет вид: +

import mathgl
+a=mathgl.mglGraph()
+a.Box()
+a.WritePNG("test.png")
+

Также можно импортировать все классы из модуля mathgl и обеспечить более легкий доступ к MathGL: +

from mathgl import *
+a=mglGraph()
+a.Box()
+a.WritePNG("test.png")
+

Это становится более полезным если, например, вы создаете много объектов данных mglData. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

4 Ядро MathGL

+ + + + +

Основным классом MathGL является класс mglGraph, определённый в #include <mgl2/mgl.h>. Он включает в себя множество функций для построения графиков от 1D, 2D и 3D массивов. Он также содержит функции вывода текста и построения осей координат. Есть возможность построения в произвольной системе координат, которая задается строковыми формулами. Все графические функции используют класс mglData (см. Data processing) для хранения массивов данных. Это позволяет легко контролировать размеры, работу с памятью и производить обработку данных. Дополнительная информация о цветах, шрифтах, вычисления формул может быть найдена в General concepts и Other classes. +

+

Некоторые возможности MathGL доступны только в новых версиях библиотеки. Для проверки текущей версии MathGL можно использовать следующую функцию. +

+
Команда MGL: version 'ver'
+
Метод класса mglGraph: bool CheckVersion (const char *ver) static
+
Функция С: int mgl_check_version (const char *ver)
+

Возвращает нулевое значение если версия MathGL подходит для требуемой в ver, т.е. если номер основной версии совпадает и "подверсия" больше или равна указанной в ver. +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: MathGL core   [Contents][Index]

+
+ +

4.1 Создание и удаление графического объекта

+ + +
+
Конструктор класса mglGraph: mglGraph (int kind=0, int width=600, int height=400)
+
Конструктор класса mglGraph: mglGraph (const mglGraph &gr)
+
Конструктор класса mglGraph: mglGraph (HMGL gr)
+
Функция С: HMGL mgl_create_graph (int width, int height)
+
Функция С: HMGL mgl_create_graph_gl ()
+

Создает (или использует созданный) экземпляр класса, производного от mglGraph (тип HMGL) с указанными размерами width и height. Параметр kind может иметь следующие значения: ‘0’ – использовать рисование по умолчанию, ‘1’ – использовать рисование в OpenGL. +

+ +
+
Destructor on mglGraph: ~mglGraph ()
+
Функция С: HMGL mgl_delete_graph (HMGL gr)
+

Удаляет экземпляр класса mglGraph. +

+ +
+
Метод класса mglGraph: HMGL Self ()
+

Возвращает указатель на используемый объект типа HMGL. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.2 Настройка графика

+ + + +

Функции и переменные в этой группе влияют на вид всего рисунка. Соответственно они должны располагаться перед вызовом функций непосредственно рисующих графики. +

+
+
Команда MGL: reset
+
Метод класса mglGraph: void DefaultPlotParam ()
+
Функция С: void mgl_set_def_param (HMGL gr)
+

Устанавливает все настройки по умолчанию и очищает рисунок. +

+ +
+
Команда MGL: setup val flag
+
Метод класса mglGraph: void SetFlagAdv (int val, uint32_t flag)
+
Функция С: void mgl_set_flag (HMGL gr, int val, uint32_t flag)
+

Устанавливает значение бинарного флага flag в val. Список флагов можно найти в define.h. Текущий список флагов: +

#define MGL_ENABLE_CUT		0x00000004 	///< Определяет способ рисования точек вне диапазона осей координат
+#define MGL_ENABLE_RTEXT 	0x00000008 	///< Использовать вращение текста
+#define MGL_AUTO_FACTOR		0x00000010 	///< Разрешить автоматическое масштабирование графика
+#define MGL_ENABLE_ALPHA 	0x00000020 	///< Использовать прозрачность
+#define MGL_ENABLE_LIGHT 	0x00000040 	///< Использовать освещение
+#define MGL_TICKS_ROTATE 	0x00000080 	///< Разрешить вращение меток осей
+#define MGL_TICKS_SKIP		0x00000100 	///< Разрешить пропуск меток осей
+#define MGL_DISABLE_SCALE	0x00000200 	///< Временный флаг, запрещающий изменение размеров
+#define MGL_FINISHED 		0x00000400 	///< Флаг готовности окончательной картинки (т.е. mglCanvas::G)
+#define MGL_USE_GMTIME		0x00000800 	///< Использовать gmtime вместо localtime
+#define MGL_SHOW_POS		0x00001000 	///< Включить показ координат щелчка мыши
+#define MGL_CLF_ON_UPD		0x00002000 	///< Очищать график перед Update()
+#define MGL_NOSUBTICKS		0x00004000 	///< Запретить рисование subticks для bounding box
+#define MGL_LOCAL_LIGHT		0x00008000 	///< Сохранять источники освещения в каждом inplot
+#define MGL_VECT_FRAME		0x00010000 	///< Использовать DrwDat для сохранения всех данных в кадрах
+#define MGL_REDUCEACC		0x00020000 	///< Сокращать точность вывода точек (для уменьшения размера выходных файлов)
+#define MGL_PREFERVC 		0x00040000 	///< Предпочитать цвета вершин вместо текстур если выходной формат поддерживает
+#define MGL_ONESIDED 		0x00080000 	///< Выводить только переднюю сторону поверхностей если выходной формат поддерживает
+#define MGL_NO_ORIGIN 		0x00100000 	///< Не рисовать метки в точке пересечения осей
+#define MGL_GRAY_MODE 		0x00200000 	///< Преобразовать все цвета в оттенки серого
+#define MGL_FULL_CURV 		0x00400000 	///< Запретить пропуск точек на прямолинейных участках
+#define MGL_NO_SCALE_REL 	0x00800000 	///< Запретить изменение размера текста в относительных inplots
+
+ +
+
Функция С: void mgl_bsize (unsigned bsize)
+

Задает размер буфера под примитивы как (1<<bsize)^2. Т.е. как 10^12 для bsize=20 или 4*10^9 для bsize=16 (по умолчанию). ВАЖНО: можно устанавливать только один раз вначале, до построения графиков. Возвращает текущее значение. +

+ + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.1 Прозрачность

+ + + + + + + +

Эти функции и переменные настраивают тип и степень прозрачности поверхностей. Главной является функция alpha, которая включает/выключает прозрачность для всего графика. Функция alphadef устанавливает величину alpha-канала по умолчанию. Наконец, функция transptype задает тип прозрачности. См. раздел Transparency and lighting, для примеров кода и графика. +

+
+
Команда MGL: alpha [val=on]
+
Метод класса mglGraph: void Alpha (bool enable)
+
Функция С: void mgl_set_alpha (HMGL gr, int enable)
+

Включает/выключает прозрачность и возвращает свое предыдущее состояние. По умолчанию прозрачность выключена. Функция включает прозрачность для всего рисунка. +

+ +
+
Команда MGL: alphadef val
+
Метод класса mglGraph: void SetAlphaDef (mreal val)
+
Функция С: void mgl_set_alpha_default (HMGL gr, mreal alpha)
+

Задает значение прозрачности по умолчанию для всех графиков. Значение по умолчанию 0.5. +

+ +
+
Команда MGL: transptype val
+
Метод класса mglGraph: void SetTranspType (int type)
+
Функция С: void mgl_set_transp_type (HMGL gr, int type)
+

Задает тип прозрачности. Допустимые значения: +

    +
  • Обычная прозрачность (‘0’) – "закрытые" объекты видны меньше чем закрывающие. Этот режим некорректно отображается в OpenGL (mglGraphGL) для нескольких перекрывающихся поверхностей. +
  • "Стеклянная" прозрачность (‘1’) – закрытые и закрывающие объекты единообразно ослабляют интенсивность света (по RGB каналам). +
  • "Ламповая" прозрачность (‘2’) – закрытые и закрывающие объекты являются источниками дополнительного освещения (рекомендую установить SetAlphaDef(0.3) или меньше в этом случае). +
+

См. раздел Types of transparency, для примеров кода и графика. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.2 Освещение

+ + + + + + +

Эти функции настраивают освещение графика. Главная функция light включает/выключает освещение графиков построенных после ее вызова (в OpenGL работает сразу для всего рисунка). MathGL поддерживает до 10 независимых источников света. Но в режиме OpenGL можно использовать только первые 8 из них. Положение, цвет, яркость каждого источника света можно задавать по отдельности. По умолчанию включен только первый (с порядковым номером 0) источник света белого цвета, расположенный сверху. См. раздел Lighting sample, для примеров кода и графика. +

+
+
Команда MGL: light [val=on]
+
Метод класса mglGraph: bool Light (bool enable)
+
Функция С: void mgl_set_light (HMGL gr, int enable)
+

Включает/выключает освещение графика и возвращает предыдущее состояние. По умолчанию освещение выключено. +

+ +
+
Команда MGL: light num val
+
Метод класса mglGraph: void Light (int n, bool enable)
+
Функция С: void mgl_set_light_n (HMGL gr, int n, int enable)
+

Включает/выключает n-ый источник света. +

+ +
+
Команда MGL: light num xdir ydir zdir ['col'='w' br=0.5 ap=0]
+
Команда MGL: light num xdir ydir zdir xpos ypos zpos ['col'='w' br=0.5]
+
Метод класса mglGraph: void AddLight (int n, mglPoint d, char c='w', mreal bright=0.5, mreal ap=0)
+
Метод класса mglGraph: void AddLight (int n, mglPoint r, mglPoint d, char c='w', mreal bright=0.5, mreal ap=0)
+
Функция С: void mgl_add_light (HMGL gr, int n, mreal dx, mreal dy, mreal dz)
+
Функция С: void mgl_add_light_ext (HMGL gr, int n, mreal dx, mreal dy, mreal dz, char c, mreal bright, mreal ap)
+
Функция С: void mgl_add_light_loc (HMGL gr, int n, mreal rx, mreal ry, mreal rz, mreal dx, mreal dy, mreal dz, char c, mreal bright, mreal ap)
+

Добавляет источник света с номером n в положение p с цветом c и яркостью bright, которая должна быть в диапазоне [0,1]. Если указано положение источника r и оно не NAN, то источник считается локальным, иначе источник полагается бесконечно удалённым (для более быстрого рисования). +

+ +
+
Команда MGL: diffuse val
+
Метод класса mglGraph: void SetDifLight (mreal bright)
+
Функция С: void mgl_set_difbr (HMGL gr, mreal bright)
+

Задает яркость диффузного освещения (только для локальных источников света). +

+ +
+
Команда MGL: ambient val
+
Метод класса mglGraph: void SetAmbient (mreal bright=0.5)
+
Функция С: void mgl_set_ambbr (HMGL gr, mreal bright)
+

Задает яркость рассеянного освещения. Значение должно быть в диапазоне [0,1]. +

+ +
+
Команда MGL: attachlight val
+
Метод класса mglGraph: void AttachLight (bool val)
+
Функция С: void mgl_set_attach_light (HMGL gr, int val)
+

Задает привязку настроек освещения к inplot/subplot. Отмечу, что OpenGL и некоторые выходные форматы не поддерживают эту возможность. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.3 Туман

+ + + +
+
Команда MGL: fog val [dz=0.25]
+
Метод класса mglGraph: void Fog (mreal d, mreal dz=0.25)
+
Функция С: void mgl_set_fog (HMGL gr, mreal d, mreal dz)
+

Имитирует туман на графике. Туман начинается на относительном расстоянии dz от точки обзора и его плотность растет экспоненциально вглубь по закону ~ 1-exp(-d*z). Здесь z – нормализованная на 1 глубина графика. Если d=0 то туман отсутствует. См. раздел Adding fog, для примеров кода и графика. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.4 Базовые размеры

+ + + + + + + + + + + +

Эти функции задают величины большинства параметров графика, включая размеры маркеров, стрелок, толщину линий и т.д. Как и любые другие настройки, они подействуют только на графики созданные после изменения настроек. +

+
+
Команда MGL: barwidth val
+
Метод класса mglGraph: void SetBarWidth ( mreal val)
+
Функция С: void mgl_set_bar_width (HMGL gr, mreal val)
+

Задает относительный размер прямоугольников в bars, barh, boxplot, candle. Значение по умолчанию 0.7. +

+ +
+
Команда MGL: marksize val
+
Метод класса mglGraph: void SetMarkSize (mreal val)
+
Функция С: void mgl_set_mark_size (HMGL gr, mreal val)
+

Задает размер маркеров для 1D plotting. Значение по умолчанию 1. +

+ +
+
Команда MGL: arrowsize val
+
Метод класса mglGraph: void SetArrowSize (mreal val)
+
Функция С: void mgl_set_arrow_size (HMGL gr, mreal val)
+

Задает размер стрелок для 1D plotting, линий и кривых (см. Primitives). Значение по умолчанию 1. +

+ +
+
Команда MGL: meshnum val
+
Метод класса mglGraph: void SetMeshNum (int val)
+
Функция С: void mgl_set_meshnum (HMGL gr, int num)
+

Задает ориентировочное число линий в mesh, fall, и число стрелок (штрихов) в vect, dew, и число ячеек в cloud, и число маркеров в plot, tens, step, mark, textmark. По умолчанию (=0) рисуются все линии, стрелки, ячейки и т.д. +

+ +
+
Команда MGL: facenum val
+
Метод класса mglGraph: void SetFaceNum (int val)
+
Функция С: void mgl_set_facenum (HMGL gr, int num)
+

Задает ориентировочное число видимых граней. Может быть использована для ускорения рисования за счет более грубого рисунка. По умолчанию (=0) рисуются все грани. +

+ +
+
Команда MGL: plotid 'id'
+
Метод класса mglGraph: void SetPlotId (const char *id)
+
Функция С: void mgl_set_plotid (HMGL gr, const char *id)
+

Задает имя графика для сохранения в файл (например, в окне FLTK). +

+ +
+
Метод класса mglGraph: const char * GetPlotId ()
+
Функция С: const char * mgl_get_plotid (HMGL gr)
+
Fortran процедура: mgl_get_plotid (long gr, char *out, int len)
+

Возвращает имя графика для сохранения в файл (например, в окне FLTK). +

+ +
+
Команда MGL: pendelta val
+
Метод класса mglGraph: void SetPenDelta (double val)
+
Функция С: void mgl_pen_delta (HMGL gr, double val)
+

Изменяет размытие около линий и текста (по умолчанию 1). Для val>1 текст и линии более резкие. Для val<1 текст и линии более размытые. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.5 Обрезание

+ + + + + + +

Эти функции задают условия когда точка будет исключена (вырезана) из рисования. Замечу, что все точки со значением(-ями) NAN по одной из координат или амплитуде автоматически исключаются из рисования. См. раздел Cutting sample, для примеров кода и графика. +

+
+
Команда MGL: cut val
+
Метод класса mglGraph: void SetCut (bool val)
+
Функция С: void mgl_set_cut (HMGL gr, int val)
+

Задает обрезание точек за пределами осей координат. Если true то такие точки исключаются из рисования (это по умолчанию) иначе они проецируются на ограничивающий прямоугольник. +

+ +
+
Команда MGL: cut x1 y1 z1 x2 y2 z2
+
Метод класса mglGraph: void SetCutBox (mglPoint p1, mglPoint p1)
+
Функция С: void mgl_set_cut_box (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2)
+

Задает границы параллелепипеда внутри которого точки не рисуются. Если границы одинаковы (переменные равны), то параллелепипеда считается пустым. +

+ +
+
Команда MGL: cut 'cond'
+
Метод класса mglGraph: void CutOff (const char *cond)
+
Функция С: void mgl_set_cutoff (HMGL gr, const char *cond)
+

Задает условие обрезания по формуле cond. Это условие исключает точки из рисования если результат вычисления формулы не равен нулю. Установите аргумент "" для выключения условия обрезания. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.6 Шрифты

+ + + + + + + + + + + + + +
+
Команда MGL: font 'fnt' [val=6]
+

Задает стиль и размер шрифта. Вначале используется ‘:rC’ – прямой шрифт с выравниванием по центру. По умолчанию размер подписей оси координат в 1.4 раза больше. См. также см. Font styles. +

+ +
+
Команда MGL: rotatetext val
+
Метод класса mglGraph: void SetRotatedText (bool val)
+
Функция С: void mgl_set_rotated_text (HMGL gr, int val)
+

Включает/выключает вращение меток и подписей осей координат вдоль оси. +

+ +
+
Команда MGL: scaletext val
+
Метод класса mglGraph: void SetScaleText (bool val)
+
Функция С: void mgl_set_scale_text (HMGL gr, int val)
+

Включает/выключает масштабирование текста в относительных inplot-ах (в том числе columnplot, gridplot, stickplot, shearplot). +

+ +
+
Команда MGL: loadfont ['name'='']
+
Метод класса mglGraph: void LoadFont (const char *name, const char *path="")
+
Функция С: void mgl_load_font (HMGL gr, const char *name, const char *path)
+

Загружает начертание шрифта из файла path/name. Пустая строка загрузит шрифт по умолчанию. +

+ +
+
Метод класса mglGraph: void SetFontDef (const char *fnt)
+
Функция С: void mgl_set_font_def (HMGL gr, const char * val)
+

Задает стиль шрифта (см. Text printing). По умолчанию используется ‘rC’ – прямой шрифт с выравниванием по центру. +

+ +
+
Метод класса mglGraph: void SetFontSize (mreal val)
+
Функция С: void mgl_set_font_size (HMGL gr, mreal val)
+

Задает базовый размер шрифта. По умолчанию размер подписей оси координат в 1.4 раза больше. +

+ +
+
Метод класса mglGraph: void SetFontSizePT (mreal cm, int dpi=72)
+

Задает размер шрифта в пунктах для заданного DPI (по умолчанию 16 pt для dpi=72). +

+
+
Метод класса mglGraph: inline void SetFontSizeCM (mreal cm, int dpi=72)
+

Задает размер шрифта в сантиметрах для заданного DPI (по умолчанию 0.56 см = 16 pt). +

+
+
Метод класса mglGraph: inline void SetFontSizeIN (mreal cm, int dpi=72)
+

Задает размер шрифта в дюймах для заданного DPI (по умолчанию 0.22 in = 16 pt). +

+ +
+
Метод класса mglGraph: void CopyFont (mglGraph * from)
+
Функция С: void mgl_copy_font (HMGL gr, HMGL gr_from)
+

Копирует начертание шрифта из другого объекта mglGraph. +

+ +
+
Метод класса mglGraph: void RestoreFont ()
+
Функция С: void mgl_restore_font (HMGL gr)
+

Восстанавливает начертание шрифта по умолчанию. +

+ +
+
Метод класса mglGraph: void SetDefFont (const char *name, const char *path="") static
+
Функция С: void mgl_def_font (const char *name, const char *path)
+

Загружает начертание шрифта по умолчанию (для всех вновь создаваемых HMGL/mglGraph объектов) из файла path/name. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.7 Палитра и цвета

+ + + + +
+
Команда MGL: palette 'colors'
+
Метод класса mglGraph: void SetPalette (const char *colors)
+
Функция С: void mgl_set_palette (HMGL gr, const char *colors)
+

Задает палитру как последовательность цветов. Значение по умолчанию "Hbgrcmyhlnqeup", что соответствует цветам: темно серый ‘H’, синий ‘b’, зелёный ‘g’, красный ‘r’, голубой ‘c’, малиновый ‘m’, жёлтый ‘y’, серый ‘h’, сине-зелёный ‘l’, небесно-голубой ‘n’, оранжевый ‘q’, желто-зелёный ‘e’, сине-фиолетовый ‘u’, фиолетовый ‘p’. Палитра в основном используется в 1D графиках (см. 1D plotting) для кривых с неопределённым стилем линии. Внутренний счетчик цвета будет сброшен при любом изменении палитры, включая скрытые (например, функциями box или axis). +

+ +
+
Метод класса mglGraph: void SetDefScheme (const char *sch)
+
Функция С: void mgl_set_def_sch (HMGL gr, const char *sch)
+

Устанавливает sch в качестве цветовой схемы по умолчанию. Начальное значение "BbcyrR". +

+ +
+
Метод класса mglGraph: void SetColor (char id, mreal r, mreal g, mreal b) static
+
Функция С: void mgl_set_color (char id, mreal r, mreal g, mreal b)
+

Задает RGB значения для цвета с заданным id. Изменения действуют глобально для всех последующих использований данного id. +

+ +
+
Команда MGL: gray [val=on]
+
Метод класса mglGraph: void Gray (bool enable)
+
Функция С: void mgl_set_gray (HMGL gr, int enable)
+

Включает/выключает вывод графика в оттенках серого. +

+ + +
+ + + +

4.2.8 Маски

+ + + + +
+
Команда MGL: mask 'id' 'hex' [angle]
+
Команда MGL: mask 'id' hex [angle]
+
Метод класса mglGraph: void SetMask (char id, const char *hex)
+
Метод класса mglGraph: void SetMask (char id, uint64_t hex)
+
Функция С: void mgl_set_mask (HMGL gr, const char *hex)
+
Функция С: void mgl_set_mask_val (HMGL gr, uint64_t hex)
+

Задает новую матрицу hex размером 8*8 для маски с заданным id. Изменения действуют глобально для всех последующих использований данного id. Значения по умолчанию (см. Color scheme): ‘-’ – 000000FF00000000, ‘+’ – 080808FF08080808, ‘=’ – 0000FF00FF000000, ‘;’ – 0000007700000000, ‘o’ – 0000182424180000, ‘O’ – 0000183C3C180000, ‘s’ – 00003C24243C0000, ‘S’ – 00003C3C3C3C0000, ‘~’ – 0000060990600000, ‘<’ – 0060584658600000, ‘>’ – 00061A621A060000, ‘j’ – 0000005F00000000, ‘d’ – 0008142214080000, ‘D’ – 00081C3E1C080000, ‘*’ – 8142241818244281, ‘^’ – 0000001824420000. Параметр angle позволяет сразу задать и угол поворота маски. ВАЖНО: при экспорте в EPS угол поворота будет приведен к ближайшему кратному 45 градусам. +

+

Задает новую матрицу hex размером 8*8 для маски с заданным id. Изменения действуют глобально для всех последующих использований данного id. Значения по умолчанию (см. Color scheme): ‘-’ – линии (0x000000FF00000000), ‘+’ – клетки (080808FF08080808), ‘=’ – двойные линии (0000FF00FF000000), ‘;’ – пунктир (0x0000000F00000000), ‘o’ – окружкости (0000182424180000), ‘O’ – круги (0000183C3C180000), ‘s’ – квадраты (00003C24243C0000), ‘S’ – закрашенные квадраты (00003C3C3C3C0000), ‘~’ – волны (0000060990600000), ‘<’ – треугольники влево (0060584658600000), ‘>’ – треугольники вправо (00061A621A060000), ‘j’ пунктир с точками (0000002700000000), ‘d’ плюсы (0x0008083E08080000), ‘D’ – стежки (0x0139010010931000), ‘*’ – точки (0x0000001818000000), ‘^’ – кирпичи (0x101010FF010101FF). Параметр angle позволяет сразу задать и угол поворота маски. ВАЖНО: при экспорте в EPS угол поворота будет приведен к ближайшему кратному 45 градусам. +

+ +
+
Команда MGL: mask angle
+
Метод класса mglGraph: void SetMaskAngle (int angle)
+
Функция С: void mgl_set_mask_angle (HMGL gr, int angle)
+

Задает угол поворота маски в градусах. Отмечу, что символы ‘\’, ‘/’, ‘I’ в цветовой схеме задают угол поворота в 45, -45 и 90 градусов соответственно. ВАЖНО: при экспорте в EPS угол поворота будет приведен к ближайшему кратному 45 градусам. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.9 Обработка ошибок

+ + + + + +

Обычно вы должны сбросить признак ошибки с помощью SetWarn(0); перед построением и проверить GetWarnCode() или Message() на наличие ошибок после построения. Только последнее предупреждение сохраняется. Замечу, что все предупреждения/ошибки в MathGL не являются критичными – в худшем из вариантов соответствующий график просто не будет построен. По умолчанию, все предупреждения выводятся в stderr. Этот вывод можно выключить вызовом mgl_suppress_warn(true);. +

+
+
Метод класса mglGraph: void SetWarn (int code, const char *info="")
+
Функция С: void mgl_set_warn (HMGL gr, int code, const char *info)
+

Задает код предупреждения. Обычно вызывается только для очистки предупреждений (SetWarn(0);) или внутри библиотеки. Текст info будет добавлен к предупреждениям как есть при code<0. +

+ +
+
Метод класса mglGraph: const char *Message ()
+
Функция С: const char *mgl_get_mess (HMGL gr)
+
Fortran процедура: mgl_get_mess (long gr, char *out, int len)
+

Возвращает текст предупреждений о причине отсутствия графика. Если возвращаемая строка пустая, то сообщений нет. +

+ +
+
Метод класса mglGraph: int GetWarn ()
+
Функция С: int mgl_get_warn (HMGL gr)
+

Возвращает код сообщения о причине отсутствия графика. Возможные значения: +

+
mglWarnNone=0
+

Предупреждений нет +

+
mglWarnDim
+

Неправильные или несовместимые размеры данных +

+
mglWarnLow
+

Размеры данных слишком малы +

+
mglWarnNeg
+

Минимальное значение отрицательно +

+
mglWarnFile
+

Файл не найден или указаны неправильные размерности +

+
mglWarnMem
+

Не достаточно памяти +

+
mglWarnZero
+

Значение данных равно нулю +

+
mglWarnLeg
+

Нет записей в легенде +

+
mglWarnSlc
+

Индекс среза вне данных +

+
mglWarnCnt
+

Число линий уровня меньше или равно нулю +

+
mglWarnOpen
+

Не могу открыть файл +

+
mglWarnLId
+

Light: ID вне допустимых значений +

+
mglWarnSize
+

Setsize: размер(ы) равны нулю или отрицательны +

+
mglWarnFmt
+

Формат не поддерживается +

+
mglWarnTern
+

Диапазоны осей несовместимые +

+
mglWarnNull
+

Указатель равен NULL +

+
mglWarnSpc
+

Не хватает места для графика +

+
mglScrArg
+

Неправильные аргументы команды скрипта MGL +

+
mglScrCmd
+

Неправильная команда в скрипте MGL +

+
mglScrLong
+

Слишком длинная строка в скрипте MGL +

+
mglScrStr
+

Одиночная ’ в скрипте MGL +

+
mglScrTemp
+

Изменяется временная переменная в MGL скрипте +

+
+
+ +
+
Метод класса mglGraph: void SuppressWarn (bool state) static
+
Функция С: void mgl_suppress_warn (int state)
+

Выключает вывод предупреждений в stderr если state не ноль. +

+ +
+
Метод класса mglGraph: void SetGlobalWarn (const char *info) static
+
Функция С: void mgl_set_global_warn (const char *info)
+

Задает предупреждение info, не привязанное к конкретному объекту рисования. +

+ +
+
Метод класса mglGraph: const char * GlobalWarn () static
+
Функция С: const char * mgl_get_global_warn ()
+

Возвращает предупреждения, не привязанные к конкретному объекту рисования. +

+ + + + +
+ +
+

+Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

4.2.10 Остановка рисования

+ + + + + +
+
Метод класса mglGraph: void Stop (bool stop=true)
+
Функция С only: void mgl_ask_stop (HMGL gr, int stop)
+

Просит остановить рисование если stop не ноль, иначе сбрасывает флаг остановки. +

+ +
+
Метод класса mglGraph: bool NeedStop ()
+
Функция С only: void mgl_need_stop (HMGL gr)
+

Возвращает true если рисование должно быть остановлено. Также запускает обработку всех отложенных событий в GUI. Пользователь должен вызывать эту функцию время от времени внутри долгих вычислений для плавности отклика GUI. +

+ +
+
Метод класса mglGraph: bool SetEventFunc (void (*func)(void *), void *par=NULL)
+
Функция С only: void mgl_set_event_func (HMGL gr, void (*func)(void *), void *par)
+

Задает функцию, которая будет вызвана для обработки событий в GUI библиотеке. +

+ + + + +
+ + + +

4.3 Настройки осей координат

+ + +

Эти функции управляет видом и масштабом осей координат. Перед построением для каждой точки выполняются 3 преобразования: сначала определяется возможность рисования точки (см. Cutting), далее применяются формулы перехода к криволинейным координатам и наконец точка отображается. Отмечу, что MathGL выдает предупреждение если масштабы осей координат лежат вне области определения формул преобразования координат. +

+ + + + + + + +
+ + + +

4.3.1 Масштаб осей координат

+ + + + + + + + + + + +
+
Команда MGL: xrange v1 v2 [add=off]
+
Команда MGL: yrange v1 v2 [add=off]
+
Команда MGL: zrange v1 v2 [add=off]
+
Команда MGL: crange v1 v2 [add=off]
+
Метод класса mglGraph: void SetRange (char dir, mreal v1, mreal v2)
+
Метод класса mglGraph: void AddRange (char dir, mreal v1, mreal v2)
+
Функция С: void mgl_set_range_val (HMGL gr, char dir, mreal v1, mreal v2)
+
Функция С: void mgl_add_range_val (HMGL gr, char dir, mreal v1, mreal v2)
+

Задает диапазон изменения ‘x’-,‘y’-,‘z’-,‘c’-координат. Если одно из значений равно NAN, то оно игнорируется. Параметр add=on указывает добавлять новый диапазон к существующему (не заменять его). См. также ranges. +

+ +
+
Команда MGL: xrange dat [add=off]
+
Команда MGL: yrange dat [add=off]
+
Команда MGL: zrange dat [add=off]
+
Команда MGL: crange dat [add=off]
+
Метод класса mglGraph: void SetRange (char dir, const mglDataA &dat, bool add=false)
+
Функция С: void mgl_set_range_dat (HMGL gr, char dir, const HCDT a, int add)
+

Задает диапазон изменения ‘x’-,‘y’-,‘z’-,‘c’-координат как минимальное и максимальное значение массива dat. Параметр add=on указывает добавлять новый диапазон к существующему (не заменять его). +

+ +
+
Команда MGL: ranges x1 x2 y1 y2 [z1=0 z2=0]
+
Метод класса mglGraph: void SetRanges (mglPoint p1, mglPoint p2)
+
Метод класса mglGraph: void SetRanges (mreal x1, mreal x2, mreal y1, mreal y2, mreal z1=0, mreal z2=0)
+
Функция С: void mgl_set_ranges (HMGL gr, mreal x1, mreal x2, mreal y1, mreal y2, mreal z1, mreal z2)
+

Задает диапазон изменения координат. Если минимальное и максимальное значение координаты равны, то они игнорируются по данному направлению. Также устанавливает размер цветовой шкалы, аналогично команде crange z1 z2. Начальные диапазоны равны [-1, 1]. +

+ +
+
Команда MGL: ranges xx yy [zz cc=zz]
+
Метод класса mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy)
+
Метод класса mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz)
+
Метод класса mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz, const mglDataA &cc)
+

Задает диапазон изменения ‘x’-,‘y’-,‘z’-,‘c’-координат как минимальное и максимальное значение массивов xx, yy, zz, cc соответственно. +

+ +
+
Метод класса mglGraph: void SetAutoRanges (mglPoint p1, mglPoint p2)
+
Метод класса mglGraph: void SetAutoRanges (double x1, double x2, double y1, double y2, double z1=0, double z2=0, double c1=0, double c2=0)
+
Функция С: void mgl_set_auto_ranges (HMGL gr, double x1, double x2, double y1, double y2, double z1, double z2, double z1, double z2)
+

Задает диапазон изменения координат для автоматических переменных. Если минимальное и максимальное значение координаты равны, то они игнорируются по данному направлению. +

+ +
+
Команда MGL: origin x0 y0 [z0=nan]
+
Метод класса mglGraph: void SetOrigin (mglPoint p0)
+
Метод класса mglGraph: void SetOrigin (mreal x0, mreal y0, mreal z0=NAN)
+
Функция С: void mgl_set_origin (HMGL gr, mreal x0, mreal y0, mreal z0)
+

Задает центр пересечения осей координат. Если одно из значений равно NAN, то MathGL попытается выбрать оптимальное положение осей координат по этому направлению. +

+ +
+
Команда MGL: zoomaxis x1 x2
+
Команда MGL: zoomaxis x1 y1 x2 y2
+
Команда MGL: zoomaxis x1 y1 z1 x2 y2 z2
+
Команда MGL: zoomaxis x1 y1 z1 c1 x2 y2 z2 c2
+
Метод класса mglGraph: void ZoomAxis (mglPoint p1, mglPoint p2)
+
Функция С: void mgl_zoom_axis (HMGL gr, mreal x1, mreal y1, mreal z1, mreal c1, mreal x2, mreal y2, mreal z2, mreal c2)
+

Дополнительно расширяет диапазон осей координат, задаваемый функциями SetRange или SetRanges, в соответствии с формулами min += (max-min)*p1 и max += (max-min)*p1 (или min *= (max/min)^p1 и max *= (max/min)^p1 для "логарифмических" диапазонов, когда inf>max/min>100 или 0<max/min<0.01). Начальные значения [0, 1]. Внимание! эти настройки не могут быть переписаны никакими другими функциями, включая DefaultPlotParam(). +

+ + + +
+ +
+

+Next: , Previous: , Up: Axis settings   [Contents][Index]

+
+ +

4.3.2 Криволинейные координаты

+ + + + + + +
+
Команда MGL: axis 'fx' 'fy' 'fz' ['fa'='']
+
Метод класса mglGraph: void SetFunc (const char *EqX, const char *EqY, const char *EqZ="", const char *EqA="")
+
Функция С: void mgl_set_func (HMGL gr, const char *EqX, const char *EqY, const char *EqZ, const char *EqA)
+

Задает формулы перехода к криволинейным координатам. Каждая строка является математическим выражением, зависящим от старых координат ‘x’, ‘y’, ‘z’ и ‘a’ или ‘c’ для цветовой шкалы. Например, для цилиндрических координат будет SetFunc("x*cos(y)", "x*sin(y)", "z");. Для удаления формул соответствующий параметр должен быть пустым или NULL. Использование формул преобразования слегка замедляет программу. Параметр EqA задает аналогичную формулу для цветовой шкалы. See Textual formulas. +

+ +
+
Команда MGL: axis how
+
Метод класса mglGraph: void SetCoor (int how)
+
Функция С: void mgl_set_coor (HMGL gr, int how)
+

Устанавливает одну из предопределенных систем криволинейных координат в зависимости от параметра how: +

+
mglCartesian=0
+

декартова система (нет преобразования координат, {x,y,z}); +

+
mglPolar=1
+

полярные координаты: {x*cos(y),x*sin(y), z}; +

+
mglSpherical=2
+

сферические координаты: {x*sin(y)*cos(z), x*sin(y)*sin(z), x*cos(y)}; +

+
mglParabolic=3
+

параболические координаты: {x*y, (x*x-y*y)/2, z}; +

+
mglParaboloidal=4
+

Paraboloidal coordinates: {(x*x-y*y)*cos(z)/2, (x*x-y*y)*sin(z)/2, x*y}; +

+
mglOblate=5
+

Oblate coordinates: {cosh(x)*cos(y)*cos(z), cosh(x)*cos(y)*sin(z), sinh(x)*sin(y)}; +

+
mglProlate=6
+

Prolate coordinates: {sinh(x)*sin(y)*cos(z), sinh(x)*sin(y)*sin(z), cosh(x)*cos(y)}; +

+
mglElliptic=7
+

эллиптические координаты: {cosh(x)*cos(y), sinh(x)*sin(y), z}; +

+
mglToroidal=8
+

тороидальные координаты: {sinh(x)*cos(z)/(cosh(x)-cos(y)), sinh(x)*sin(z)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y))}; +

+
mglBispherical=9
+

бисферические координаты: {sin(y)*cos(z)/(cosh(x)-cos(y)), sin(y)*sin(z)/(cosh(x)-cos(y)), sinh(x)/(cosh(x)-cos(y))}; +

+
mglBipolar=10
+

биполярные координаты: {sinh(x)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y)), z}; +

+
mglLogLog=11
+

Log-log координаты: {lg(x), lg(y), lg(z)}; +

+
mglLogX=12
+

Log-x координаты: {lg(x), y, z}; +

+
mglLogY=13
+

Log-y координаты: {x, lg(y), z}. +

+
+
+ +
+
Команда MGL: ternary val
+
Метод класса mglGraph: void Ternary (int tern)
+
Функция С: void mgl_set_ternary (HMGL gr, int tern)
+

Задает рисование треугольных (Ternary, tern=1), пирамидальных (Quaternary, tern=2) осей координат и проекций осей координат (tern=4,5,6). +

+

Ternary – специальный тип графика для 3 зависимых координат (компонент) a, b, c таких, что a+b+c=1. MathGL использует только 2 независимые координаты a=x и b=y поскольку их достаточно для построения всех графиков. При этом третья координата z является независимым параметром для построения линий уровня, поверхностей и т.д. +

+

Соответственно Quaternary координаты – 4 зависимые координаты a, b, c и d, такие что a+b+c+d=1. MathGL использует только 2 независимые координаты a=x, b=y и d=z поскольку их достаточно для построения всех графиков. +

+

Проекции строятся если к переменной tern добавить число 4. Так что tern=4 нарисует проекции в декартовых координатах, tern=5 нарисует проекции в треугольных координатах, tern=6 нарисует проекции в пирамидальных координатах. Если добавить 8 вместо 4, то текст не будет выводиться на проекциях. +

+

Используйте Ternary(0) для возвращения к привычным координатам. См. раздел Ternary axis, для примеров кода и графика. См. раздел Axis projection, для примеров кода и графика. +

+ + +
+ +
+

+Previous: , Up: Axis settings   [Contents][Index]

+
+ +

4.3.3 Метки осей

+ + + + + + + + + + + + + + + + + + + + +
+
Команда MGL: adjust ['dir'='xyzc']
+
Метод класса mglGraph: void Adjust (const char *dir="xyzc")
+
Функция С: void mgl_adjust_ticks (HMGL gr, const char *dir)
+

Автоматически задает шаг меток осей, число подметок и начальное положение меток для осей координат dir в виде наиболее удобном для человека. Также задает SetTuneTicks(true). Обычно не требуется вызывать эту функцию кроме случая возвращения настроек по умолчанию. +

+ +
+
Команда MGL: xtick val [sub=0 org=nan 'fact'='']
+
Команда MGL: ytick val [sub=0 org=nan 'fact'='']
+
Команда MGL: ztick val [sub=0 org=nan 'fact'='']
+
Команда MGL: xtick val sub ['fact'='']
+
Команда MGL: ytick val sub ['fact'='']
+
Команда MGL: ztick val sub ['fact'='']
+
Команда MGL: ctick val ['fact'='']
+
Метод класса mglGraph: void SetTicks (char dir, mreal d=0, int ns=0, mreal org=NAN, const char *fact="")
+
Метод класса mglGraph: void SetTicks (char dir, mreal d=0, int ns=0, mreal org=NAN, const wchar_t *fact)
+
Функция С: void mgl_set_ticks (HMGL gr, char dir, mreal d, int ns, mreal org)
+
Функция С: void mgl_set_ticks_fact (HMGL gr, char dir, mreal d, int ns, mreal org, const char *fact)
+
Функция С: void mgl_set_ticks_factw (HMGL gr, char dir, mreal d, int ns, mreal org, const wchar_t * fact)
+

Задает шаг меток осей d, число подметок ns и начальное положение меток org для оси вдоль направления dir (используйте ’c’ для меток colorbar). Переменная d задает шаг меток (если положительна) или их число на оси (если отрицательна). Нулевое значение задает автоматическую расстановку меток. Если org=NAN, то используется значение из переменной Org. Параметр fact задает текст, которые будет напечатан после метки оси (например, "\pi" для d=M_PI). +

+ +
+
Команда MGL: xtick val1 'lbl1' [val2 'lbl2' ...]
+
Команда MGL: ytick val1 'lbl1' [val2 'lbl2' ...]
+
Команда MGL: ztick val1 'lbl1' [val2 'lbl2' ...]
+
Команда MGL: ctick val1 'lbl1' [val2 'lbl2' ...]
+
Команда MGL: xtick vdat 'lbls' [add=off]
+
Команда MGL: ytick vdat 'lbls' [add=off]
+
Команда MGL: ztick vdat 'lbls' [add=off]
+
Команда MGL: ctick vdat 'lbls' [add=off]
+
Метод класса mglGraph: void SetTicksVal (char dir, const char *lbl, bool add=false)
+
Метод класса mglGraph: void SetTicksVal (char dir, const wchar_t *lbl, bool add=false)
+
Метод класса mglGraph: void SetTicksVal (char dir, const mglDataA &val, const char *lbl, bool add=false)
+
Метод класса mglGraph: void SetTicksVal (char dir, const mglDataA &val, const wchar_t *lbl, bool add=false)
+
Функция С: void mgl_set_ticks_str (HMGL gr, char dir, const char *lbl, bool add)
+
Функция С: void mgl_set_ticks_wcs (HMGL gr, char dir, const wchar_t *lbl, bool add)
+
Функция С: void mgl_set_ticks_val (HMGL gr, char dir, HCDT val, const char *lbl, bool add)
+
Функция С: void mgl_set_ticks_valw (HMGL gr, char dir, HCDT val, const wchar_t *lbl, bool add)
+

Задает явное положение val и подписи lbl для меток вдоль оси dir. Если массив val не указан, то используются значения равно распределённые в диапазоне осей координат. Метки разделяются символом ‘\n’. Если в команде MGL задано только одно значение, то метка будет добавлена к существующим меткам. Используйте SetTicks() для восстановления автоматических меток. +

+ +
+
Метод класса mglGraph: void AddTick (char dir, double val, const char *lbl)
+
Метод класса mglGraph: void AddTick (char dir, double val, const wchar_t *lbl)
+
Функция С: void mgl_add_tick (HMGL gr, char dir, double val, const char *lbl)
+
Функция С: void mgl_set_tickw (HMGL gr, char dir, double val, const wchar_t *lbl)
+

Аналогично предыдущему, но добавляет одну метку оси к списку существующих меток. +

+ +
+
Команда MGL: xtick 'templ'
+
Команда MGL: ytick 'templ'
+
Команда MGL: ztick 'templ'
+
Команда MGL: ctick 'templ'
+
Метод класса mglGraph: void SetTickTempl (char dir, const char *templ)
+
Метод класса mglGraph: void SetTickTempl (char dir, const wchar_t *templ)
+
Функция С: void mgl_set_tick_templ (HMGL gr, const char *templ)
+
Функция С: void mgl_set_tick_templw (HMGL gr, const wchar_t *templ)
+

Задает шаблон templ для меток вдоль x-,y-,z-оси или colorbar. Шаблон может содержать и символы TeX. Если templ="", то используется шаблон по умолчанию (в простейшем случае ‘%.2g’). Если шаблон начинается с символа ‘&’, то будет использовано целое long вместо типа double. Установка шаблона выключает автоматическое улучшение вида меток. +

+ +
+
Команда MGL: ticktime 'dir' [dv=0 'tmpl'='']
+
Метод класса mglGraph: void SetTicksTime (char dir, mreal val, const char *templ)
+
Функция С: void mgl_set_ticks_time (HMGL gr, mreal val, const char *templ)
+

Задает метки времени с шагом val и шаблоном templ для меток вдоль x-,y-,z-оси или colorbar. Шаблон может содержать и символы TeX. Формат шаблона templ такой же как http://www.manpagez.com/man/3/strftime/. Наиболее употребительные варианты: ‘%X’ для национального представления времени, ‘%x’ для национального представления даты, ‘%Y’ для года с цифрами столетия. Если val=0 и/или templ="", то используется автоматическая расстановка меток и/или выбор шаблона. Вы можете использовать функцию mgl_get_time() для получения числа секунд с 1970 года до указанной даты/времени. Отмечу, что MS Visual Studio не может обрабатывать даты до 1970. +

+ +
+
Функция С: double mgl_get_time (const char*str, const char *templ)
+

Возвращает число секунд с 1970 года до даты/времени, указанной в строке str. Формат строки задается templ, такой же как http://www.manpagez.com/man/3/strftime/. Наиболее употребительные варианты: ‘%X’ для национального представления времени, ‘%x’ для национального представления даты, ‘%Y’ для года с цифрами столетия. Отмечу, что MS Visual Studio не может обрабатывать даты до 1970. +

+ +
+
Команда MGL: tuneticks val [pos=1.15]
+
Метод класса mglGraph: void SetTuneTicks (int tune, mreal pos=1.15)
+
Функция С: void mgl_tune_ticks (HMGL gr, int tune, mreal pos)
+

Включает/выключает улучшение вида меток осей путем вынесения общего множителя (для маленьких, типа 0.001...0.002, или больших, типа 1000...2000, значений координат) или общей компоненты (для узкого диапазона, типа 0.999...1.000). Также задает положение pos общего множителя на оси: =0 около минимального значения, =1 около максимального значения. +

+ +
+
Команда MGL: tickshift dx [dy=0 dz=0 dc=0]
+
Метод класса mglGraph: void SetTickShift (mglPoint d)
+
Функция С: void mgl_set_tick_shift (HMGL gr, mreal dx, mreal dy, mreal dz, mreal dc)
+

Задает значение дополнительного сдвига меток осей координат. +

+ + +
+
Метод класса mglGraph: void SetTickRotate (bool val)
+
Функция С: void mgl_set_tick_rotate (HMGL gr, bool val)
+

Включает/выключает поворот меток если их число или длина меток слишком велики. +

+ +
+
Метод класса mglGraph: void SetTickSkip (bool val)
+
Функция С: void mgl_set_tick_skip (HMGL gr, bool val)
+

Включает/выключает пропуск меток если их число или длина меток слишком велики. +

+ +
+
Метод класса mglGraph: void SetTimeUTC (bool val)
+

Разрешает/запрещает использование UTC времени в метках осей координат. В C/Fortran следует использовать mgl_set_flag(gr,val, MGL_USE_GMTIME);. +

+ + +
+
Команда MGL: origintick val
+
Метод класса mglGraph: void SetOriginTick (bool val=true)
+

Разрешает/запрещает рисование меток в точке пересечения осей координат. В C/Fortran следует использовать mgl_set_flag(gr,val, MGL_NO_ORIGIN);. +

+ +
+
Команда MGL: ticklen val [stt=1]
+
Метод класса mglGraph: void SetTickLen (mreal val, mreal stt=1)
+
Функция С: void mgl_set_tick_len (HMGL gr, mreal val, mreal stt)
+

Задает относительную длину меток осей координат. Значение по умолчанию 0.1. Параметр stt>0 задает относительную длину подметок, которые в sqrt(1+stt) раз меньше. +

+ +
+
Команда MGL: axisstl 'stl' ['tck'='' 'sub'='']
+
Метод класса mglGraph: void SetAxisStl (const char *stl="k", const char *tck=0, const char *sub=0)
+
Функция С: void mgl_set_axis_stl (HMGL gr, const char *stl, const char *tck, const char *sub)
+

Задает стиль осей (stl), меток (tck) и подметок (sub) осей координат. Если stl пустая или ноль, то используется стиль по умолчанию (‘k’ или ‘w’ в зависимости от типа прозрачности). Если tck, sub пустая или ноль, то используется стиль осей (т.е. stl). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.4 Матрица преобразования

+ + + + + + + + + + + + + + + +

Эти функции контролируют где и как график будет расположен. Существует определенный порядок вызова этих функций для лучшего вида графика. Вначале должны вызываться функции subplot, multiplot или inplot для указания местоположения вывода. После них – функции вращения rotate, shear и aspect. И наконец любые другие функции для рисования графика. Вместо вращения графика можно вызвать функцию columnplot, gridplot, stickplot, shearplot или относительную inplot для расположения графиков в столбец одного над другим без зазора между осями. См. раздел Subplots, для примеров кода и графика. +

+
+
Команда MGL: subplot nx ny m ['stl'='<>_^' dx=0 dy=0]
+
Метод класса mglGraph: void SubPlot (int nx, int ny, int m, const char *stl="<>_^", mreal dx=0, mreal dy=0)
+
Функция С: void mgl_subplot (HMGL gr, int nx, int ny, int m, const char *stl)
+
Функция С: void mgl_subplot_d (HMGL gr, int nx, int ny, int m, const char *stl, mreal dx, mreal dy)
+

Помещает последующий вывод в m-ую ячейку сетки размером nx*ny от всего рисунка. Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться первой для создания "подграфика". С эстетической точки зрения не рекомендуется вызывать эту функцию с различными (или не кратными) размерами сетки. Дополнительное место для осей/colorbar резервируется только если строка stl содержит: +

    +
  • L’ или ‘<’ – с левого края, +
  • R’ или ‘>’ – с правого края, +
  • A’ или ‘^’ – с верхнего края, +
  • U’ или ‘_’ – с нижнего края, +
  • #’ – место резервироваться не будет – оси координат будут занимать все доступное пространство. +
+

Ячейка может быть дополнительно сдвинута относительно своего обычного положения на относительный размер dx, dy. Отмечу, что colorbar может находиться за пределами рисунка если выбран пустой стиль ‘’. +

+ +
+
Команда MGL: multiplot nx ny m dx dy ['style'='<>_^' sx sy]
+
Метод класса mglGraph: void MultiPlot (int nx, int ny, int m, int dx, int dy, const char *stl="<>_^")
+
Функция С: void mgl_multiplot (HMGL gr, int nx, int ny, int m, int dx, int dy, const char *stl)
+

Помещает последующий вывод в прямоугольник из dx*dy ячеек, начиная с m-ой ячейки, сетки размером nx*ny от всего рисунка. Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться первой для создания "подграфика". Дополнительное место для осей/colorbar резервируется если строка stl содержит: +

    +
  • L’ или ‘<’ – с левого края, +
  • R’ или ‘>’ – с правого края, +
  • A’ или ‘^’ – с верхнего края, +
  • U’ или ‘_’ – с нижнего края, +
  • #’ – место резервироваться не будет – оси координат будут занимать все доступное пространство. +
+

Область вывода может быть дополнительно сдвинута относительно своего обычного положения на относительный размер sx, sy. +

+ +
+
Команда MGL: inplot x1 x2 y1 y2 [rel=on]
+
Метод класса mglGraph: void InPlot (mreal x1, mreal x2, mreal y1, mreal y2, bool rel=true)
+
Функция С: void mgl_inplot (HMGL gr, mreal x1, mreal x2, mreal y1, mreal y2)
+
Функция С: void mgl_relplot (HMGL gr, mreal x1, mreal x2, mreal y1, mreal y2)
+

Помещает последующий вывод в прямоугольную область [x1, x2]*[y1, y2] (исходный размер [0,1]*[0,1]). Эта функция позволяет поместить график в произвольную область рисунка. Если параметр rel=true, то используется позиция относительно текущего subplot (или inplot с rel=false). Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться первой для создания "подграфика". +

+ +
+
Команда MGL: columnplot num ind [d=0]
+
Метод класса mglGraph: void ColumnPlot (int num, int ind, mreal d=0)
+
Функция С: void mgl_columnplot (HMGL gr, int num, int ind)
+
Функция С: void mgl_columnplot_d (HMGL gr, int num, int ind, mreal d)
+

Помещает последующий вывод в ind-ую строку столбца из num строк. Положение столбца выбирается относительно последнего вызова subplot (или inplot с rel=false). Параметр d задает дополнительный зазор между строк. +

+ +
+
Команда MGL: gridplot nx ny ind [d=0]
+
Метод класса mglGraph: void GridPlot (int nx, int ny, int ind, mreal d=0)
+
Функция С: void mgl_gridplot (HMGL gr, int nx, int ny, int ind)
+
Функция С: void mgl_gridplot_d (HMGL gr, int nx, int ny, int ind, mreal d)
+

Помещает последующий вывод в ind-ую ячейку таблицы nx*ny. Положение ячейки выбирается относительно последнего вызова subplot (или inplot с rel=false). Параметр d задает дополнительный зазор между ячеек. +

+ +
+
Команда MGL: stickplot num ind tet phi
+
Метод класса mglGraph: void StickPlot (int num, int ind, mreal tet, mreal phi)
+
Функция С: void mgl_stickplot (HMGL gr, int num, int ind, mreal tet, mreal phi)
+

Помещает последующий вывод в ind-ую ячейку "бруска" из num ячеек. При этом сам брусок повернут на углы tet, phi. Положение выбирается относительно последнего вызова subplot (или inplot с rel=false). +

+ +
+
Команда MGL: shearplot num ind sx sy [xd yd]
+
Метод класса mglGraph: void ShearPlot (int num, int ind, mreal sx, mreal sy, mreal xd=1, mreal yd=0)
+
Функция С: void mgl_shearplot (HMGL gr, int num, int ind, mreal sx, mreal sy, mreal xd, mreal yd)
+

Помещает последующий вывод в ind-ую ячейку "бруска" из num ячеек. При этом сама ячейка скошена на sx, sy. Направление бруска задается переменными xd и yd. Положение выбирается относительно последнего вызова subplot (или inplot с rel=false). +

+ +
+
Команда MGL: title 'title' ['stl'='' size=-2]
+
Метод класса mglGraph: void Title (const char *txt, const char *stl="", mreal size=-2)
+
Метод класса mglGraph: void Title (const wchar_t *txt, const char *stl="", mreal size=-2)
+
Функция С: void mgl_title (HMGL gr, const char *txt, const char *stl, mreal size)
+
Функция С: void mgl_titlew (HMGL gr, const wchar_t *txt, const char *stl, mreal size)
+

Выводит заголовок title для текущего "подграфика" шрифтом stl с размером size. Если строка stl содержит ‘#’, то рисуется обрамляющий прямоугольник. Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться сразу после создания "подграфика". +

+ +
+
Команда MGL: rotate tetx tetz [tety=0]
+
Метод класса mglGraph: void Rotate (mreal TetX, mreal TetZ, mreal TetY=0)
+
Функция С: void mgl_rotate (HMGL gr, mreal TetX, mreal TetZ, mreal TetY)
+

Вращает систему координат относительно осей {x, z, y} последовательно на углы TetX, TetZ, TetY. +

+ +
+
Команда MGL: rotate tet x y z
+
Метод класса mglGraph: void RotateN (mreal Tet, mreal x, mreal y, mreal z)
+
Функция С: void mgl_rotate_vector (HMGL gr, mreal Tet, mreal x, mreal y, mreal z)
+

Вращает систему координат относительно вектора {x, y, z} на угол Tet. +

+ + +
+
Команда MGL: shear sx sy
+
Метод класса mglGraph: void Shear (mreal sx, mreal sy)
+
Функция С: void mgl_shear (HMGL gr, mreal sx, mreal sy)
+

Сдвигает (скашивает) систему координат на значения sx, sy. +

+ + +
+
Команда MGL: aspect ax ay [az=1]
+
Метод класса mglGraph: void Aspect (mreal Ax, mreal Ay, mreal Az=1)
+
Функция С: void mgl_aspect (HMGL gr, mreal Ax, mreal Ay, mreal Az)
+

Устанавливает соотношение размеров осей в отношении Ax:Ay:Az. Для лучшего вида следует вызывать после функции rotate. Если Ax=NAN, то функция выберет оптимальное соотношение размеров, чтобы шаг по осям x-y был одинаков. При этом, Ay задает фактор пропорциональности шага (обычно 1), или указывает на его автоматический выбор при Ay=NAN. +

+ + +
+
Метод класса mglGraph: void Push ()
+
Функция С: void mgl_mat_push (HMGL gr)
+

Помещает матрицу преобразования в стек. Позднее вы можете восстановить текущее состояние с помощью функции Pop(). +

+ +
+
Метод класса mglGraph: void Pop ()
+
Функция С: void mgl_mat_pop (HMGL gr)
+

Заменяет (восстанавливает) матрицу преобразования на последнюю помещенную в стек матрицу. +

+ +
+
Метод класса mglGraph: void SetPlotFactor (mreal val)
+
Функция С: void mgl_set_plotfactor (HMGL gr, mreal val)
+

Задает масштаб картинки. Не рекомендуется устанавливать значения меньше 1.5. Это аналог функции Zoom(), но применяется только к конкретному подграфику. Используйте ноль для включения автоматического масштабирования. +

+ + + +

Также есть 3 функции, которые управляют перспективой Perspective(), масштабированием Zoom() и вращением View() всего рисунка. Т.е. они действуют как ещё одна матрица трансформации. Они были введены для вращения/приближения графика с помощью мыши. Не рекомендуется вызывать их при рисовании графика. +

+
+
Команда MGL: perspective val
+
Метод класса mglGraph: void Perspective (mreal a)
+
Функция С: void mgl_perspective (HMGL gr, mreal a)
+

Добавляет (включает) перспективу для графика. Параметр a = Depth/(Depth+dz) \in [0,1). По умолчанию (a=0) перспектива отключена. +

+ +
+
Команда MGL: view tetx tetz [tety=0]
+
Метод класса mglGraph: void View (mreal TetX, mreal TetZ, mreal TetY=0)
+
Функция С: void mgl_view (HMGL gr, mreal TetX, mreal TetZ, mreal TetY)
+

Вращает систему координат относительно осей {x, z, y} последовательно на углы TetX, TetZ, TetY. Вращение происходит независимо от rotate. Внимание! эти настройки не могут быть переписаны функцией DefaultPlotParam(). Используйте Zoom(0,0,1,1) для возвращения к виду по умолчанию. +

+ +
+
Команда MGL: zoom x1 y1 x2 y2
+
Метод класса mglGraph: void Zoom (mreal x1, mreal y1, mreal x2, mreal y2)
+
Функция С: void mgl_set_zoom (HMGL gr, mreal x1, mreal y1, mreal x2, mreal y2)
+

Масштабирует весь рисунок. После вызова функции текущий график будет очищен и в дальнейшем рисунок будет содержать только область [x1,x2]*[y1,y2] от исходного рисунка. Координаты x1, x2, y1, y2 меняются в диапазоне от 0 до 1. Внимание! эти настройки не могут быть переписаны никакими другими функциями, включая DefaultPlotParam(). Используйте Zoom(0,0,1,1) для возвращения к виду по умолчанию. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.5 Экспорт рисунка

+ + + +

Функции в этой группе сохраняют или дают доступ к полученному рисунку. Поэтом обычно они должны вызываться в конце рисования. +

+
+
Команда MGL: setsize w h
+
Метод класса mglGraph: void SetSize (int width, int height, bool clear=true)
+
Функция С: void mgl_set_size (HMGL gr, int width, int height)
+
Функция С: void mgl_scale_size (HMGL gr, int width, int height)
+

Изменяет размер картинки в пикселях. Функция должна вызываться перед любыми функциями построения потому что полностью очищает содержимое рисунка при clear=true. Функция только очищает растровый рисунок и масштабирует примитивы при clear=false. +

+ + +
+
Команда MGL: setsizescl factor
+
Метод класса mglGraph: void SetSizeScl (double factor)
+
Функция С: void mgl_set_size_scl (HMGL gr, double factor)
+

Задает множитель для высоты и ширины во всех последующих вызовах setsize. +

+ + +
+
Команда MGL: quality [val=2]
+
Метод класса mglGraph: void SetQuality (int val=MGL_DRAW_NORM)
+
Функция С: void mgl_set_quality (HMGL gr, int val)
+

Задает качество графика в зависимости от значения val: MGL_DRAW_WIRE=0 – нет рисования граней (наиболее быстрый), MGL_DRAW_FAST=1 – нет интерполяции цвета (быстрый), MGL_DRAW_NORM=2 – высокое качество (нормальный), MGL_DRAW_HIGH=3 – высокое качество с рисованием 3d примитивов (стрелок и маркеров). Если установлен бит MGL_DRAW_LMEM=0x4, то происходит прямое рисование в растровое изображение (меньше затраты памяти). Если установлен бит MGL_DRAW_DOTS=0x8, то рисуются точки вместо примитивов (очень быстро). +

+ +
+
Метод класса mglGraph: int GetQuality ()
+
Функция С: void mgl_get_quality (HMGL gr)
+

Возвращает качество графика: MGL_DRAW_WIRE=0 – нет рисования граней (наиболее быстрый), MGL_DRAW_FAST=1 – нет интерполяции цвета (быстрый), MGL_DRAW_NORM=2 – высокое качество (нормальный), MGL_DRAW_HIGH=3 – высокое качество с рисованием 3d примитивов (стрелок и маркеров). Если установлен бит MGL_DRAW_LMEM=0x4, то происходит прямое рисование в растровое изображение (меньше затраты памяти). Если установлен бит MGL_DRAW_DOTS=0x8, то рисуются точки вместо примитивов (очень быстро). +

+ +
+
Метод класса mglGraph: void StartGroup (const char *name)
+
Функция С: void mgl_start_group (HMGL gr, const char *name)
+

Начинает определение группы. Группа может содержать объекты и другие группы. Они используются для выбора части модели при приближении, изменении прозрачности и т.д. +

+ +
+
Метод класса mglGraph: void EndGroup ()
+
Функция С: void mgl_end_group (HMGL gr)
+

Завершает определение группы. +

+ + + + + + + + + +
+ + + +

4.5.1 Экспорт в файл

+ + + + + + + + + + + + + + + + + +

Эти функции экспортируют текущую картинку (кадр) в файл. Имя файла fname должно иметь соответствующее расширение. Параметр descr дает краткое описание картинки. Пока прозрачность поддерживается только для форматов PNG, SVG, OBJ и PRC. +

+
+
Команда MGL: write ['fname'='']
+
Метод класса mglGraph: void WriteFrame (const char *fname="", const char *descr="")
+
Функция С: void mgl_write_frame (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в файл fname с типом, определяемым по расширению. Параметр descr добавляет описание (может быть пустым). Если fname пустой, то используется имя ‘frame####.jpg’, где ‘####’ – текущий номер кадра и имя ‘frame’ определяется переменной plotid. +

+ +
+
Команда MGL: bbox x1 y1 [x2=-1 y2=-1]
+
Метод класса mglGraph: void SetBBox (int x1=0, int y1=0, int x2=-1, int y2=-1)
+
Функция С: void mgl_set_bbox (HMGL gr, int x1, int y1, int x2, int y2)
+

Задает область изображения, которая будет сохранена в файл 2D формата. Если x2<0 (y2<0), то исходная ширина (высота) рисунка будет использована. Если x1<0 или y1<0 или x1>=x2|Width или y1>=y2|Height, то обрезания рисунка не будет. +

+ + +
+
Метод класса mglGraph: void WritePNG (const char *fname, const char *descr="", int compr="", bool alpha=true)
+
Функция С: void mgl_write_png (HMGL gr, const char *fname, const char *descr)
+
Функция С: void mgl_write_png_solid (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в PNG файл. Параметры функции следующие: fname – имя файла, descr – описание файла, alpha – прозрачность фона. Если при компиляции MathGL не был определен флаг HAVE_PNG, то экспорт в файл не производится. +

+ +
+
Метод класса mglGraph: void WriteJPEG (const char *fname, const char *descr="")
+
Функция С: void mgl_write_jpg (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в JPEG файл. Параметры функции следующие: fname – имя файла, descr – описание файла. Если при компиляции MathGL не был определен флаг HAVE_JPEG, то экспорт в файл не производится. +

+ +
+
Метод класса mglGraph: void WriteGIF (const char *fname, const char *descr="")
+
Функция С: void mgl_write_gif (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в GIF файл. Параметры функции следующие: fname – имя файла, descr – описание файла. Если при компиляции MathGL не был определен флаг HAVE_GIF, то экспорт в файл не производится. +

+ +
+
Метод класса mglGraph: void WriteBMP (const char *fname, const char *descr="")
+
Функция С: void mgl_write_bmp (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в BMP файл. Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ +
+
Метод класса mglGraph: void WriteTGA (const char *fname, const char *descr="")
+
Функция С: void mgl_write_tga (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в TGA файл. Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ +
+
Метод класса mglGraph: void WriteEPS (const char *fname, const char *descr="")
+
Функция С: void mgl_write_eps (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в EPS файл, используя векторное представление графика. Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. Если имя файла оканчивается на ‘z’ (например, ‘fname.eps.gz’), то файл автоматически архивируется в формате gzip. Отмечу, что формат EPS не поддерживает интерполяцию цвета, и картинка будет выглядеть как при использовании quality=1. +

+ +
+
Метод класса mglGraph: void WriteBPS (const char *fname, const char *descr="")
+
Функция С: void mgl_write_eps (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в EPS файл, используя растровое представление графика. Параметры функции следующие: fname – имя файла, descr – описание файла. Если имя файла оканчивается на ‘z’ (например, ‘fname.eps.gz’), то файл автоматически архивируется в формате gzip. +

+ +
+
Метод класса mglGraph: void WriteSVG (const char *fname, const char *descr="")
+
Функция С: void mgl_write_svg (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в SVG файл, используя векторное представление графика. Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. Если имя файла оканчивается на ‘z’ (например, ‘fname.svgz’), то файл автоматически архивируется в формате gzip. Отмечу, что формат SVG не поддерживает интерполяцию цвета, и картинка будет выглядеть как при использовании quality=1. +

+ +
+
Метод класса mglGraph: void WriteTEX (const char *fname, const char *descr="")
+
Функция С: void mgl_write_tex (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в LaTeX файл (пакет Tikz/PGF), используя векторное представление графика. Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. Отмечу, что сейчас отсутствует изменение размера текста (например, в subplot), что может приводить к неправильному положению надписей. +

+ + +
+
Метод класса mglGraph: void WritePRC (const char *fname, const char *descr="", bool make_pdf=true)
+
Функция С: void mgl_write_prc (HMGL gr, const char *fname, const char *descr, int make_pdf)
+

Экспортирует текущий кадр в PRC файл, используя векторное представление графика (см. http://en.wikipedia.org/wiki/PRC_%28file_format%29). Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. Если параметр make_pdf=true и PDF был выбран при конфигурировании MathGL, то также создается соответствующий PDF файл с 3D изображением. +

+ +
+
Метод класса mglGraph: void WriteOBJ (const char *fname, const char *descr="")
+
Функция С: void mgl_write_obj (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в OBJ/MTL файл, используя векторное представление графика (см. OBJ формат). Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ + +
+
Метод класса mglGraph: void WriteXYZ (const char *fname, const char *descr="")
+
Функция С: void mgl_write_xyz (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в XYZ/XYZL/XYZF файлы, используя векторное представление графика (см. XYZ формат). Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ +
+
Метод класса mglGraph: void WriteSTL (const char *fname, const char *descr="")
+
Функция С: void mgl_write_stl (HMGL gr, const char *fname, const char *descr)
+

Экспортирует текущий кадр в STL файл, используя векторное представление графика (см. STL формат). Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ +
+
Метод класса mglGraph: void WriteOFF (const char *fname, const char *descr="", bool colored=false)
+
Функция С: void mgl_write_off (HMGL gr, const char *fname, const char *descr, bool colored)
+

Экспортирует текущий кадр в OFF файл, используя векторное представление графика (см. OFF формат). Вследствие чего не рекомендуется сохранять большие графики (поверхности, а особенно поверхности уровня) из-за большого размера файла. Хотя никаких внутренних ограничений на размер выходного файла нет. Для них лучше использовать растровый формат (например, PNG или JPEG). Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ + + + +
+
Метод класса mglGraph: void ShowImage (const char *viewer, bool nowait=false)
+
Функция С: void mgl_show_image (const char *viewer, int nowait)
+

Отображает текущий кадр используя внешнюю программу просмотра viewer. Функция сохраняет картинку во временный файл и вызывает viewer для его отображения. Если nowait=true, то функция возвращает управление немедленно – не ждет пока окно просмотра будет закрыто. +

+ + +
+
Метод класса mglGraph: void WriteJSON (const char *fname, const char *descr="")
+
Функция С: void mgl_write_json (HMGL gr, const char *fname, const char *descr)
+

Экспортирует точки и примитивы в текстовый файл используя JSON format. В дальнейшем этот файл можно загрузить и просмотреть в JavaScript скрипте. Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ +
+
Метод класса mglGraph: void ExportMGLD (const char *fname, const char *descr="")
+
Функция С: void mgl_export_mgld (HMGL gr, const char *fname, const char *descr)
+

Экспортирует точки и примитивы в файл MGLD format. В дальнейшем этот файл можно загрузить и просмотреть с помощью mglview. Параметры функции следующие: fname – имя файла, descr – описание файла. +

+ +
+
Метод класса mglGraph: void ImportMGLD (const char *fname, bool add=false)
+
Функция С: void mgl_import_mgld (HMGL gr, const char *fname, int add)
+

Импортирует точки и примитивы из файла в MGLD format. Параметры функции следующие: fname – имя файла, add – флаг добавления или замены существующих точек и примитивов. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Export picture   [Contents][Index]

+
+ +

4.5.2 Кадры/Анимация

+ + + + + + + + + + +

Эти функции позволяют создавать несколько картинок одновременно. В большинстве случаев это бесполезно, но для органов управления (см. Widget classes) это позволяет показывать анимацию. Также можно записать несколько кадров в анимированный GIF файл. +

+
+
Метод класса mglGraph: void NewFrame ()
+
Функция С: void mgl_new_frame (HMGL gr)
+

Создает новый кадр. Функция возвращает номер текущего кадра. В режиме OpenGL функция не должны вызываться в параллельных потоках! – используйте прямое создание списка. Функция EndFrame() должна быть вызвана после рисования кадра для каждого вызова этой функции. +

+ +
+
Метод класса mglGraph: void EndFrame ()
+
Функция С: void mgl_end_frame (HMGL gr)
+

Завершает рисование кадра. +

+ +
+
Метод класса mglGraph: int GetNumFrame ()
+
Функция С: int mgl_get_num_frame (HMGL gr)
+

Возвращает число созданных кадров. +

+ +
+
Метод класса mglGraph: void GetFrame (int i)
+
Функция С: void mgl_get_frame (HMGL gr, int i)
+

Завершает рисование кадра и сохраняет объекты рисования в кадр с номером i, который должен быть в диапазоне [0, GetNumFrame()-1]. Функция аналогична EndFrame(), но не добавляет кадр в GIF изображение. +

+ +
+
Метод класса mglGraph: void GetFrame (int i)
+
Функция С: void mgl_get_frame (HMGL gr, int i)
+

Заменяет объекты рисования на объекты из кадра с номером i. Функция работает если установлен флаг MGL_VECT_FRAME (по умолчанию). +

+ +
+
Метод класса mglGraph: void ShowFrame (int i)
+
Функция С: void mgl_show_frame (HMGL gr, int i)
+

Добавляет объекты рисования из кадра с номером i к уже существующим. Функция работает если установлен флаг MGL_VECT_FRAME (по умолчанию). +

+ +
+
Метод класса mglGraph: void DelFrame (int i)
+
Функция С: void mgl_del_frame (HMGL gr, int i)
+

Удаляет объекты рисования для кадра с номером i и сдвигает нумерацию всех последующих кадров. Функция работает если установлен флаг MGL_VECT_FRAME (по умолчанию). +

+ +
+
Метод класса mglGraph: void ResetFrames ()
+
Функция С: void mgl_reset_frames (HMGL gr)
+

Сбрасывает счетчик кадров в 0. +

+ +
+
Метод класса mglGraph: void ClearFrame (int i)
+
Функция С: void mgl_clear_frame (HMGL gr, int i)
+

Очищает текущий список объектов. +

+ +
+
Метод класса mglGraph: void StartGIF (const char *fname, int ms=100)
+
Функция С: void mgl_start_gif (HMGL gr, const char *fname, int ms)
+

Начинает запись кадров в анимированный GIF файл fname. Параметр ms задает задержку между кадрами в миллисекундах. Вы не должны менять размер рисунка во время создания кино. Используйте CloseGIF() для завершения записи. Эта функция не работает в режиме OpenGL. +

+ +
+
Метод класса mglGraph: void CloseGIF ()
+
Функция С: void mgl_close_gif (HMGL gr)
+

Завершает запись анимированного GIF файла. +

+ + +
+ + + +

4.5.3 Рисование в памяти

+ + +

Эти функции возвращают созданный растровый рисунок, его ширину и высоту. В дальнейшем его можно использовать в любой графической библиотеке (см. также, Widget classes) или сохранить в файл (см. также, Export to file). +

+
+
Метод класса mglGraph: const unsigned char * GetRGB ()
+
Метод класса mglGraph: void GetRGB (char *buf, int size)
+
Метод класса mglGraph: void GetBGRN (char *buf, int size)
+
Функция С: const unsigned char * mgl_get_rgb (HMGL gr)
+

Возвращает растровое изображение в формате RGB для текущего кадра. Формат каждого элемента (пикселя): {red, green, blue}. Число элементов Width*Height. Положение элемента {i,j} есть [3*i + 3*Width*j] (или [4*i + 4*Width*j] для GetBGRN()). В Python вы должны предоставить буфер buf достаточного размера size, т.е. код должен выглядеть следующим образом (для Python) +

from mathgl import *
+gr = mglGraph();
+bits='\t';
+bits=bits.expandtabs(4*gr.GetWidth()*gr.GetHeight());
+gr.GetBGRN(bits, len(bits));
+
+ +
+
Метод класса mglGraph: const unsigned char * GetRGBA ()
+
Метод класса mglGraph: void GetRGBA (char *buf, int size)
+
Функция С: const unsigned char * mgl_get_rgba (HMGL gr)
+

Возвращает растровое изображение в формате RGBA для текущего кадра. Формат каждого элемента (пикселя): {red, green, blue, alpha}. Число элементов Width*Height. Положение элемента {i,j} есть [4*i + 4*Width*j]. +

+ +
+
Метод класса mglGraph: int GetWidth ()
+
Метод класса mglGraph: int GetHeight ()
+
Функция С: int mgl_get_width (HMGL gr)
+
Функция С: int mgl_get_height (HMGL gr)
+

Возвращает ширину и высоту изображения. +

+ + +
+
Метод класса mglGraph: mglPoint CalcXYZ (int xs, int ys)
+
Функция С: void mgl_calc_xyz (HMGL gr, int xs, int ys, mreal *x, mreal *y, mreal *z)
+

Вычисляет 3D координаты {x,y,z} для экранной точки {xs,ys}. В данный момент игнорируется перспектива графика и формулы перехода в криволинейные координаты. Вычисления производятся для последнего использованного InPlot (см. Subplots and rotation). +

+ +
+
Метод класса mglGraph: mglPoint CalcScr (mglPoint p)
+
Функция С: void mgl_calc_scr (HMGL gr, mreal x, mreal y, mreal z, int *xs, int *ys)
+

Вычисляет экранные координаты {xs,ys} для 3D координат {x,y,z}. Вычисления производятся для последнего использованного InPlot (см. Subplots and rotation). +

+ +
+
Метод класса mglGraph: void SetObjId (int id)
+
Функция С: void mgl_set_obj_id (HMGL gr, int id)
+

Задает числовой идентификатор для объектов или subplot/inplot. +

+ +
+
Метод класса mglGraph: int GetObjId (int xs, int ys)
+
Функция С: int mgl_get_obj_id (HMGL gr, int xs, int ys)
+

Возвращает числовой идентификатор верхнего объекта в точке {xs, ys} рисунка. +

+ +
+
Метод класса mglGraph: int GetSplId (int xs, int ys)
+
Функция С: int mgl_get_spl_id (HMGL gr, int xs, int ys)
+

Возвращает числовой идентификатор верхнего "подграфика" в точке {xs, ys} рисунка. +

+ +
+
Метод класса mglGraph: void Highlight (int id)
+
Функция С: void mgl_highlight (HMGL gr, int id)
+

Выделяет объект с заданным id. +

+ +
+
Метод класса mglGraph: long IsActive (int xs, int ys, int d=1)
+
Функция С: long mgl_is_active (HMGL gr, int xs, int ys, int d)
+

Проверяет близка ли точка {xs, ys} к активной точке (т.е. mglBase::Act) с точностью d и возвращает индекс активной точки или -1 если не найдено. Активные точки – специальные точки, которые характеризуют примитивы (например, вершины). Это функция только для опытных пользователей. +

+ +
+
Метод класса mglGraph: long SetDrawReg (int nx=1, int ny=1, int m=0)
+
Функция С: long mgl_set_draw_reg (HMGL gr, int nx, int ny, int m)
+

Ограничивает рисование прямоугольной областью m-ой клетки матрицы размером nx*ny (аналогично subplot). Функция может бытб использована для ускорения вывода путем уменьшения выводимых примитивов. Это функция только для опытных пользователей. +

+ + + +
+ +
+

+Previous: , Up: Export picture   [Contents][Index]

+
+ +

4.5.4 Распараллеливание

+ + + + + + +

Многие функции MathGL используют несколько потоков для ускорения работы (если MathGL была собрана с поддержкой pthread). При этом можно настраивать число используемых потоков. +

+
+
Функция С: int mgl_set_num_thr (int n)
+

Задает число потоков, которое будет использовано в MathGL. При n<1 число потоков задается как максимальное число процессоров (ядер) в системе. При n=1 не используется распараллеливание. +

+ +

Другая возможность – комбинирование изображений из разных объектов mglGraph. Эти методы наиболее подходят для компьютерных кластеров, когда данные настолько велики, что не могут поместиться в памяти отдельного компьютера. +

+
+
Метод класса mglGraph: int Combine (const mglGraph *g)
+
Функция С: int mgl_combine_gr (HMGL gr, HMGL g)
+

Комбинирует (добавляет) рисунок из g с gr, принимая во внимание “высоту” пикселей. Ширина и высота обоих рисунков должна быть одинаковы. +

+ +
+
Метод класса mglGraph: int MPI_Send (int id)
+
Функция С: int mgl_mpi_send (HMGL gr, int id)
+

Посылает рисунок из компьютера (ноды) id, используя MPI. Ширина и высота обоих рисунков должна быть одинаковы. +

+ +
+
Метод класса mglGraph: int MPI_Recv (int id)
+
Функция С: int mgl_mpi_send (HMGL gr, int id)
+

Принимает рисунок из компьютера (ноды) id, используя MPI. Ширина и высота обоих рисунков должна быть одинаковы. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.6 Фоновое изображение

+ + + + + +

These functions change background image. +

+
+
Команда MGL: clf ['col']
+
Команда MGL: clf r g b
+
Метод класса mglGraph: void Clf ()
+
Метод класса mglGraph: void Clf (const char * col)
+
Метод класса mglGraph: void Clf (char col)
+
Метод класса mglGraph: void Clf (mreal r, mreal g, mreal b)
+
Функция С: void mgl_clf (HMGL gr)
+
Функция С: void mgl_clf_str (HMGL gr, const char * col)
+
Функция С: void mgl_clf_chr (HMGL gr, char col)
+
Функция С: void mgl_clf_rgb (HMGL gr, mreal r, mreal g, mreal b)
+

Очищает рисунок и заполняет фон заданным цветом. +

+ +
+
Команда MGL: rasterize
+
Метод класса mglGraph: void Rasterize ()
+
Функция С: void mgl_rasterize (HMGL gr)
+

Завершает рисование графика и помещает результат в качестве фона. После этого, очищает список примитивов (как clf). Функция полезна для сохранения части графика (например, поверхностей или векторных полей) в растровом виде, а другой части (кривых, осей и пр.) в векторном. +

+ +
+
Команда MGL: background 'fname' [alpha=1]
+
Метод класса mglGraph: void LoadBackground (const char * fname, double alpha=1)
+
Функция С: void mgl_load_background (HMGL gr, const char * fname, double alpha)
+

Загружает PNG или JPEG файл fname в качестве фона для графика. Параметр alpha задает прозрачность фона вручную. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.7 Рисование примитивов

+ + + + + + + + + + + + + + + + +

Эти функции рисуют рисуют простые объекты типа линий, точек, сфер, капель, конусов, и т.д. +

+
+
Команда MGL: ball x y ['col'='r.']
+
Команда MGL: ball x y z ['col'='r.']
+
Метод класса mglGraph: void Ball (mglPoint p, char col='r')
+
Метод класса mglGraph: void Mark (mglPoint p, const char *mark)
+
Функция С: void mgl_mark (HMGL gr, mreal x, mreal y, mreal z, const char *mark)
+

Рисует маркер (точку по умолчанию) с координатами p={x, y, z} и цветом col. +

+ +
+
Команда MGL: errbox x y ex ey ['stl'='']
+
Команда MGL: errbox x y z ex ey ez ['stl'='']
+
Метод класса mglGraph: void Error (mglPoint p, mglPoint e, char *stl="")
+
Функция С: void mgl_error_box (HMGL gr, mreal px, mreal py, mreal pz, mreal ex, mreal ey, mreal ez, char *stl)
+

Рисует 3d error box в точке p={x, y, z} размером e={ex, ey, ez} и стилем stl. Используйте NAN в компонентах e для уменьшения рисуемых элементов. +

+ +
+
Команда MGL: line x1 y1 x2 y2 ['stl'='']
+
Команда MGL: line x1 y1 z1 x2 y2 z2 ['stl'='']
+
Метод класса mglGraph: void Line (mglPoint p1, mglPoint p2, char *stl="B", intnum=2)
+
Функция С: void mgl_line (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, char *stl, intnum)
+

Рисует геодезическую линию (декартовых координатах – прямую) из точки p1 в p2 использую стиль линии stl. Параметр num определяет гладкость линии (число точек на линии). Если num=2, то рисуется прямая даже в криволинейных координатах (см. Curved coordinates). Наоборот, для больших значений (например, =100) рисуется геодезическая линия (окружность в полярных координатах, парабола в параболических и т.д.). Линия рисуется даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: curve x1 y1 dx1 dy1 x2 y2 dx2 dy2 ['stl'='']
+
Команда MGL: curve x1 y1 z1 dx1 dy1 dz1 x2 y2 z2 dx2 dy2 dz2 ['stl'='']
+
Метод класса mglGraph: void Curve (mglPoint p1, mglPoint d1, mglPoint p2, mglPoint d2, const char *stl="B", int num=100)
+
Функция С: void mgl_curve (HMGL gr, mreal x1, mreal y1, mreal z1, mreal dx1, mreal dy1, mreal dz1, mreal x2, mreal y2, mreal z2, mreal dx2, mreal dy2, mreal dz2, const char *stl, int num)
+

Рисует кривую Безье из точки p1 в p2 используя стиль линии stl. Касательные в точках пропорциональны d1, d2. Параметр num определяет гладкость линии (число точек на линии). Если num=2, то рисуется прямая даже в криволинейных координатах (см. Curved coordinates). Наоборот, для больших значений (например, =100) рисуется геодезическая линия (окружность в полярных координатах, парабола в параболических и т.д.). Кривая рисуется даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: face x1 y1 x2 y2 x3 y3 x4 y4 ['stl'='']
+
Команда MGL: face x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 ['stl'='']
+
Метод класса mglGraph: void Face (mglPoint p1, mglPoint p2, mglPoint p3, mglPoint p4, const char *stl="w")
+
Функция С: void mgl_face (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal x3, mreal y3, mreal z3, mreal x4, mreal y4, mreal z4, const char *stl)
+

Рисует заполненный четырехугольник (грань) с углами в точках p1, p2, p3, p4 и цветом(-ами) stl. При этом цвет может быть один для всей грани, или различным если указаны все 4 цвета. Грань будет нарисована даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: rect x1 y1 x2 y2 ['stl'='']
+
Команда MGL: rect x1 y1 z1 x2 y2 z2 ['stl'='']
+

Рисует закрашенный прямоугольник (грань) с вершинами {x1, y1, z1} и {x2, y2, z2} цветом stl. При этом цвет может быть один для всей грани, или различным для разных вершин если указаны все 4 цвета. Грань будет нарисована даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: facex x0 y0 z0 wy wz ['stl'='' d1=0 d2=0]
+
Команда MGL: facey x0 y0 z0 wx wz ['stl'='' d1=0 d2=0]
+
Команда MGL: facez x0 y0 z0 wx wy ['stl'='' d1=0 d2=0]
+
Метод класса mglGraph: void FaceX (mreal x0, mreal y0, mreal z0, mreal wy, mreal wz, const char *stl="w", mreal d1=0, mreal d2=0)
+
Метод класса mglGraph: void FaceY (mreal x0, mreal y0, mreal z0, mreal wx, mreal wz, const char *stl="w", mreal d1=0, mreal d2=0)
+
Метод класса mglGraph: void FaceZ (mreal x0, mreal y0, mreal z0, mreal wx, mreal wy, const char *stl="w", mreal d1=0, mreal d2=0)
+
Функция С: void mgl_facex (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wy, mreal wz, const char *stl, mreal d1, mreal d2)
+
Функция С: void mgl_facey (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wx, mreal wz, const char *stl, mreal d1, mreal d2)
+
Функция С: void mgl_facez (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wx, mreal wy, const char *stl, mreal d1, mreal d2)
+

Рисует закрашенный прямоугольник (грань) перпендикулярно оси [x,y,z] в точке {x0, y0, z0} цветом stl и шириной wx, wy, wz вдоль соответствующего направления. При этом цвет может быть один для всей грани, или различным для разных вершин если указаны все 4 цвета. Параметры d1!=0, d2!=0 задают дополнительный сдвиг последней точки (т.е. рисуют четырехугольник). Грань будет нарисована даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: sphere x0 y0 r ['col'='r']
+
Команда MGL: sphere x0 y0 z0 r ['col'='r']
+
Метод класса mglGraph: void Sphere (mglPoint p, mreal r, const char *stl="r")
+
Функция С: void mgl_sphere (HMGL gr, mreal x0, mreal y0, mreal z0, mreal r, const char *stl)
+

Рисует сферу радиуса r с центром в точке p={x0, y0, z0} цветом stl. +

+ +
+
Команда MGL: drop x0 y0 dx dy r ['col'='r' sh=1 asp=1]
+
Команда MGL: drop x0 y0 z0 dx dy dz r ['col'='r' sh=1 asp=1]
+
Метод класса mglGraph: void Drop (mglPoint p, mglPoint d, mreal r, const char *col="r", mreal shift=1, mreal ap=1)
+
Функция С: void mgl_drop (HMGL gr, mreal x0, mreal y0, mreal z0, mreal dx, mreal dy, mreal dz, mreal r, const char *col, mreal shift, mreal ap)
+

Рисует каплю радиуса r в точке p вытянутую вдоль направления d цветом col. Параметр shift определяет степень вытянутости: ‘0’ – сфера, ‘1’ – классическая капля. Параметр ap определяет относительную ширину капли (аналог "эллиптичности" для сферы). +

+ +
+
Команда MGL: cone x1 y1 z1 x2 y2 z2 r1 [r2=-1 'stl'='' edge=off]
+
Метод класса mglGraph: void Cone (mglPoint p1, mglPoint p2, mreal r1, mreal r2=-1, const char *stl="B", bool edge=false)
+
Функция С: void mgl_cone (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r1, mreal r2, const char *stl, int draw_edge)
+

Рисует трубу (или усеченный конус если edge=false) между точками p1, p2 с радиусами на концах r1, r2. Если r2<0, то полагается r2=r1. Цвет конуса задается строкой stl. Параметр stl может содержать: +

    +
  • @’ для рисования торцов; +
  • #’ для сетчатой фигуры; +
  • t’ для рисования цилиндра вместо конуса/призмы; +
  • 4’, ‘6’, ‘8’ для рисования квадратной, шестиугольной или восьмиугольной призмы вместо конуса. +
+ +
+ +
+
Команда MGL: circle x0 y0 r ['col'='r']
+
Команда MGL: circle x0 y0 z0 r ['col'='r']
+
Метод класса mglGraph: void Circle (mglPoint p, mreal r, const char *stl="r")
+

Рисует круг радиуса r с центром в точке p={x0, y0, z0} цветом stl. Если col содержит: ‘#’ то рисуется только граница, ‘@’ то рисуется граница (вторым цветом из col или черными). +

+ +
+
Команда MGL: ellipse x1 y1 x2 y2 r ['col'='r']
+
Команда MGL: ellipse x1 y1 z1 x2 y2 z2 r ['col'='r']
+
Метод класса mglGraph: void Ellipse (mglPoint p1, mglPoint p2, mreal r, const char *col="r")
+
Функция С: void mgl_ellipse (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r, const char *col)
+

Рисует эллипс радиуса r с фокусами в точках p1, p2 цветом stl. Если col содержит: ‘#’ то рисуется только граница, ‘@’ то рисуется граница (вторым цветом из col или черными). +

+ +
+
Команда MGL: rhomb x1 y1 x2 y2 r ['col'='r']
+
Команда MGL: rhomb x1 y1 z1 x2 y2 z2 r ['col'='r']
+
Метод класса mglGraph: void Rhomb (mglPoint p1, mglPoint p2, mreal r, const char *col="r")
+
Функция С: void mgl_rhomb (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r, const char *col)
+

Рисует ромб ширины r с вершинами в точках p1, p2 цветом stl. Если col содержит: ‘#’ то рисуется только граница, ‘@’ то рисуется граница (вторым цветом из col или черными). Если col содержит 3 цвета, то используется градиентная заливка. +

+ +
+
Команда MGL: arc x0 y0 x1 y1 a ['col'='r']
+
Команда MGL: arc x0 y0 z0 x1 y1 a ['col'='r']
+
Команда MGL: arc x0 y0 z0 xa ya za x1 y1 z1 a ['col'='r']
+
Метод класса mglGraph: void Arc (mglPoint p0, mglPoint p1, mreal a, const char *col="r")
+
Метод класса mglGraph: void Arc (mglPoint p0, mglPoint pa, mglPoint p1, mreal a, const char *col="r")
+
Функция С: void mgl_arc (HMGL gr, mreal x0, mreal y0, mreal x1, mreal y1, mreal a, const char *col)
+
Функция С: void mgl_arc_ext (HMGL gr, mreal x0, mreal y0, mreal z0, mreal xa, mreal ya, mreal za, mreal x1, mreal y1, mreal z1, mreal a, const char *col)
+

Рисует дугу вокруг оси pa (по умолчанию вокруг оси z pa={0,0,1}) с центром в p0, начиная с точки p1. Параметр a задает угол дуги в градусах. Строка col задает цвет дуги и тип стрелок на краях. +

+ +
+
Команда MGL: polygon x0 y0 x1 y1 num ['col'='r']
+
Команда MGL: polygon x0 y0 z0 x1 y1 z1 num ['col'='r']
+
Метод класса mglGraph: void Polygon (mglPoint p0, mglPoint p1, int num, const char *col="r")
+
Функция С: void mgl_polygon (HMGL gr, mreal x0, mreal y0, mreal z0, mreal x1, mreal y1, mreal z1, int num, const char *col)
+

Рисует правильный num-угольник с центром в p0 с первой вершиной в p1 цветом col. Если col содержит: ‘#’ то рисуется только граница, ‘@’ то рисуется граница (вторым цветом из col или черными). +

+ +
+
Команда MGL: logo 'fname' [smooth=off]
+
Метод класса mglGraph: void Logo (const char *fname, bool smooth=false, const char *opt="")
+
Метод класса mglGraph: void Logo (long w, long h, const unsigned char *rgba, bool smooth=false, const char *opt="")
+
Функция С: void mgl_logo (HMGL gr, long w, long h, const unsigned char *rgba, bool smooth, const char *opt)
+
Функция С: void mgl_logo_file (HMGL gr, const char *fname, bool smooth, const char *opt)
+

Draw bitmap (logo) along whole axis range, which can be changed by Command options. Bitmap can be loaded from file or specified as RGBA values for pixels. Parameter smooth set to draw bitmap without or with color interpolation. +

+ + + +
+
Команда MGL: symbol x y 'id' ['fnt'='' size=-1]
+
Команда MGL: symbol x y z 'id' ['fnt'='' size=-1]
+
Метод класса mglGraph: void Symbol (mglPoint p, char id, const char *fnt="", mreal size=-1)
+
Функция С: void mgl_symbol (HMGL gr, mreal x, mreal y, mreal z, char id, const char *fnt, mreal size)
+

Рисует определенный пользователем символ с именем id в точке p стилем fnt. Размер задается параметром size (по умолчанию -1). Строка fnt может содержать цвет (до разделителя ‘:’); стили ‘a’ или ‘A’ для вывода в абсолютной позиции ({x, y} полагаются в диапазоне [0,1]) относительно рисунка (для ‘A’) или subplot/inplot (для ‘a’); и стиль ‘w’ для рисования только контура символа. +

+ +
+
Команда MGL: symbol x y dx dy 'id' ['fnt'=':L' size=-1]
+
Команда MGL: symbol x y z dx dy dz 'id' ['fnt'=':L' size=-1]
+
Метод класса mglGraph: void Symbol (mglPoint p, mglPoint d, char id, const char *fnt="", mreal size=-1)
+
Функция С: void mgl_symbol_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const char *text, const char *fnt, mreal size)
+

Аналогично предыдущему, но символ рисуется в повернутым в направлении d. +

+ +
+
Команда MGL: addsymbol 'id' xdat ydat
+
Метод класса mglGraph: void DefineSymbol (char id, const mglDataA &xdat, const mglDataA &ydat)
+
Функция С: void mgl_define_symbol (HMGL gr, HCDT xdat, HCDT ydat)
+

Добавляет определенный пользователем символ с именем id и границей {xdat, ydat}. Значения NAN задают разрыв (скачок) граничной кривой. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.8 Вывод текста

+ + + + + + +

Функции для вывода текста позволяют вывести строку текста в произвольном месте рисунка, в произвольном направлении и вдоль произвольной кривой. MathGL позволяет использовать произвольное начертание шрифта и многие ТеХ-ие команды (детальнее см. Font styles). Все функции вывода текста имеют варианты для 8-bit строк (char *) и для Unicode строк (wchar_t *). В первом случае используется конверсия из текущей локали, т.е. иногда вам требуется явно указать локаль с помощью функции setlocale(). Аргумент size определяет размер текста: размер шрифта если положителен или относительный размер (=-size*SetFontSize()) если отрицателен. Начертание шрифта (STIX, arial, courier, times и др.) можно изменить с помощью функции LoadFont(). See Font settings. +

+

Параметры шрифта задаются строкой, которая может содержать символы цвета ‘wkrgbcymhRGBCYMHW’ (см. Color styles). Также после символа ‘:’ можно указать символы стиля (‘rbiwou’) и/или выравнивания (‘LRCTV’). Стили шрифта: ‘r’ – прямой, ‘i’ – курсив, ‘b’ – жирный, ‘w’ – контурный, ‘o’ – надчеркнутый, ‘u’ – подчеркнутый. По умолчанию используется прямой шрифт. Типы выравнивания: ‘L’ – по левому краю (по умолчанию), ‘C’ – по центру, ‘R’ – по правому краю, ‘T’ – под текстом, ‘V’ – по центру вертикально. Например, строка ‘b:iC’ соответствует курсиву синего цвета с выравниванием по центру. Начиная с MathGL версии 2.3, вы можете задать цветовой градиент для выводимой строки (см. Color scheme). +

+

Если строка содержит символы ‘aA’, то текст выводится в абсолютных координатах (полагаются в диапазоне [0,1]). При этом используются координаты относительно рисунка (если указано ‘A’) или относительно последнего subplot/inplot (если указано ‘a’). Если строка содержит символ ‘@’, то вокруг текста рисуется прямоугольник. +

+

См. раздел Text features, для примеров кода и графика. +

+
+
Команда MGL: text x y 'text' ['fnt'='' size=-1]
+
Команда MGL: text x y z 'text' ['fnt'='' size=-1]
+
Метод класса mglGraph: void Puts (mglPoint p, const char *text, const char *fnt=":C", mreal size=-1)
+
Метод класса mglGraph: void Putsw (mglPoint p, const wchar_t *text, const char *fnt=":C", mreal size=-1)
+
Метод класса mglGraph: void Puts (mreal x, mreal y, const char *text, const char *fnt=":AC", mreal size=-1)
+
Метод класса mglGraph: void Putsw (mreal x, mreal y, const wchar_t *text, const char *fnt=":AC", mreal size=-1)
+
Функция С: void mgl_puts (HMGL gr, mreal x, mreal y, mreal z, const char *text, const char *fnt, mreal size)
+
Функция С: void mgl_putsw (HMGL gr, mreal x, mreal y, mreal z, const wchar_t *text, const char *fnt, mreal size)
+

Выводит строку text от точки p шрифтом определяемым строкой fnt. Размер шрифта задается параметром size (по умолчанию -1). +

+ +
+
Команда MGL: text x y dx dy 'text' ['fnt'=':L' size=-1]
+
Команда MGL: text x y z dx dy dz 'text' ['fnt'=':L' size=-1]
+
Метод класса mglGraph: void Puts (mglPoint p, mglPoint d, const char *text, const char *fnt=':L', mreal size=-1)
+
Метод класса mglGraph: void Putsw (mglPoint p, mglPoint d, const wchar_t *text, const char *fnt=':L', mreal size=-1)
+
Функция С: void mgl_puts_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const char *text, const char *fnt, mreal size)
+
Функция С: void mgl_putsw_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const wchar_t *text, const char *fnt, mreal size)
+

Выводит строку text от точки p вдоль направления d. Параметр fnt задает стиль текста и указывает выводить текст под линией (‘T’) или над ней (‘t’). +

+ +
+
Команда MGL: fgets x y 'fname' [n=0 'fnt'='' size=-1.4]
+
Команда MGL: fgets x y z 'fname' [n=0 'fnt'='' size=-1.4]
+

Выводит n-ую строку файла fname от точки {x,y,z} шрифтом fnt и размером size. По умолчанию используются параметры заданные командой font. +

+ +
+
Команда MGL: text ydat 'text' ['fnt'='']
+
Команда MGL: text xdat ydat 'text' ['fnt'='' size=-1 zval=nan]
+
Команда MGL: text xdat ydat zdat 'text' ['fnt'='' size=-1]
+
Метод класса mglGraph: void Text (const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Text (const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Text (const mglDataA &x, const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Text (const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *fnt="", const char *opt="")
+
Функция С: void mgl_text_y (HMGL gr, HCDT y, const char *text, const char *fnt, const char *opt)
+
Функция С: void mgl_textw_y (HMGL gr, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
+
Функция С: void mgl_text_xy (HCDT x, HCDT y, const char *text, const char *fnt, const char *opt)
+
Функция С: void mgl_textw_xy (HCDT x, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
+
Функция С: void mgl_text_xyz (HCDT x, HCDT y, HCDT z, const char *text, const char *fnt, const char *opt)
+
Функция С: void mgl_textw_xyz (HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *fnt, const char *opt)
+

Выводит строку text вдоль кривой {x[i], y[i], z[i]} шрифтом fnt. Строка fnt может содержать символы: ‘t’ для вывода текста под кривой (по умолчанию), или ‘T’ для вывода текста под кривой. Размеры по 1-ой размерности должны быть одинаковы для всех массивов x.nx=y.nx=z.nx. Если массив x не указан, то используется "автоматический" массив со значениями в диапазоне осей координат (см. Ranges (bounding box)). Если массив z не указан, то используется минимальное значение оси z. Строка opt содержит опции команды (см. Command options). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.9 Оси и Colorbar

+ + + + + + + +

Эти функции рисуют объекты для "измерения" типа осей координат, цветовой таблицы (colorbar), сетку по осям, обрамляющий параллелепипед и подписи по осям координат. См. также см. Axis settings. +

+
+
Команда MGL: axis ['dir'='xyz' 'stl'='']
+
Метод класса mglGraph: void Axis (const char *dir="xyz", const char *stl="", const char *opt="")
+
Функция С: void mgl_axis (HMGL gr, const char *dir, const char *stl, const char *opt)
+

Рисует оси координат и метки на них (см. Axis settings) в направлениях ‘xyz’, указанных строкой dir. Строка dir может содержать: +

    +
  • xyz’ для рисования соответствующих осей; +
  • XYZ’ для рисования соответствующих осей с метками с другой стороны; +
  • ~’ или ‘_’ для осей без подписей; +
  • U’ для невращаемых подписей; +
  • ^’ для инвертирования положения по умолчанию; +
  • !’ для отключения улучшения вида меток (см. tuneticks); +
  • AKDTVISO’ для вывода стрелки на конце оси; +
  • a’ для принудительной автоматической расстановки меток; +
  • :’ для рисования линий через точку (0,0,0); +
  • f’ для вывода чисел в фиксированном формате; +
  • E’ для вывода ‘E’ вместо ‘e’; +
  • F’ для вывода в формате LaTeX; +
  • +’ для вывода ‘+’ для положительных чисел; +
  • -’ для вывода обычного ‘-’; +
  • 0123456789’ для задания точности при выводе чисел. +
+

Стиль меток и оси(ей) задается строкой stl. Опция value задает угол вращения меток оси. См. раздел Axis and ticks, для примеров кода и графика. +

+ +
+
Команда MGL: colorbar ['sch'='']
+
Метод класса mglGraph: void Colorbar (const char *sch="")
+
Функция С: void mgl_colorbar (HMGL gr, const char *sch)
+

Рисует полосу соответствия цвета и числовых значений (colorbar) для цветовой схемы sch (используется текущая для sch="") с краю от графика. Строка sch также может содержать: +

    +
  • <>^_’ для расположения слева, справа, сверху или снизу соответственно; +
  • I’ для расположения около осей (по умолчанию, на краях subplot); +
  • A’ для использования абсолютных координат (относительно рисунка); +
  • ~’ для colorbar без подписей; +
  • !’ для отключения улучшения вида меток (см. tuneticks); +
  • a’ для принудительной автоматической расстановки меток; +
  • f’ для вывода чисел в фиксированном формате; +
  • E’ для вывода ‘E’ вместо ‘e’; +
  • F’ для вывода в формате LaTeX; +
  • +’ для вывода ‘+’ для положительных чисел; +
  • -’ для вывода обычного ‘-’; +
  • 0123456789’ для задания точности при выводе чисел. +
+

См. раздел Colorbars, для примеров кода и графика. +

+ +
+
Команда MGL: colorbar vdat ['sch'='']
+
Метод класса mglGraph: void Colorbar (const mglDataA &v, const char *sch="")
+
Функция С: void mgl_colorbar_val (HMGL gr, HCDT v, const char *sch)
+

Аналогично предыдущему, но для цветовой схемы без сглаживания с заданными значениями v. См. раздел contd sample, для примеров кода и графика. +

+ +
+
Команда MGL: colorbar 'sch' x y [w=1 h=1]
+
Метод класса mglGraph: void Colorbar (const char *sch, mreal x, mreal y, mreal w=1, mreal h=1)
+
Функция С: void mgl_colorbar_ext (HMGL gr, const char *sch, mreal x, mreal y, mreal w, mreal h)
+

Аналогично первому, но в произвольном месте графика {x, y} (полагаются в диапазоне [0,1]). Параметры w, h задают относительную ширину и высоту colorbar. +

+ +
+
Команда MGL: colorbar vdat 'sch' x y [w=1 h=1]
+
Метод класса mglGraph: void Colorbar (const mglDataA &v, const char *sch, mreal x, mreal y, mreal w=1, mreal h=1)
+
Функция С: void mgl_colorbar_val_ext (HMGL gr, HCDT v, const char *sch, mreal x, mreal y, mreal w, mreal h)
+

Аналогично предыдущему, но для цветовой схемы sch без сглаживания с заданными значениями v. См. раздел contd sample, для примеров кода и графика. +

+ +
+
Команда MGL: grid ['dir'='xyz' 'pen'='B']
+
Метод класса mglGraph: void Grid (const char *dir="xyz", const char *pen="B", const char *opt="")
+
Функция С: void mgl_axis_grid (HMGL gr, const char *dir, const char *pen, const char *opt)
+

Рисует линии сетки в направлениях перпендикулярным dir. Если dir содержит ‘!’, то линии рисуются также и для координат под-меток. Шаг сетки такой же как у меток осей координат. Стиль линий задается параметром pen (по умолчанию – сплошная темно синяя линия ‘B-’). +

+ +
+
Команда MGL: box ['stl'='k' ticks=on]
+
Метод класса mglGraph: void Box (const char *col="", bool ticks=true)
+
Функция С: void mgl_box (HMGL gr)
+
Функция С: void mgl_box_str (HMGL gr, const char *col, int ticks)
+

Рисует ограничивающий параллелепипед цветом col. Если col содержит ‘@’, то рисуются закрашенные задние грани. При этом первый цвет используется для граней (по умолчанию светло жёлтый), а последний для рёбер и меток. +

+ +
+
Команда MGL: xlabel 'text' [pos=1]
+
Команда MGL: ylabel 'text' [pos=1]
+
Команда MGL: zlabel 'text' [pos=1]
+
Команда MGL: tlabel 'text' [pos=1]
+
Команда MGL: clabel 'text' [pos=1]
+
Метод класса mglGraph: void Label (char dir, const char *text, mreal pos=1, const char *opt="")
+
Метод класса mglGraph: void Label (char dir, const wchar_t *text, mreal pos=1, const char *opt="")
+
Функция С: void mgl_label (HMGL gr, char dir, const char *text, mreal pos, const char *opt)
+
Функция С: void mgl_labelw (HMGL gr, char dir, const wchar_t *text, mreal pos, const char *opt)
+

Выводит подпись text для оси dir=‘x’,‘y’,‘z’,‘t’,‘c’, где ‘t’ – “тернарная” ось t=1-x-y; ‘c’ – для цвета (следует вызывать после colorbar). Параметр pos задает положение подписи: при pos=0 – по центру оси, при pos>0 – около максимальных значений, при pos<0 – около минимальных значений. Опция value задает дополнительный сдвиг текста. See Text printing. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.10 Легенда

+ + + + + + + +

Эти функции обеспечивают рисование легенды графика (полезно для 1D plotting). Запись в легенде состоит из двух строк: одна для стиля линии и маркеров, другая с текстом описания (с включенным разбором TeX-их команд). Можно использовать непосредственно массивы строк, или накопление во внутренние массивы с помощью функции AddLegend() с последующим отображением. Положение легенды можно задать автоматически или вручную. Параметры fnt и size задают стиль и размер шрифта (см. Font settings). Опция value задает зазор между примером линии и текстом (по умолчанию 0.1). Опция size задает размер текста. Если стиль линии пустой, то соответствующий текст печатается без отступа. Строка fnt может содержать: +

    +
  • стиль текста для записей; +
  • A’ для расположения относительно всего рисунка, а не текущего subplot; +
  • ^’ для размещения снаружи от указанных координат; +
  • #’ для вывода прямоугольника вокруг легенды; +
  • -’ для горизонтального расположения записей; +
  • цвета для заливки (1-ый), для границы (2-ой) и для текста записей (3-ий). Если указано меньше трех цветов, то цвет границы черный (для 2 и менее цветов), и цвет заливки белый (для 1 и менее цвета). +
+

См. раздел Legend sample, для примеров кода и графика. +

+
+
Команда MGL: legend [pos=3 'fnt'='#']
+
Метод класса mglGraph: void Legend (int pos=0x3, const char *fnt="#", const char *opt="")
+
Функция С: void mgl_legend (HMGL gr, int pos, const char *fnt, const char *opt)
+

Рисует легенду из накопленных записей шрифтом fnt. Параметр pos задает положение легенды: ‘0’ – в нижнем левом углу, ‘1’ – нижнем правом углу, ‘2’ – верхнем левом углу, ‘3’ – верхнем правом углу (по умолчанию). Опция value задает зазор между примером линии и текстом (по умолчанию 0.1). +

+ +
+
Команда MGL: legend x y ['fnt'='#']
+
Метод класса mglGraph: void Legend (mreal x, mreal y, const char *fnt="#", const char *opt="")
+
Функция С: void mgl_legend_pos (HMGL gr, mreal x, mreal y, const char *fnt, const char *opt)
+

Рисует легенду из накопленных записей шрифтом fnt. Положение легенды задается параметрами x, y, которые полагаются нормированными в диапазоне [0,1]. Опция value задает зазор между примером линии и текстом (по умолчанию 0.1). +

+ +
+
Команда MGL: addlegend 'text' 'stl'
+
Метод класса mglGraph: void AddLegend (const char *text, const char *style)
+
Метод класса mglGraph: void AddLegend (const wchar_t *text, const char *style)
+
Функция С: void mgl_add_legend (HMGL gr, const char *text, const char *style)
+
Функция С: void mgl_add_legendw (HMGL gr, const wchar_t *text, const char *style)
+

Добавляет описание text кривой со стилем style (см. Line styles) во внутренний массив записей легенды. +

+ +
+
Команда MGL: clearlegend
+
Метод класса mglGraph: void ClearLegend ()
+
Функция С: void mgl_clear_legend (HMGL gr)
+

Очищает внутренний массив записей легенды. +

+ +
+
Команда MGL: legendmarks val
+
Метод класса mglGraph: void SetLegendMarks (int num)
+
Функция С: void mgl_set_legend_marks (HMGL gr, int num)
+

Задает число маркеров в легенде. По умолчанию используется 1 маркер. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.11 1D графики

+ + + + + + + + + + + + + + + + + + + + + + +

Эти функции строят графики для одномерных (1D) массивов. Одномерными считаются массивы, зависящие только от одного параметра (индекса) подобно кривой в параметрической форме {x(i),y(i),z(i)}, i=1...n. По умолчанию (если отсутствуют) значения x[i] равно распределены в диапазоне оси х, и z[i] равно минимальному значению оси z. Графики рисуются для каждой строки массива данных если он двумерный. Размер по 1-ой координате должен быть одинаков для всех массивов x.nx=y.nx=z.nx. +

+

Строка pen задает цвет и стиль линии и маркеров (см. Line styles). По умолчанию (pen="") рисуется сплошная линия с текущим цветом из палитры (см. Palette and colors). Символ ‘!’ в строке задает использование нового цвета из палитры для каждой точки данных (не для всей кривой, как по умолчанию). Строка opt задает опции графика (см. Command options). +

+
+
Команда MGL: plot ydat ['stl'='']
+
Команда MGL: plot xdat ydat ['stl'='']
+
Команда MGL: plot xdat ydat zdat ['stl'='']
+
Метод класса mglGraph: void Plot (const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Plot (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Plot (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_plot (HMGL gr, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_plot_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_plot_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

Функции рисуют ломанную линию по точкам {x[i], y[i], z[i]}. Если pen содержит ‘a’, то рисуются и сегменты между точками вне диапазона осей координат. Если pen содержит ‘~’, то число сегментов уменьшается для квази-линейных участков. См. также area, step, stem, tube, mark, error, belt, tens, tape, meshnum. См. раздел plot sample, для примеров кода и графика. +

+ +
+
Команда MGL: radar adat ['stl'='']
+
Метод класса mglGraph: void Radar (const mglDataA &a, const char *pen="", const char *opt="")
+
Функция С: void mgl_radar (HMGL gr, HCDT a, const char *pen, const char *opt)
+

Функции рисуют radar chart, представляющий собой ломанную с вершинами на радиальных линиях (типа ломанной в полярных координатах). Параметр value в опциях opt задает дополнительный сдвиг данных (т.е. использование a+value вместо a). Если pen содержит ‘#’, то рисуется "сетка" (радиальные линии). Если pen содержит ‘a’, то рисуются и сегменты между точками вне диапазона осей координат. См. также plot, meshnum. См. раздел radar sample, для примеров кода и графика. +

+ +
+
Команда MGL: step ydat ['stl'='']
+
Команда MGL: step xdat ydat ['stl'='']
+
Команда MGL: step xdat ydat zdat ['stl'='']
+
Метод класса mglGraph: void Step (const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Step (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Step (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_step (HMGL gr, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_step_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_step_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

Функции рисуют ступеньки для точек массива. Если x.nx>y.nx, то массив x задает границы ступенек, а не их конец. См. также plot, stem, tile, boxs, meshnum. См. раздел step sample, для примеров кода и графика. +

+ +
+
Команда MGL: tens ydat cdat ['stl'='']
+
Команда MGL: tens xdat ydat cdat ['stl'='']
+
Команда MGL: tens xdat ydat zdat cdat ['stl'='']
+
Метод класса mglGraph: void Tens (const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tens (const mglDataA &x, const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tens (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *pen="", const char *opt="")
+
Функция С: void mgl_tens (HMGL gr, HCDT y, HCDT c, const char *pen, const char *opt)
+
Функция С: void mgl_tens_xy (HMGL gr, HCDT x, HCDT y, HCDT c, const char *pen, const char *opt)
+
Функция С: void mgl_tens_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *pen, const char *opt)
+

Функции рисуют ломанную линию по точкам с цветом, определяемым массивом c (типа графика натяжений). Строка pen задает цветовую схему (см. Color scheme) и стиль линий и/или маркеров (см. Line styles). Если pen содержит ‘a’, то рисуются и сегменты между точками вне диапазона осей координат. Если pen содержит ‘~’, то число сегментов уменьшается для квази-линейных участков. См. также plot, mesh, fall, meshnum. См. раздел tens sample, для примеров кода и графика. +

+ +
+
Команда MGL: tape ydat ['stl'='']
+
Команда MGL: tape xdat ydat ['stl'='']
+
Команда MGL: tape xdat ydat zdat ['stl'='']
+
Метод класса mglGraph: void Tape (const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tape (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tape (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_tape (HMGL gr, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_tape_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_tape_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

Функции рисуют ленты, которые вращаются вокруг кривой {x[i], y[i], z[i]} как её нормали. Начальная лента(ы) выбираются в плоскости x-y (для ‘x’ в pen) и/или y-z (для ‘x’ в pen). Ширина лент пропорциональна barwidth, а также может быть изменена опцией value. См. также plot, flow, barwidth. См. раздел tape sample, для примеров кода и графика. +

+ +
+
Команда MGL: area ydat ['stl'='']
+
Команда MGL: area xdat ydat ['stl'='']
+
Команда MGL: area xdat ydat zdat ['stl'='']
+
Метод класса mglGraph: void Area (const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Area (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Area (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_area (HMGL gr, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_area_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_area_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

Функции рисуют ломанную линию между точками и закрашивает её вниз до плоскости осей координат. Градиентная заливка используется если число цветов равно удвоенному число кривых. Если pen содержит ‘#’, то рисуется только каркас. Если pen содержит ‘a’, то рисуются и сегменты между точками вне диапазона осей координат. См. также plot, bars, stem, region. См. раздел area sample, для примеров кода и графика. +

+ +
+
Команда MGL: region ydat1 ydat2 ['stl'='']
+
Команда MGL: region xdat ydat1 ydat2 ['stl'='']
+
Команда MGL: region xdat1 ydat1 xdat2 ydat2 ['stl'='']
+
Команда MGL: region xdat1 ydat1 zdat1 xdat2 ydat2 zdat2 ['stl'='']
+
Метод класса mglGraph: void Region (const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Region (const mglDataA &x, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Region (const mglDataA &x1, const mglDataA &y1, const mglDataA &x2, const mglDataA &y2, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Region (const mglDataA &x1, const mglDataA &y1, const mglDataA &z1, const mglDataA &x2, const mglDataA &y2, const mglDataA &z2, const char *pen="", const char *opt="")
+
Функция С: void mgl_region (HMGL gr, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
Функция С: void mgl_region_xy (HMGL gr, HCDT x, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
Функция С: void mgl_region_3d (HMGL gr, HCDT x1, HCDT y1, HCDT z1, HCDT x2, HCDT y2, HCDT z2, const char *pen, const char *opt)
+

Функции закрашивают область между 2 кривыми. Градиентная заливка используется если число цветов равно удвоенному число кривых. Если в 2d версии pen содержит ‘i’, то закрашивается только область y1<y<y2, в противном случае будет закрашена и область y2<y<y1. Если pen содержит ‘#’, то рисуется только каркас. Если pen содержит ‘a’, то рисуются и сегменты между точками вне диапазона осей координат. См. также area, bars, stem. См. раздел region sample, для примеров кода и графика. +

+ +
+
Команда MGL: stem ydat ['stl'='']
+
Команда MGL: stem xdat ydat ['stl'='']
+
Команда MGL: stem xdat ydat zdat ['stl'='']
+
Метод класса mglGraph: void Stem (const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Stem (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Stem (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_stem (HMGL gr, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_stem_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_stem_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

Функции рисуют вертикальные линии из точек до плоскости осей координат. См. также area, bars, plot, mark. См. раздел stem sample, для примеров кода и графика. +

+ +
+
Команда MGL: bars ydat ['stl'='']
+
Команда MGL: bars xdat ydat ['stl'='']
+
Команда MGL: bars xdat ydat zdat ['stl'='']
+
Метод класса mglGraph: void Bars (const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Bars (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Bars (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_bars (HMGL gr, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_bars_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_bars_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

Функции рисуют вертикальные полосы (прямоугольники) из точек до плоскости осей координат. Строка pen может содержать: +

    +
  • a’ для вывода линий одной поверх другой (как при суммировании); +
  • f’ для определения кумулятивного эффекта последовательности положительных и отрицательных значений (график типа waterfall); +
  • F’ для использования одинаковой (минимальной) ширины полосок; +
  • <’, ‘^’ or ‘>’ для выравнивания полосок влево, вправо или центрирования относительно их координат. +
+

Можно использовать разные цвета для положительных и отрицательных значений если число указанных цветов равно удвоенному числу кривых для построения. Если x.nx>y.nx, то массив x задает границы полос, а не их центр. См. также barh, cones, area, stem, chart, barwidth. См. раздел bars sample, для примеров кода и графика. +

+ +
+
Команда MGL: barh vdat ['stl'='']
+
Команда MGL: barh ydat vdat ['stl'='']
+
Метод класса mglGraph: void Barh (const mglDataA &v, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Barh (const mglDataA &y, const mglDataA &v, const char *pen="", const char *opt="")
+
Функция С: void mgl_barh (HMGL gr, HCDT v, const char *pen, const char *opt)
+
Функция С: void mgl_barh_xy (HMGL gr, HCDT y, HCDT v, const char *pen, const char *opt)
+

Функции рисуют горизонтальные полосы (прямоугольники) из точек до плоскости осей координат. Строка pen может содержать: +

    +
  • a’ для вывода линий одной поверх другой (как при суммировании); +
  • f’ для определения кумулятивного эффекта последовательности положительных и отрицательных значений (график типа waterfall); +
  • F’ для использования одинаковой (минимальной) ширины полосок; +
  • <’, ‘^’ or ‘>’ для выравнивания полосок влево, вправо или центрирования относительно их координат. +
+

Можно использовать разные цвета для положительных и отрицательных значений если число указанных цветов равно удвоенному числу кривых для построения. Если x.nx>y.nx, то массив x задает границы полос, а не их центр. См. также bars, barwidth. См. раздел barh sample, для примеров кода и графика. +

+ +
+
Команда MGL: cones ydat ['stl'='']
+
Команда MGL: cones xdat ydat ['stl'='']
+
Команда MGL: cones xdat ydat zdat ['stl'='']
+
Метод класса mglGraph: void Cones (const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Cones (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Cones (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_cones (HMGL gr, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_cones_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
+
Функция С: void mgl_cones_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
+

Функции рисуют конусы из точек до плоскости осей координат. Если строка pen содержит символ ‘a’, то линии рисуются одна поверх другой. Можно использовать разные цвета для положительных и отрицательных значений если число указанных цветов равно удвоенному числу кривых для построения. Параметр pen может содержать: +

    +
  • @’ для рисования торцов; +
  • #’ для сетчатой фигуры; +
  • t’ для рисования цилиндра вместо конуса/призмы; +
  • 4’, ‘6’, ‘8’ для рисования квадратной, шестиугольной или восьмиугольной призмы вместо конуса; +
  • <’, ‘^’ или ‘>’ для выравнивания конусов влево, вправо или по центру относительно их координат. +
+

См. также bars, cone, barwidth. См. раздел cones sample, для примеров кода и графика. +

+ + + +
+
Команда MGL: chart adat ['col'='']
+
Метод класса mglGraph: void Chart (const mglDataA &a, const char *col="", const char *opt="")
+
Функция С: void mgl_chart (HMGL gr, HCDT a, const char *col, const char *opt)
+

Рисует цветные полосы (пояса) для массива данных a. Число полос равно числу строк a (равно a.ny). Цвет полос поочерёдно меняется из цветов указанных в col или в палитре (см. Palette and colors). Пробел в цветах соответствует прозрачному "цвету", т.е. если col содержит пробел(ы), то соответствующая полоса не рисуется. Ширина полосы пропорциональна значению элемента в a. График строится только для массивов не содержащих отрицательных значений. Если строка col содержит ‘#’, то рисуется также чёрная граница полос. График выглядит лучше в (после вращения системы координат) и/или в полярной системе координат (становится Pie chart). См. раздел chart sample, для примеров кода и графика. +

+ +
+
Команда MGL: boxplot adat ['stl'='']
+
Команда MGL: boxplot xdat adat ['stl'='']
+
Метод класса mglGraph: void BoxPlot (const mglDataA &a, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void BoxPlot (const mglDataA &x, const mglDataA &a, const char *pen="", const char *opt="")
+
Функция С: void mgl_boxplot (HMGL gr, HCDT a, const char *pen, const char *opt)
+
Функция С: void mgl_boxplot_xy (HMGL gr, HCDT x, HCDT a, const char *pen, const char *opt)
+

Функции рисуют boxplot (называемый также как box-and-whisker diagram или как "ящик с усами") в точках x[i] на плоскости z = zVal (по умолчанию z равно минимальному значению оси z). Это график, компактно изображающий распределение вероятностей a[i,j] (минимум, нижний квартиль (Q1), медиана (Q2), верхний квартиль (Q3) и максимум) вдоль второго (j-го) направления. Если pen содержит ‘<’, ‘^’ или ‘>’, то полоски будут выровнены влево, вправо или центрированы относительно их координат. См. также plot, error, bars, barwidth. См. раздел boxplot sample, для примеров кода и графика. +

+ +
+
Команда MGL: candle vdat1 ['stl'='']
+
Команда MGL: candle vdat1 vdat2 ['stl'='']
+
Команда MGL: candle vdat1 ydat1 ydat2 ['stl'='']
+
Команда MGL: candle vdat1 vdat2 ydat1 ydat2 ['stl'='']
+
Команда MGL: candle xdat vdat1 vdat2 ydat1 ydat2 ['stl'='']
+
Метод класса mglGraph: void Candle (const mglDataA &v1, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Candle (const mglDataA &v1, const mglDataA &v2, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Candle (const mglDataA &v1, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Candle (const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Candle (const mglDataA &x, const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
+
Функция С: void mgl_candle (HMGL gr, HCDT v1, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
Функция С: void mgl_candle_yv (HMGL gr, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt)
+
Функция С: void mgl_candle_xyv (HMGL gr, HCDT x, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt)
+

Функции рисуют candlestick chart в точках x[i]. Этот график показывает прямоугольником ("свечой") диапазон изменения величины. Прозрачная (белая) свеча соответствует росту величины v1[i]<v2[i], чёрная – уменьшению. "Тени" показывают минимальное y1 и максимальное y2 значения. Если v2 отсутствует, то он определяется как v2[i]=v1[i+1]. Можно использовать разные цвета для растущих и падающих дней если число указанных цветов равно удвоенному числу кривых для построения. Если pen содержит ‘#’, то прозрачная свеча будет использована и при 2-цветной схеме. См. также plot, bars, ohlc, barwidth. См. раздел candle sample, для примеров кода и графика. +

+ +
+
Команда MGL: ohlc odat hdat ldat cdat ['stl'='']
+
Команда MGL: ohlc xdat odat hdat ldat cdat ['stl'='']
+
MМетод класса mglGraph: void OHLC (const mglDataA &o, const mglDataA &h, const mglDataA &l, const mglDataA &c, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void OHLC (const mglDataA &x, const mglDataA &o, const mglDataA &h, const mglDataA &l, const mglDataA &c, const char *pen="", const char *opt="")
+
Функция С: void mgl_ohlc (HMGL gr, HCDT o, HCDT h, HCDT l, HCDT c, const char *pen, const char *opt)
+
Функция С: void mgl_ohlc_x (HMGL gr, HCDT x, HCDT o, HCDT h, HCDT l, HCDT c, const char *pen, const char *opt)
+

Функции рисуют Open-High-Low-Close диаграмму. Этот график содержит вертикальные линии между максимальным h и минимальным l значениями, и горизонтальные линии перед/после вертикальной линии для начального o и конечного c значений процесса (обычно цены). Можно использовать разные цвета для растущих и падающих дней если число указанных цветов равно удвоенному числу кривых для построения. См. также candle, plot, barwidth. См. раздел ohlc sample, для примеров кода и графика. +

+ + +
+
Команда MGL: error ydat yerr ['stl'='']
+
Команда MGL: error xdat ydat yerr ['stl'='']
+
Команда MGL: error xdat ydat xerr yerr ['stl'='']
+
Метод класса mglGraph: void Error (const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Error (const mglDataA &x, const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Error (const mglDataA &x, const mglDataA &y, const mglDataA &ex, const mglDataA &ey, const char *pen="", const char *opt="")
+
Функция С: void mgl_error (HMGL gr, HCDT y, HCDT ey, const char *pen, const char *opt)
+
Функция С: void mgl_error_xy (HMGL gr, HCDT x, HCDT y, HCDT ey, const char *pen, const char *opt)
+
Функция С: void mgl_error_exy (HMGL gr, HCDT x, HCDT y, HCDT ex, HCDT ey, const char *pen, const char *opt)
+

Функции рисуют размер ошибки {ex[i], ey[i]} в точках {x[i], y[i]} на плоскости z = zVal (по умолчанию z равно минимальному значению оси z). Такой график полезен для отображения ошибки эксперимента, вычислений и пр. Если pen содержит ‘@’, то будут использованы большие полупрозрачные маркеры. См. также plot, mark. См. раздел error sample, для примеров кода и графика. +

+ +
+
Команда MGL: mark ydat rdat ['stl'='']
+
Команда MGL: mark xdat ydat rdat ['stl'='']
+
Команда MGL: mark xdat ydat zdat rdat ['stl'='']
+
Метод класса mglGraph: void Mark (const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Mark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Mark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")
+
Функция С: void mgl_mark_y (HMGL gr, HCDT y, HCDT r, const char *pen, const char *opt)
+
Функция С: void mgl_mark_xy (HMGL gr, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt)
+
Функция С: void mgl_mark_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt)
+

Функции рисуют маркеры размером r[i]*marksize (см. Default sizes) в точках {x[i], y[i], z[i]}. Для рисования маркеров одинакового размера можно использовать функцию plot с невидимой линией (со стилем содержащим ‘ ’). Для маркеров с размером как у координат можно использовать error со стилем ‘@’. См. также plot, textmark, error, stem, meshnum. См. раздел mark sample, для примеров кода и графика. +

+ +
+
Команда MGL: textmark ydat 'txt' ['stl'='']
+
Команда MGL: textmark ydat rdat 'txt' ['stl'='']
+
Команда MGL: textmark xdat ydat rdat 'txt' ['stl'='']
+
Команда MGL: textmark xdat ydat zdat rdat 'txt' ['stl'='']
+
Метод класса mglGraph: void TextMark (const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void TextMark (const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void TextMark (const mglDataA &y, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void TextMark (const mglDataA &y, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Функция С: void mgl_textmark (HMGL gr, HCDT y, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_textmarkw (HMGL gr, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_textmark_yr (HMGL gr, HCDT y, HCDT r, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_textmarkw_yr (HMGL gr, HCDT y, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_textmark_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_textmarkw_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_textmark_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_textmarkw_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
+

Функции рисуют текст txt как маркер с размером пропорциональным r[i]*marksize в точках {x[i], y[i], z[i]}. См. также plot, mark, stem, meshnum. См. раздел textmark sample, для примеров кода и графика. +

+ +
+
Команда MGL: label ydat 'txt' ['stl'='']
+
Команда MGL: label xdat ydat 'txt' ['stl'='']
+
Команда MGL: label xdat ydat zdat 'txt' ['stl'='']
+
Метод класса mglGraph: void Label (const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Label (const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Label (const mglDataA &x, const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Label (const mglDataA &x, const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Label (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Label (const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Функция С: void mgl_label (HMGL gr, HCDT y, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_labelw (HMGL gr, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_label_xy (HMGL gr, HCDT x, HCDT y, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_labelw_xy (HMGL gr, HCDT x, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_label_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_labelw_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const wchar_t *txt, const char *fnt, const char *opt)
+

Функции выводят текстовую строку txt в точках {x[i], y[i], z[i]}. Если строка txt содержит ‘%x’, ‘%y’, ‘%z’ или ‘%n’, то они будут заменены на значения соответствующих координат или на номер точки. Строка fnt может содержать: +

    +
  • стиль текста Font styles; +
  • f’ для вывода чисел в фиксированном формате; +
  • E’ для вывода ‘E’ вместо ‘e’; +
  • F’ для вывода в формате LaTeX; +
  • +’ для вывода ‘+’ для положительных чисел; +
  • -’ для вывода обычного ‘-’; +
  • 0123456789’ для задания точности при выводе чисел. +
+

См. также plot, mark, textmark, table. См. раздел label sample, для примеров кода и графика. +

+ +
+
Команда MGL: table vdat 'txt' ['stl'='#']
+
Команда MGL: table x y vdat 'txt' ['stl'='#']
+
Метод класса mglGraph: void Table (const mglDataA &val, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Table (const mglDataA &val, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Table (mreal x, mreal y, const mglDataA &val, const char *txt, const char *fnt="", const char *opt="")
+
Метод класса mglGraph: void Table (mreal x, mreal y, const mglDataA &val, const wchar_t *txt, const char *fnt="", const char *opt="")
+
Функция С: void mgl_table (HMGL gr, mreal x, mreal y, HCDT val, const char *txt, const char *fnt, const char *opt)
+
Функция С: void mgl_tablew (HMGL gr, mreal x, mreal y, HCDT val, const wchar_t *txt, const char *fnt, const char *opt)
+

Рисует таблицу значений массива val с заголовками txt (разделенными символом новой строки ‘\n’) в точке {x, y} (по умолчанию {0,0}) относительно текущего subplot. Строка fnt может содержать: +

    +
  • стиль текста Font styles; +
  • #’ для рисования границ ячеек; +
  • =’ для одинаковой ширины всех ячеек; +
  • |’ для ограничения ширины таблицы шириной subplot (эквивалентно опции ‘value 1’); +
  • f’ для вывода чисел в фиксированном формате; +
  • E’ для вывода ‘E’ вместо ‘e’; +
  • F’ для вывода в формате LaTeX; +
  • +’ для вывода ‘+’ для положительных чисел; +
  • -’ для вывода обычного ‘-’; +
  • 0123456789’ для задания точности при выводе чисел. +
+

Опция value задает ширину таблицы (по умолчанию 1). См. также plot, label. См. раздел table sample, для примеров кода и графика. +

+ +
+
Команда MGL: iris dats 'ids' ['stl'='']
+
Команда MGL: iris dats rngs 'ids' ['stl'='']
+
Метод класса mglGraph: void Iris (const mglDataA &dats, const char *ids, const char *stl="", const char *opt="")
+
Метод класса mglGraph: void Iris (const mglDataA &dats, const wchar_t *ids, const char *stl="", const char *opt="")
+
Метод класса mglGraph: void Iris (const mglDataA &dats, const mglDataA &rngs, const char *ids, const char *stl="", const char *opt="")
+
Метод класса mglGraph: void Iris (const mglDataA &dats, const mglDataA &rngs, const wchar_t *ids, const char *stl="", const char *opt="")
+
Функция С: void mgl_iris_1 (HMGL gr, HCDT dats, const char *ids, const char *stl, const char *opt)
+
Функция С: void mgl_irisw_1 (HMGL gr, HCDT dats, const wchar_t *ids, const char *stl, const char *opt)
+
Функция С: void mgl_iris (HMGL gr, HCDT dats, HCDT rngs, const char *ids, const char *stl, const char *opt)
+
Функция С: void mgl_irisw (HMGL gr, HCDT dats, HCDT rngs, const wchar_t *ids, const char *stl, const char *opt)
+

Рисует Ирисы Фишера для определения зависимостей данных dats друг от друга (см. http://en.wikipedia.org/wiki/Iris_flower_data_set). Массив rngs размером 2*dats.nx задает диапазон изменения осей для каждой из колонки. Строка ids содержит имена колонок данных, разделенных символом ‘;’. Опция value задает размер текста для имен данных. На график можно добавить новый набор данных если указать тот же размер rngs и использовать пустую строку имен ids. См. также plot. См. раздел iris sample, для примеров кода и графика. +

+ +
+
Команда MGL: tube ydat rdat ['stl'='']
+
Команда MGL: tube ydat rval ['stl'='']
+
Команда MGL: tube xdat ydat rdat ['stl'='']
+
Команда MGL: tube xdat ydat rval ['stl'='']
+
Команда MGL: tube xdat ydat zdat rdat ['stl'='']
+
Команда MGL: tube xdat ydat zdat rval ['stl'='']
+
Метод класса mglGraph: void Tube (const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tube (const mglDataA &y, mreal r, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tube (const mglDataA &x, const mglDataA &y, mreal r, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")
+
Метод класса mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &z, mreal r, const char *pen="", const char *opt="")
+
Функция С: void mgl_tube_r (HMGL gr, HCDT y, HCDT r, const char *pen, const char *opt)
+
Функция С: void mgl_tube (HMGL gr, HCDT y, mreal r, const char *pen, const char *opt)
+
Функция С: void mgl_tube_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt)
+
Функция С: void mgl_tube_xy (HMGL gr, HCDT x, HCDT y, mreal r, const char *pen, const char *opt)
+
Функция С: void mgl_tube_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt)
+
Функция С: void mgl_tube_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, mreal r, const char *pen, const char *opt)
+

Функции рисуют трубу радиуса r[i] вдоль кривой между точками {x[i], y[i], z[i]}. Опция value число сегментов в поперечном сечении (по умолчанию 25). См. также plot. См. раздел tube sample, для примеров кода и графика. +

+ +
+
Команда MGL: torus rdat zdat ['stl'='']
+
Метод класса mglGraph: void Torus (const mglDataA &r, const mglDataA &z, const char *pen="", const char *opt="")
+
Функция С: void mgl_torus (HMGL gr, HCDT r, HCDT z, const char *pen, const char *opt)
+

Функции рисуют поверхность вращения кривой {r, z} относительно оси. Если строка pen содержит ‘x’ или ‘z’, то ось вращения будет выбрана в указанном направлении (по умолчанию вдоль оси y). Если sch содержит ‘#’, то рисуется сетчатая поверхность. Если sch содержит ‘.’, то рисуется поверхность из точек. См. также plot, axial. См. раздел torus sample, для примеров кода и графика. +

+ + + +
+
Команда MGL: lamerey x0 ydat ['stl'='']
+
Команда MGL: lamerey x0 'y(x)' ['stl'='']
+
Метод класса mglGraph: void Lamerey (double x0, const mglDataA &y, const char *stl="", const char *opt="")
+
Метод класса mglGraph: void Lamerey (double x0, const char *y, const char *stl="", const char *opt="")
+
Функция С: void mgl_lamerey_dat (HMGL gr, double x0, HCDT y, const char *stl, const char *opt)
+
Функция С: void mgl_lamerey_str (HMGL gr, double x0, const char *y, const char *stl, const char *opt)
+

Функции рисуют диаграмму Ламерея для точечного отображения x_new = y(x_old) начиная с точки x0. Строка stl может содержать стиль линии, символ ‘v’ для стрелок, символ ‘~’ для исключения первого сегмента. Опция value задает число сегментов для рисования (по умолчанию 20). См. также plot, fplot, bifurcation, pmap. См. раздел lamerey sample, для примеров кода и графика. +

+ +
+
Команда MGL: bifurcation dx ydat ['stl'='']
+
Команда MGL: bifurcation dx 'y(x)' ['stl'='']
+
Метод класса mglGraph: void Bifurcation (double dx, const mglDataA &y, const char *stl="", const char *opt="")
+
Метод класса mglGraph: void Bifurcation (double dx, const char *y, const char *stl="", const char *opt="")
+
Функция С: void mgl_bifurcation_dat (HMGL gr, double dx, HCDT y, const char *stl, const char *opt)
+
Функция С: void mgl_bifurcation_str (HMGL gr, double dx, const char *y, const char *stl, const char *opt)
+

Функции рисуют бифуркационную диаграмму (диаграмму удвоения периода) для точечного отображения x_new = y(x_old). Параметр dx задает точность по оси x. Строка stl задает цвет. Опция value задает число учитываемых стационарных точек (по умолчанию 1024). См. также plot, fplot, lamerey. См. раздел bifurcation sample, для примеров кода и графика. +

+ +
+
Команда MGL: pmap ydat sdat ['stl'='']
+
Команда MGL: pmap xdat ydat sdat ['stl'='']
+
Команда MGL: pmap xdat ydat zdat sdat ['stl'='']
+
Метод класса mglGraph: void Pmap (const mglDataA &y, const mglDataA &s, const char *stl="", const char *opt="")
+
Метод класса mglGraph: void Pmap (const mglDataA &x, const mglDataA &y, const mglDataA &s, const char *stl="", const char *opt="")
+
Метод класса mglGraph: void Pmap (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &s, const char *stl="", const char *opt="")
+
Функция С: void mgl_pmap (HMGL gr, HMDT y, HCDT s, const char *stl, const char *opt)
+
Функция С: void mgl_pmap_xy (HMGL gr, HCDT x, HMDT y, HCDT s, const char *stl, const char *opt)
+
Функция С: void mgl_pmap_xyz (HMGL gr, HCDT x, HMDT y, HCDT z, HCDT s, const char *stl, const char *opt)
+

Функции рисуют отображение Пуанкаре для кривой {x, y, z} при условии s=0. Проще говоря, рисуются точки пересечения кривой и поверхности. Строка stl задает стиль маркеров. См. также plot, mark, lamerey. См. раздел pmap sample, для примеров кода и графика. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.12 2D графики

+ + + + + + + + + + + + + + + +

Эти функции строят графики для двумерных (2D) массивов. Двумерными считаются массивы, зависящие только от двух параметров (индексов) подобно матрице f(x_i,y_j), i=1...n, j=1...m. По умолчанию (если отсутствуют) значения x, y равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z должны быть одинаковы x.nx=z.nx && y.nx=z.ny или x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Массивы x и y могут быть векторами (не матрицами как z). График строится для каждого z среза данных. Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+
+
Команда MGL: surf zdat ['sch'='']
+
Команда MGL: surf xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Surf (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_surf_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]}. Если sch содержит ‘#’, то рисуется сетка на поверхности. Если sch содержит ‘.’, то рисуется поверхность из точек. См. также mesh, dens, belt, tile, boxs, surfc, surfa. См. раздел surf sample, для примеров кода и графика. +

+ +
+
Команда MGL: mesh zdat ['sch'='']
+
Команда MGL: mesh xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Mesh (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Mesh (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_mesh (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_mesh_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует сетчатую поверхность, заданную параметрически {x[i,j], y[i,j], z[i,j]}. См. также surf, fall, meshnum, cont, tens. См. раздел mesh sample, для примеров кода и графика. +

+ +
+
Команда MGL: fall zdat ['sch'='']
+
Команда MGL: fall xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Fall (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Fall (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_fall (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_fall_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует водопад для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. График удобен для построения нескольких кривых, сдвинутых вглубь друг относительно друга. Если sch содержит ‘x’, то линии рисуются вдоль оси x, иначе (по умолчанию) вдоль оси y. См. также belt, mesh, tens, meshnum. См. раздел fall sample, для примеров кода и графика. +

+ +
+
Команда MGL: belt zdat ['sch'='']
+
Команда MGL: belt xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Belt (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Belt (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_belt (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_belt_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует ленточки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. График может использоваться как 3d обобщение графика plot. Если sch содержит ‘x’, то ленточки рисуются вдоль оси x, иначе (по умолчанию) вдоль оси y. См. также fall, surf, beltc, plot, meshnum. См. раздел belt sample, для примеров кода и графика. +

+ +
+
Команда MGL: boxs zdat ['sch'='']
+
Команда MGL: boxs xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Boxs (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Boxs (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_boxs (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_boxs_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует вертикальные ящики для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. См. также surf, dens, tile, step. См. раздел boxs sample, для примеров кода и графика. +

+ +
+
Команда MGL: tile zdat ['sch'='']
+
Команда MGL: tile xdat ydat zdat ['sch'='']
+
Команда MGL: tile xdat ydat zdat cdat ['sch'='']
+
Метод класса mglGraph: void Tile (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Tile (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Tile (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_tile (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_tile_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_tile_xyc (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

Рисует плитки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. Если строка sch содержит стиль ‘x’ или ‘y’, то плитки будут ориентированы перпендикулярно x- или y-оси. График может использоваться как 3d обобщение step. См. также surf, boxs, step, tiles. См. раздел tile sample, для примеров кода и графика. +

+ +
+
Команда MGL: dens zdat ['sch'='']
+
Команда MGL: dens xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Dens (const mglDataA &z, const char *sch="", const char *opt="", mreal zVal=NAN)
+
Метод класса mglGraph: void Dens (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="", mreal zVal=NAN)
+
Функция С: void mgl_dens (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_dens_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует график плотности для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z равном минимальному значению оси z. Если sch содержит ‘#’, то рисуется сетка. Если sch содержит ‘.’, то рисуется поверхность из точек. См. также surf, cont, contf, boxs, tile, dens[xyz]. См. раздел dens sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont vdat zdat ['sch'='']
+
Команда MGL: cont vdat xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Cont (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Cont (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_cont__val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_cont_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует линии уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит ‘_’. Линии уровня рисуются для z[i,j]=v[k]. Если sch содержит ‘t’ или ‘T’, то значения v[k] будут выведены вдоль контуров над (или под) кривой. См. также dens, contf, contd, axial, cont[xyz]. См. раздел cont sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont zdat ['sch'='']
+
Команда MGL: cont xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Cont (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Cont (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_cont (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_cont_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). Если sch содержит ‘.’, то будут строится только контуры по уровням седловых точек. +

+ +
+
Команда MGL: contf vdat zdat ['sch'='']
+
Команда MGL: contf vdat xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void ContF (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void ContF (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_contf_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_contf_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует закрашенные линии (контуры) уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит ‘_’. Линии уровня рисуются для z[i,j]=v[k]. См. также dens, cont, contd, contf[xyz]. См. раздел contf sample, для примеров кода и графика. +

+ +
+
Команда MGL: contf zdat ['sch'='']
+
Команда MGL: contf xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void ContF (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void ContF (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_contf (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_contf_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: contd vdat zdat ['sch'='']
+
Команда MGL: contd vdat xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void ContD (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void ContD (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_contd_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_contd_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует закрашенные линии (контуры) уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит ‘_’. Линии уровня рисуются для z[i,j]=v[k]. Строка sch задает цвета контуров: цвет k-го контура определяется как k-ый цвет строки. См. также dens, cont, contf. См. раздел contd sample, для примеров кода и графика. +

+ +
+
Команда MGL: contd zdat ['sch'='']
+
Команда MGL: contd xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void ContD (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void ContD (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_contd (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_contd_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ + +
+
Команда MGL: contp vdat xdat ydat zdat adat ['sch'='']
+
Метод класса mglGraph: void ContP (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
Функция С: void mgl_contp_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

Рисует линии уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. Линии уровня рисуются для a[i,j]=v[k]. Если sch содержит ‘t’ или ‘T’, то значения v[k] будут выведены вдоль контуров над (или под) кривой. Если sch содержит ‘f’, то контуры будут закрашены. См. также cont, contf, surfc, cont[xyz].

+ +
+
Команда MGL: contp xdat ydat zdat adat ['sch'='']
+
Метод класса mglGraph: void ContP (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
Функция С: void mgl_contp (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: contv vdat zdat ['sch'='']
+
Команда MGL: contv vdat xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void ContV (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void ContV (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_contv_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_contv_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует вертикальные цилиндры от линий уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит ‘_’. Линии уровня рисуются для z[i,j]=v[k]. См. также cont, contf. См. раздел contv sample, для примеров кода и графика. +

+ +
+
Команда MGL: contv zdat ['sch'='']
+
Команда MGL: contv xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void ContV (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void ContV (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_contv (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_contv_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: axial vdat zdat ['sch'='']
+
Команда MGL: axial vdat xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Axial (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Axial (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_axial_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_axial_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует поверхность вращения линии уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. Линии уровня рисуются для z[i,j]=v[k]. Если sch содержит ‘#’, то рисуется сетчатая поверхность. Если sch содержит ‘.’, то рисуется поверхность из точек. Если строка содержит символы ‘x’ или ‘z’, то ось вращения устанавливается в указанное направление (по умолчанию вдоль ‘y’). См. также cont, contf, torus, surf3. См. раздел axial sample, для примеров кода и графика. +

+ +
+
Команда MGL: axial zdat ['sch'='']
+
Команда MGL: axial xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Axial (const mglDataA &z, const char *sch="", const char *opt="", int num=3)
+
Метод класса mglGraph: void Axial (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="", int num=3)
+
Функция С: void mgl_axial (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_axial_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 3). +

+ +
+
Команда MGL: grid2 zdat ['sch'='']
+
Команда MGL: grid2 xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Grid (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Grid (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_grid (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_grid_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует плоскую сету для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z равном минимальному значению оси z. См. также dens, cont, contf, grid3, meshnum. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.13 3D графики

+ + + + + + + + + +

Эти функции строят графики для трехмерных (3D) массивов. Трёхмерными считаются массивы, зависящие от трёх параметров (индексов) подобно матрице f(x_i,y_j,z_k), i=1...n, j=1...m, k=1...l. По умолчанию (если отсутствуют) значения x, y, z равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z должны быть одинаковы x.nx=a.nx && y.nx=a.ny && z.nz=a.nz или x.nx=y.nx=z.nx=a.nx && x.ny=y.ny=z.ny=a.ny && x.nz=y.nz=z.nz=a.nz. Массивы x, y и z могут быть векторами (не матрицами как a). Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+ +
+
Команда MGL: surf3 adat val ['sch'='']
+
Команда MGL: surf3 xdat ydat zdat adat val ['sch'='']
+
Метод класса mglGraph: void Surf3 (mreal val, const mglDataA &a, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3 (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3_val (HMGL gr, mreal val, HCDT a, const char *sch, const char *opt)
+
Функция С: void mgl_surf3_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Если sch содержит ‘#’, то рисуется сетчатая поверхность. Если sch содержит ‘.’, то рисуется поверхность из точек. Замечу, что возможно некорректная отрисовка граней вследствие неопределённости построения сечения если поверхность пересекает ячейку данных 2 и более раз. См. также cloud, dens3, surf3c, surf3a, axial. См. раздел surf3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3 adat ['sch'='']
+
Команда MGL: surf3 xdat ydat zdat adat ['sch'='']
+
Метод класса mglGraph: void Surf3 (const mglDataA &a, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3 (HMGL gr, HCDT a, const char *sch, const char *opt)
+
Функция С: void mgl_surf3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ +
+
Команда MGL: cloud adat ['sch'='']
+
Команда MGL: cloud xdat ydat zdat adat ['sch'='']
+
Метод класса mglGraph: void Cloud (const mglDataA &a, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Cloud (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
Функция С: void mgl_cloud (HMGL gr, HCDT a, const char *sch, const char *opt)
+
Функция С: void mgl_cloud_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+

Рисует облачный график для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). График состоит из кубиков с цветом и прозрачностью пропорциональной значениям a. Результат похож на облако – малые значения прозрачны, а большие нет. Число кубиков зависит от meshnum. Если sch содержит ‘.’, то будет построен график более низкого качества, но с заметно меньшим использованием памяти. Если sch содержит ‘i’, то прозрачность будет инвертирована, т.е. области с более высокими значениями будут более прозрачны, а с более низким – менее прозрачны. См. также surf3, meshnum. См. раздел cloud sample, для примеров кода и графика. +

+ +
+
Команда MGL: dens3 adat ['sch'='' sval=-1]
+
Команда MGL: dens3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Метод класса mglGraph: void Dens3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Метод класса mglGraph: void Dens3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Функция С: void mgl_dens3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
Функция С: void mgl_dens3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

Рисует график плотности для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). График рисуется на срезе sVal в направлении {‘x’, ‘y’, ‘z’}, указанном в строке sch (по умолчанию, в напралении ‘y’). Если sch содержит ‘#’, то на срезе рисуется сетка. См. также cont3, contf3, dens, grid3. См. раздел dens3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont3 vdat adat ['sch'='' sval=-1]
+
Команда MGL: cont3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+
Метод класса mglGraph: void Cont3 (const mglDataA &v, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Метод класса mglGraph: void Cont3 (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Функция С: void mgl_cont3_val (HMGL gr, HCDT v, HCDT a, const char *sch, mreal sVal, const char *opt)
+
Функция С: void mgl_cont3_xyz_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

Рисует линии уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Линии рисуются для значений из массива v на срезе sVal в направлении {‘x’, ‘y’, ‘z’}, указанном в строке sch (по умолчанию, в напралении ‘y’). Если sch содержит ‘#’, то на срезе рисуется сетка. Если sch содержит ‘t’ или ‘T’, то значения v[k] будут выведены вдоль контуров над (или под) кривой. См. также dens3, contf3, cont, grid3. См. раздел cont3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont3 adat ['sch'='' sval=-1]
+
Команда MGL: cont3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Метод класса mglGraph: void Cont3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="", const char *opt="")
+
Метод класса mglGraph: void Cont3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Функция С: void mgl_cont3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
Функция С: void mgl_cont3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

Аналогично предыдущему для num линий уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: contf3 vdat adat ['sch'='' sval=-1]
+
Команда MGL: contf3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+
Метод класса mglGraph: void Contf3 (const mglDataA &v, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Метод класса mglGraph: void Contf3 (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Функция С: void mgl_contf3_val (HMGL gr, HCDT v, HCDT a, const char *sch, mreal sVal, const char *opt)
+
Функция С: void mgl_contf3_xyz_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

Рисует закрашенные линии (контуры) уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Линии рисуются для значений из массива v на срезе sVal в направлении {‘x’, ‘y’, ‘z’}, указанном в строке sch (по умолчанию, в напралении ‘y’). Если sch содержит ‘#’, то на срезе рисуется сетка. См. также dens3, cont3, contf, grid3. См. раздел contf3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: contf3 adat ['sch'='' sval=-1]
+
Команда MGL: contf3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Метод класса mglGraph: void Contf3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="", const char *opt="")
+
Метод класса mglGraph: void Contf3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Функция С: void mgl_contf3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
Функция С: void mgl_contf3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

Аналогично предыдущему для num закрашенных линий (контуров) уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: grid3 adat ['sch'='' sval=-1]
+
Команда MGL: grid3 xdat ydat zdat adat ['sch'='' sval=-1]
+
Метод класса mglGraph: void Grid3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Метод класса mglGraph: void Grid3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
+
Функция С: void mgl_grid3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
+
Функция С: void mgl_grid3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
+

Рисует сетку для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). График рисуется на срезе sVal в направлении {‘x’, ‘y’, ‘z’}, указанном в строке sch (по умолчанию, в напралении ‘y’). См. также cont3, contf3, dens3, grid2, meshnum. +

+ +
+
Команда MGL: beam tr g1 g2 adat rval ['sch'='' flag=0 num=3]
+
Метод класса mglGraph: void Beam (const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, mreal r, const char *stl="", int flag=0, int num=3)
+
Метод класса mglGraph: void Beam (mreal val, const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, mreal r, const char *stl="", int flag=0)
+
Функция С: void mgl_beam (HMGL gr, HCDT tr, HCDT g1, HCDT g2, HCDT a, mreal r, const char *stl, int flag, int num)
+
Функция С: void mgl_beam_val (HMGL gr, mreal val, HCDT tr, HCDT g1, HCDT g2, HCDT a, mreal r, const char *stl, int flag)
+

Рисует поверхность уровня для 3d массива a при постоянном значении a=val. Это специальный тип графика для a заданного в сопровождающей системе координат вдоль кривой tr с ортами g1, g2 и с поперечным размером r. Переменная flag – битовый флаг: ‘0x1’ - рисовать в сопровождающих (не лабораторных) координатах; ‘0x2’ - рисовать проекцию на плоскость \rho-z; ‘0x4’ - рисовать нормированное в каждом сечении поле. Размеры массивов по 1-му индексу tr, g1, g2 должны быть nx>2. Размеры массивов по 2-му индексу tr, g1, g2 и размер по 3-му индексу массива a должны быть одинаковы. См. также surf3. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.14 Парные графики

+ + + + + + + + + +

Эти функции строят графики для двух связанных массивов. Есть несколько основных типов 3D графиков: поверхность и поверхность уровня с окраской по второму массиву (SurfC, Surf3C), поверхность и поверхность уровня с прозрачностью по второму массиву (SurfA, Surf3A), плитки переменного размера (TileS), диаграмма точечного отображения (Map), STFA диаграмма (STFA). По умолчанию (если отсутствуют) значения x, y (и z для Surf3C, Surf3A) равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z, c должны быть одинаковы x.nx=a.nx && y.nx=a.ny && z.nz=a.nz или x.nx=y.nx=z.nx=a.nx && x.ny=y.ny=z.ny=a.ny && x.nz=y.nz=z.nz=a.nz. Массивы x, y (и z для Surf3C, Surf3A) могут быть векторами (не матрицами как c). Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+ +
+
Команда MGL: surfc zdat cdat ['sch'='']
+
Команда MGL: surfc xdat ydat zdat cdat ['sch'='']
+
Метод класса mglGraph: void SurfC (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void SurfC (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_surfc (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_surfc_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. Если sch содержит ‘#’, то на поверхности рисуется сетка. Если sch содержит ‘.’, то рисуется поверхность из точек. Размерность массивов z и c должна быть одинакова. График строится для каждого z среза данных. См. также surf, surfa, beltc, surf3c. См. раздел surfc sample, для примеров кода и графика. +

+ + +
+
Команда MGL: beltc zdat cdat ['sch'='']
+
Команда MGL: beltc xdat ydat zdat cdat ['sch'='']
+
Метод класса mglGraph: void BeltC (const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void BeltC (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_beltc (HMGL gr, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_beltc_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует ленточки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. График может использоваться как 3d обобщение графика plot. Если sch содержит ‘x’, то ленточки рисуются вдоль оси x, иначе (по умолчанию) вдоль оси y. См. также belt, surfc, meshnum.

+ + +
+
Команда MGL: surf3c adat cdat val ['sch'='']
+
Команда MGL: surf3c xdat ydat zdat adat cdat val ['sch'='']
+
Метод класса mglGraph: void Surf3C (mreal val, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3C (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3c_val (HMGL gr, mreal val, HCDT a, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_surf3c_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Аналогично surf3, но цвет задается массивом c. Если sch содержит ‘#’, то рисуется сетчатая поверхность. Если sch содержит ‘.’, то рисуется поверхность из точек. См. также surf3, surfc, surf3a. См. раздел surf3c sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3c adat cdat ['sch'='']
+
Команда MGL: surf3c xdat ydat zdat adat cdat ['sch'='']
+
Метод класса mglGraph: void Surf3C (const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3C (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3c (HMGL gr, HCDT a, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_surf3c_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ + +
+
Команда MGL: surfa zdat cdat ['sch'='']
+
Команда MGL: surfa xdat ydat zdat cdat ['sch'='']
+
Метод класса mglGraph: void SurfA (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void SurfA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_surfa (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_surfa_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]} с прозрачностью, заданной массивом c[i,j]. Если sch содержит ‘#’, то на поверхности рисуется сетка. Если sch содержит ‘.’, то рисуется поверхность из точек. Размерность массивов z и c должна быть одинакова. График строится для каждого z среза данных. См. также surf, surfc, surf3a. См. раздел surfa sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3a adat cdat val ['sch'='']
+
Команда MGL: surf3a xdat ydat zdat adat cdat val ['sch'='']
+
Метод класса mglGraph: void Surf3A (mreal val, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3A (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3a_val (HMGL gr, mreal val, HCDT a, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_surf3a_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Аналогично surf3, но прозрачность задается массивом c. Если sch содержит ‘#’, то рисуется сетчатая поверхность. Если sch содержит ‘.’, то рисуется поверхность из точек. См. также surf3, surfc, surf3a. См. раздел surf3a sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3a adat cdat ['sch'='']
+
Команда MGL: surf3a xdat ydat zdat adat cdat ['sch'='']
+
Метод класса mglGraph: void Surf3A (const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3A (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3a (HMGL gr, HCDT a, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_surf3a_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. При этом массив c может быть вектором со значениями прозрачности и num=c.nx. В противном случае величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ + + +
+
Команда MGL: surfca zdat cdat adat ['sch'='']
+
Команда MGL: surfca xdat ydat zdat cdat adat ['sch'='']
+
Метод класса mglGraph: void SurfCA (const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void SurfCA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
+
Функция С: void mgl_surfca (HMGL gr, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
+
Функция С: void mgl_surfca_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]} с цветом и прозрачностью, заданными массивами c[i,j] и a[i,j] соответственно. Если sch содержит ‘#’, то на поверхности рисуется сетка. Если sch содержит ‘.’, то рисуется поверхность из точек. Размерность массивов z и c должна быть одинакова. График строится для каждого z среза данных. См. также surf, surfc, surfa, surf3ca. См. раздел surfca sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3ca adat cdat bdat val ['sch'='']
+
Команда MGL: surf3ca xdat ydat zdat adat cdat bdat val ['sch'='']
+
Метод класса mglGraph: void Surf3CA (mreal val, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3CA (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3ca_val (HMGL gr, mreal val, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
+
Функция С: void mgl_surf3ca_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Аналогично surf3, но цвет и прозрачность задается массивами c и b соответственно. Если sch содержит ‘#’, то рисуется сетчатая поверхность. Если sch содержит ‘.’, то рисуется поверхность из точек. См. также surf3, surfc, surf3a. См. раздел surf3a sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3ca adat cdat ['sch'='']
+
Команда MGL: surf3ca xdat ydat zdat adat cdat ['sch'='']
+
Метод класса mglGraph: void Surf3CA (const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Surf3CA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
+
Функция С: void mgl_surf3ca (HMGL gr, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
+
Функция С: void mgl_surf3ca_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. Здесь величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ + +
+
Команда MGL: tiles zdat rdat ['sch'='']
+
Команда MGL: tiles xdat ydat zdat rdat ['sch'='']
+
Команда MGL: tiles xdat ydat zdat rdat cdat ['sch'='']
+
Метод класса mglGraph: void TileS (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void TileS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void TileS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const mglDataA &c, const char *sch="", const char *opt="")
+
Функция С: void mgl_tiles (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_tiles_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *sch, const char *opt)
+
Функция С: void mgl_tiles_xyc (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, HCDT c, const char *sch, const char *opt)
+

Рисует плитки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. Аналогично Tile(), но размер плиток задается массивов r. Если строка sch содержит стиль ‘x’ или ‘y’, то плитки будут ориентированы перпендикулярно x- или y-оси. Это создает эффект "прозрачности" при экспорте в файлы EPS. График строится для каждого z среза данных. См. также surfa, tile. См. раздел tiles sample, для примеров кода и графика. +

+ +
+
Команда MGL: map udat vdat ['sch'='']
+
Команда MGL: map xdat ydat udat vdat ['sch'='']
+
Метод класса mglGraph: void Map (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Map (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Функция С: void mgl_map (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
Функция С: void mgl_map_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

Рисует точечное отображение для матриц {ax, ay } параметрически зависящих от координат x, y. Исходное положение ячейки задает ее цвет. Высота пропорциональна якобиану J(ax,ay). График является аналогом диаграммы Арнольда ??? Если sch содержит ‘.’, то цветные точки рисуются в узлах матриц (полезно для "запутанного" отображения), иначе рисуются грани. См. раздел Mapping visualization, для примеров кода и графика. +

+ +
+
Команда MGL: stfa re im dn ['sch'='']
+
Команда MGL: stfa xdat ydat re im dn ['sch'='']
+
Метод класса mglGraph: void STFA (const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void STFA (const mglDataA &x, const mglDataA &y, const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")
+
Функция С: void mgl_stfa (HMGL gr, HCDT re, HCDT im, int dn, const char *sch, const char *opt)
+
Функция С: void mgl_stfa_xy (HMGL gr, HCDT x, HCDT y, HCDT re, HCDT im, int dn, const char *sch, const char *opt)
+

Рисует спектрограмму комплексного массива re+i*im для Фурье размером dn точек в плоскости z равно минимальному значению оси z. Параметр dn – любое чётное число. Например в 1D случае, результатом будет график плотности от массива res[i,j]=|\sum_d^dn exp(I*j*d)*(re[i*dn+d]+I*im[i*dn+d])|/dn размером {int(nx/dn), dn, ny}. Массивы re, im параметрически зависят от координат x, y. Все размеры массивов re и im должны быть одинаковы. Младшие размерности массивов x, y, re должны быть одинаковы. Массивы x и y могут быть векторами (не матрицами как re). См. раздел stfa sample, для примеров кода и графика. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.15 Векторные поля

+ + + + + + + + +

Эти функции рисуют графики для 2D и 3D векторных полей. Есть несколько типов графиков: просто векторное поле (Vect), вектора вдоль траектории (Traj), векторное поле каплями (Dew), нити тока (Flow, FlowP), трубки тока (Pipe). По умолчанию (если отсутствуют) значения x, y и z равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z и ax должны быть одинаковы. Размеры массивов ax, ay и az должны быть одинаковы. Массивы x, y и z могут быть векторами (не матрицами как ax). Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+
+
Команда MGL: traj xdat ydat udat vdat ['sch'='']
+
Команда MGL: traj xdat ydat zdat udat vdat wdat ['sch'='']
+
Метод класса mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Функция С: void mgl_traj_xyz (HMGL gr, HCDTx, HCDTy, HCDTz, HCDTax, HCDTay, HCDTaz, const char *sch, const char *opt)
+
Функция С: void mgl_traj_xy (HMGL gr, HCDTx, HCDTy, HCDTax, HCDTay, const char *sch, const char *opt)
+

Рисует вектора {ax, ay, az} вдоль кривой {x, y, z}. Длина векторов пропорциональна \sqrt{ax^2+ay^2+az^2}. Строка pen задает цвет (см. Line styles). По умолчанию (pen="") используется текущий цвет из палитры (см. Palette and colors). Опция value задает фактор длины векторов (если не нуль) или выбирать длину пропорционально расстоянию между точками кривой (если value=0). Размер по 1-му индексу должен быть 2 или больше. График рисуется для каждой строки если один из массивов матрица. См. также vect. См. раздел traj sample, для примеров кода и графика. +

+ +
+
Команда MGL: vect udat vdat ['sch'='']
+
Команда MGL: vect xdat ydat udat vdat ['sch'='']
+
Метод класса mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Функция С: void mgl_vect_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
Функция С: void mgl_vect_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

Рисует векторное поле {ax, ay} параметрически зависящее от координат x, y на плоскости при z равном минимальному значению оси z. Длина и цвет векторов пропорциональна \sqrt{ax^2+ay^2}. Число рисуемых векторов зависит от meshnum. Вид стрелок/штрихов может быть изменён символами: +

    +
  • f’ для стрелок одинаковой длины, +
  • >’, ‘<’ для стрелок начинающихся или заканчивающихся в ячейке сетки (по умолчанию центрированы), +
  • .’ для рисования штрихов с точкой в начале вместо стрелок, +
  • =’ для использования градиента цвета вдоль стрелок. +
+

См. также flow, dew. См. раздел vect sample, для примеров кода и графика. +

+ +
+
Команда MGL: vect udat vdat wdat ['sch'='']
+
Команда MGL: vect xdat ydat zdat udat vdat wdat ['sch'='']
+
Метод класса mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Функция С: void mgl_vect_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+
Функция С: void mgl_vect_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+

Это 3d версия графика. Здесь массивы ax, ay, az должны трёхмерными тензорами и длина вектора пропорциональна \sqrt{ax^2+ay^2+az^2}. +

+ +
+
Команда MGL: vect3 udat vdat wdat ['sch'='' sval]
+
Команда MGL: vect3 xdat ydat zdat udat vdat wdat ['sch'='' sval]
+
Метод класса mglGraph: void Vect3 (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
+
Метод класса mglGraph: void Vect3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
+
Функция С: void mgl_vect3 (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)
+
Функция С: void mgl_vect3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)
+

Рисует 3D векторное поле {ax, ay, az} параметрически зависящее от координат x, y, z. График рисуется на срезе sVal в направлении {‘x’, ‘y’, ‘z’}, указанном в строке sch (по умолчанию, в напралении ‘y’). Длина и цвет векторов пропорциональна \sqrt{ax^2+ay^2+az^2}. Число рисуемых векторов зависит от meshnum. Вид стрелок/штрихов может быть изменён символами: +

    +
  • f’ для стрелок одинаковой длины, +
  • >’, ‘<’ для стрелок начинающихся или заканчивающихся в ячейке сетки (по умолчанию центрированы), +
  • .’ для рисования штрихов с точкой в начале вместо стрелок, +
  • =’ для использования градиента цвета вдоль стрелок. +
+

См. также vect, flow, dew. См. раздел vect sample, для примеров кода и графика. +

+ +
+
Команда MGL: dew udat vdat ['sch'='']
+
Команда MGL: dew xdat ydat udat vdat ['sch'='']
+
Метод класса mglGraph: void Dew (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Dew (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Функция С: void mgl_dew (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
Функция С: void mgl_dew_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

Рисует капли для векторного поля {ax, ay}, параметрически зависящего от координат x, y при z равном минимальному значению оси z. Замечу, что график требует много памяти и процессорного времени для своего создания! Цвет капель пропорционален \sqrt{ax^2+ay^2}. Число капель определяется meshnum. См. также vect. См. раздел dew sample, для примеров кода и графика. +

+ +
+
Команда MGL: flow udat vdat ['sch'='']
+
Команда MGL: flow xdat ydat udat vdat ['sch'='']
+
Метод класса mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Функция С: void mgl_flow_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
Функция С: void mgl_flow_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

Рисует нити тока для векторного поля {ax, ay}, параметрически зависящего от координат x, y на плоскости при z равном минимальному значению оси z. Число нитей пропорционально значению опции value (по умолчанию 5). Цвет нитей пропорционален \sqrt{ax^2+ay^2}. Строка sch может содержать +

    +
  • цветовую схему – тёплые цвета соответствуют нормальному току (типа стока), холодные цвета соответствуют обратному току (типа источника); +
  • #’ для использования нитей, начинающихся только на границе; +
  • .’ для рисования сепаратрис (нитей из/в стационарных точек). +
  • *’ для использования нитей, начинающихся с двумерной сетки внутри данных; +
  • v’ для рисования стрелок на нитях; +
  • x’, ‘z’ для рисования лент нормалей, начинающихся в плоскостях x-y и y-z соответственно. +
+

См. также pipe, vect, tape, flow3, barwidth. См. раздел flow sample, для примеров кода и графика. +

+ +
+
Команда MGL: flow udat vdat wdat ['sch'='']
+
Команда MGL: flow xdat ydat zdat udat vdat wdat ['sch'='']
+
Метод класса mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Функция С: void mgl_flow_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+
Функция С: void mgl_flow_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+

Это 3d версия графика. Здесь массивы должны трёхмерными тензорами и цвет пропорционален \sqrt{ax^2+ay^2+az^2}. +

+ +
+
Команда MGL: flow x0 y0 udat vdat ['sch'='']
+
Команда MGL: flow x0 y0 xdat ydat udat vdat ['sch'='']
+
Метод класса mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
+
Функция С: void mgl_flowp_2d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, const char *sch, const char *opt)
+
Функция С: void mgl_flowp_xy (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
+

Аналогично flow, но рисует одну нить из точки p0={x0,y0,z0}. Строка sch также может содержать: ‘>’ или ‘<’ для рисования линии тока только вперед или только назад от заданной точки (по умолчанию, рисует в обе стороны). +

+ +
+
Команда MGL: flow x0 y0 z0 udat vdat wdat ['sch'='']
+
Команда MGL: flow x0 y0 z0 xdat ydat zdat udat vdat wdat ['sch'='']
+
Метод класса mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
+
Функция С: void mgl_flowp_3d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+
Функция С: void mgl_flowp_xyz (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
+

Это 3d версия графика. +

+ +
+
MGL command: flow3 udat vdat wdat ['sch'='']
+
MGL command: flow3 xdat ydat zdat udat vdat ['sch'='']
+
Method on mglGraph: void Flow3 (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", double sVal=-1, const char *opt="")
+
Method on mglGraph: void Flow3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", double sVal=-1, const char *opt="")
+
C function: void mgl_flow3 (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, double sVal, const char *opt)
+
C function: void mgl_flow3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, double sVal, const char *opt)
+

The function draws flow threads for the 3D vector field {ax, ay, az} parametrically depending on coordinates x, y, z. Flow threads starts from given plane. Option value set the approximate number of threads (default is 5). String sch may contain: +

    +
  • color scheme – up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); +
  • x’, ‘z’ for normal of starting plane (default is y-direction); +
  • v’ for drawing arrows on the threads; +
  • t’ for drawing tapes of normals in x-y and y-z planes. +
+

See also flow, pipe, vect. См. раздел flow3 sample, для примеров кода и графика. +

+ + +
+
Команда MGL: grad pdat ['sch'='']
+
Команда MGL: grad xdat ydat pdat ['sch'='']
+
Команда MGL: grad xdat ydat zdat pdat ['sch'='']
+
Метод класса mglGraph: void Grad (const mglDataA &phi, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &phi, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &phi, const char *sch="", const char *opt="")
+
Функция С: void mgl_grad (HMGL gr, HCDT phi, const char *sch, const char *opt)
+
Функция С: void mgl_grad_xy (HMGL gr, HCDT x, HCDT y, HCDT phi, const char *sch, const char *opt)
+
Функция С: void mgl_grad_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT phi, const char *sch, const char *opt)
+

Рисует линии градиента скалярного поля phi[i,j] (или phi[i,j,k] в 3d случае) заданного параметрически {x[i,j,k], y[i,j,k], z[i,j,k]}. Число линий пропорционально значению опции value (по умолчанию 5). См. также dens, cont, flow. +

+ +
+
Команда MGL: pipe udat vdat ['sch'='' r0=0.05]
+
Команда MGL: pipe xdat ydat udat vdat ['sch'='' r0=0.05]
+
Метод класса mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
+
Метод класса mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
+
Функция С: void mgl_pipe_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)
+
Функция С: void mgl_pipe_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)
+

Рисует трубки тока для векторного поля {ax, ay}, параметрически зависящего от координат x, y на плоскости при z равном минимальному значению оси z. Число трубок пропорционально значению опции value. Цвет и радиус трубок пропорционален \sqrt{ax^2+ay^2}. Тёплые цвета соответствуют нормальному току (типа стока). Холодные цвета соответствуют обратному току (типа источника). Параметр r0 задает радиус трубок. При r0<0 радиус трубок обратно пропорционален их амплитуде. См. также flow, vect. См. раздел pipe sample, для примеров кода и графика. +

+ +
+
Команда MGL: pipe udat vdat wdat ['sch'='' r0=0.05]
+
Команда MGL: pipe xdat ydat zdat udat vdat wdat ['sch'='' r0=0.05]
+
Метод класса mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
+
Метод класса mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
+
Функция С: void mgl_pipe_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)
+
Функция С: void mgl_pipe_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)
+

Это 3d версия графика. Здесь массивы ax, ay, az должны трёхмерными тензорами и цвет пропорционален \sqrt{ax^2+ay^2+az^2}. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.16 Прочие графики

+ + + + + + + + + + + + +

Это функции, не относящиеся к какой-то специальной категории. Сюда входят функции построения графиков по текстовым формулам (FPlot и FSurf), рисования поверхностей из треугольников и четырёхугольников (TriPlot, TriCont, QuadPlot), произвольных точек в пространстве (Dots) и реконструкции по ним поверхности (Crust), графики плотности и линии уровня на плоскостях, перпендикулярных осям x, y или z (Dens[XYZ], Cont[XYZ], ContF[XYZ]). Каждый тип графика имеет похожий интерфейс. Есть версия для рисования одного массива с автоматическими координатами и версия для параметрически заданного массива. Параметры цветовой схемы задаются строкой. See Color scheme. +

+
+
Команда MGL: densx dat ['sch'='' sval=nan]
+
Команда MGL: densy dat ['sch'='' sval=nan]
+
Команда MGL: densz dat ['sch'='' sval=nan]
+
Метод класса mglGraph: void DensX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void DensY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void DensZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Функция С: void mgl_dens_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_dens_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_dens_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+

Эти функции рисуют график плотности на x, y или z плоскостях. Если a – 3d массив, то выполняется интерполяция к заданному срезу sVal. Функции полезны для создания проекций 3D массивов на оси координат. См. также ContXYZ, ContFXYZ, dens, Data manipulation. См. раздел dens_xyz sample, для примеров кода и графика. +

+ +
+
Команда MGL: contx dat ['sch'='' sval=nan]
+
Команда MGL: conty dat ['sch'='' sval=nan]
+
Команда MGL: contz dat ['sch'='' sval=nan]
+
Метод класса mglGraph: void ContX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Функция С: void mgl_cont_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_cont_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_cont_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+

Эти функции рисуют линии уровня на x, y или z плоскостях. Если a – 3d массив, то выполняется интерполяция к заданному срезу sVal. Опция value задает число контуров. Функции полезны для создания проекций 3D массивов на оси координат. См. также ContFXYZ, DensXYZ, cont, Data manipulation. См. раздел cont_xyz sample, для примеров кода и графика. +

+ +
+
Метод класса mglGraph: void ContX (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContY (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContZ (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Функция С: void mgl_cont_x_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_cont_y_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_cont_z_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+

Аналогично предыдущему с ручным заданием значений для линий уровня. +

+ +
+
Команда MGL: contfx dat ['sch'='' sval=nan]
+
Команда MGL: contfy dat ['sch'='' sval=nan]
+
Команда MGL: contfz dat ['sch'='' sval=nan]
+
Метод класса mglGraph: void ContFX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContFY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContFZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Функция С: void mgl_contf_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_contf_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_contf_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
+

Эти функции рисуют закрашенные контуры уровня на x, y или z плоскостях. Если a – 3d массив, то выполняется интерполяция к заданному срезу sVal. Опция value задает число контуров. Функции полезны для создания проекций 3D массивов на оси координат. См. также ContFXYZ, DensXYZ, cont, Data manipulation. См. раздел contf_xyz sample, для примеров кода и графика. +

+ +
+
Метод класса mglGraph: void ContFX (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContFY (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Метод класса mglGraph: void ContFZ (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
+
Функция С: void mgl_contf_x_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_contf_y_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+
Функция С: void mgl_contf_z_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
+

Аналогично предыдущему с ручным заданием значений для линий уровня. +

+ +
+
Команда MGL: fplot 'y(x)' ['pen'='']
+
Метод класса mglGraph: void FPlot (const char *eqY, const char *pen="", const char *opt="")
+
Функция С: void mgl_fplot (HMGL gr, const char *eqY, const char *pen, const char *opt)
+

Рисует функцию ‘eqY(x)’ в плоскости z равно минимальному значению оси z с координатой ‘x’ в диапазоне осей координат. Опция value задает начальное число точек. См. также plot. +

+ +
+
Команда MGL: fplot 'x(t)' 'y(t)' 'z(t)' ['pen'='']
+
Метод класса mglGraph: void FPlot (const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt="")
+
Функция С: void mgl_fplot_xyz (HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt)
+

Рисует параметрическую кривую {‘eqX(t)’, ‘eqY(t)’, ‘eqZ(t)’}, где координата ‘t’ меняется в диапазоне [0, 1]. Опция value задает начальное число точек. См. также plot. +

+ +
+
Команда MGL: fsurf 'z(x,y)' ['sch'='']
+
Метод класса mglGraph: void FSurf (const char *eqZ, const char *sch="", const char *opt="");
+
Функция С: void mgl_fsurf (HMGL gr, const char *eqZ, const char *sch, const char *opt);
+

Рисует поверхность ‘eqY(x,y)’ с координатами ‘x’, ‘y’ в диапазоне xrange, yrange. Опция value задает число точек. См. также surf. +

+ +
+
Команда MGL: fsurf 'x(u,v)' 'y(u,v)' 'z(u,v)' ['sch'='']
+
Метод класса mglGraph: void FSurf (const char *eqX, const char *eqY, const char *eqZ, const char *sch="", const char *opt="")
+
Функция С: void mgl_fsurf_xyz (HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *sch, const char *opt)
+

Рисует параметрическую поверхность {‘eqX(u,v)’, ‘eqY(u,v)’, ‘eqZ(u,v)’}, где координаты ‘u’, ‘v’ меняются в диапазоне [0, 1]. Опция value задает число точек. См. также surf. +

+ +
+
Команда MGL: triplot idat xdat ydat ['sch'='']
+
Команда MGL: triplot idat xdat ydat zdat ['sch'='']
+
Команда MGL: triplot idat xdat ydat zdat cdat ['sch'='']
+
Метод класса mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_triplot_xy (HMGL gr, HCDT id, HCDT x, HCDT y, const char *sch, const char *opt)
+
Функция С: void mgl_triplot_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_triplot_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

Рисует поверхность из треугольников. Вершины треугольников задаются индексами id в массиве точек {x[i], y[i], z[i]}. Строка sch задает цветовую схему. Если строка содержит ‘#’, то рисуется сетчатая поверхность. Размер по 1-му индексу массива id должен быть 3 или больше. Массивы x, y, z должны иметь одинаковые размеры. Массив c задает цвет треугольников (если id.ny=c.nx) или цвет вершин (если x.nx=c.nx). См. также dots, crust, quadplot, triangulation. См. раздел triplot sample, для примеров кода и графика. +

+ +
+
Команда MGL: tricont vdat idat xdat ydat zdat cdat ['sch'='']
+
Команда MGL: tricont vdat idat xdat ydat zdat ['sch'='']
+
Команда MGL: tricont idat xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void TriCont (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void TriCont (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void TriContV (const mglDataA &v, const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void TriContV (const mglDataA &v, const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_tricont_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_tricont_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_tricont_xyzcv (HMGL gr, HCDT v, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+
Функция С: void mgl_tricont_xyzv (HMGL gr, HCDT v, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Рисует линии уровня поверхности из треугольников при z=v[k] (или при z равном минимальному значению оси z если sch содержит ‘_’). Вершины треугольников задаются индексами id в массиве точек {x[i], y[i], z[i]}. Если аргуент v не задан, то используется массив из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). Строка sch задает цветовую схему. Размер по 1-му индексу массива id должен быть 3 или больше. Массивы x, y, z должны иметь одинаковые размеры. Массив c задает цвет треугольников (если id.ny=c.nx) или цвет вершин (если x.nx=c.nx). См. также triplot, cont, triangulation. +

+ +
+
Команда MGL: quadplot idat xdat ydat ['sch'='']
+
Команда MGL: quadplot idat xdat ydat zdat ['sch'='']
+
Команда MGL: quadplot idat xdat ydat zdat cdat ['sch'='']
+
Метод класса mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_quadplot_xy (HMGL gr, HCDT id, HCDT x, HCDT y, const char *sch, const char *opt)
+
Функция С: void mgl_quadplot_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_quadplot_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
+

Рисует поверхность из четырёхугольников. Вершины четырёхугольников задаются индексами id в массиве точек {x[i], y[i], z[i]}. Строка sch задает цветовую схему. Если строка содержит ‘#’, то рисуется сетчатая поверхность. Размер по 1-му индексу массива id должен быть 4 или больше. Массивы x, y, z должны иметь одинаковые размеры. Массив c задает цвет четырёхугольников (если id.ny=c.nx) или цвет вершин (если x.nx=c.nx). См. также triplot. См. раздел triplot sample, для примеров кода и графика. +

+ +
+
Команда MGL: dots xdat ydat zdat ['sch'='']
+
Команда MGL: dots xdat ydat zdat adat ['sch'='']
+
Метод класса mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
+
Метод класса mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
+
Функция С: void mgl_dots (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+
Функция С: void mgl_dots_a (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
+
Функция С: void mgl_dots_ca (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
+

Рисует произвольно расположенные точки {x[i], y[i], z[i]}. Строка sch задает цветовую схему и тип маркеров. Если определёны массивы c, a то они задают цвет и прозрачность точек соответственно. Непрозрачные точки с заданным цветом можно нарисовать с помощью tens, используя стиль ‘ .’. Массивы x, y, z, a должны иметь одинаковые размеры. См. также crust, tens, mark, plot. См. раздел dots sample, для примеров кода и графика. +

+ +
+
Команда MGL: crust xdat ydat zdat ['sch'='']
+
Метод класса mglGraph: void Crust (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
+
Функция С: void mgl_crust (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
+

Реконструирует и рисует поверхность по произвольно расположенным точкам {x[i], y[i], z[i]}. Опция value задает радиус ошибки (увеличите для удаления дыр). Строка sch задает цветовую схему. Если строка содержит ‘#’, то рисуется сетчатая поверхность. Массивы x, y, z должны иметь одинаковые размеры. См. также dots, triplot.

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.17 Nonlinear fitting

+ + + + + + + + +

Эти функции подбирают параметры функции для наилучшей аппроксимации данных, т.е. минимизируют сумму \sum_i (f(x_i, y_i, z_i) - a_i)^2/s_i^2. При этом аппроксимирующая функция ‘f’ может зависеть от одного аргумента ‘x’ (1D случай), от двух аргументов ‘x,y’ (2D случай) или от трех аргументов ‘x,y,z’ (3D случай). Функция ‘f’ также может зависеть от параметров. Список параметров задается строкой var (например, ‘abcd’). Обычно пользователь должен предоставить начальные значения параметров в переменной ini. Однако, при его отсутствии используются нулевые значения. Параметр print=true включает вывод найденной формулы в Message (см. Error handling). +

+

Функции Fit() и FitS() не рисуют полученные массивы. Они заполняют массив fit по формуле ‘f’ с найденными коэффициентами и возвращают \chi^2 ошибку аппроксимации. При этом, координаты ‘x,y,z’ равно распределены в диапазоне осей координат. Число точек в fit определяется опцией value (по умолчанию mglFitPnts=100). Функции используют библиотеку GSL. См. раздел Nonlinear fitting hints, для примеров кода и графика. +

+
+
Команда MGL: fits res adat sdat 'func' 'var' [ini=0]
+
Команда MGL: fits res xdat adat sdat 'func' 'var' [ini=0]
+
Команда MGL: fits res xdat ydat adat sdat 'func' 'var' [ini=0]
+
Команда MGL: fits res xdat ydat zdat adat sdat 'func' 'var' [ini=0]
+
Метод класса mglGraph: mglData FitS (const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData FitS (const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
Метод класса mglGraph: mglData FitS (const mglDataA &x, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData FitS (const mglDataA &x, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
Метод класса mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
Метод класса mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
+
Функция С: HMDT mgl_fit_ys (HMGL gr, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+
Функция С: HMDT mgl_fit_xys (HMGL gr, HCDT x, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+
Функция С: HMDT mgl_fit_xyzs (HMGL gr, HCDT x, HCDT y, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+
Функция С: HMDT mgl_fit_xyzas (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
+

"Подгоняют" формулу вдоль x-, y- и z-направлений для 3d массива заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) с весовым множителем s[i,j,k]. +

+ +
+
Команда MGL: fit res adat 'func' 'var' [ini=0]
+
Команда MGL: fit res xdat adat 'func' 'var' [ini=0]
+
Команда MGL: fit res xdat ydat adat 'func' 'var' [ini=0]
+
Команда MGL: fit res xdat ydat zdat adat 'func' 'var' [ini=0]
+
Метод класса mglGraph: mglData Fit (const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData Fit (const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Метод класса mglGraph: mglData Fit (const mglDataA &x, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData Fit (const mglDataA &x, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Метод класса mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Метод класса mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Функция С: HMDT mgl_fit_y (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
Функция С: HMDT mgl_fit_xy (HMGL gr, HCDT x, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
Функция С: HMDT mgl_fit_xyz (HMGL gr, HCDT x, HCDT y, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
Функция С: HMDT mgl_fit_xyza (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+

"Подгоняют" формулу вдоль x-, y- и z-направлений для 3d массива заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) с весовым множителем 1. +

+ + +
+
Метод класса mglGraph: mglData Fit2 (const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData Fit2 (mglData &fit, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Метод класса mglGraph: mglData Fit3 (mglData &fit, const mglDataA &a, const char *func, const char *var, const char *opt="")
+
Метод класса mglGraph: mglData Fit3 (mglData &fit, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
+
Функция С: HMDT mgl_fit_2 (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+
Функция С: HMDT mgl_fit_3 (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
+

"Подгоняют" формулу вдоль всех направлений для 2d или 3d массива a с s=1 и x, y, z равно распределёнными в диапазоне осей координат. +

+ +
+
Команда MGL: putsfit x y ['pre'='' 'fnt'='' size=-1]
+
Метод класса mglGraph: void PutsFit (mglPoint p, const char *prefix="", const char *font="", mreal size=-1)
+
Функция С: void mgl_puts_fit (HMGL gr, mreal x, mreal y, mreal z, const char *prefix, const char *font, mreal size)
+

Печатает последнюю подобранную формулу с найденными коэффициентами в точке p0. Строка prefix будет напечатана перед формулой. Все другие параметры такие же как в Text printing. +

+ +
+
Метод класса mglGraph: const char *GetFit ()
+
Функция С: const char * mgl_get_fit (HMGL gr)
+
Fortran процедура: mgl_get_fit (long gr, char *out, int len)
+

Возвращает последнюю подобранную формулу с найденными коэффициентами. +

+ +
+
Метод класса mglGraph: mreal GetFitChi ()
+
Функция С: mreal mgl_get_fit_chi ()
+

Возвращает величину \chi для последней подобранной формулы. +

+ +
+
Метод класса mglGraph: mreal GetFitCovar ()
+
Функция С: mreal mgl_get_fit_covar ()
+

Возвращает ковариационную матрицу для последней подобранной формулы. +

+ + + + +
+ +
+

+Previous: , Up: MathGL core   [Contents][Index]

+
+ +

4.18 Распределение данных

+ + + + + +
+
Команда MGL: hist RES xdat adat
+
Команда MGL: hist RES xdat ydat adat
+
Команда MGL: hist RES xdat ydat zdat adat
+
Метод класса mglGraph: mglData Hist (const mglDataA &x, const mglDataA &a, const char *opt="")
+
Метод класса mglGraph: mglData Hist (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *opt="")
+
Метод класса mglGraph: mglData Hist (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *opt="")
+
Функция С: HMDT mgl_hist_x (HMGL gr, HCDT x, HCDT a, const char *opt)
+
Функция С: HMDT mgl_hist_xy (HMGL gr, HCDT x, HCDT y, HCDT a, const char *opt)
+
Функция С: HMDT mgl_hist_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *opt)
+

Создают распределения данных. Они не рисуют данные. Функции могут быть полезны в случае когда данные пользователя определены на случайно расположенных точка (например, после PIC расчетов) и он хочет построить график, требующий регулярных данных (данных на сетках). Диапазон сеток равен диапазону осей координат. Массивы x, y, z определяют положение (координаты) точек. Массив a задает значения данных. Число точек в результате res определяется опцией value (по умолчанию mglFitPnts=100). +

+ + +
+
Команда MGL: fill dat 'eq'
+
Команда MGL: fill dat 'eq' vdat
+
Команда MGL: fill dat 'eq' vdat wdat
+
Метод класса mglGraph: void Fill (mglData &u, const char *eq, const char *opt="")
+
Метод класса mglGraph: void Fill (mglData &u, const char *eq, const mglDataA &v, const char *opt="")
+
Метод класса mglGraph: void Fill (mglData &u, const char *eq, const mglDataA &v, const mglDataA &w, const char *opt="")
+
Функция С: void mgl_data_fill_eq (HMGL gr, HMDT u, const char *eq, HCDTv, HCDTw, const char *opt)
+

Заполняют значения массива ‘u’ в соответствии с формулой в строке eq. Формула – произвольное выражение, зависящее от переменных ‘x’, ‘y’, ‘z’, ‘u’, ‘v’, ‘w’. Координаты ‘x’, ‘y’, ‘z’ полагаются в диапазоне изменения осей координат. Переменная ‘u’ – значение исходного массива. Переменные ‘v’ и ‘w’ – значения массивов v, w, которые могут быть NULL (т.е. могут быть опущены). +

+ +
+
Команда MGL: datagrid dat xdat ydat zdat
+
Метод класса mglGraph: void DataGrid (mglData &u, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *opt="")
+
Функция С: void mgl_data_grid (HMGL gr, HMDT u, HCDT x, HCDT y, HCDT z, const char *opt)
+

Заполняет значения массива ‘u’ результатом линейной интерполяции по триангулированной поверхности, найденной по произвольно расположенным точкам ‘x’, ‘y’, ‘z’. NAN значение используется для точек сетки вне триангулированной поверхности. См. раздел Making regular data, для примеров кода и графика. +

+ +
+
Команда MGL: refill dat xdat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat zdat vdat
+
Метод класса mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &v, long sl=-1, const char *opt="")
+
Метод класса mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &y, const mglDataA &v, long sl=-1, const char *opt="")
+
Метод класса mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &v, const char *opt="")
+
Функция С: void mgl_data_refill_gr (HMGL gr, HMDT a, HCDT x, HCDT y, HCDT z, HCDT v, long sl, const char *opt)
+

Заполняет значениями интерполяции массива v в точках {x, y, z}={X[i], Y[j], Z[k]} (или {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} если x, y, z не 1d массивы), где X,Y,Z равномерно распределены в диапазоне осей координат и имеют такой же размер как и массив dat. Если параметр sl равен 0 или положительный, то изменятся будет только sl-ый срез. +

+ + + +
+
Команда MGL: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+
Метод класса mglGraph: mglData PDE (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
Функция С: HMDT mgl_pde_solve (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+

Решает уравнение в частных производных du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], где p=-i/k0*d/dx, q=-i/k0*d/dy – псевдо-дифференциальные оперторы. Параметры ini_re, ini_im задают действительную и мнимую часть начального распределения поля. Координаты ‘x’, ‘y’, ‘z’ полагаются в диапазоне изменения осей координат. Отмечу, ято в действительности этот диапазон увеличен на 3/2 для уменьшения отражения от границ сетки. Параметр dz задает шаг по эволюционной координате z. Сейчас используется упрощенный вид функции ham – исключены все “смешанные” члены (типа ‘x*p’->x*d/dx). Например, в 2D случае это функция вида ham = f(p,z) + g(x,z,u). Однако, коммутирующие члены (типа ‘x*q’->x*d/dy) разрешены. Переменная ‘u’ используется для амплитуды поля |u|, что позволяет решать нелинейные задачи – например уравнение Шредингера ham="p^2 + q^2 - u^2". Вы можете задавать мнимую часть для поглощения волн, например ham = "p^2 + i*x*(x>0)", но только для линейной зависимости от переменной ‘i’ (т.е. ham = hre+i*him). См. раздел PDE solving hints, для примеров кода и графика. +

+ + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ + +

5 “Оконные” классы

+ + + + + + + + +

Есть целый набор “оконных” классов для создания окон с графикой MathGL: mglWnd и mglGLUT для окон целиком, Fl_MathGL и QMathGL для виджетов. Все эти классы позволяют пользователю просмотривать, вращать, экспортировать рисунок. Большинство из них (кроме mglGLUT) имеют панель инструментов для упрощения изменения графика. Все оконные классы имеют схожий набор функций. Ниже приведен список классов с краткими комментариями. +

+

Для рисования можно использовать: указатель NULL если планируется обновлять график вручную, глобальную функцию типа int draw(HMGL gr, void *p) или int draw(mglGraph *gr), или экземпляр класса, производного от mglDraw class. Этот класс определен в #include <mgl2/wnd.h> и имеет 2 основных виртуальных метода: +

class mglDraw
+{
+public:
+    virtual int Draw(mglGraph *) { return 0; };
+    virtual void Reload() {};
+};
+

Вам следует наследовать свой класс от mglDraw и определить один или оба метода. +

+

Непосредственно окна можно создать используя один из следующих классов (см. Using MathGL window для примеров). +

+ +
+
Конструктор класса mglFLTK: mglFLTK (const char *title="MathGL")
+
Конструктор класса mglFLTK: mglFLTK (int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, void (*reload)(HMGL gr, void *p)=0)
+
Конструктор класса mglFLTK: mglFLTK (int (*draw)(mglGraph *gr), const char *title="MathGL")
+
Конструктор класса mglFLTK: mglFLTK (mglDraw *draw, const char *title="MathGL")
+
Функция С: HMGL mgl_create_graph_fltk (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
+
+

Создает FLTK окно для вывода графика. Параметр draw – указатель (имя) функции рисования. Есть возможность создания нескольких кадров вначале (требует больше памяти) и их быстрая анимации в дальнейшем. В этом случае функция draw должна возвращать число кадров или ноль для рисования по запросу. Замечу, что draw может быть равна NULL для отображения статической (текущей) картинки. Параметр title задает заголовок окна. Параметр par содержит указатель на данные, передаваемые функции рисования draw. FLTK окна обеспечивают быстрое рисование и хорошо поддерживают многопоточность. +

+ +
+
Метод класса mglWnd: int RunThr ()
+
Функция С: int mgl_fltk_thr ()
+

Запускает цикл обработки сообщений в отдельном потоке. В данный момент работает только для окон FLTK. +

+ + +
+
Конструктор класса mglQT: mglQT (const char *title="MathGL")
+
Конструктор класса mglQT: mglQT (int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, void (*reload)(HMGL gr, void *p)=0)
+
Конструктор класса mglQT: mglQT (int (*draw)(mglGraph *gr), const char *title="MathGL")
+
Конструктор класса mglQT: mglQT (mglDraw *draw, const char *title="MathGL")
+
Функция С: HMGL mgl_create_graph_qt (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
+
+

Создает Qt окно для вывода графика. Параметр draw – указатель (имя) функции рисования. Есть возможность создания нескольких кадров вначале (требует больше памяти) и их быстрая анимации в дальнейшем. В этом случае функция draw должна возвращать число кадров или ноль для рисования по запросу. Замечу, что draw может быть равна NULL для отображения статической (текущей) картинки. Параметр title задает заголовок окна. Параметр par содержит указатель на данные, передаваемые функции рисования draw. +

+ + +
+
Конструктор класса mglGLUT: mglGLUT (const char *title="MathGL")
+
Конструктор класса mglGLUT: mglGLUT (int (*draw)(HMGL gr, void *p), const char *title="MathGL", void *par=NULL, void (*reload)(HMGL gr, void *p)=0)
+
Конструктор класса mglGLUT: mglGLUT (int (*draw)(mglGraph *gr), const char *title="MathGL")
+
Конструктор класса mglGLUT: mglGLUT (mglDraw *draw, const char *title="MathGL")
+
Функция С: HMGL mgl_create_graph_glut (int (*draw)(HMGL gr, void *p), const char *title, void *par, void (*reload)(HMGL gr, void *p))
+
+

Создает окно для вывода графика. Параметр draw – указатель (имя) функции рисования. Есть возможность создания нескольких кадров вначале (требует больше памяти) и их быстрая анимации в дальнейшем. В этом случае функция draw должна возвращать число кадров или ноль для рисования по запросу. Замечу, что draw может быть равна NULL для отображения статической (текущей) картинки. Параметр title задает заголовок окна. Параметр par содержит указатель на данные, передаваемые функции рисования draw. Параметр kind может иметь следующие значения: ‘0’ – использовать окно FLTK, ‘1’ – использовать окно Qt. +

+

В окне просмотра можно использовать клавиши: ’a’, ’d’, ’w’, ’s’ для вращения; ’,’, ’.’ для просмотра предыдущего и следующего кадров; ’r’ для переключения прозрачности; ’f’ для переключения оспещенности; ’x’ для закрытия окна. +

+ + + + + + + + + + + + + +
+ + + +

5.1 Класс mglWnd

+ + + + +

Это абстрактный класс производный от класса mglGraph (см. MathGL core). Он определен в #include <mgl2/wnd.h>. Класс содержит методы для создания и управления окном, содержащим графику MathGL. Производные от него классы существует отдельно для каждой библиотеки виджетов: mglQT в #include <mgl2/qt.h>, mglFLTK в #include <mgl2/fltk.h>. +

+
+
Метод класса mglWnd: int Run ()
+
Функция С: int mgl_qt_run ()
+
Функция С: int mgl_fltk_run ()
+

Запускает цикл обработки сообщений. Обычно эта функция должна вызываться в отдельном потоке или последней функцией в main(). +

+ +
+
Метод класса mglWnd: void SetDrawFunc (int (*draw)(HMGL gr, void *p), void *par=NULL, void (*reload)(void *p)=NULL)
+
Метод класса mglWnd: void SetDrawFunc (int (*draw)(mglGraph *gr))
+
Метод класса mglWnd: void SetDrawFunc (mglDraw *obj)
+
Функция С: void mgl_wnd_set_func (HMGL gr, int (*draw)(HMGL gr, void *p), void *par, void (*reload)(void *p))
+

Устанавливает функцию, которая будет вызвана при перерисовке (draw) и при повторной загрузке данных (reload), или объект obj класса, производного от mglDraw. +

+ +
+
Метод класса mglWnd: void SetClickFunc (void (*func)(HMGL gr, void *p))
+
Функция С: void mgl_set_click_func (void (*func)(HMGL gr, void *p))
+

Устанавливает функцию, которая будет вызвана при щелчке мышью. +

+ +
+
Method on mglWnd: void SetMutex(pthread_mutex_t *mutex)
+
C function: void mgl_wnd_set_mutex(HMGL gr, pthread_mutex_t *mutex)
+

Устанавливает внешний mutex для блокировки/разблокировки внешних вычислений с помощью меню или кнопок окна. Функция вызывается автоматически при использовании mglDraw class. +

+ +
+
Метод класса mglWnd: void ToggleAlpha ()
+
Функция С: void mgl_wnd_toggle_alpha (HMGL gr)
+

Включает/выключает прозрачность, но не перекрывает ее включение в пользовательской функции рисования. +

+
+
Метод класса mglWnd: void ToggleLight ()
+
Функция С: void mgl_wnd_toggle_light (HMGL gr)
+

Включает/выключает освещение, но не перекрывает его включение в пользовательской функции рисования. +

+
+
Метод класса mglWnd: void ToggleRotate ()
+
Функция С: void mgl_wnd_toggle_rotate (HMGL gr)
+

Включает/выключает вращение мышкой. Нажатая левая кнопка используется для вращения, средняя для сдвига, правая для приближения/перспективы. +

+
+
Метод класса mglWnd: void ToggleZoom ()
+
Функция С: void mgl_wnd_toggle_zoom (HMGL gr)
+

Включает/выключает приближение мышкой. Выделите прямоугольную область и она будет приближена. +

+
+
Метод класса mglWnd: void ToggleNo ()
+
Функция С: void mgl_wnd_toggle_no (HMGL gr)
+

Выключает вращение и приближение мышкой, а также восстанавливает исходный вид графика. +

+
+
Метод класса mglWnd: void Update ()
+
Функция С: void mgl_wnd_update (HMGL gr)
+

Обновляет содержимое окна. Функция полезна при ручном обновлении содержимого, пока долгий расчет идет в параллельном потоке. +

+
+
Метод класса mglWnd: void ReLoad ()
+
Функция С: void mgl_wnd_reload (HMGL gr)
+

Перегружает данные и обновляет рисунок. Функция также обновляет число кадров, которое создает функция рисования. +

+
+
Метод класса mglWnd: void Adjust ()
+
Функция С: void mgl_wnd_adjust (HMGL gr)
+

Подгоняет размер рисунка под размер окна. +

+
+
Метод класса mglWnd: void NextFrame ()
+
Функция С: void mgl_wnd_next_frame (HMGL gr)
+

Показывает следующий кадр, если он есть. +

+
+
Метод класса mglWnd: void PrevFrame ()
+
Функция С: void mgl_wnd_prev_frame (HMGL gr)
+

Показывает предыдущий кадр, если он есть. +

+
+
Метод класса mglWnd: void Animation ()
+
Функция С: void mgl_wnd_animation (HMGL gr)
+

Запускает/останавливает анимацию кадров. +

+ +
+
Метод класса mglWnd: void SetDelay (double dt)
+
Функция С: void mgl_wnd_set_delay (HMGL gr, double dt)
+

Задает задержку при анимации в секундах. По умолчанию интервал – 1 секунда. +

+ +
+
Метод класса mglWnd: double GetDelay ()
+
Функция С: double mgl_wnd_get_delay (HMGL gr)
+

Возвращает задержку при анимации в секундах. +

+ +
+
Метод класса mglWnd: void Setup (bool clfupd=true, bool showpos=false)
+
Функция С: void mgl_setup_window (HMGL gr, bool clfupd, bool showpos)
+

Включает/выключает: +

    +
  • очистку рисунка перед Update(); +
  • показ позиции щелчка мыши на рисунке. +
+
+ +
+
Метод класса mglWnd: mglPoint LastMousePos ()
+
Функция С: void mgl_get_last_mouse_pos (HMGL gr, mreal *x, mreal *y, mreal *z)
+

Возвращает положение щелчка мыши. +

+ +
+
Method on mglWnd: void * Widget ()
+
C function: void * mgl_fltk_widget (HMGL gr)
+
C function: void * mgl_qt_widget (HMGL gr)
+

Возвращает указатель на виджет (Fl_MathGL class or QMathGL class), используемый для рисования. +

+ + +
+ +
+

+Next: , Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.2 mglDraw class

+ + + +

This class provide base functionality for callback drawing and running calculation in separate thread. It is defined in #include <mgl2/wnd.h>. You should make inherited class and implement virtual functions if you need it. +

+
+
Virtual method on mglDraw: int Draw (mglGraph *gr)
+

This is callback drawing function, which will be called when any redrawing is required for the window. There is support of a list of plots (frames). So as one can prepare a set of frames at first and redraw it fast later (but it requires more memory). Function should return positive number of frames for the list or zero if it will plot directly. +

+ +
+
Virtual method on mglDraw: void Reload ()
+

This is callback function, which will be called if user press menu or toolbutton to reload data. +

+ +
+
Virtual method on mglDraw: void Click ()
+

This is callback function, which will be called if user click mouse. +

+ +
+
Virtual method on mglDraw: void Calc ()
+

This is callback function, which will be called if user start calculations in separate thread by calling mglDraw::Run() function. It should periodically call mglDraw::Check() function to check if calculations should be paused. +

+ +
+
Method on mglDraw: void Run ()
+

Runs mglDraw::Calc() function in separate thread. It also initialize mglDraw::thr variable and unlock mglDraw::mutex. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Cancel ()
+

Cancels thread with calculations. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Pause ()
+

Pauses thread with calculations by locking mglDraw::mutex. You should call mglDraw::Continue() to continue calculations. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Continue ()
+

Continues calculations by unlocking mglDraw::mutex. Function is present only if FLTK support for widgets was enabled. +

+ +
+
Method on mglDraw: void Continue ()
+

Checks if calculations should be paused and pause it. Function is present only if FLTK support for widgets was enabled. +

+ + +
+ +
+

+Next: , Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.3 Класс Fl_MathGL

+ + + + +

Класс реализует элемент интерфейса FLTK для отображения графики MathGL. Он определен в #include <mgl2/Fl_MathGL.h>. +

+
Пример окна FLTK с графикой MathGL. +
+
+
Method on Fl_MathGL: void set_draw (int (*draw)(HMGL gr, void *p))
+
Method on Fl_MathGL: void set_draw (int (*draw)(mglGraph *gr))
+
Method on Fl_MathGL: void set_draw (mglDraw *draw)
+

Устанавливает функцию рисования как глобальную функцию или как функцию член класса, производного от mglDraw. Поддерживается список графиков (кадров), так что можно вначале их нарисовать (требует довольно много памяти), а потом достаточно быстро отображать. Функция должна возвращать положительное число создаваемых кадров или ноль для непосредственного рисования. Параметр par содержит указатель на данные пользователя, передаваемый функции рисования draw. +

+
+
Method on Fl_MathGL: mglDraw *get_class ()
+

Указатель на экземпляр класса mglDraw или NULL если отсутствует. +

+ +
+
Method on Fl_MathGL: void update ()
+

Обновляет (перерисовывает) график. +

+
+
Method on Fl_MathGL: void set_angle (mreal t, mreal p)
+

Задает углы для дополнительного вращения графика. +

+
+
Method on Fl_MathGL: void set_flag (int f)
+

Задает битовые флаги для: 1 - прозрачности, 2 - освещения. +

+
+
Method on Fl_MathGL: void set_state (bool z, bool r)
+

Задает флаги обработки движений мыши: z=true – разрешает приближение выделения, r=true разрешает вращение/сдвиг/приближение/перспективу. +

+ +
+
Method on Fl_MathGL: void set_zoom (mreal X1, mreal Y1, mreal X2, mreal Y2)
+

Задает область приближения. +

+
+
Method on Fl_MathGL: void get_zoom (mreal *X1, mreal *Y1, mreal *X2, mreal *Y2)
+

Возвращает область приближения. +

+ +
+
Method on Fl_MathGL: void set_popup (const Fl_Menu_Item *pmenu, Fl_Widget *w, void *v)
+

Задает указатель на всплывающее меню. +

+ +
+
Method on Fl_MathGL: void set_graph (mglCanvas *gr)
+
Method on Fl_MathGL: void set_graph (mglGraph *gr)
+

Задает экземпляр класс для рисования вместо встроеного. Fl_MathGL автоматически удалит его при удалении виджета и при новом вызове set_graph(). +

+
+
Method on Fl_MathGL: mglGraph * get_graph ()
+

Возвращает указатель на объект, строящий графики. +

+ +
+
Method on Fl_MathGL: void set_show_warn (bool val)
+

Флаг показа окна с сообщениями после выполнения скрипта. +

+
+
Method on Fl_MathGL: void stop (bool stop=true)
+

Запрос на остановку рисования. +

+
+
Method on Fl_MathGL: void set_handle_key (bool val)
+

Вкл/выкл обработку нажатий клавиш (как в mglview, по умолчанию выкл). +

+
+
Method on Fl_MathGL: int get_last_id ()
+

Вернуть id последнего выделенного объекта. +

+
+
Method on Fl_MathGL: bool running ()
+

Проверяет выполняется ли сейчас скрипт или нет. +

+ +
+
Widget option of Fl_MathGL: Fl_Valuator * tet_val
+

Указатель на внешний элемент управления для изменения угла tet. +

+
+
Widget option of Fl_MathGL: Fl_Valuator * phi_val
+

Указатель на внешний элемент управления для изменения угла phi. +

+ + +
+ +
+

+Next: , Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.4 Класс QMathGL

+ + + + +

Класс реализует элемент интерфейса Qt для отображения графики MathGL. Он определен в #include <mgl2/qt.h>. +

+
Пример окна Qt с графикой MathGL. +
+
+
Method on QMathGL: void setDraw (mglDraw *dr)
+

Задает функцию рисования из класса производного от mglDraw. +

+
+
Method on QMathGL: void setDraw (int (*draw)(mglBase *gr, void *p), void *par=NULL)
+
Method on QMathGL: void setDraw (int (*draw)(mglGraph *gr))
+

Задает функцию рисования draw. Поддерживается список графиков (кадров), так что можно вначале их нарисовать (требует довольно много памяти), а потом достаточно быстро отображать. Функция должна возвращать положительное число создаваемых кадров или ноль для непосредственного рисования. Параметр par содержит указатель на данные пользователя, передаваемый функции рисования draw. +

+ +
+
Method on QMathGL: void setGraph (mglCanvas *gr)
+
Method on QMathGL: void setGraph (mglGraph *gr)
+

Устанавливает указатель на внешний экземпляр класса для рисования (вместо встроенного). Отмечу, что QMathGL автоматически удалит этот объект при удалении элемента интерфейса или при новом вызове setGraph(). +

+
+
Method on QMathGL: HMGL getGraph ()
+

Возвращает указатель на объект, строящий графики. +

+ +
+
Method on QMathGL: void setPopup (QMenu *p)
+

Задает указатель на всплывающее меню. +

+
+
Method on QMathGL: void setSize (int w, int h)
+

Задает размеры элемента управления и картинки. +

+
+
Method on QMathGL: double getRatio ()
+

Возвращает соотношение сторон рисунка. +

+ +
+
Method on QMathGL: int getPer ()
+

Возвращает величину перспективы в процентах. +

+
+
Method on QMathGL: int getPhi ()
+

Возвращает величину угла Phi в градусах. +

+
+
Method on QMathGL: int getTet ()
+

Возвращает величину угла Theta в градусах. +

+
+
Method on QMathGL: bool getAlpha ()
+

Возвращает состояние переключателя прозрачности. +

+
+
Method on QMathGL: bool getLight ()
+

Возвращает состояние переключателя освещения. +

+
+
Method on QMathGL: bool getZoom ()
+

Возвращает состояние переключателя приближения мышью. +

+
+
Method on QMathGL: bool getRotate ()
+

Возвращает состояние переключателя вращения мышью. +

+ + +
+
Slot on QMathGL: void refresh ()
+

Перерисовывает (обновляет) элемент управления без вызова функции рисования. +

+
+
Slot on QMathGL: void update ()
+

Обновляет рисунок путем вызова функции рисования. +

+
+
Slot on QMathGL: void copy ()
+

Копирует график в буфер обмена. +

+
+
Slot on QMathGL: void copyClickCoor ()
+

Копирует координаты щелчка мышью (как текст). +

+
+
Slot on QMathGL: void print ()
+

Печатает текущий рисунок. +

+ +
+
Slot on QMathGL: void stop ()
+

Посылает сигнал остановки рисования. +

+
+
Slot on QMathGL: void adjust ()
+

Подгоняет размер картинки под размер окна. +

+
+
Slot on QMathGL: void nextSlide ()
+

Показывает следующий кадр. +

+
+
Slot on QMathGL: void prevSlide ()
+

Показывает предыдущий кадр. +

+
+
Slot on QMathGL: void animation (bool st=true)
+

Запускает анимацию. +

+ +
+
Slot on QMathGL: void setPer (int val)
+

Задает величину перспективы. +

+
+
Slot on QMathGL: void setPhi (int val)
+

Задает величину угла Phi. +

+
+
Slot on QMathGL: void setTet (int val)
+

Задает величину угла Theta. +

+
+
Slot on QMathGL: void setAlpha (bool val)
+

Включает/выключает прозрачность. +

+
+
Slot on QMathGL: void setLight (bool val)
+

Включает/выключает освещение. +

+
+
Slot on QMathGL: void setGrid (bool val)
+

Включает/выключает рисование сетки абсолютных координат на графике. +

+
+
Slot on QMathGL: void setZoom (bool val)
+

Включает/выключает приближение мышью. +

+
+
Slot on QMathGL: void setRotate (bool val)
+

Включает/выключает вращение мышью. +

+
+
Slot on QMathGL: void zoomIn ()
+

Приблиажет график. +

+
+
Slot on QMathGL: void zoomOut ()
+

Отдаляет график. +

+
+
Slot on QMathGL: void shiftLeft ()
+

Сдвигает график влево. +

+
+
Slot on QMathGL: void shiftRight ()
+

Сдвигает график вправо. +

+
+
Slot on QMathGL: void shiftUp ()
+

Сдвигает график вверх. +

+
+
Slot on QMathGL: void shiftDown ()
+

Сдвигает график вниз. +

+
+
Slot on QMathGL: void restore ()
+

Восстанавливает приближение и поворот графика в значения по умолчанию. +

+ +
+
Slot on QMathGL: void exportPNG (QString fname="")
+

Сохраняет текущий рисунок в PNG файл. +

+
+
Slot on QMathGL: void exportPNGs (QString fname="")
+

Сохраняет текущий рисунок в PNG файл без прозрачности. +

+
+
Slot on QMathGL: void exportJPG (QString fname="")
+

Сохраняет текущий рисунок в JPEG файл. +

+
+
Slot on QMathGL: void exportBPS (QString fname="")
+

Сохраняет текущий рисунок в растровый EPS файл. +

+
+
Slot on QMathGL: void exportEPS (QString fname="")
+

Сохраняет текущий рисунок в векторный EPS файл. +

+
+
Slot on QMathGL: void exportSVG (QString fname="")
+

Сохраняет текущий рисунок в векторный SVG файл. +

+ +
+
Slot on QMathGL: void exportGIF (QString fname="")
+

Сохраняет текущий рисунок в GIF файл. +

+
+
Slot on QMathGL: void exportTEX (QString fname="")
+

Сохраняет текущий рисунок в векторный LaTeX/Tikz файл. +

+
+
Slot on QMathGL: void exportTGA (QString fname="")
+

Сохраняет текущий рисунок в TGA файл. +

+ +
+
Slot on QMathGL: void exportXYZ (QString fname="")
+

Сохраняет текущий рисунок в векторный XYZ/XYZL/XYZF файл. +

+
+
Slot on QMathGL: void exportOBJ (QString fname="")
+

Сохраняет текущий рисунок в векторный OBJ/MTL файл. +

+
+
Slot on QMathGL: void exportSTL (QString fname="")
+

Сохраняет текущий рисунок в векторный STL файл. +

+
+
Slot on QMathGL: void exportOFF (QString fname="")
+

Сохраняет текущий рисунок в векторный OFF файл. +

+ +
+
Slot on QMathGL: void setUsePrimitives (bool use)
+

Разрешает использовать список примитивов для кадров. Это позволяет вращать/масштабировать кадры, но требует значительно больше памяти. По умолчанию разрешено (=true). +

+
+
Slot on QMathGL: void setMGLFont (QString path)
+

Восстанавливает (path="") или загружает файлы шрифтов. +

+ +
+
Slot on QMathGL: void about ()
+

Показывает информацию о программе. +

+
+
Slot on QMathGL: void aboutQt ()
+

Показывает информацию о версии Qt. +

+ +
+
Signal on QMathGL: void phiChanged (int val)
+

Угол Phi изменен. +

+
+
Signal on QMathGL: void tetChanged (int val)
+

Угол Tet изменен. +

+
+
Signal on QMathGL: void perChanged (int val)
+

Перспектива изменена. +

+
+
Signal on QMathGL: void alphaChanged (bool val)
+

Прозрачность изменена. +

+
+
Signal on QMathGL: void lightChanged (bool val)
+

Освещение изменено. +

+
+
Signal on QMathGL: void gridChanged (bool val)
+

Рисование сетки изменено. +

+
+
Signal on QMathGL: void zoomChanged (bool val)
+

Режим приближения мышью изменен. +

+
+
Signal on QMathGL: void rotateChanged (bool val)
+

Режим вращения мышью изменен. +

+ +
+
Signal on QMathGL: void mouseClick (mreal x, mreal y, mreal z)
+

Был щелчок мышью в точке {x,y,z}. +

+
+
Signal on QMathGL: void frameChanged (int val)
+

Требуется новый кадр для отображения. +

+
+
Signal on QMathGL: void showWarn (QString warn)
+

Есть предупреждения. +

+
+
Signal on QMathGL: void posChanged (QString pos)
+

Положение щелчка мышью изменилось. +

+
+
Signal on QMathGL: void objChanged (int id)
+

Изменился id объекта на графике (из-за щелчка мышью). +

+
+
Signal on QMathGL: void refreshData ()
+

Данные могли измениться (рисование завершено). +

+ + +
+
QMathGL option of QMathGL: QString appName
+

Имя приложения для окон сообщений. +

+
+
QMathGL option of QMathGL: bool autoResize
+

Разрешить изменять размер рисунка (по умолчанию false). +

+ + + + + +
+ +
+

+Previous: , Up: Widget classes   [Contents][Index]

+
+ +

5.5 Класс wxMathGL

+ + + + +

Класс реализует элемент интерфейса WX для отображения графики MathGL. Он определен в #include <mgl2/wx.h>. +

+
+
Method on wxMathGL: void SetDraw (mglDraw *dr)
+

Задает функцию рисования из класса производного от mglDraw. +

+
+
Method on wxMathGL: void SetDraw (int (*draw)(mglBase *gr, void *p), void *par=NULL)
+
Method on wxMathGL: void SetDraw (int (*draw)(mglGraph *gr))
+

Задает функцию рисования draw. Поддерживается список графиков (кадров), так что можно вначале их нарисовать (требует довольно много памяти), а потом достаточно быстро отображать. Функция должна возвращать положительное число создаваемых кадров или ноль для непосредственного рисования. Параметр par содержит указатель на данные пользователя, передаваемый функции рисования draw. +

+ +
+
Method on wxMathGL: void SetGraph (mglCanvas *gr)
+
Method on wxMathGL: void SetGraph (mglGraph *gr)
+

Устанавливает указатель на внешний экземпляр класса для рисования (вместо встроенного). Отмечу, что wxMathGL автоматически удалит этот объект при удалении элемента интерфейса или при новом вызове setGraph(). +

+
+
Method on wxMathGL: HMGL GetGraph ()
+

Возвращает указатель на объект, строящий графики. +

+ +
+
Method on wxMathGL: void SetPopup (QMenu *p)
+

Задает указатель на всплывающее меню. +

+
+
Method on wxMathGL: void SetSize (int w, int h)
+

Задает размеры элемента управления и картинки. +

+
+
Method on wxMathGL: double GetRatio ()
+

Возвращает соотношение сторон рисунка. +

+ +
+
Method on wxMathGL: int GetPer ()
+

Возвращает величину перспективы в процентах. +

+
+
Method on wxMathGL: int GetPhi ()
+

Возвращает величину угла Phi в градусах. +

+
+
Method on wxMathGL: int GetTet ()
+

Возвращает величину угла Theta в градусах. +

+
+
Method on wxMathGL: bool GetAlpha ()
+

Возвращает состояние переключателя прозрачности. +

+
+
Method on wxMathGL: bool GetLight ()
+

Возвращает состояние переключателя освещения. +

+
+
Method on wxMathGL: bool GetZoom ()
+

Возвращает состояние переключателя приближения мышью. +

+
+
Method on wxMathGL: bool GetRotate ()
+

Возвращает состояние переключателя вращения мышью. +

+ + +
+
Method on wxMathGL: void Repaint ()
+

Перерисовывает (обновляет) элемент управления без вызова функции рисования. +

+
+
Method on wxMathGL: void Update ()
+

Обновляет рисунок путем вызова функции рисования. +

+
+
Method on wxMathGL: void Copy ()
+

Копирует график в буфер обмена. +

+
+
Method on wxMathGL: void Print ()
+

Печатает текущий рисунок. +

+ +
+
Method on wxMathGL: void Adjust ()
+

Подгоняет размер картинки под размер окна. +

+
+
Method on wxMathGL: void NextSlide ()
+

Показывает следующий кадр. +

+
+
Method on wxMathGL: void PrevSlide ()
+

Показывает предыдущий кадр. +

+
+
Method on wxMathGL: void Animation (bool st=true)
+

Запускает анимацию. +

+ +
+
Method on wxMathGL: void SetPer (int val)
+

Задает величину перспективы. +

+
+
Method on wxMathGL: void SetPhi (int val)
+

Задает величину угла Phi. +

+
+
Method on wxMathGL: void SetTet (int val)
+

Задает величину угла Theta. +

+
+
Method on wxMathGL: void SetAlpha (bool val)
+

Включает/выключает прозрачность. +

+
+
Method on wxMathGL: void SetLight (bool val)
+

Включает/выключает освещение. +

+
+
Method on wxMathGL: void SetZoom (bool val)
+

Включает/выключает приближение мышью. +

+
+
Method on wxMathGL: void SetRotate (bool val)
+

Включает/выключает вращение мышью. +

+
+
Method on wxMathGL: void ZoomIn ()
+

Приблиажет график. +

+
+
Method on wxMathGL: void ZoomOut ()
+

Отдаляет график. +

+
+
Method on wxMathGL: void ShiftLeft ()
+

Сдвигает график влево. +

+
+
Method on wxMathGL: void ShiftRight ()
+

Сдвигает график вправо. +

+
+
Method on wxMathGL: void ShiftUp ()
+

Сдвигает график вверх. +

+
+
Method on wxMathGL: void ShiftDown ()
+

Сдвигает график вниз. +

+
+
Method on wxMathGL: void Restore ()
+

Восстанавливает приближение и поворот графика в значения по умолчанию. +

+ +
+
Method on wxMathGL: void About ()
+

Показывает информацию о программе. +

+ +
+
Method on wxMathGL: void ExportPNG (QString fname="")
+

Сохраняет текущий рисунок в PNG файл. +

+
+
Method on wxMathGL: void ExportPNGs (QString fname="")
+

Сохраняет текущий рисунок в PNG файл без прозрачности. +

+
+
Method on wxMathGL: void ExportJPG (QString fname="")
+

Сохраняет текущий рисунок в JPEG файл. +

+
+
Method on wxMathGL: void ExportBPS (QString fname="")
+

Сохраняет текущий рисунок в растровый EPS файл. +

+
+
Method on wxMathGL: void ExportEPS (QString fname="")
+

Сохраняет текущий рисунок в векторный EPS файл. +

+
+
Method on wxMathGL: void ExportSVG (QString fname="")
+

Сохраняет текущий рисунок в векторный SVG файл. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 Обработка данных

+ + + +

В данной главе описываются классы mglData и mglDataC для работы с массивами действительных и комплексных данных, определённые в #include <mgl2/data.h> и #include <mgl2/datac.h> соответственно. Оба класса являются наследниками абстрактного класса mglDataA, и могут быть использованы в аргументах всех функций рисования (см. MathGL core). Классы содержат функции для выделения памяти и изменения размера данных, чтения данных из файла, численного дифференцирования, интегрирования, интерполяции и пр., заполнения по текстовой формуле и т.д. Классы позволяют работать с данными размерности не более 3 (как функции от трёх переменных – x,y,z). По умолчанию внутреннее представление данных использует тип mreal (и dual=std::complex<mreal> для mglDataC), который может быть сконфигурирован как float или double на этапе установки указав опцию --enable-double (см. Installation). Тип float удобен в силу меньшего размера занимаемой памяти и, как правило, достаточной для построения графиков точности. Однако, тип double имеет большую точность, что может быть важно, например, для осей с метками времени. Массивы которые могут быть созданы командами MGL отображаются Small Caps шрифтом (например, DAT). +

+ + + + + + + + + + + + + + + + + +
+ + + +

6.1 Переменные

+ + + +
+
Variable of mglData: mreal * a
+
Variable of mglDataC: dual * a
+

Указатель на массив данных. Это одномерный массив. Например, матрица [nx x ny x nz] представляется одномерным массивом длиной nx*ny*nz, где элемент с индексами {i, j, k} находится как a[i+nx*j+nx*ny*k] (индексы отсчитываются от нуля). +

+
+
Variable of mglData: int nx
+
Variable of mglDataC: long nx
+

Размер массива по 1-ой размерности (’x’ размерности). +

+
+
Variable of mglData: int ny
+
Variable of mglDataC: long ny
+

Размер массива по 2-ой размерности (’y’ размерности). +

+
+
Variable of mglData: int nz
+
Variable of mglDataC: long nz
+

Размер массива по 3-ей размерности (’z’ размерности). +

+
+
Variable of mglData: std::string id
+
Variable of mglDataC: std::string id
+

Имена колонки (или среза при nz>1) – один символ на колонку. +

+
+
Variable of mglData: bool link
+
Variable of mglDataC: bool link
+

Флаг использования указателя на внешние данные, включает запрет на удаление массива данных. +

+ +
+
Variable of mglDataA: std::wstring s
+

Имя массива данных, использующееся при разборе MGL скриптов. +

+
+
Variable of mglDataA: bool temp
+

Флаг временной переменной, которая может быть удалена в любой момент. +

+
+
Variable of mglDataA: void (*)(void *) func
+

Указатель на callback функцию, которая будет вызвана при удлалении данных. +

+
+
Variable of mglDataA: void * o
+

Указатель для callback функции. +

+ +
+
Метод класса mglData: mreal GetVal (long i)
+
Метод класса mglDataC: mreal GetVal (long i)
+
Метод класса mglData: void SetVal (mreal val, long i)
+
Метод класса mglDataC: void SetVal (mreal val, long i)
+

Присваивает или возвращает значение используя "непрерывную" индексацию без проверки выхода за границы массива. Индекс i должен быть в диапазоне [0, nx*ny*nz-1]. +

+ +
+
Метод класса mglDataA: long GetNx ()
+
Метод класса mglDataA: long GetNy ()
+
Метод класса mglDataA: long GetNz ()
+
Функция С: long mgl_data_get_nx (HCDT dat)
+
Функция С: long mgl_data_get_ny (HCDT dat)
+
Функция С: long mgl_data_get_nz (HCDT dat)
+

Возвращает размер данных в направлении x, y и z соответственно. +

+ +
+
Функция С: mreal mgl_data_get_value (HCDT dat, int i, int j, int k)
+
Функция С: dual mgl_datac_get_value (HCDT dat, int i, int j, int k)
+
Функция С: mreal * mgl_data_value (HMDT dat, int i, int j, int k)
+
Функция С: dual * mgl_datac_value (HADT dat, int i, int j, int k)
+
Функция С: void mgl_data_set_value (HMDT dat, mreal v, int i, int j, int k)
+
Функция С: void mgl_datac_set_value (HADT dat, dual v, int i, int j, int k)
+

Присваивает или возвращает значение ячейки данных с проверкой выхода за пределы массива. +

+
+
Функция С: const mreal * mgl_data_data (HCDT dat)
+

Возвращает указатель на внутренний массив данных. +

+ +
+
Функция С: void mgl_data_set_func (mglDataA *dat, void (*func)(void *), void *par)
+

Задает указатель на callback функцию, которая будет вызвана при удлалении данных. +

+ +
+
Функция С: void mgl_data_set_name (mglDataA *dat, const char *name)
+
Функция С: void mgl_data_set_name_w (mglDataA *dat, const wchar_t *name)
+

Задает имя массива данных, использующееся при разборе MGL скриптов. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.2 Создание и удаление данных

+ + + + +
+
Команда MGL: new DAT [nx=1 'eq']
+
Команда MGL: new DAT nx ny ['eq']
+
Команда MGL: new DAT nx ny nz ['eq']
+
Конструктор класса mglData: mglData (int mx=1, int my=1, int mz=1)
+
Конструктор класса mglDataC: mglDataC (int mx=1, int my=1, int mz=1)
+
Функция С: HMDT mgl_create_data ()
+
Функция С: HMDT mgl_create_data_size (int mx, int my, int mz)
+

Выделяет память для массива данных и заполняет её нулями. Если указана формула eq, то данные заполняются также как при использовании fill. +

+ +
+
Команда MGL: copy DAT dat2 ['eq'='']
+
Команда MGL: copy DAT val
+
Конструктор класса mglData: mglData (const mglData &dat2)
+
Конструктор класса mglData: mglData (const mglDataA *dat2)
+
Конструктор класса mglData: mglData (int size, const mreal *dat2)
+
Конструктор класса mglData: mglData (int size, int cols, const mreal *dat2)
+
Конструктор класса mglData: mglData (int size, const double *dat2)
+
Конструктор класса mglData: mglData (int size, int cols, const double *dat2)
+
Конструктор класса mglData: mglData (const double *dat2, int size)
+
Конструктор класса mglData: mglData (const double *dat2, int size, int cols)
+
Конструктор класса mglDataC: mglDataC (const mglDataA &dat2)
+
Конструктор класса mglDataC: mglDataC (const mglDataA *dat2)
+
Конструктор класса mglDataC: mglDataC (int size, const float *dat2)
+
Конструктор класса mglDataC: mglDataC (int size, int cols, const float *dat2)
+
Конструктор класса mglDataC: mglDataC (int size, const double *dat2)
+
Конструктор класса mglDataC: mglDataC (int size, int cols, const double *dat2)
+
Конструктор класса mglDataC: mglDataC (int size, const dual *dat2)
+
Конструктор класса mglDataC: mglDataC (int size, int cols, const dual *dat2)
+

Копирует данные из другого экземпляра данных. Если указана формула eq, то данные заполняются также как при использовании fill. +

+ +
+
Команда MGL: copy REDAT IMDAT dat2
+

Копирует действительную и мнимую часть данных из комплексного массива данных dat2. +

+ +
+
Команда MGL: copy DAT 'name'
+

Копирует данные из другого экземпляра данных с именем name. При этом имя name может быть некорректным с точки зрения MGL (например, взятым из HDF5 файла). +

+ + + +
+
Команда MGL: read DAT 'fname'
+
Конструктор класса mglData: mglData (const char *fname)
+
Конструктор класса mglDataC: mglDataC (const char *fname)
+
Функция С: HMDT mgl_create_data_file (const char *fname)
+
Функция С: HADT mgl_create_datac_file (const char *fname)
+

Читает данные из текстового файла с автоматическим определением размеров массива. +

+ +
+
Команда MGL: delete dat
+
Команда MGL: delete 'name'
+
Destructor on mglData: ~mglData ()
+
Функция С: void mgl_delete_data (HMDT dat)
+
Destructor on mglDataC: ~mglDataC ()
+
Функция С: void mgl_delete_datac (HADT dat)
+

Удаляет массив данных из памяти. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.3 Изменение размеров данных

+ + + + + + + + + + + + + + +
+
Команда MGL: new DAT [nx=1 ny=1 nz=1]
+
Метод класса mglData: void Create (int mx, int my=1, int mz=1)
+
Метод класса mglDataC: void Create (int mx, int my=1, int mz=1)
+
Функция С: void mgl_data_create (HMDT dat, int mx, int my, int mz)
+
Функция С: void mgl_datac_create (HADT dat, int mx, int my, int mz)
+

Создает/пересоздает массив данных указанного размера и заполняет его нулями. Ничего не делает при mx, my, mz отрицательных или равных нулю. +

+ +
+
Команда MGL: rearrange dat mx [my=0 mz=0]
+
Метод класса mglData: void Rearrange (int mx, int my=0, int mz=0)
+
Метод класса mglDataC: void Rearrange (int mx, int my=0, int mz=0)
+
Функция С: void mgl_data_rearrange (HMDT dat, int mx, int my, int mz)
+
Функция С: void mgl_datac_rearrange (HADT dat, int mx, int my, int mz)
+

Изменяет размерность данных без изменения самого массива данных, так что результирующий массив mx*my*mz < nx*ny*nz. Если один из параметров my или mz ноль, то он будет выбран оптимальным образом. Например, если my=0, то будет my=nx*ny*nz/mx и mz=1. +

+ +
+
Команда MGL: transpose dat ['dim'='yxz']
+
Метод класса mglData: void Transpose (const char *dim="yx")
+
Метод класса mglDataC: void Transpose (const char *dim="yx")
+
Функция С: void mgl_data_transpose (const char *dim)
+
Функция С: void mgl_datac_transpose (HADT dat, const char *dim)
+

Транспонирует (меняет порядок размерностей) массив данных. Новый порядок размерностей задается строкой dim. Функция может быть полезна для транспонирования одномерных (или квазиодномерных) массивов после чтения их из файла. +

+ +
+
Команда MGL: extend dat n1 [n2=0]
+
Метод класса mglData: void Extend (int n1, int n2=0)
+
Метод класса mglDataC: void Extend (int n1, int n2=0)
+
Функция С: void mgl_data_extend (HMDT dat, int n1, int n2)
+
Функция С: void mgl_datac_extend (HADT dat, int n1, int n2)
+

Увеличивает размер данных путем вставки (|n1|+1) новых срезов после (для n1>0) или перед (для n1<0) существующими данными. Можно добавить сразу 2 размерности для 1d массива, используя второй параметр n2. Данные в новые срезы будут скопированы из существующих. Например, для n1>0 новый массив будет +a_ij^new = a_i^old where j=0...n1. Соответственно, для n1<0 новый массив будет a_ij^new = a_j^old, где i=0...|n1|. +

+ +
+
Команда MGL: squeeze dat rx [ry=1 rz=1 sm=off]
+
Метод класса mglData: void Squeeze (int rx, int ry=1, int rz=1, bool smooth=false)
+
Метод класса mglDataC: void Squeeze (int rx, int ry=1, int rz=1, bool smooth=false)
+
Функция С: void mgl_data_squeeze (HMDT dat, int rx, int ry, int rz, int smooth)
+
Функция С: void mgl_datac_squeeze (HADT dat, int rx, int ry, int rz, int smooth)
+

Уменьшает размер данных путём удаления элементов с индексами не кратными rx, ry, rz соответственно. Параметр smooth задает использовать сглаживания +(т.е. out[i]=\sum_{j=i,i+r} a[j]/r) или нет (т.е. out[i]=a[j*r]). +

+ +
+
Команда MGL: crop dat n1 n2 'dir'
+
Метод класса mglData: void Crop (int n1, int n2, char dir='x')
+
Метод класса mglDataC: void Crop (int n1, int n2, char dir='x')
+
Функция С: void mgl_data_crop (HMDT dat, int n1, int n2, char dir)
+
Функция С: void mgl_datac_crop (HADT dat, int n1, int n2, char dir)
+

Обрезает границы данных при i<n1 и i>n2 (при n2>0) или i>n[xyz]-n2 (при n2<=0) вдоль направления dir. +

+ +
+
Команда MGL: crop dat 'how'
+
Метод класса mglData: void Crop (const char *how="235x")
+
Метод класса mglDataC: void Crop (const char *how="235x")
+
Функция Сn: void mgl_data_crop_opt (HMDT dat, const char *how)
+
Функция Сn: void mgl_datac_crop_opt (HADT dat, const char *how)
+

Обрезает дальний край данных, чтобы сделать их более оптимальным для быстрого преобразования Фурье. Размер массива будет равен наиболее близким к исходному из 2^n*3^m*5^l. Строка how может содержать: ‘x’, ‘y’, ‘z’ для направлений, и ‘2’, ‘3’, ‘5’ для использования соответствующего основания. +

+ +
+
Команда MGL: insert dat 'dir' [pos=off num=0]
+
Метод класса mglData: void Insert (char dir, int pos=0, int num=1)
+
Метод класса mglDataC: void Insert (char dir, int pos=0, int num=1)
+
Функция С: void mgl_data_insert (HMDT dat, char dir, int pos, char num)
+
Функция С: void mgl_datac_insert (HADT dat, char dir, int pos, char num)
+

Вставляет num срезов вдоль направления dir с позиции pos и заполняет их нулями. +

+ +
+
Команда MGL: delete dat 'dir' [pos=off num=0]
+
Метод класса mglData: void Delete (char dir, int pos=0, int num=1)
+
Метод класса mglDataC: void Delete (char dir, int pos=0, int num=1)
+
Функция С: void mgl_data_delete (HMDT dat, char dir, int pos, char num)
+
Функция С: void mgl_datac_delete (HADT dat, char dir, int pos, char num)
+

Удаляет num срезов вдоль направления dir с позиции pos. +

+ +
+
Команда MGL: delete dat
+
Команда MGL: delete 'name'
+

Удаляет массив данных из памяти. +

+ +
+
Команда MGL: sort dat idx [idy=-1]
+
Метод класса mglData: void Sort (lond idx, long idy=-1)
+
Функция С: void mgl_data_sort (HMDT dat, lond idx, long idy)
+

Сортирует строки (или срезы в 3D случае) по значениям в указанной колонке idx (или ячейках {idx,idy} для 3D случая). Не используйте в многопоточных функциях! +

+ +
+
Команда MGL: clean dat idx
+
Метод класса mglData: void Clean (lond idx)
+
Функция С: void mgl_data_clean (HMDT dat, lond idx)
+

Удаляет строки в которых значения для заданной колонки idx совпадают со значениями в следующей строке. +

+ + +
+
Команда MGL: join dat vdat [v2dat ...]
+
Метод класса mglData: void Join (const mglDataA &vdat)
+
Метод класса mglDataC: void Join (const mglDataA &vdat)
+
Функция С: void mgl_data_join (HMDT dat, HCDT vdat)
+
Функция С: void mgl_datac_join (HADT dat, HCDT vdat)
+

Объединяет данные из массива vdat с данными массива dat. При этом, функция увеличивает размер массива dat: в z-направлении для массивов с одинаковыми размерами по x и y; в y-направлении для массивов с одинаковыми размерами по x; в x-направлении в остальных случаях. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.4 Заполнение данных

+ + + + + + + + +
+
Команда MGL: list DAT v1 ...
+

Создает новый массив данных dat и заполняет его числовыми значениями аргументов v1 .... Команда может создавать одно- и двухмерные массивы с произвольными значениями. Для создания 2d массива следует использовать разделитель ‘|’, который означает начало новой строки данных. Размер массива данных будет [maximal of row sizes * number of rows]. Например, команда list 1 | 2 3 создаст массив [1 0; 2 3]. Замечу, что максимальное число аргументов равно 1000. +

+
+
Команда MGL: list DAT d1 ...
+

Создает новый массив данных dat и заполняет его значениями из массивов d1 .... Команда может создавать двух- и трёхмерные (если аргументы – двумерные массивы) массивы. Меньшая размерность всех массивов в аргументах должна совпадать. В противном случае аргумент (массив) будет пропущен. +

+ +
+
Метод класса mglData: void Set (const mreal *A, int NX, int NY=1, int NZ=1)
+
Метод класса mglData: void Set (const double *A, int NX, int NY=1, int NZ=1)
+
Функция С: void mgl_data_set_mreal (HMDT dat, const mreal *A, int NX, int NY, int NZ)
+
Функция С: void mgl_data_set_double (HMDT dat, const double *A, int NX, int NY, int NZ)
+
Метод класса mglDataC: void Set (const float *A, int NX, int NY=1, int NZ=1)
+
Метод класса mglDataC: void Set (const double *A, int NX, int NY=1, int NZ=1)
+
Метод класса mglDataC: void Set (const dual *A, int NX, int NY=1, int NZ=1)
+
Функция С: void mgl_datac_set_float (HADT dat, const mreal *A, int NX, int NY, int NZ)
+
Функция С: void mgl_datac_set_double (HADT dat, const double *A, int NX, int NY, int NZ)
+
Функция С: void mgl_datac_set_complex (HADT dat, const dual *A, int NX, int NY, int NZ)
+

Выделяет память и копирует данные из массивов типа mreal* или double*, т.е. из массивов определённых как mreal a[NX*NY*NZ];. +

+ +
+
Метод класса mglData: void Set (const mreal **A, int N1, int N2)
+
Метод класса mglData: void Set (const double **A, int N1, int N2)
+
Функция С: void mgl_data_set_mreal2 (HMDT dat, const mreal **A, int N1, int N2)
+
Функция С: void mgl_data_set_double2 (HMDT dat, const double **A, int N1, int N2)
+

Выделяет память и копирует данные из массивов типа mreal** или double** с размерностями N1, N2, т.е. из массивов определённых как mreal a[N1][N2];. +

+ +
+
Метод класса mglData: void Set (const mreal ***A, int N1, int N2)
+
Метод класса mglData: void Set (const double ***A, int N1, int N2)
+
Функция С: void mgl_data_set_mreal3 (HMDT dat, const mreal ***A, int N1, int N2)
+
Функция С: void mgl_data_set_double3 (HMDT dat, const double ***A, int N1, int N2)
+

Выделяет память и копирует данные из массивов типа mreal*** или double*** с размерностями N1, N2, N3, т.е. из массивов определённых как mreal a[N1][N2][N3];. +

+ +
+
Метод класса mglData: void Set (gsl_vector *v)
+
Метод класса mglDataC: void Set (gsl_vector *v)
+
Функция С: void mgl_data_set_vector (HMDT dat, gsl_vector *v)
+
Функция С: void mgl_datac_set_vector (HADT dat, gsl_vector *v)
+

Выделяет память и копирует данные из структуры типа gsl_vector *. +

+
+
Метод класса mglData: void Set (gsl_matrix *m)
+
Метод класса mglDataC: void Set (gsl_matrix *m)
+
Функция С: void mgl_data_set_matrix (HMDT dat, gsl_matrix *m)
+
Функция С: void mgl_datac_set_matrix (HADT dat, gsl_matrix *m)
+

Выделяет память и копирует данные из структуры типа gsl_matrix *. +

+
+
Метод класса mglData: void Set (const mglDataA &from)
+
Метод класса mglData: void Set (HCDT from)
+
Функция С: void mgl_data_set (HMDT dat, HCDT from)
+
Метод класса mglDataC: void Set (const mglDataA &from)
+
Метод класса mglDataC: void Set (HCDT from)
+
Функция С: void mgl_datac_set (HADT dat, HCDT from)
+

Выделяет память и копирует данные из другого экземпляра данных from. +

+ +
+
Метод класса mglDataC: void Set (const mglDataA &re, const mglDataA &im)
+
Метод класса mglDataC: void Set (HCDT re, HCDT im)
+
Метод класса mglDataC: void SetAmpl (HCDT ampl, const mglDataA &phase)
+
Функция С: void mgl_datac_set_ri (HADT dat, HCDT re, HCDT im)
+
Функция С: void mgl_datac_set_ap (HADT dat, HCDT ampl, HCDT phase)
+

Выделяет память и копирует данные из экземпляра данных для действительной re и мнимой im частей комплексного массива данных. +

+ +
+
Метод класса mglData: void Set (const std::vector<int> &d)
+
Метод класса mglDataC: void Set (const std::vector<int> &d)
+
Метод класса mglData: void Set (const std::vector<float> &d)
+
Метод класса mglDataC: void Set (const std::vector<float> &d)
+
Метод класса mglData: void Set (const std::vector<double> &d)
+
Метод класса mglDataC: void Set (const std::vector<double> &d)
+
Метод класса mglDataC: void Set (const std::vector<dual> &d)
+

Выделяет память и копирует данные из массива типа std::vector<T>. +

+ +
+
Метод класса mglData: void Set (const char *str, int NX, int NY=1, int NZ=1)
+
Функция С: void mgl_data_set_values (const char *str, int NX, int NY, int NZ)
+
Метод класса mglDataC: void Set (const char *str, int NX, int NY=1, int NZ=1)
+
Функция С: void mgl_datac_set_values (const char *str, int NX, int NY, int NZ)
+

Выделяет память и сканирует массив данных из строки. +

+ + +
+
Метод класса mglData: void SetList (long n, ...)
+

Allocate memory and set data from variable argument list of double values. Note, you need to specify decimal point ‘.’ for integer values! For example, the code SetList(2,0.,1.); is correct, but the code SetList(2,0,1); is incorrect. +

+ + +
+
Метод класса mglData: void Link (mglData &from)
+
Метод класса mglData: void Link (mreal *A, int NX, int NY=1, int NZ=1)
+
Функция С: void mgl_data_link (HMDT dat, const mreal *A, int NX, int NY, int NZ)
+
Метод класса mglDataC: void Link (mglDataC &from)
+
Метод класса mglDataC: void Link (dual *A, int NX, int NY=1, int NZ=1)
+
Функция С: void mgl_datac_link (HADT dat, const mreal *A, int NX, int NY, int NZ)
+

Устанавливает флаг использования внешнего массива данных, которые не будут удалены. Флаг может быть возвращён в исходное состояние и создан новый внутренний массив если использовались функции изменяющие размер данных. +

+ +
+
Команда MGL: var DAT num v1 [v2=nan]
+

Создает новый одномерный массив данных dat размером num, и заполняет его равномерно в диапазоне [v1, v2]. Если v2=nan, то используется v2=v1. +

+ +
+
Команда MGL: fill dat v1 v2 ['dir'='x']
+
Метод класса mglData: void Fill (mreal v1, mreal v2, char dir='x')
+
Метод класса mglDataC: void Fill (dual v1, dual v2, char dir='x')
+
Функция С: void mgl_data_fill (HMDT dat, mreal v1, mreal v2, char dir)
+
Функция С: void mgl_datac_fill (HADT dat, dual v1, dual v2, char dir)
+

Заполняет значениями равно распределёнными в диапазоне [x1, x2] в направлении dir={‘x’,‘y’,‘z’}. +

+ +
+
Команда MGL: fill dat 'eq'[vdat wdat]
+
Метод класса mglData: void Fill (HMGL gr, const char *eq, const char *opt="")
+
Метод класса mglData: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const char *opt="")
+
Метод класса mglData: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const mglDataA &wdat, const char *opt="")
+
Метод класса mglDataC: void Fill (HMGL gr, const char *eq, const char *opt="")
+
Метод класса mglDataC: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const char *opt="")
+
Метод класса mglDataC: void Fill (HMGL gr, const char *eq, const mglDataA &vdat, const mglDataA &wdat, const char *opt="")
+
Функция С: void mgl_data_fill_eq (HMGL gr, HMDT dat, const char *eq, HCDT vdat, HCDT wdat, const char *opt)
+
Функция С: void mgl_datac_fill_eq (HMGL gr, HADT dat, const char *eq, HCDT vdat, HCDT wdat, const char *opt)
+

Заполняет значениями вычисленными по формуле eq. Формула представляет собой произвольное выражение, зависящее от переменных ‘x’, ‘y’, ‘z’, ‘u’, ‘v’, ‘w’. Координаты ‘x’, ‘y’, ‘z’ полагаются меняющимися в диапазоне Min x Max (в отличие от функции Modify). Переменная ‘u’ – значения исходного массива, переменные ‘v’, ‘w’ – значения массивов vdat, wdat. Последние могут быть NULL, т.е. опущены. +

+ +
+
Команда MGL: modify dat 'eq' [dim=0]
+
Команда MGL: modify dat 'eq' vdat [wdat]
+
Метод класса mglData: void Modify (const char *eq, int dim=0)
+
Метод класса mglData: void Modify (const char *eq, const mglDataA &v)
+
Метод класса mglData: void Modify (const char *eq, const mglDataA &v, const mglDataA &w)
+
Метод класса mglDataC: void Modify (const char *eq, int dim=0)
+
Метод класса mglDataC: void Modify (const char *eq, const mglDataA &v)
+
Метод класса mglDataC: void Modify (const char *eq, const mglDataA &v, const mglDataA &w)
+
Функция С: void mgl_data_modify (HMDT dat, const char *eq, int dim)
+
Функция С: void mgl_data_modify_vw (HMDT dat, const char *eq, HCDT v, HCDT w)
+
Функция С: void mgl_datac_modify (HADT dat, const char *eq, int dim)
+
Функция С: void mgl_datac_modify_vw (HADT dat, const char *eq, HCDT v, HCDT w)
+

Аналогично предыдущему с координатами ‘x’, ‘y’, ‘z’, меняющимися в диапазоне [0,1]. Если указан dim>0, то изменяются только слои >=dim. +

+ +
+
Команда MGL: fillsample dat 'how'
+
Метод класса mglData: void FillSample (const char *how)
+
Функция С: void mgl_data_fill_sample (HMDT a, const char *how)
+

Заполняет массив данных ’x’ или ’k’ значениями для преобразований Ханкеля (’h’) или Фурье (’f’). +

+ + +
+
Команда MGL: datagrid dat xdat ydat zdat
+
Метод класса mglData: mglData Grid (HMGL gr, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *opt="")
+
Метод класса mglData: mglData Grid (const mglDataA &x, const mglDataA &y, const mglDataA &z, mglPoint p1, mglPoint p2)
+
Функция С: void mgl_data_grid (HMGL gr, HMDT u, HCDT x, HCDT y, HCDT z, const char *opt)
+
Функция С: void mgl_data_grid_xy (HMDT u, HCDT x, HCDT y, HCDT z, mreal x1, mreal x2, mreal y1, mreal y2)
+

Заполняет значения массива результатом линейной интерполяции (считая координаты равнораспределенными в диапазоне осей координат или в диапазоне [x1,x2]*[y1,y2]) по триангулированной поверхности, найденной по произвольно расположенным точкам ‘x’, ‘y’, ‘z’. NAN значение используется для точек сетки вне триангулированной поверхности. См. раздел Making regular data, для примеров кода и графика. +

+ + +
+
Команда MGL: put dat val [i=all j=all k=all]
+
Метод класса mglData: void Put (mreal val, int i=-1, int j=-1, int k=-1)
+
Метод класса mglDataC: void Put (dual val, int i=-1, int j=-1, int k=-1)
+
Функция С: void mgl_data_put_val (HMDT a, mreal val, int i, int j, int k)
+
Функция С: void mgl_datac_put_val (HADT a, dual val, int i, int j, int k)
+

Присваивает значения (под-)массива dat[i, j, k] = val. Индексы i, j, k равные ‘-1’ задают значения val для всего диапазона соответствующего направления(ий). Например, Put(val,-1,0,-1); задает a[i,0,j]=val для i=0...(nx-1), j=0...(nz-1). +

+ +
+
Команда MGL: put dat vdat [i=all j=all k=all]
+
Метод класса mglData: void Put (const mglDataA &v, int i=-1, int j=-1, int k=-1)
+
Метод класса mglDataC: void Put (const mglDataA &v, int i=-1, int j=-1, int k=-1)
+
Функция С: void mgl_data_put_dat (HMDT a, HCDT v, int i, int j, int k)
+
Функция С: void mgl_datac_put_dat (HADT a, HCDT v, int i, int j, int k)
+

Копирует значения из массива v в диапазон значений данного массива. Индексы i, j, k равные ‘-1’ задают диапазон изменения значений в соответствующих направление(ях). Младшие размерности массива v должны быть больше выбранного диапазона массива. Например, Put(v,-1,0,-1); присвоит a[i,0,j]=v.ny>nz ? v.a[i,j] : v.a[i], где i=0...(nx-1), j=0...(nz-1) и условие v.nx>=nx выполнено. +

+ +
+
Команда MGL: refill dat xdat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat zdat vdat
+
Метод класса mglData: void Refill (const mglDataA &x, const mglDataA &v, mreal x1, mreal x2, long sl=-1)
+
Метод класса mglData: void Refill (const mglDataA &x, const mglDataA &v, mglPoint p1, mglPoint p2, long sl=-1)
+
Метод класса mglData: void Refill (const mglDataA &x, const mglDataA &y, const mglDataA &v, mglPoint p1, mglPoint p2, long sl=-1)
+
Метод класса mglData: void Refill (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &v, mglPoint p1, mglPoint p2)
+
Метод класса mglData: void Refill (HMGL gr, const mglDataA &x, const mglDataA &v, long sl=-1, const char *opt="")
+
Метод класса mglData: void Refill (HMGL gr, const mglDataA &x, const mglDataA &y, const mglDataA &v, long sl=-1, const char *opt="")
+
Метод класса mglData: void Refill (HMGL gr, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &v, const char *opt="")
+
Функция С: void mgl_data_refill_x (HMDT a, HCDT x, HCDT v, mreal x1, mreal x2, long sl)
+
Функция С: void mgl_data_refill_xy (HMDT a, HCDT x, HCDT y, HCDT v, mreal x1, mreal x2, mreal y1, mreal y2, long sl)
+
Функция С: void mgl_data_refill_xyz (HMDT a, HCDT x, HCDT y, HCDT z, HCDT v, mreal x1, mreal x2, mreal y1, mreal y2, mreal z1, mreal z2)
+
Функция С: void mgl_data_refill_gr (HMGL gr, HMDT a, HCDT x, HCDT y, HCDT z, HCDT v, long sl, const char *opt)
+

Заполняет значениями интерполяции массива v в точках {x, y, z}={X[i], Y[j], Z[k]} (или {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} если x, y, z не 1d массивы), где X,Y,Z равномерно распределены в диапазоне [x1,x2]*[y1,y2]*[z1,z2] и имеют такой же размер как и заполняемый массив. Если параметр sl равен 0 или положительный, то изменятся будет только sl-ый срез. +

+ +
+
Команда MGL: gspline dat xdat vdat [sl=-1]
+
Метод класса mglData: void RefillGS (const mglDataA &x, const mglDataA &v, mreal x1, mreal x2, long sl=-1)
+
Функция С: void mgl_data_refill_gs (HMDT a, HCDT x, HCDT v, mreal x1, mreal x2, long sl)
+

Заполняет значениями глобального кубического сплайна для массива v в точках x=X[i], где X равномерно распределен в диапазоне [x1,x2] и имеет такой же размер как и заполняемый массив. Если параметр sl равен 0 или положительный, то изменятся будет только sl-ый срез. +

+ +
+
Команда MGL: idset dat 'ids'
+
Метод класса mglData: void SetColumnId (const char *ids)
+
Функция С: void mgl_data_set_id (const char *ids)
+
Метод класса mglDataC: void SetColumnId (const char *ids)
+
Функция С: void mgl_datac_set_id (HADT a, const char *ids)
+

Задает названия ids для колонок массива данных. Строка должна содержать один символ ’a’...’z’ на колонку. Эти названия используются в функции column. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.5 Чтение/сохранение данных

+ + + + + + + + + + + +
+
Команда MGL: read DAT 'fname'
+
Команда MGL: read REDAT IMDAT 'fname'
+
Метод класса mglData: void Read (const char *fname)
+
Метод класса mglDataC: bool Read (const char *fname)
+
Функция С: int mgl_data_read (HMDT dat, const char *fname)
+
Функция С: int mgl_datac_read (HADT dat, const char *fname)
+

Читает данные из текстового файла с разделителями символом пробела/табуляции с автоматическим определением размера массива. Двойной перевод строки начинает новый срез данных (по направлению z). +

+ +
+
Команда MGL: read DAT 'fname' mx [my=1 mz=1]
+
Команда MGL: read REDAT IMDAT 'fname' mx [my=1 mz=1]
+
Метод класса mglData: void Read (const char *fname, int mx, int my=1, int mz=1)
+
Метод класса mglDataC: bool Read (const char *fname, int mx, int my=1, int mz=1)
+
Функция С: int mgl_data_read_dim (HMDT dat, const char *fname, int mx, int my, int mz)
+
Функция С: int mgl_datac_read_dim (HADT dat, const char *fname, int mx, int my, int mz)
+

Читает данные из текстового файла с заданными размерами. Ничего не делается если параметры mx, my или mz равны нулю или отрицательны. +

+ +
+
Команда MGL: readmat DAT 'fname' [dim=2]
+
Метод класса mglData: void ReadMat (const char *fname, int dim=2)
+
Метод класса mglDataC: bool ReadMat (const char *fname, int dim=2)
+
Функция С: int mgl_data_read_mat (HMDT dat, const char *fname, int dim)
+
Функция С: int mgl_datac_read_mat (HADT dat, const char *fname, int dim)
+

Читает данные из текстового файла с размерами, указанными в первых dim числах файла. При этом переменная dim задает размерность (1d, 2d, 3d) данных. +

+ +
+
Команда MGL: readall DAT 'templ' v1 v2 [dv=1 slice=off]
+
Метод класса mglData: void ReadRange (const char *templ, mreal from, mreal to, mreal step=1.f, bool as_slice=false)
+
Метод класса mglDataC: void ReadRange (const char *templ, mreal from, mreal to, mreal step=1, bool as_slice=false)
+
Функция С: int mgl_data_read_range (HMDT dat, const char *templ, mreal from, mreal to, mreal step, int as_slice)
+
Функция С: int mgl_datac_read_range (HADT dat, const char *templ, mreal from, mreal to, mreal step, int as_slice)
+

Объединяет данные из нескольких текстовых файлов. Имена файлов определяются вызовом функции sprintf(fname,templ,val);, где val меняется от from до to с шагом step. Данные загружаются один за другим в один и тот же срез данных (при as_slice=false) или срез-за-срезом (при as_slice=true). +

+ +
+
Команда MGL: readall DAT 'templ' [slice=off]
+
Метод класса mglData: void ReadAll (const char *templ, bool as_slice=false)
+
Метод класса mglDataC: void ReadAll (const char *templ, bool as_slice=false)
+
Функция С: int mgl_data_read_all (HMDT dat, const char *templ, int as_slice)
+
Функция С: int mgl_datac_read_all (HADT dat, const char *templ, int as_slice)
+

Объединяет данные из нескольких текстовых файлов, чьи имена удовлетворяют шаблону templ (например, templ="t_*.dat"). Данные загружаются один за другим в один и тот же срез данных (при as_slice=false) или срез-за-срезом (при as_slice=true). +

+ +
+
Команда MGL: scanfile DAT 'fname' 'templ'
+
Метод класса mglData: bool ScanFile (const char *fname, const char *templ)
+
Функция С: int mgl_data_scan_file (HMDT dat, const char *fname, const char *templ)
+

Читает файл fname построчно и каждую строку сканирует на соответствие шаблону templ. Полученные числа (обозначаются как ‘%g’ в шаблоне) сохраняются. См. раздел Saving and scanning file, для примеров кода и графика. +

+ +
+
Команда MGL: save dat 'fname'
+
Метод класса mglDataA: void Save (const char *fname, int ns=-1) const
+
Функция С: void mgl_data_save (HCDT dat, const char *fname, int ns)
+
Функция С: void mgl_datac_save (HCDT dat, const char *fname, int ns)
+

Сохраняет весь массив данных при ns=-1 или только ns-ый срез в текстовый файл. +

+ +
+
Команда MGL: save 'str' 'fname' ['mode'='a']
+

Сохраняет строку str в файл fname. Для параметра mode=‘a’ происходит добавление строки (по умолчанию): для mode=‘w’ файл будет перезаписан. См. раздел Saving and scanning file, для примеров кода и графика. +

+ +
+
Команда MGL: readhdf DAT 'fname' 'dname'
+
Метод класса mglData: void ReadHDF (const char *fname, const char *dname)
+
Метод класса mglDataC: void ReadHDF (const char *fname, const char *dname)
+
Функция С: void mgl_data_read_hdf (HMDT dat, const char *fname, const char *dname)
+
Функция С: void mgl_datac_read_hdf (HADT dat, const char *fname, const char *dname)
+

Читает массив с именем dname из HDF5 или HDF4 файла fname. Функция ничего не делает если библиотека была собрана без поддержки HDF5|HDF4. +

+ +
+
Команда MGL: savehdf dat 'fname' 'dname' [rewrite=off]
+
Метод класса mglDataA: void SaveHDF (const char *fname, const char *dname, bool rewrite=false) const
+
Функция С: void mgl_data_save_hdf (HCDT dat, const char *fname, const char *dname, int rewrite)
+
Функция С: void mgl_datac_save_hdf (HCDT dat, const char *fname, const char *dname, int rewrite)
+

Сохраняет массив под именем dname в HDF5 или HDF4 файл fname. Функция ничего не делает если библиотека была собрана без поддержки HDF5|HDF4. +

+ +
+
Команда MGL: datas 'fname'
+
Метод класса mglDataA: int DatasHDF (const char *fname, char *buf, long size) static
+
Функция С: void mgl_datas_hdf (const char *fname, char *buf, long size)
+

Помещает имена массивов данных в HDF5 файле fname в строку buf разделёнными символом табуляции ’\t’. В версии MGL имена массивов будут выведены как сообщение. Функция ничего не делает если библиотека была собрана без поддержки HDF5. +

+ +
+
Команда MGL: openhdf 'fname'
+
Метод класса mglParse: void OpenHDF (const char *fname)
+
Функция С: void mgl_parser_openhdf (HMPR pr, const char *fname)
+

Читает все массивы данных из HDF5 файла fname и создает переменные MGL с соответствующими именами. Если имя данных начинается с ‘!’, то будут созданы комплексные массивы. +

+ +
+
Функция С: const char * const * mgl_datas_hdf_str (HMPR pr, const char *fname)
+

Помещает имена данных из HDF файла fname в массив строк (последняя строка ""). Массив строк будет изменен при следующем вызове функции. +

+ +
+
Команда MGL: import DAT 'fname' 'sch' [v1=0 v2=1]
+
Метод класса mglData: void Import (const char *fname, const char *scheme, mreal v1=0, mreal v2=1)
+
Функция С: void mgl_data_import (HMDT dat, const char *fname, const char *scheme, mreal v1, mreal v2)
+

Читает данные из растрового файла. RGB значения пикселов преобразуются в число в диапазоне [v1, v2] используя цветовую схему sch (see Color scheme). +

+ +
+
Команда MGL: export dat 'fname' 'sch' [v1=0 v2=0]
+
Метод класса mglDataA: void Export (const char *fname, const char *scheme, mreal v1=0, mreal v2=0, int ns=-1) const
+
Функция С: void mgl_data_export (HMDT dat, const char *fname, const char *scheme, mreal v1, mreal v2, int ns) const
+

Сохраняет данные в растровый файл. Числовые значения, нормированные в диапазон [v1, v2], преобразуются в RGB значения пикселов, используя цветовую схему sch (see Color scheme). Если v1>=v2, то значения v1, v2 определяются автоматически как минимальное и максимальное значение данных. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.6 Make another data

+ + + + + + + + + + + + + + + + +
+
Команда MGL: subdata RES dat xx [yy=all zz=all]
+
Метод класса mglData: mglData SubData (mreal xx, mreal yy=-1, mreal zz=-1) const
+
Метод класса mglDataC: mglData SubData (mreal xx, mreal yy=-1, mreal zz=-1) const
+
Функция С: HMDT mgl_data_subdata (HCDT dat, mreal xx, mreal yy, mreal zz)
+

Возвращает в res подмассив массива данных dat с фиксированными значениями индексов с положительными значениями. Например, SubData(-1,2) выделяет третью строку (индексы начинаются с нуля), SubData(4,-1) выделяет 5-ую колонку, SubData(-1,-1,3) выделяет 4-ый срез и т.д. В MGL скриптах обычно используется упрощенная версия dat(xx,yy,zz). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: subdata RES dat xdat [ydat zdat]
+
Метод класса mglData: mglData SubData (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz) const
+
Метод класса mglDataC: mglData SubData (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz) const
+
Функция С: HMDT mgl_data_subdata_ext (HCDT dat, HCDT xx, HCDT yy, HCDT zz)
+

Возвращает в res подмассив массива данных dat с индексами, заданными в массивах xx, yy, zz (косвенная адресация). Результат будет иметь размерность массивов с индексами. Размеры массивов xx, yy, zz с индексами должна быть одинакова, либо должны быть "скаляром" (т.е. 1*1*1). В MGL скриптах обычно используется упрощенная версия dat(xx,yy,zz). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: column RES dat 'eq'
+
Метод класса mglData: mglData Column (const char *eq) const
+
Метод класса mglDataC: mglData Column (const char *eq) const
+
Функция С: HMDT mgl_data_column (HCDT dat, const char *eq)
+

Возвращает массив данных заполненный по формуле eq, вычисленной для именованных колонок (или срезов). Например, Column("n*w^2/exp(t)");. Имена колонок должны быть предварительно заданы функцией idset или при чтении файлов данных. В MGL скриптах обычно используется упрощенная версия dat('eq'). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: resize RES dat mx [my=1 mz=1]
+
Метод класса mglData: mglData Resize (int mx, int my=0, int mz=0, mreal x1=0, mreal x2=1, mreal y1=0, mreal y2=1, mreal z1=0, mreal z2=1) const
+
Метод класса mglDataC: mglData Resize (int mx, int my=0, int mz=0, mreal x1=0, mreal x2=1, mreal y1=0, mreal y2=1, mreal z1=0, mreal z2=1) const
+
Функция С: HMDT mgl_data_resize (HCDT dat, int mx, int my, int mz)
+
Функция С: HMDT mgl_data_resize_box (HCDT dat, int mx, int my, int mz, mreal x1, mreal x2, mreal y1, mreal y2, mreal z1, mreal z2)
+

Возвращает массив данных размером mx, my, mz со значениями полученными интерполяцией значений из части [x1,x2] x [y1,y2] x [z1,z2] исходного массива. Величины x,y,z полагаются нормированными в диапазоне [0,1]. Если значение mx, my или mz равно 0, то исходный размер используется. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: evaluate RES dat idat [norm=on]
+
Команда MGL: evaluate RES dat idat jdat [norm=on]
+
Команда MGL: evaluate RES dat idat jdat kdat [norm=on]
+
Метод класса mglData: mglData Evaluate (const mglDataA &idat, bool norm=true) const
+
Метод класса mglData: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, bool norm=true) const
+
Метод класса mglData: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, const mglDataA &kdat, bool norm=true) const
+
Метод класса mglDataC: mglData Evaluate (const mglDataA &idat, bool norm=true) const
+
Метод класса mglDataC: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, bool norm=true) const
+
Метод класса mglDataC: mglData Evaluate (const mglDataA &idat, const mglDataA &jdat, const mglDataA &kdat, bool norm=true) const
+
Функция С: HMDT mgl_data_evaluate (HCDT dat, HCDT idat, HCDT jdat, HCDT kdat, int norm)
+

Возвращает массив данных, полученный в результате интерполяции исходного массива в точках других массивов (например, res[i,j]=dat[idat[i,j],jdat[i,j]]). Размеры массивов idat, jdat, kdat должны совпадать. Координаты в idat, jdat, kdat полагаются нормированными в диапазон [0,1] (при norm=true) или в диапазоны [0,nx], [0,ny], [0,nz] соответственно. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: section RES dat ids ['dir'='y' val=nan]
+
Команда MGL: section RES dat id ['dir'='y' val=nan]
+
Метод класса mglData: mglData Section (const mglDataA &ids, const char *dir='y', mreal val=NAN) const
+
Метод класса mglData: mglData Section (long id, const char *dir='y', mreal val=NAN) const
+
Метод класса mglDataC: mglData Section (const mglDataA &ids, const char *dir='y', mreal val=NAN) const
+
Метод класса mglDataC: mglData Section (long id, const char *dir='y', mreal val=NAN) const
+
Функция С: HMDT mgl_data_section (HCDT dat, HCDT ids, const char *dir, mreal val)
+
Функция С: HMDT mgl_data_section_val (HCDT dat, long id, const char *dir, mreal val)
+
Функция С: HADT mgl_datac_section (HCDT dat, HCDT ids, const char *dir, mreal val)
+
Функция С: HADT mgl_datac_section_val (HCDT dat, long id, const char *dir, mreal val)
+

Возвращает массив данных, являющийся id-ой секцией (диапазоном срезов, разделенных значениями val) исходного массива dat. Для id<0 используется обратный порядок (т.e. -1 даст последнюю секцию). Если указано несколько ids, то выходной массив будет результатом последовательного объединения секций. +

+ +
+
Команда MGL: solve RES dat val 'dir' [norm=on]
+
Команда MGL: solve RES dat val 'dir' idat [norm=on]
+
Метод класса mglData: mglData Solve (mreal val, char dir, bool norm=true) const
+
Метод класса mglData: mglData Solve (mreal val, char dir, const mglDataA &idat, bool norm=true) const
+
Функция С: HMDT mgl_data_solve (HCDT dat, mreal val, char dir, HCDT idat, int norm)
+

Возвращает массив индексов (корней) вдоль выбранного направления dir в которых значения массива dat равны val. Выходной массив будет иметь размеры массива dat в направлениях поперечных dir. Если предоставлен массив idat, то его значения используются как стартовые при поиске. Это позволяет найти несколько веток с помощью последовательного вызова функции. Индексы полагаются нормированными в диапазон [0,1] (при norm=true) или в диапазоны [0,nx], [0,ny], [0,nz] соответственно. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. См. раздел Solve sample, для примеров кода и графика. +

+ +
+
Команда MGL: roots RES 'func' ini ['var'='x']
+
Команда MGL: roots RES 'func' ini ['var'='x']
+
Метод класса mglData: mglData Roots (const char *func, char var) const
+
Функция С: HMDT mgl_data_roots (const char *func, HCDT ini, char var)
+
Функция С: mreal mgl_find_root_txt (const char *func, mreal ini, char var)
+

Возвращает массив корней уравнения ’func’=0 для переменной var с начальными положениями ini. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: roots RES 'funcs' 'vars' ini
+
Метод класса mglData: mglData MultiRoots (const char *funcs, const char *vars) const
+
Метод класса mglDataC: mglDataC MultiRoots (const char *funcs, const char *vars) const
+
Функция С: HMDT mgl_find_roots_txt (const char *func, const char *vars, HCDT ini)
+
Функция С: HADT mgl_find_roots_txt_c (const char *func, const char *vars, HCDT ini)
+

Возвращает массив корней системы уравнений ’funcs’=0 для переменных vars с начальными значениями ini. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: detect RES dat lvl dj [di=0 minlen=0]
+
Метод класса mglData: mglData Detect (mreal lvl, mreal dj, mreal di=0, mreal minlen=0) const
+
Функция С: HMDT mgl_data_detect (HCDT dat, mreal lvl, mreal dj, mreal di, mreal minlen)
+

Возвращает массив кривых {x,y}, разделенных NAN значениями, для локальных максимумов массива dat как функцию координаты x. Шумы амплитудой меньше lvl игнорируются. Параметр dj (в диапазоне [0,ny]) задает область "притяжения" точек в y-направлении к кривой. Аналогично, di продолжает кривые в x-направлении через разрывы длиной менее di точек. Кривые с минимальной длинной менее minlen игнорируются. +

+ +
+
Команда MGL: hist RES dat num v1 v2 [nsub=0]
+
Команда MGL: hist RES dat wdat num v1 v2 [nsub=0]
+
Метод класса mglData: mglData Hist (int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
Метод класса mglData: mglData Hist (const mglDataA &w, int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
Метод класса mglDataC: mglData Hist (int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
Метод класса mglDataC: mglData Hist (const mglDataA &w, int n, mreal v1=0, mreal v2=1, int nsub=0) const
+
Функция С: HMDT mgl_data_hist (HCDT dat, int n, mreal v1, mreal v2, int nsub)
+
Функция С: HMDT mgl_data_hist_w (HCDT dat, HCDT w, int n, mreal v1, mreal v2, int nsub)
+

Возвращает распределение (гистограмму) из n точек от значений массива в диапазоне [v1, v2]. Массив w задает веса элементов (по умолчанию все веса равны 1). Параметр nsub задает число дополнительных точек интерполяции (для сглаживания получившейся гистограммы). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. См. также Data manipulation +

+ +
+
Команда MGL: momentum RES dat 'how' ['dir'='z']
+
Метод класса mglData: mglData Momentum (char dir, const char *how) const
+
Метод класса mglDataC: mglData Momentum (char dir, const char *how) const
+
Функция С: HMDT mgl_data_momentum (HCDT dat, char dir, const char *how)
+

Возвращает момент (1d массив) данных вдоль направления dir. Строка how определяет тип момента. Момент определяется как +res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij +если dir=‘z’ и т.д. Координаты ‘x’, ‘y’, ‘z’ – индексы массива в диапазоне [0,1]. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: sum RES dat 'dir'
+
Метод класса mglData: mglData Sum (const char *dir) const
+
Метод класса mglDataC: mglData Sum (const char *dir) const
+
Функция С: HMDT mgl_data_sum (HCDT dat, const char *dir)
+

Возвращает результат суммирования данных вдоль направления(ий) dir. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: max RES dat 'dir'
+
Метод класса mglData: mglData Max (const char *dir) const
+
Метод класса mglDataC: mglData Max (const char *dir) const
+
Функция С: HMDT mgl_data_max_dir (HCDT dat, const char *dir)
+

Возвращает максимальное значение данных вдоль направления(ий) dir. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: min RES dat 'dir'
+
Метод класса mglData: mglData Min (const char *dir) const
+
Метод класса mglDataC: mglData Min (const char *dir) const
+
Функция С: HMDT mgl_data_min_dir (HCDT dat, const char *dir)
+

Возвращает минимальное значение данных вдоль направления(ий) dir. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: combine RES adat bdat
+
Метод класса mglData: mglData Combine (const mglDataA &a) const
+
Метод класса mglDataC: mglData Combine (const mglDataA &a) const
+
Функция С: HMDT mgl_data_combine (HCDT dat, HCDT a)
+

Возвращает прямое произведение массивов (наподобие, res[i,j] = adat[i]*bdat[j] и т.д.). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: trace RES dat
+
Метод класса mglData: mglData Trace () const
+
Метод класса mglDataC: mglData Trace () const
+
Функция С: HMDT mgl_data_trace (HCDT dat)
+

Возвращает массив диагональных элементов a[i,i] (для 2D данных) или a[i,i,i] (для 3D данных) где i=0...nx-1. В 1D случае возвращается сам массив данных. Размеры массива данных должен быть ny,nz >= nx или ny,nz = 1. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: correl RES adat bdat 'dir'
+
Метод класса mglData: mglData Correl (const mglDataA &b, const char *dir) const
+
Метод класса mglData: mglData AutoCorrel (const char *dir) const
+
Метод класса mglDataC: mglDataC Correl (const mglDataA &b, const char *dir) const
+
Метод класса mglDataC: mglDataC AutoCorrel (const char *dir) const
+
Функция С: HMDT mgl_data_correl (HCDT a, HCDT b, const char *dir)
+
Функция С: HADT mgl_datac_correl (HCDT a, HCDT b, const char *dir)
+

Возвращает корреляцию массивов a (или this в C++) и b вдоль направлений dir. При вычислении используется преобразование Фурье. Поэтому может потребоваться вызов функций swap и/или norm перед построением. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Метод класса mglDataC: mglData Real () const
+
Функция С: HMDT mgl_datac_real (HCDT dat)
+

Возвращает массив действительных частей массива данных. +

+
+
Метод класса mglDataC: mglData Imag () const
+
Функция С: HMDT mgl_datac_imag (HCDT dat)
+

Возвращает массив мнимых частей массива данных. +

+
+
Метод класса mglDataC: mglData Abs () const
+
Функция С: HMDT mgl_datac_abs (HCDT dat)
+

Возвращает массив абсолютных значений массива данных. +

+
+
Метод класса mglDataC: mglData Arg () const
+
Функция С: HMDT mgl_datac_arg (HCDT dat)
+

Возвращает массив аргументов массива данных. +

+ +
+
Команда MGL: pulse RES dat 'dir'
+
Метод класса mglData: mglData Pulse (const char *dir) const
+
Функция С: HMDT mgl_data_pulse (HCDT dat, const char *dir)
+

Находит параметры импульса вдоль направления dir: максимальное значение (в колонке 0), его положение (в колонке 1), ширина по параболлической аппроксимации (в колонке 3) и по полувысоте (в колонке 2), энергию около максимума (в колонке 4). NAN значения используются для ширин если максимум расположен вблизи границ массива. Отмечу, что для комплексных массивов есть неопределенность определения параметров. Обычно следует использовать квадрат абсолютного значения амплитуды (т.е. |dat[i]|^2). Поэтому MathGL не включает эту функцию в mglDataC, хотя формально C функция будет работать и для них, но будет использовать абсолютное значение амплитуды (т.е. |dat[i]|). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. См. также max, min, momentum, sum. См. раздел Pulse properties, для примеров кода и графика. +

+ + +
+ + + +

6.7 Изменение данных

+ + + + + + + + + + + + + + + + + +

These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain ‘x’, ‘y’ or ‘z’ characters for 1-st, 2-nd and 3-d dimension correspondingly. +

+
+
Команда MGL: cumsum dat 'dir'
+
Метод класса mglData: void CumSum (const char *dir)
+
Метод класса mglDataC: void CumSum (const char *dir)
+
Функция С: void mgl_data_cumsum (HMDT dat, const char *dir)
+
Функция С: void mgl_datac_cumsum (HADT dat, const char *dir)
+

Суммирует с накоплением в выбранном направлении(ях). +

+ +
+
Команда MGL: integrate dat 'dir'
+
Метод класса mglData: void Integral (const char *dir)
+
Метод класса mglDataC: void Integral (const char *dir)
+
Функция С: void mgl_data_integral (HMDT dat, const char *dir)
+
Функция С: void mgl_datac_integral (HADT dat, const char *dir)
+

Выполняет интегрирование (методом трапеций) в выбранном направлении(ях). +

+ +
+
Команда MGL: diff dat 'dir'
+
Метод класса mglData: void Diff (const char *dir)
+
Метод класса mglDataC: void Diff (const char *dir)
+
Функция С: void mgl_data_diff (HMDT dat, const char *dir)
+
Функция С: void mgl_datac_diff (HADT dat, const char *dir)
+

Выполняет дифференцирование в выбранном направлении(ях). +

+ +
+
Команда MGL: diff dat xdat ydat [zdat]
+
Метод класса mglData: void Diff (const mglDataA &x)
+
Метод класса mglData: void Diff (const mglDataA &x, const mglDataA &y)
+
Метод класса mglData: void Diff (const mglDataA &x, const mglDataA &y, const mglDataA &z)
+
Метод класса mglDataC: void Diff (const mglDataA &x)
+
Метод класса mglDataC: void Diff (const mglDataA &x, const mglDataA &y)
+
Метод класса mglDataC: void Diff (const mglDataA &x, const mglDataA &y, const mglDataA &z)
+
Функция С: void mgl_data_diff_par (HMDT dat, HCDT x, HCDTy, HCDTz)
+
Функция С: void mgl_datac_diff_par (HADT dat, HCDT x, HCDTy, HCDTz)
+

Выполняет дифференцирование данных, параметрически зависящих от координат, в направлении x с y, z=constant. Параметр z может быть опущен, что соответствует 2D случаю. Используются следующие формулы (2D случай): da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j), где a_i=da/di, a_j=da/dj обозначает дифференцирование вдоль 1-ой и 2-ой размерности. Похожие формулы используются и в 3D случае. Порядок аргументов можно менять – например, если данные a(i,j) зависят от координат {x(i,j), y(i,j)}, то обычная производная по ‘x’ будет равна Diff(x,y);, а обычная производная по ‘y’ будет равна Diff(y,x);. +

+ +
+
Команда MGL: diff2 dat 'dir'
+
Метод класса mglData: void Diff2 (const char *dir)
+
Метод класса mglDataC: void Diff2 (const char *dir)
+
Функция С: void mgl_data_diff2 (HMDT dat, const char *dir)
+
Функция С: void mgl_datac_diff2 (HADT dat, const char *dir)
+

Выполняет двойное дифференцирование (как в операторе Лапласа) в выбранном направлении(ях). +

+ +
+
Команда MGL: sinfft dat 'dir'
+
Метод класса mglData: void SinFFT (const char *dir)
+
Функция С: void mgl_data_sinfft (HMDT dat, const char *dir)
+

Выполняет синус преобразование в выбранном направлении(ях). Синус преобразование есть \sum a_j \sin(k j) (см. http://en.wikipedia.org/wiki/Discrete_sine_transform#DST-I). +

+ +
+
Команда MGL: cosfft dat 'dir'
+
Метод класса mglData: void CosFFT (const char *dir)
+
Функция С: void mgl_data_cosfft (HMDT dat, const char *dir)
+

Выполняет косинус преобразование в выбранном направлении(ях). Синус преобразование есть \sum a_j \cos(k j) (см. http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-I). +

+ +
+
Метод класса mglDataC: void FFT (const char *dir)
+
Функция С: void mgl_datac_fft (HADT dat, const char *dir)
+

Выполняет фурье преобразование в выбранном направлении(ях). Если строка dir содержит ‘i’, то используется обратное преобразование фурье. Фурье преобразование есть \sum a_j \exp(i k j) (см. http://en.wikipedia.org/wiki/Discrete_Fourier_transform). +

+ +
+
Команда MGL: hankel dat 'dir'
+
Метод класса mglData: void Hankel (const char *dir)
+
Метод класса mglDataC: void Hankel (const char *dir)
+
Функция С: void mgl_data_hankel (HMDT dat, const char *dir)
+
Функция С: void mgl_datac_hankel (HADT dat, const char *dir)
+

Выполняет преобразование Ханкеля в выбранном направлении(ях). Преобразование Ханкеля есть \sum a_j J_0(k j) (см. http://en.wikipedia.org/wiki/Hankel_transform). +

+ +
+
Команда MGL: wavelet dat 'dir' k
+
Метод класса mglData: void Wavelet (const char *dir, int k)
+
Функция С: void mgl_data_wavelet (HMDT dat, const char *dir, int k)
+

Выполняет преобразование wavelet в выбранном направлении(ях). Параметр dir задает тип: +‘d’ для daubechies, ‘D’ для центрированного daubechies, ‘h’ для haar, ‘H’ для центрированного haar, ‘b’ для bspline, ‘B’ для центрированного bspline. Если указан символ ‘i’, то выполняется обратное преобразование. Параметр k задает размер преобразования. +

+ +
+
Команда MGL: swap dat 'dir'
+
Метод класса mglData: void Swap (const char *dir)
+
Метод класса mglDataC: void Swap (const char *dir)
+
Функция С: void mgl_data_swap (HMDT dat, const char *dir)
+
Функция С: void mgl_datac_swap (HADT dat, const char *dir)
+

Меняет местами левую и правую части данных в выбранном направлении(ях). Полезно для отображения результата FFT. +

+ +
+
Команда MGL: roll dat 'dir' num
+
Метод класса mglData: void Roll (char dir, num)
+
Метод класса mglDataC: void Roll (char dir, num)
+
Функция С: void mgl_data_roll (HMDT dat, char dir, num)
+
Функция С: void mgl_datac_roll (HADT dat, char dir, num)
+

Сдвигает данные на num ячеек в выбранном направлении(ях). Соответствует замене индекса на i->(i+num)%nx при dir='x'. +

+ +
+
Команда MGL: mirror dat 'dir'
+
Метод класса mglData: void Mirror (const char *dir)
+
Метод класса mglDataC: void Mirror (const char *dir)
+
Функция С: void mgl_data_mirror (HMDT dat, const char *dir)
+
Функция С: void mgl_datac_mirror (HADT dat, const char *dir)
+

Отражает данные в выбранном направлении(ях). Соответствует замене индекса на i->n-i. Отмечу, что похожего эффекта на графике можно достичь используя опции (see Command options), например, surf dat; xrange 1 -1. +

+ +
+
Команда MGL: sew dat ['dir'='xyz' da=2*pi]
+
Метод класса mglData: void Sew (const char *dir, mreal da=2*M_PI)
+
Функция С: void mgl_data_sew (HMDT dat, const char *dir, mreal da)
+

Удаляет скачки данных (например, скачки фазы после обратных тригонометрических функций) с периодом da в выбранном направлении(ях). +

+ +
+
Команда MGL: smooth data ['dir'='xyz']
+
Метод класса mglData: void Smooth (const char *dir="xyz", mreal delta=0)
+
Метод класса mglDataC: void Smooth (const char *dir="xyz", mreal delta=0)
+
Функция С: void mgl_data_smooth (HMDT dat, const char *dir, mreal delta)
+
Функция С: void mgl_datac_smooth (HADT dat, const char *dir, mreal delta)
+

Сглаживает данные в выбранном направлении(ях) dir. Строка dirs задает направления вдоль которых будет производиться сглаживание. Строка dir может содержать: +

    +
  • xyz’ – сглаживание по x-,y-,z-направлениям, +
  • 0’ – ничего не делает, +
  • 3’ – линейное усреднение по 3 точкам, +
  • 5’ – линейное усреднение по 5 точкам, +
  • d1’...‘d9’ – линейное усреднение по (2*N+1) точкам, +
  • ^’ – определение верхней границы, +
  • _’ – определение нижней границы. +
+

По умолчанию используется квадратичное усреднение по 5 точкам. +

+ +
+
Команда MGL: envelop dat ['dir'='x']
+
Метод класса mglData: void Envelop (char dir='x')
+
Функция С: void mgl_data_envelop (HMDT dat, char dir)
+

Находит огибающую данных в выбранном направлении dir. +

+ +
+
Команда MGL: diffract dat 'how' q
+
Метод класса mglDataC: void Diffraction (const char *how, mreal q)
+
Функция С: void mgl_datac_diffr (HADT dat, const char *how, mreal q)
+

Вычисляет один шаг диффракции в конечно-разностной схеме с параметром q=\delta t/\delta x^2 используя метод третьего порядка точности. Параметр how может содержать: +

    +
  • xyz’ для расчета вдоль x-,y-,z-направления; +
  • r’ для аксиально симметричного лапласиана по направлению x; +
  • 0’ для нулевых граничных условий; +
  • 1’ для постоянных граничных условий; +
  • 2’ для линейных граничных условий; +
  • 3’ для параболлических граничных условий; +
  • 4’ для экспоненциальных граничных условий; +
  • 5’ для гауссовых граничных условий. +
+
+ +
+
Команда MGL: norm dat v1 v2 [sym=off dim=0]
+
Метод класса mglData: void Norm (mreal v1=0, mreal v2=1, bool sym=false, long dim=0)
+
Функция С: void mgl_data_norm (HMDT dat, mreal v1, mreal v2, int sym, long dim)
+

Нормирует данные в интервал [v1,v2]. Если sym=true, то используется симметричный интервал [-max(|v1|,|v2|), max(|v1|,|v2|)]. Изменения применяются только к срезам >=dim. +

+ +
+
Команда MGL: normsl dat v1 v2 ['dir'='z' keep=on sym=off]
+
Метод класса mglData: void NormSl (mreal v1=0, mreal v2=1, char dir='z', bool keep=true, bool sym=false)
+
Функция С: void mgl_data_norm_slice (HMDT dat, mreal v1, mreal v2, char dir, int keep, int sym)
+

Нормирует данные срез-за-срезом в выбранном направлении dir в интервал [v1,v2]. Если sym=true, то используется симметричный интервал [-max(|v1|,|v2|), max(|v1|,|v2|)]. Если keep=true, то максимальное значение k-го среза ограничено величиной +\sqrt{\sum a_ij(k)/\sum a_ij(0)}. +

+ +
+
Команда MGL: limit dat val
+
Метод класса mglData: void Limit (mreal val)
+
Метод класса mglDataC: void Limit (mreal val)
+
Функция С: void mgl_data_limit (HMDT dat, mreal val)
+
Функция С: void mgl_datac_limit (HADT dat, mreal val)
+

Ограничивает амплитуду данных диапазоном [-val,val]. При этом сохраняется исходный знак (фаза для комплексных чисел). Эквивалентно операции a[i] *= abs(a[i])<val?1.:val/abs(a[i]);. +

+ +
+
Команда MGL: coil dat v1 v2 [sep=on]
+
Метод класса mglData: void Coil (mreal v1, mreal v2, bool sep=true)
+
Функция С: void mgl_data_coil (HMDT dat, mreal v1, mreal v2, int sep)
+

Проецирует периодические данные на диапазон [v1,v2] (аналогично функции mod()). Разделяет ветки по значениям равным NAN если sep=true. +

+ +
+
Команда MGL: dilate dat [val=1 step=1]
+
Метод класса mglData: void Dilate (mreal val=1, long step=1)
+
Функция С: void mgl_data_dilate (HMDT dat, mreal val, long step)
+

Возвращает "расширенный" на step ячеек массив из 0 и 1 для данных больших порогового значения val.

+ +
+
Команда MGL: erode dat [val=1 step=1]
+
Метод класса mglData: void Erode (mreal val=1, long step=1)
+
Функция С: void mgl_data_erode (HMDT dat, mreal val, long step)
+

Возвращает "суженный" на step ячеек массив из 0 и 1 для данных больших порогового значения val.

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.8 Интерполяция

+ + +

Скрипты MGL могут использовать интерполяцию кубическими сплайнами с помощью команд evaluate или refill. Также можно использовать resize для массива с новыми размерами. +

+ +

Однако, есть специальные и более быстрые функции при использовании других языков (C/C++/Fortran/Python/...). +

+ +
+
Метод класса mglData: mreal Spline (mreal x, mreal y=0, mreal z=0) const
+
Метод класса mglDataC: dual Spline (mreal x, mreal y=0, mreal z=0) const
+
Функция С: mreal mgl_data_spline (HCDT dat, mreal x, mreal y, mreal z)
+
Функция С: dual mgl_datac_spline (HCDT dat, mreal x, mreal y, mreal z)
+

Интерполирует данные кубическим сплайном в точке x в [0...nx-1], y в [0...ny-1], z в [0...nz-1]. +

+ +
+
Метод класса mglData: mreal Spline1 (mreal x, mreal y=0, mreal z=0) const
+
Метод класса mglDataC: dual Spline1 (mreal x, mreal y=0, mreal z=0) const
+

Интерполирует данные кубическим сплайном в точке x, y, z, где координаты полагаются в интервале [0, 1]. +

+ +
+
Метод класса mglData: mreal Spline (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
Функция С: mreal mgl_data_spline_ext (HCDT dat, mreal x, mreal y, mreal z, mreal *dx, mreal *dy, mreal *dz)
+
Функция С: dual mgl_datac_spline_ext (HCDT dat, mreal x, mreal y, mreal z, dual *dx, dual *dy, dual *dz)
+

Интерполирует данные кубическим сплайном в точке x в [0...nx-1], y в [0...ny-1], z в [0...nz-1]. Значения производных в точке записываются в dif. +

+ +
+
Метод класса mglData: mreal Spline1 (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+

Интерполирует данные кубическим сплайном в точке x, y, z, где координаты полагаются в интервале [0, 1]. Значения производных в точке записываются в dif. +

+ + + +
+
Метод класса mglData: mreal Linear (mreal x, mreal y=0, mreal z=0) const
+
Метод класса mglDataC: dual Linear (mreal x, mreal y=0, mreal z=0) const
+
Функция С: mreal mgl_data_linear (HCDT dat, mreal x, mreal y, mreal z)
+
Функция С: dual mgl_datac_linear (HCDT dat, mreal x, mreal y, mreal z)
+

Интерполирует данные линейной функцией в точке x в [0...nx-1], y в [0...ny-1], z в [0...nz-1]. +

+ +
+
Метод класса mglData: mreal Linear1 (mreal x, mreal y=0, mreal z=0) const
+
Метод класса mglDataC: dual Linear1 (mreal x, mreal y=0, mreal z=0) const
+

Интерполирует данные линейной функцией в точке x, y, z, где координаты полагаются в интервале [0, 1]. +

+ +
+
Метод класса mglData: mreal Linear (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
Метод класса mglDataC: dual Linear (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
Функция С: mreal mgl_data_linear_ext (HCDT dat, mreal x, mreal y, mreal z, mreal *dx, mreal *dy, mreal *dz)
+
Функция С: dual mgl_datac_linear_ext (HCDT dat, mreal x, mreal y, mreal z, dual *dx, dual *dy, dual *dz)
+

Интерполирует данные линейной функцией в точке x, y, z, где координаты полагаются в интервале [0, 1]. Значения производных в точке записываются в dif. +

+ +
+
Метод класса mglData: mreal Linear1 (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+
Метод класса mglDataC: dual Linear1 (mglPoint &dif, mreal x, mreal y=0, mreal z=0) const
+

Интерполирует данные линейной функцией в точке x, y, z, где координаты полагаются в интервале [0, 1]. Значения производных в точке записываются в dif. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.9 Информационные функции

+ + +

В MathGL есть ряд функций для получения свойств массива данных. В MGL скриптах большинство из них реализовано в виде "суффиксов". Суффиксы дают числовое значение некоторой характеристики массива данных. Например, его размер, минимальное и максимальное значение, сумму элементов и т.д. Суффиксы начинаются с точки ‘.’ сразу после массива (без пробелов). Например, a.nx даст размер массива a вдоль x, b(1).max даст максимальное значение второй колонки массива b, (c(:,0)^2).sum даст сумму квадратов в первой строке массива c и т.д. +

+ + +
+
Команда MGL: info dat
+
Метод класса mglDataA: const char * PrintInfo () const
+
Метод класса mglDataA: void PrintInfo (FILE *fp) const
+
Функция С: const char * mgl_data_info (HCDT dat)
+
Fortran процедура: mgl_data_info (long dat, char *out, int len)
+

Возвращает строку с информацией о данных (размеры, моменты и пр.) или пишет её в файл. В MGL скрипте печатает её как сообщение. +

+ +
+
Команда MGL: info 'txt'
+

Печатает строку txt как сообщение. +

+ +
+
Команда MGL: info val
+

Печатает значение числа val как сообщение. +

+ +
+
Команда MGL: print dat
+
Команда MGL: print 'txt'
+
Команда MGL: print val
+

Аналогично info, но сразу выводит в stdout. +

+ +
+
Команда MGL: echo dat
+

Печатает все значения массива dat как сообщение. +

+ +
+
Команда MGL: progress val max
+
Метод класса mglGraph: void Progress (int val, int max)
+
Функция С: void mgl_progress (int val, int max)
+

Отображает прогресс чего-либо как заполненную полоску с относительной длиной val/max. На данный момент работает только в консоли и основанных на FLTK программах, включая mgllab и mglview. +

+ + + + + +
+
MGL suffix: (dat) .nx
+
MGL suffix: (dat) .ny
+
MGL suffix: (dat) .nz
+
Метод класса mglDataA: long GetNx ()
+
Метод класса mglDataA: long GetNy ()
+
Метод класса mglDataA: long GetNz ()
+
Функция С: long mgl_data_get_nx (HCDT dat)
+
Функция С: long mgl_data_get_ny (HCDT dat)
+
Функция С: long mgl_data_get_nz (HCDT dat)
+

Возвращает размер данных в направлении x, y и z соответственно. +

+ + + + +
+
MGL suffix: (dat) .max
+
Метод класса mglDataA: mreal Maximal () const
+
Функция С: mreal mgl_data_max (HCDT dat)
+

Возвращает максимальное значение массива данных. +

+ + +
+
MGL suffix: (dat) .min
+
Метод класса mglDataA: mreal Minimal () const
+
Функция С: mreal mgl_data_min (HMDT dat) const
+

Возвращает минимальное значение массива данных. +

+ +
+
Метод класса mglDataA: mreal Minimal (int &i, int &j, int &k) const
+
Функция С: mreal mgl_data_min_int (HCDT dat, int *i, int *j, int *k)
+

Возвращает максимальное значение массива данных и сохраняет его положение в переменные i, j, k. +

+
+
Метод класса mglDataA: mreal Maximal (int &i, int &j, int &k) const
+
Функция С: mreal mgl_data_max_int (HCDT dat, int *i, int *j, int *k)
+

Возвращает минимальное значение массива данных и сохраняет его положение в переменные i, j, k. +

+
+
Метод класса mglDataA: mreal Minimal (mreal &x, mreal &y, mreal &z) const
+
Функция С: mreal mgl_data_min_real (HCDT dat, mreal *x, mreal *y, mreal *z)
+

Возвращает максимальное значение массива данных и его приближенное (интерполированное) положение в переменные x, y, z. +

+ +
+
MGL suffix: (dat) .mx
+
MGL suffix: (dat) .my
+
MGL suffix: (dat) .mz
+
Метод класса mglDataA: mreal Maximal (mreal &x, mreal &y, mreal &z) const
+
Функция С: mreal mgl_data_max_real (HCDT dat, mreal *x, mreal *y, mreal *z)
+

Возвращает минимальное значение массива данных и его приближенное (интерполированное) положение в переменные x, y, z. +

+ +
+
MGL suffix: (dat) .mxf
+
MGL suffix: (dat) .myf
+
MGL suffix: (dat) .mzf
+
MGL suffix: (dat) .mxl
+
MGL suffix: (dat) .myl
+
MGL suffix: (dat) .mzl
+
Метод класса mglDataA: long Maximal (char dir, long from) const
+
Метод класса mglDataA: long Maximal (char dir, long from, long &p1, long &p2) const
+
Функция С: mreal mgl_data_max_firstl (HCDT dat, char dir, long from, long *p1, long *p2)
+

Возвращает положение первого (последнего при from<0) максимума в направлении dir, начиная с позиции from. Положение остальных координат для максимума сохраняется в p1, p2. +

+ + + +
+
MGL suffix: (dat) .sum
+
MGL suffix: (dat) .ax
+
MGL suffix: (dat) .ay
+
MGL suffix: (dat) .az
+
MGL suffix: (dat) .aa
+
MGL suffix: (dat) .wx
+
MGL suffix: (dat) .wy
+
MGL suffix: (dat) .wz
+
MGL suffix: (dat) .wa
+
MGL suffix: (dat) .sx
+
MGL suffix: (dat) .sy
+
MGL suffix: (dat) .sz
+
MGL suffix: (dat) .sa
+
MGL suffix: (dat) .kx
+
MGL suffix: (dat) .ky
+
MGL suffix: (dat) .kz
+
MGL suffix: (dat) .ka
+
Метод класса mglDataA: mreal Momentum (char dir, mreal &a, mreal &w) const
+
Метод класса mglDataA: mreal Momentum (char dir, mreal &m, mreal &w, mreal &s, mreal &k) const
+
Функция С: mreal mgl_data_momentum_val (HCDT dat, char dir, mreal *a, mreal *w, mreal *s, mreal *k)
+

Возвращает нулевой момент (энергию, I=\sum a_i) и записывает первый (среднее, m = \sum \xi_i a_i/I), второй (ширину, w^2 = \sum (\xi_i-m)^2 a_i/I), третий (асимметрия, s = \sum (\xi_i-m)^3 a_i/ I w^3) и четвёртый моменты (эксцесс, k = \sum (\xi_i-m)^4 a_i / 3 I w^4)). Здесь \xi – соответствующая координата если dir равно ‘'x'’, ‘'y'’, ‘'z'’. В противном случае среднее, ширина, асимметрия, эксцесс равны m = \sum a_i/N, w^2 = \sum (a_i-m)^2/N и т.д. +

+ +
+
MGL suffix: (dat) .fst
+
+
Метод класса mglDataA: mreal Find (const char *cond, int &i, int &j, int &k) const
+
Функция С: mreal mgl_data_first (HCDT dat, const char *cond, int *i, int *j, int *k)
+

Находит положение (после заданного в i, j, k) первого не нулевого значения формулы cond. Функция возвращает найденное значение и записывает его положение в i, j, k. +

+ +
+
MGL suffix: (dat) .lst
+
+
Метод класса mglDataA: mreal Last (const char *cond, int &i, int &j, int &k) const
+
Функция С: mreal mgl_data_last (HCDT dat, const char *cond, int *i, int *j, int *k)
+

Находит положение (перед заданного в i, j, k) последнего не нулевого значения формулы cond. Функция возвращает найденное значение и записывает его положение в i, j, k. +

+ +
+
Метод класса mglDataA: int Find (const char *cond, char dir, int i=0, int j=0, int k=0) const
+
Функция С: mreal mgl_data_find (HCDT dat, const char *cond, int i, int j, int k)
+

Возвращает положение первого в направлении dir не нулевого значения формулы cond. Поиск начинается с точки {i,j,k}. +

+ +
+
Метод класса mglDataA: bool FindAny (const char *cond) const
+
Функция С: mreal mgl_data_find_any (HCDT dat, const char *cond)
+

Определяет есть ли хоть одно значение массива, удовлетворяющее условию cond. +

+ +
+
MGL suffix: (dat) .a
+

Возвращает первое число массива (для .a это dat->a[0]). +

+ + + +
+ + + +

6.10 Операторы

+ + +
+
Команда MGL: copy DAT dat2 ['eq'='']
+
Метод класса mglData: void operator= (const mglDataA &d)
+

Копирует данные из другого экземпляра. +

+ +
+
Команда MGL: copy dat val
+
Метод класса mreal: void operator= (mreal val)
+

Устанавливает все значения массива равными val. +

+ +
+
Команда MGL: multo dat dat2
+
Команда MGL: multo dat val
+
Метод класса mglData: void operator*= (const mglDataA &d)
+
Метод класса mglData: void operator*= (mreal d)
+
Функция С: void mgl_data_mul_dat (HMDT dat, HCDT d)
+
Функция С: void mgl_data_mul_num (HMDT dat, mreal d)
+

Поэлементно умножает на массив d или на число val. +

+ +
+
Команда MGL: divto dat dat2
+
Команда MGL: divto dat val
+
Метод класса mglData: void operator/= (const mglDataA &d)
+
Метод класса mglData: void operator/= (mreal d)
+
Функция С: void mgl_data_div_dat (HMDT dat, HCDT d)
+
Функция С: void mgl_data_div_num (HMDT dat, mreal d)
+

Поэлементно делит на массив d или на число val. +

+ +
+
Команда MGL: addto dat dat2
+
Команда MGL: addto dat val
+
Метод класса mglData: void operator+= (const mglDataA &d)
+
Метод класса mglData: void operator+= (mreal d)
+
Функция С: void mgl_data_add_dat (HMDT dat, HCDT d)
+
Функция С: void mgl_data_add_num (HMDT dat, mreal d)
+

Поэлементно прибавляет d или число val. +

+ +
+
Команда MGL: subto dat dat2
+
Команда MGL: subto dat val
+
Метод класса mglData: void operator-= (const mglDataA &d)
+
Метод класса mglData: void operator-= (mreal d)
+
Функция С: void mgl_data_sub_dat (HMDT dat, HCDT d)
+
Функция С: void mgl_data_sub_num (HMDT dat, mreal d)
+

Поэлементно вычитает d или число val. +

+ +
+
Library Function: mglData operator+ (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator+ (mreal a, const mglDataA &b)
+
Library Function: mglData operator+ (const mglDataA &a, mreal b)
+

Возвращает поэлементную сумму данных. +

+ +
+
Library Function: mglData operator- (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator- (mreal a, const mglDataA &b)
+
Library Function: mglData operator- (const mglDataA &a, mreal b)
+

Возвращает поэлементную разность данных. +

+ +
+
Library Function: mglData operator* (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator* (mreal a, const mglDataA &b)
+
Library Function: mglData operator* (const mglDataA &a, mreal b)
+

Возвращает поэлементное произведение данных. +

+ +
+
Library Function: mglData operator/ (const mglDataA &a, const mglDataA &b)
+
Library Function: mglData operator/ (const mglDataA &a, mreal b)
+

Возвращает поэлементное деление данных. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

6.11 Глобальные функции

+ + +

Эти функции не методы класса mglData, но они дают дополнительные возможности по обработке данных. Поэтому я поместил их в эту главу. +

+
+
Команда MGL: transform DAT 'type' real imag
+
Общая функция: mglData mglTransform (const mglDataA &real, const mglDataA &imag, const char *type)
+
Функция С: HMDT mgl_transform (HCDT real, HCDT imag, const char *type)
+

Выполняет интегральное преобразование комплексных данных real, imag в выбранном направлении и возвращает модуль результата. Порядок и тип преобразований задается строкой type: первый символ для x-направления, второй для y-направления, третий для z-направления. Возможные символы: ‘f’ – прямое преобразование Фурье, ‘i’ – обратное преобразование Фурье, ‘s’ – синус преобразование, ‘c’ – косинус преобразование, ‘h’ – преобразование Ханкеля, ‘n’ или ‘ ’ – нет преобразования. +

+ +
+
Команда MGL: transforma DAT 'type' ampl phase
+
Общая функция: mglData mglTransformA const mglDataA &ampl, const mglDataA &phase, const char *type)
+
Функция С: HMDT mgl_transform_a HCDT ampl, HCDT phase, const char *type)
+

Аналогично предыдущему с заданными амплитудой ampl и фазой phase комплексных чисел. +

+ +
+
Команда MGL: fourier reDat imDat 'dir'
+
Команда MGL: fourier complexDat 'dir'
+
Общая функция: void mglFourier const mglDataA &re, const mglDataA &im, const char *dir)
+
Метод класса mglDataC: void FFT (const char *dir)
+
Функция С: void mgl_data_fourier HCDT re, HCDT im, const char *dir)
+
Функция С: void mgl_datac_fft (HADT dat, const char *dir)
+

Выполняет Фурье преобразование для комплексных данных re+i*im в направлениях dir. Результат помещается обратно в массивы re и im. Если dir содержит ‘i’, то выполняется обратное преобразование Фурье. +

+ +
+
Команда MGL: stfad RES real imag dn ['dir'='x']
+
Общая функция: mglData mglSTFA (const mglDataA &real, const mglDataA &imag, int dn, char dir='x')
+
Функция С: HMDT mgl_data_stfa (HCDT real, HCDT imag, int dn, char dir)
+

Выполняет оконное преобразование Фурье длиной dn для комплексных данных real, imag и возвращает модуль результата. Например, для dir=‘x’ результат будет иметь размер {int(nx/dn), dn, ny} и будет равен res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn. +

+ + +
+
Команда MGL: triangulate dat xdat ydat
+
Общая функция: mglData mglTriangulation (const mglDataA &x, const mglDataA &y)
+
Функция С: void mgl_triangulation_2d (HCDT x, HCDT y)
+

Выполняет триангуляцию Делоне для точек на плоскости и возвращает массив, пригодный для triplot и tricont. См. раздел Making regular data, для примеров кода и графика. +

+ +
+
Команда MGL: tridmat RES ADAT BDAT CDAT DDAT 'how'
+
Общая функция: mglData mglTridMat (const mglDataA &A, const mglDataA &B, const mglDataA &C, const mglDataA &D, const char *how)
+
Общая функция: mglDataC mglTridMatC (const mglDataA &A, const mglDataA &B, const mglDataA &C, const mglDataA &D, const char *how)
+
Функция С: HMDT mgl_data_tridmat (HCDT A, HCDT B, HCDT C, HCDT D, const char*how)
+
Функция С: HADT mgl_datac_tridmat (HCDT A, HCDT B, HCDT C, HCDT D, const char*how)
+

Возвращает решение трехдиагональной системы уравнений A[i]*x[i-1]+B[i]*x[i]+C[i]*x[i+1]=D[i]. Строка how может содержать: +

    +
  • xyz’ для решения вдоль x-,y-,z-направлений; +
  • h’ для решения вдоль диагонали на плоскости x-y (требует квадратную матрицу); +
  • c’ для использования периодических граничных условий; +
  • d’ для расчета диффракции/диффузии (т.е. для использования -A[i]*D[i-1]+(2-B[i])*D[i]-C[i]*D[i+1] в правой частиц вместо D[i]). +
+

Размеры массивов A, B, C должны быть одинаковы. Также их размерности должны совпадать со всеми или с "младшими" размерностями массива D. См. раздел PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+
Общая функция: mglData mglPDE (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
Общая функция: mglDataC mglPDEc (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
Функция С: HMDT mgl_pde_solve (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+
Функция С: HADT mgl_pde_solve_c (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+

Решает уравнение в частных производных du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], где p=-i/k0*d/dx, q=-i/k0*d/dy – псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Координаты в уравнении и в решении полагаются в диапазоне осей координат. Замечу, что внутри этот диапазон увеличивается в 3/2 раза для уменьшения отражения от границ расчетного интервала. Параметр dz задает шаг по эволюционной координате z. В данный момент использован упрощенный алгоритм, когда все “смешанные” члена (типа ‘x*p’->x*d/dx) исключаются. Например, в 2D случае это функции типа ham = f(p,z) + g(x,z,u). При этом допускаются коммутирующие комбинации (типа ‘x*q’->x*d/dy). Переменная ‘u’ используется для обозначения амплитуды поля |u|. Это позволяет решать нелинейные задачи – например, нелинейное уравнение Шредингера ham='p^2+q^2-u^2'. Также можно указать мнимую часть для поглощения (типа ham = 'p^2+i*x*(x>0)'). См. также apde, qo2d, qo3d. См. раздел PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: apde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+
Общая функция: mglData mglAPDE (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
Общая функция: mglDataC mglAPDEc (HMGL gr, const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
+
Функция С: HMDT mgl_pde_solve_adv (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+
Функция С: HADT mgl_pde_solve_adv_c (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
+

Решает уравнение в частных производных du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], где p=-i/k0*d/dx, q=-i/k0*d/dy – псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Координаты в уравнении и в решении полагаются в диапазоне осей координат. Замечу, что внутри этот диапазон увеличивается в 3/2 раза для уменьшения отражения от границ расчетного интервала. Параметр dz задает шаг по эволюционной координате z. Используется достаточно сложный и медленный алгоритм, способный учесть одновременное влияние пространственной дисперсии и неоднородности среды [см. А.А. Балакин, Е.Д. Господчиков, А.Г. Шалашов, Письма ЖЭТФ 104, 701 (2016)]. Переменная ‘u’ используется для обозначения амплитуды поля |u|. Это позволяет решать нелинейные задачи – например, нелинейное уравнение Шредингера ham='p^2+q^2-u^2'. Также можно указать мнимую часть для поглощения (типа ham = 'p^2+i*x*(x>0)'). См. также apde. См. раздел PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: ray RES 'ham' x0 y0 z0 p0 q0 v0 [dt=0.1 tmax=10]
+
Общая функция: mglData mglRay (const char *ham, mglPoint r0, mglPoint p0, mreal dt=0.1, mreal tmax=10)
+
Функция С: HMDT mgl_ray_trace (const char *ham, mreal x0, mreal y0, mreal z0, mreal px, mreal py, mreal pz, mreal dt, mreal tmax)
+

Решает систему геометрооптических уравнений dr/dt = d ham/dp, dp/dt = -d ham/dr. Это гамильтоновы уравнения для траектории частицы в 3D случае. Гамильтониан ham может зависеть от координат ‘x’, ‘y’, ‘z’, импульсов ‘p’=px, ‘q’=py, ‘v’=pz и времени ‘t’: ham = H(x,y,z,p,q,v,t). Начальная точка (при t=0) задается переменными {x0, y0, z0, p0, q0, v0}. Параметры dt и tmax задают шаг и максимальное время интегрирования. Результат – массив {x,y,z,p,q,v,t} с размером {7 * int(tmax/dt+1) }. +

+ +
+
Команда MGL: ode RES 'df' 'var' ini [dt=0.1 tmax=10]
+
Общая функция: mglData mglODE (const char *df, const char *var, const mglDataA &ini, mreal dt=0.1, mreal tmax=10)
+
Общая функция: mglDataC mglODEc (const char *df, const char *var, const mglDataA &ini, mreal dt=0.1, mreal tmax=10)
+
Функция С: HMDT mgl_ode_solve_str (const char *df, const char *var, HCDT ini, mreal dt, mreal tmax)
+
Функция С: HADT mgl_ode_solve_str_c (const char *df, const char *var, HCDT ini, mreal dt, mreal tmax)
+
Функция С: HMDT mgl_ode_solve (void (*df)(const mreal *x, mreal *dx, void *par), int n, const mreal *ini, mreal dt, mreal tmax)
+
Функция С: HMDT mgl_ode_solve_ex (void (*df)(const mreal *x, mreal *dx, void *par), int n, const mreal *ini, mreal dt, mreal tmax, void (*bord)(mreal *x, const mreal *xprev, void *par))
+

Решает систему обыкновенных дифференциальных уравнений dx/dt = df(x). Функции df могут быть заданны строкой с разделенными ’;’ формулами (аргумент var задает символы для переменных x[i]) или указателем на функцию, которая заполняет dx по заданным значениям x. Параметры ini, dt, tmax задают начальные значения, шаг и максимальное время интегрирования. Функция обрывает расчет при появлении значений NAN или INF. Результат – массив размером {n * Nt}, где Nt <= int(tmax/dt+1). +

+ +
+
Команда MGL: qo2d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy]
+
Общая функция: mglData mglQO2d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100, mglData *xx=0, mglData *yy=0)
+
Общая функция: mglData mglQO2d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mreal r=1, mreal k0=100)
+
Общая функция: mglDataC mglQO2dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100)
+
Общая функция: mglDataC mglQO2dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mreal r=1, mreal k0=100)
+
Функция С: HMDT mgl_qo2d_solve (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+
Функция С: HADT mgl_qo2d_solve_c (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+
Функция С: HMDT mgl_qo2d_func (dual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+
Функция С: HADT mgl_qo2d_func_c (dual (*ham)(mreal u, mreal x, mreal y, mreal px, mreal py, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy)
+

Решает уравнение в частных производных du/dt = i*k0*ham(p,q,x,y,|u|)[u] в сопровождающей системе координат, где p=-i/k0*d/dx, q=-i/k0*d/dy – псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Параметр ray задает опорный луч для сопровождающей системы координат. Можно использовать луч найденный с помощью ray. Опорный луч должен быть достаточно гладкий, чтобы система координат была однозначной и для исключения ошибок интегрирования. Если массивы xx и yy указаны, то в них записываются декартовы координаты для каждой точки найденного решения. См. также pde, qo3d. См. раздел PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: qo3d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy zz]
+
Общая функция: mglData mglQO3d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100)
+
Общая функция: mglData mglQO3d (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mglData &zz, mreal r=1, mreal k0=100)
+
Общая функция: mglDataC mglQO3dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mreal r=1, mreal k0=100)
+
Общая функция: mglDataC mglQO3dc (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, const mglDataA &ray, mglData &xx, mglData &yy, mglData &zz, mreal r=1, mreal k0=100)
+
Функция С: HMDT mgl_qo3d_solve (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+
Функция С: HADT mgl_qo3d_solve_c (const char *ham, HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+
Функция С: HMDT mgl_qo3d_func (dual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+
Функция С: HADT mgl_qo3d_func_c (dual (*ham)(mreal u, mreal x, mreal y, mreal z, mreal px, mreal py, mreal pz, void *par), HCDT ini_re, HCDT ini_im, HCDT ray, mreal r, mreal k0, HMDT xx, HMDT yy, HMDT zz)
+

Решает уравнение в частных производных du/dt = i*k0*ham(p,q,v,x,y,z,|u|)[u] в сопровождающей системе координат, где p=-i/k0*d/dx, q=-i/k0*d/dy, v=-i/k0*d/dz – псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Параметр ray задает опорный луч для сопровождающей системы координат. Можно использовать луч найденный с помощью ray. Опорный луч должен быть достаточно гладкий, чтобы система координат была однозначной и для исключения ошибок интегрирования. Если массивы xx, yy и zz указаны, то в них записываются декартовы координаты для каждой точки найденного решения. См. также pde, qo2d. +

+ +
+
Команда MGL: jacobian RES xdat ydat [zdat]
+
Общая функция: mglData mglJacobian (const mglDataA &x, const mglDataA &y)
+
Общая функция: mglData mglJacobian (const mglDataA &x, const mglDataA &y, const mglDataA &z)
+
Функция С: HMDT mgl_jacobian_2d (HCDT x, HCDT y)
+
Функция С: HMDT mgl_jacobian_3d (HCDT x, HCDT y, HCDT z)
+

Вычисляет якобиан преобразования {i,j,k} в {x,y,z}, где координаты {i,j,k} полагаются нормированными в интервал [0,1]. Якобиан находится по формуле det||dr_\alpha/d\xi_\beta||, где r={x,y,z} и \xi={i,j,k}. Все размерности всех массивов должны быть одинаковы. Данные должны быть трехмерными если указаны все 3 массива {x,y,z} или двумерными если только 2 массива {x,y}. +

+ +
+
Команда MGL: triangulation RES xdat ydat [zdat]
+
Общая функция: mglData mglTriangulation (const mglDataA &x, const mglDataA &y)
+
Общая функция: mglData mglTriangulation (const mglDataA &x, const mglDataA &y, const mglDataA &z)
+
Функция С: HMDT mgl_triangulation_2d (HCDT x, HCDT y)
+
Функция С: HMDT mgl_triangulation_3d (HCDT x, HCDT y, HCDT z)
+

Выполняет триангуляцию для произвольно расположенных точек с координатами {x,y,z} (т.е. находит треугольники, соединяющие точки). Первая размерность всех массивов должна быть одинакова x.nx=y.nx=z.nx. Получившийся массив можно использовать в triplot или tricont для визуализации реконструированной поверхности. См. раздел Making regular data, для примеров кода и графика. +

+ + + +
+
Общая функция: mglData mglGSplineInit (const mglDataA &x, const mglDataA &y)
+
Общая функция: mglDataC mglGSplineCInit (const mglDataA &x, const mglDataA &y)
+
Функция С: HMDT mgl_gspline_init (HCDT x, HCDT y)
+
Функция С: HADT mgl_gsplinec_init (HCDT x, HCDT y)
+

Подготавливает коэффициенты для глобального кубического сплайна. +

+ +
+
Общая функция: mreal mglGSpline (const mglDataA &coef, mreal dx, mreal *d1=0, mreal *d2=0)
+
Общая функция: dual mglGSplineC (const mglDataA &coef, mreal dx, dual *d1=0, dual *d2=0)
+
Функция С: mreal mgl_gspline (HCDT coef, mreal dx, mreal *d1, mreal *d2)
+
Функция С: dual mgl_gsplinec (HCDT coef, mreal dx, dual *d1, dual *d2)
+

Вычисляет глобальный кубический сплайн (а также 1ую и 2ую производные d1, d2 если они не NULL), используя коэффициенты coef в точке dx+x0 (здесь x0 – 1ый элемент массива x в функции mglGSpline*Init()). +

+ + +
+
Команда MGL: ifs2d RES dat num [skip=20]
+
Общая функция: mglData mglIFS2d (const mglDataA &dat, long num, long skip=20)
+
Функция С: HMDT mgl_data_ifs_2d (HCDT dat, long num, long skip)
+

Находит num точек {x[i]=res[0,i], y[i]=res[1,i]} фрактала с использованием итерационной системы функций (IFS). Матрица dat используется для генерации в соответствии с формулами +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[4,i];
+y[i+1] = dat[2,i]*x[i] + dat[3,i]*y[i] + dat[5,i];
+

Значение dat[6,i] – весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Массив dat должен иметь размер по x больше или равный 7. См. также ifs3d, flame2d. См. раздел ifs2d sample, для примеров кода и графика. +

+ +
+
Команда MGL: ifs3d RES dat num [skip=20]
+
Общая функция: mglData mglIFS3d (const mglDataA &dat, long num, long skip=20)
+
Функция С: HMDT mgl_data_ifs_3d (HCDT dat, long num, long skip)
+

Находит num точек {x[i]=res[0,i], y[i]=res[1,i], z[i]=res[2,i]} фрактала с использованием итерационной системы функций (IFS). Матрица dat используется для генерации в соответствии с формулами +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[2,i]*z[i] + dat[9,i];
+y[i+1] = dat[3,i]*x[i] + dat[4,i]*y[i] + dat[5,i]*z[i] + dat[10,i];
+z[i+1] = dat[6,i]*x[i] + dat[7,i]*y[i] + dat[8,i]*z[i] + dat[11,i];
+

Значение dat[12,i] – весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Массив dat должен иметь размер по x больше или равный 13. См. также ifs2d. См. раздел ifs3d sample, для примеров кода и графика. +

+ +
+
Команда MGL: ifsfile RES 'fname' 'name' num [skip=20]
+
Общая функция: mglData mglIFSfile (const char *fname, const char *name, long num, long skip=20)
+
Функция С: HMDT mgl_data_ifs_file (const char *fname, const char *name, long num, long skip)
+

Считывает параметры фрактала name из файла fname и находит num точек для него. Первые skip итераций будут опущены. См. также ifs2d, ifs3d. +

+

Файл IFS может содержать несколько записей. Каждая запись содержит имя фрактала (‘binary’ в примере ниже) и тело в фигурных скобках {} с параметрами фрактала. Символ ‘;’ начинает комментарий. Если имя содержит ‘(3D)’ или ‘(3d)’, то определен 3d IFS фрактал. Пример содержит два фрактала: ‘binary’ – обычный 2d фрактал, и ‘3dfern (3D)’ – 3d фрактал. См. также ifs2d, ifs3d. +

+
 binary
+ { ; comment allowed here
+  ; and here
+  .5  .0 .0 .5 -2.563477 -0.000003 .333333   ; also comment allowed here
+  .5  .0 .0 .5  2.436544 -0.000003 .333333
+  .0 -.5 .5 .0  4.873085  7.563492 .333333
+  }
+
+ 3dfern (3D) {
+   .00  .00 0 .0 .18 .0 0  0.0 0.00 0 0.0 0 .01
+   .85  .00 0 .0 .85 .1 0 -0.1 0.85 0 1.6 0 .85
+   .20 -.20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  -.20  .20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  }
+
+ +
+
Команда MGL: flame2d RES dat func num [skip=20]
+
Общая функция: mglData mglFlame2d (const mglDataA &dat, const mglDataA &func, long num, long skip=20)
+
Функция С: HMDT mgl_data_flame_2d (HCDT dat, HCDT func, long num, long skip)
+

Находит num точек {x[i]=res[0,i], y[i]=res[1,i]} фрактала с использованием итерационной системы функций (IFS). Массив func задает идентификатор функции (func[0,i,j]), ее вес (func[0,i,j]) и аргументы (func[2 ... 5,i,j]). Матрица dat используется для преобразования координат для аргументов функции. Результирующее преобразование имеет вид: +

xx = dat[0,i]*x[j] + dat[1,j]*y[i] + dat[4,j];
+yy = dat[2,i]*x[j] + dat[3,j]*y[i] + dat[5,j];
+x[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_x(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+y[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_y(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+

Значение dat[6,i] – весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Массив dat должен иметь размер по x больше или равный 7. +Доступные идентификаторы функций: mglFlame2d_linear=0, mglFlame2d_sinusoidal, mglFlame2d_spherical, mglFlame2d_swirl, mglFlame2d_horseshoe, + mglFlame2d_polar, mglFlame2d_handkerchief,mglFlame2d_heart, mglFlame2d_disc, mglFlame2d_spiral, + mglFlame2d_hyperbolic, mglFlame2d_diamond, mglFlame2d_ex, mglFlame2d_julia, mglFlame2d_bent, + mglFlame2d_waves, mglFlame2d_fisheye, mglFlame2d_popcorn, mglFlame2d_exponential, mglFlame2d_power, + mglFlame2d_cosine, mglFlame2d_rings, mglFlame2d_fan, mglFlame2d_blob, mglFlame2d_pdj, + mglFlame2d_fan2, mglFlame2d_rings2, mglFlame2d_eyefish, mglFlame2d_bubble, mglFlame2d_cylinder, + mglFlame2d_perspective, mglFlame2d_noise, mglFlame2d_juliaN, mglFlame2d_juliaScope, mglFlame2d_blur, + mglFlame2d_gaussian, mglFlame2d_radialBlur, mglFlame2d_pie, mglFlame2d_ngon, mglFlame2d_curl, + mglFlame2d_rectangles, mglFlame2d_arch, mglFlame2d_tangent, mglFlame2d_square, mglFlame2d_blade, + mglFlame2d_secant, mglFlame2d_rays, mglFlame2d_twintrian, mglFlame2d_cross, mglFlame2d_disc2, + mglFlame2d_supershape, mglFlame2d_flower, mglFlame2d_conic, mglFlame2d_parabola, mglFlame2d_bent2, + mglFlame2d_bipolar, mglFlame2d_boarders, mglFlame2d_butterfly, mglFlame2d_cell, mglFlame2d_cpow, + mglFlame2d_curve, mglFlame2d_edisc, mglFlame2d_elliptic, mglFlame2d_escher, mglFlame2d_foci, + mglFlame2d_lazySusan, mglFlame2d_loonie, mglFlame2d_preBlur, mglFlame2d_modulus, mglFlame2d_oscope, + mglFlame2d_polar2, mglFlame2d_popcorn2, mglFlame2d_scry, mglFlame2d_separation, mglFlame2d_split, + mglFlame2d_splits, mglFlame2d_stripes, mglFlame2d_wedge, mglFlame2d_wedgeJulia, mglFlame2d_wedgeSph, + mglFlame2d_whorl, mglFlame2d_waves2, mglFlame2d_exp, mglFlame2d_log, mglFlame2d_sin, + mglFlame2d_cos, mglFlame2d_tan, mglFlame2d_sec, mglFlame2d_csc, mglFlame2d_cot, + mglFlame2d_sinh, mglFlame2d_cosh, mglFlame2d_tanh, mglFlame2d_sech, mglFlame2d_csch, + mglFlame2d_coth, mglFlame2d_auger, mglFlame2d_flux. +Значение dat[6,i] – весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Размеры массивов должны удовлетворять требованиям: dat.nx>=7, func.nx>=2 и func.nz=dat.ny. См. также ifs2d, ifs3d. См. раздел flame2d sample, для примеров кода и графика. +

+ + + + +
+ + + +

6.12 Вычисление выражений

+ + + +

В MathGL есть специальные классы mglExpr и mglExprC для вычисления формул заданных строкой для действительных и комплексных чисел соответственно. Классы определены в #include <mgl2/data.h> и #include <mgl2/datac.h> соответственно. При создании класса происходит разбор формулы в древовидную структуру. А при вычислении только выполняется достаточно быстрый обход по дереву. В данный момент нет различия между верхним и нижним регистром. Если аргумент какой-либо функции лежит вне её области определения, то возвращается NaN. See Textual formulas. +

+
+
Конструктор класса mglExpr: mglExpr (const char *expr)
+
Конструктор класса mglExprC: mglExprC (const char *expr)
+
Функция С: HMEX mgl_create_expr (const char *expr)
+
Функция С: HAEX mgl_create_cexpr (const char *expr)
+

Разбирает формулу expr и создает древовидную структуру, содержащую последовательность вызова функций и операторов для последующего быстрого вычисления формулы с помощью функций Calc() и/или CalcD(). +

+ +
+
Destructor on mglExpr: ~mglExpr ()
+
Destructor on mglExprC: ~mglExprC ()
+
Функция С: void mgl_delete_expr (HMEX ex)
+
Функция С: void mgl_delete_cexpr (HAEX ex)
+

Удаляет объект типа mglExpr. +

+ +
+
Метод класса mglExpr: mreal Eval (mreal x, mreal y, mreal z)
+
Метод класса mglExprC: dual Eval (dual x, dual y, dual z)
+
Функция С: mreal mgl_expr_eval (HMEX ex, mreal x, mreal y, mreal z)
+
Функция С: dual mgl_cexpr_eval (HAEX ex, dual x, dual y, dual z)
+

Вычисляет значение формулы для 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u. +

+ +
+
Метод класса mglExpr: mreal Eval (mreal var[26])
+
Метод класса mglExprC: dual Eval (dual var[26])
+
Функция С: mreal mgl_expr_eval_v (HMEX ex, mreal *var)
+
Функция С: dual mgl_cexpr_eval_v (HMEX ex, dual *var)
+

Вычисляет значение формулы для переменных в массиве var[0,...,’z’-’a’]. +

+ + +
+
Метод класса mglExpr: mreal Diff (char dir, mreal x, mreal y, mreal z)
+
Функция С: mreal mgl_expr_diff (HMEX ex, char dir, mreal x, mreal y, mreal z)
+

Вычисляет производную от формулы по переменной dir для 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u. +

+ +
+
Метод класса mglExpr: mreal Diff (char dir, mreal var[26])
+
Функция С: mreal mgl_expr_diff_v (HMEX ex, char dir, mreal *var)
+

Вычисляет производную от формулы по переменной dir для переменных в массиве var[0,...,’z’-’a’]. +

+ + + +
+ + + +

6.13 Special data classes

+ + + +

Раздел описывает специальные классы данных mglDataV, mglDataF, mglDataT и mglDataR, которые могут заметно ускорить рисование и обработку данных. Классы определены в #include <mgl2/data.h>. Отмечу, что все функции рисования и обработки данных можно выполнить используя только основные классы mglData и/или mglDataC. Также специальные классы доступны только в коде на С++. +

+ +

Класс mglDataV

+

представляет переменную со значениями равнораспределенными в заданном интервале. +

+
Конструктор mglDataV: mglDataV (const mglDataV & d)
+

Конструктор копирования. +

+
+
Конструктор mglDataV: mglDataV (long nx=1, long ny=1, long nz=1, mreal v1=0, mreal v2=NaN, char dir='x')
+

Создает переменную "размером" nxxnyxnz, изменяющуюся от v1 до v2 (или постоянную при v2=NaN) вдоль направления dir. +

+
+
Метод класса mglDataV: void Create (long nx=1, long ny=1, long nz=1)
+

Задает "размеры" переменной nxxnyxnz. +

+
+
Метод класса mglDataV: void Fill (mreal x1, mreal x2=NaN, char dir='x')
+

Задает диапазон изменения переменной. +

+
+
Метод класса mglDataV: void Freq (mreal dp, char dir='x')
+

Задает переменную для частоты с шагом dp. +

+ + +

Класс mglDataF

+

представляет функцию, которая будет вызываться вместо обращения к элементам массива (как в классе mglData). +

+
Конструктор mglDataF: mglDataF (const mglDataF & d)
+

Конструктор копирования. +

+
+
Конструктор mglDataF: mglDataF (long nx=1, long ny=1, long nz=1)
+

Создает данные "размером" nxxnyxnz с нулевой функцией. +

+
+
Метод класса mglDataF: void Create (long nx=1, long ny=1, long nz=1)
+

Задает "размеры" данных nxxnyxnz. +

+
+
Метод класса mglDataF: void SetRanges (mglPoint p1, mglPoint p2)
+

Задает диапазоны изменения внутренних переменных x,y,z. +

+
+
Метод класса mglDataF: void SetFormula (const char *func)
+

Задает строку, которая будет разобрана в функцию. Это вариант более чем 10 раз медленнее в сравнении с SetFunc(). +

+
+
Метод класса mglDataF: void SetFunc (mreal (*f)(mreal x,mreal y,mreal z,void *p), void *p=NULL)
+

Задает указатель на функцию, которая будет использована вместо доступа к элементам массива. +

+ + +

Класс mglDataT

+

представляет именнованную ссылку на столбец в другом массиве данных. +

+
Конструктор mglDataT: mglDataT (const mglDataT & d)
+

Конструктор копирования. +

+
+
Конструктор mglDataT: mglDataT (const mglDataA & d, long col=0)
+

Создает ссылку на col-ый столбец данных d. +

+
+
Метод класса mglDataT: void SetInd (long col, wchar_t name)
+
Метод класса mglDataT: void SetInd (long col, const wchar_t * name)
+

Задает ссылку на другой столбец того же массива данных. +

+ + + +

Класс mglDataR

+

представляет именнованную ссылку на строку в другом массиве данных. +

+
Конструктор mglDataR: mglDataR (const mglDataR & d)
+

Конструктор копирования. +

+
+
Конструктор mglDataR: mglDataR (const mglDataA & d, long row=0)
+

Создает ссылку на row-ую строку данных d. +

+
+
Метод класса mglDataR: void SetInd (long row, wchar_t name)
+
Метод класса mglDataR: void SetInd (long row, const wchar_t * name)
+

Задает ссылку на другой столбец того же массива данных. +

+ + + +

Class mglDataW

+

представляет часоту для FFT в виде массива данных. +

+
Конструктор mglDataW: mglDataW (const mglDataW & d)
+

Конструктор копирования. +

+
+
Конструктор mglDataW: mglDataW (long xx=1, long yy=1, long zz=1, double dp=0, char dir='x')
+

Задает размеры, направление dir и шаг dp для частоты. +

+
+
Метод класса mglDataR: void Freq (double dp, char dir='x')
+

Равномерно распределяет данные с шагом dp в направлении dir. +

+ + + +

Class mglDataS

+

представляет std::vector в виде массива данных. +

+
Variable of mglDataS: std::vector<mreal> dat
+

Собственно данные. +

+
+
Конструктор mglDataS: mglDataS (const mglDataS & d)
+

Конструктор копирования. +

+
+
Конструктор mglDataS: mglDataS (const std::vector<mreal> & d)
+

Копирует данные из d. +

+
+
Конструктор mglDataS: mglDataS (size_t s)
+

Выделяет память для s элементов. +

+
+
Метод класса mglDataS: void reserve (size_t num)
+

Резервирует место для num элементов. +

+
+
Метод класса mglDataS: void push_back (double v)
+

Добавляет значение v к концу массива данных. +

+ + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ + +

7 Скрипты MGL

+ + +

MathGL имеет встроенный скриптовый язык MGL для обработки и отображения данных. Скрипты MGL могут быть выполнены независимо (с помощью программ UDAV, mglconv, mglview и др. +, см. Utilities) или с использованием вызовов библиотеки. +

+ + + + + + + + + + +
+ + + +

7.1 Основы MGL

+ + +

Язык MGL достаточно простой. Каждая строка – отдельная команда. Первое слово – имя команды, а все остальные ее аргументы. Команда может иметь до 1000 аргументов (по крайней мере сейчас). Слова разделяются одно от другого пробелом или символом табуляции. Различий между верхним и нижним индексом нет, т.е. переменные a и A идентичны. Символ ‘#’ начинает комментарий – все символы после него игнорируются до конца строки. Исключением является случай, когда ‘#’ входит в строку. Опции команды указываются после символа ‘;’ (see Command options). Символ ‘:’ начинает новую команду (подобно переводу строки) если он расположен не внутри скобок или строки. +

+

Если строка содержит ссылки на внешние параметры (‘$0’, ‘$1’ ... ‘$9’) или макроопределения (‘$a’, ‘$b’ ... ‘$z’), то текущие значения параметров/макроопределений подставляются в строку вместо ссылки до выполнением команды. Это позволяет использовать один и тот же скрипт при различных входных параметрах командной строки или вводить макроопределения по ходу исполнения команд скрипта. +

+

Аргументы команды могут быть строками, переменными или числами. +

    +
  • Строка – произвольный набор символов между метками ‘'’. Длинные строки могут быть соединены из нескольких линий файла символом ‘\’. Т.е. строки файла ‘'a +'\<br>' b'’ дадут строку ‘'a + b'’ (здесь ‘<br>’ – перевод строки). MGL поддерживает несколько операций над строками: +
      +
    • Соединение строк и чисел, используя ‘,’ без пробелов (например, ‘'max(u)=',u.max,' a.u.'’ или ‘'u=',!(1+i2)’ для комплексных чисел); +
    • Получение n-го символа строки, используя ‘[]’ (например, ‘'abc'[1]’ даст 'b'); +
    • Инкремент последнего символа строки, используя ‘+’ (например, ‘'abc'+3’ даст 'abf'). +
    + +
  • Обычно переменная имеет имя, состоящее из букв и чисел (должно начинаться с буквы и не быть длиннее 64 символов). Если выражение или переменная начинается с символа ‘!’, то будут использованы комплексные значения. Например, код new x 100 'x':copy !b !exp(1i*x) создаст массив действительных чисел x и массив комплексных чисел b, который будет равен exp(I*x), где I^2=-1. +В качестве переменной можно использовать также и временные массивы, включающие в себя: +
      +
    • срезы (“подмассивы”) массивов данных (подобно команде subdata). Например, a(1) или a(1,:) или a(1,:,:) – вторая строка массива a, a(:,2) или a(:,2,:) – третий столбец, a(:,:,0) – первый срез и т.д. Также можно выделить часть массива с m-го по n-ый элемент a(m:n,:,:) или просто a(m:n). + +
    • произвольные комбинации столбцов данных (например, a('n*w^2/exp(t)')), если столбцы данных были именованы командой idset или в файле данных (в строке начинающейся с ##). + +
    • произвольное выражение из существующих переменных и констант. Например, ‘sqrt(dat(:,5)+1)’ даст временный массив данных с элементами равными tmp[i,j] = sqrt(dat[i,5,j]+1). При этом символ ‘`’ возвращает транспонированный массив: ‘`sqrt(dat(:,5)+1)’ и ‘sqrt(`dat(:,5)+1)’ оба дадут временный массив данных с элементами равными tmp[i,j] = sqrt(dat[j,5,i]+1). + +
    • массивы с элементами заданными в квадратных скобках [], разделенные ‘,’. При этом внутри выражения не должно быть пробелов! Например, ‘[1,2,3]’ даст временный массив из 3 элементов {1, 2, 3}; ‘[[11,12],[21,22]]’ даст матрицу 2*2 и т.д. Элементами такой конструкции могут быть и массивы если их размерности одинаковые, например ‘[v1,v2,...,vn]’. + +
    • результат команд построения новых данных (see Make another data), если они заключены в фигурные скобки {}. Например, ‘{sum dat 'x'}’ даст временный массив, который есть результат суммирования dat вдоль ’x’. Это такой же массив как и tmp, полученный командой ‘sum tmp dat 'x'’. При этом можно использовать вложенные конструкции, например ‘{sum {max dat 'z'} 'x'}’. +
    +

    Временные массивы не могут стоять в качестве первого аргумента команд, создающих массивы (например, ‘new’, ‘read’, ‘hist’ и т.д.). +

    +
  • К скалярным переменным, кроме собственно чисел, относятся: специальные переменные nan=#QNAN, inf=бесконечность, rnd=случайное число, pi=3.1415926..., on=1, off=0, all=-1, :=-1, переменные с суффиксами (see Data information), переменные определенные командой define, значения времени (в формате "hh-mm-ss_DD.MM.YYYY", "hh-mm-ss" или "DD.MM.YYYY") . Также массивы размером 1x1x1 считаются скалярами (например, ‘pi/dat.nx’). +
+

Перед первым использованием все переменные должны быть определены с помощью команд, создающих массивы (new, var, list, copy, read, hist, sum и др., см. Data constructor, Data filling и Make another data). +

+

Команды могут иметь несколько наборов аргументов (например, plot ydat и plot xdat ydat). Все аргументы команды для выбранного набора должны быть указаны, однако часть из них могут иметь значения по умолчанию. Такие аргументы в описании команд будут помещены в квадратные скобки [], например plot ydat ['stl'='' zval=nan]. При этом запись [arg1 arg2 arg3 ...] подразумевает [arg1 [arg2 [arg3 ...]]], т.е. опускать можно только аргументы с конца, если вы согласны с их значениями по умолчанию. Например, plot ydat '' 1 или plot ydat '' правильно, а plot ydat 1 не правильно (аргумент 'stl' пропущен). +

+

Можно предоставить несколько вариантов аргументов комманд при использовании символа ‘?’ для их разделения. Конкретный вариант аргумента, используемый при выполнении команды, задается значением команды variant. При этом будет использован последний вариант, если задано слишком большое значение. По умолчанию используется первый вариант (т.е. как при variant 0). Например в следующем коде будет сначала нарисован график синим цветом (первый аргумент ‘b’), а затем красным пунктиром – после variant 1 будет использован второй аргумент ‘r|’: +

fplot 'x' 'b'?'r'
+variant 1
+fplot 'x^3' 'b'?'r|'
+
+ +
+ +
+

+Next: , Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

7.2 Управление ходом выполнения

+ + +

Ниже собраны команды, управляющие порядком выполнения других команд (условия, циклы, подпрограммы), (пере-)определяют аргументы скрипта и пр. Прочие команды могут быть найдены в главах MathGL core и Data processing. Отмечу, что некоторые из команд (например, define, ask, call, for, func) должны быть расположены на отдельной строке. +

+ +
+
Команда MGL: chdir 'path'
+

Переходит в папку path. +

+ + +
+
Команда MGL: ask $N 'question'
+

Задает N-ый аргумент скрипта равным ответу пользователя на вопрос question. Обычно команда показывает диалог с вопросом и полем ввода текста ответа. Здесь N это цифра (0...9) или буква (a...z). +

+ + +
+
Команда MGL: define $N smth
+

Задает N-ый аргумент скрипта равным smth. Отмечу, что smth используется как есть (с символами ‘'’ если присутствуют). Выполняется только подстановка других макроопределений $0...$9, $a...$z. Здесь N это цифра (0...9) или буква (a...z). +

+
+
Команда MGL: define name smth
+

Определяет константу (скаляр) с именем name и числовым значением smth. Позднее она может быть использована как обычное число. +

+ +
+
Команда MGL: defchr $N smth
+

Задает N-ый аргумент скрипта равным символу с UTF кодом smth. Здесь N это цифра (0...9) или буква (a...z). +

+ +
+
Команда MGL: defnum $N smth
+

Задает N-ый аргумент скрипта равным числовому значению smth. Здесь N это цифра (0...9) или буква (a...z). +

+ + + +
+
Команда MGL: call 'fname' [ARG1 ARG2 ... ARG9]
+

Переходит к выполнению (вызывает) подпрограммы fname (или внешнего скрипта, если функция не была найдена). Опциональные аргументы передаются в подпрограмму. См. также func. +

+ + +
+
Команда MGL: func 'fname' [narg=0]
+

Определяет подпрограмму с именем fname и задает число требуемых аргументов. Аргументы будут помещены в параметры скрипта $1, $2, ... $9. Отмечу, что выполнение основной программы будет остановлено при встрече func – действует аналогично комманде stop. См. также return. +

+
+ +
+
Команда MGL: return
+

Возвращается из подпрограммы. См. также func. +

+ + +
+
Команда MGL: load 'filename'
+

Загружает дополнительные команды MGL из внешней динамической библиотеки filename. Данная библиотека должна содержать массив с именем mgl_cmd_extra типа mglCommand, который содержит описание новых комманд. +

+ + + +
+
Команда MGL: if val then CMD
+

Выполняет команду CMD только если val не ноль. +

+
+
Команда MGL: if val
+

Начинает блок команд, выполняемый если val не ноль. +

+
+
Команда MGL: if dat 'cond'
+

Начинает блок команд, выполняемый если каждый элемент dat удовлетворяет условию cond. +

+ +
+
Команда MGL: elseif dat 'cond'
+

Начинает блок команд, выполняемый если предыдущий if или elseif не был выполнен и каждый элемент dat удовлетворяет условию cond. +

+
+
Команда MGL: elseif val
+

Начинает блок команд, выполняемый если предыдущий if или elseif не был выполнен и val не ноль. +

+ +
+
Команда MGL: else
+

Начинает блок команд, выполняемый если предыдущий if или elseif не был выполнен. +

+ +
+
Команда MGL: endif
+

Заканчивает определение блока if/elseif/else. +

+ + +
+
Команда MGL: for $N v1 v2 [dv=1]
+

Начинает блок команд, выполняемый в цикле с $N-ым аргументом изменяющимся от v1 до v2 с шагом dv. Здесь N это цифра (0...9) или буква (a...z). +

+
+
Команда MGL: for $N dat
+

Начинает блок команд, выполняемый в цикле с $N-ым аргументом пробегающим значения массива dat. Здесь N это цифра (0...9) или буква (a...z). +

+ +
+
Команда MGL: next
+

Заканчивает блок цикла for. +

+ + +
+
Команда MGL: do
+

Начинает бесконечный цикл. +

+ +
+
Команда MGL: while val
+

Переходит к следующей итерации цикла если val не ноль, в противном случае заканчивает цикл. +

+
+
Команда MGL: while dat 'cond'
+

Переходит к следующей итерации цикла если dat удовлетворяет условию cond, в противном случае заканчивает цикл. +

+ + +
+
Команда MGL: once val
+

Определяет код (между once on и once off) который будет выполнен только один раз. Полезно для работы с большими данными в программах типа UDAV. +

+ +
+
Команда MGL: stop
+

Останавливает выполнение скрипта. +

+ + +
+
Команда MGL: variant val
+

Задает вариант аргумента(ов), разделенных символом ‘?’, для всех последующих комманд. +

+ + +
+
Команда MGL: rkstep eq1;... var1;... [dt=1]
+

Выполняет один шаг решения системы обыкновенных дифференциальных уравнений {var1’ = eq1, ... } с временным шагом dt. Здесь переменные ‘var1’, ... – переменные, определенные в MGL скрипте ранее. При решении используется метод Рунге-Кутта 4-го порядка. +

+ + + + +
+ + + +

7.3 Специальные комментарии

+ + +

There are number of special comments for MGL script, which set some global behavior (like, animation, dialog for parameters and so on). All these special comments starts with double sign ##. Let consider them. +

+
+
##c v1 v2 [dv=1]
+

Sets the parameter for animation loop relative to variable $0. Here v1 and v2 are initial and final values, dv is the increment. +

+
+
##a val
+

Adds the parameter val to the list of animation relative to variable $0. You can use it several times (one parameter per line) or combine it with animation loop ##c. +

+
+
##d $I kind|label|par1|par2|...
+

Creates custom dialog for changing plot properties. Each line adds one widget to the dialog. Here $I is id ($0,$1...$9,$a,$b...$z), label is the label of widget, kind is the kind of the widget: +

    +
  • ’e’ for editor or input line (parameter is initial value) , +
  • ’v’ for spinner or counter (parameters are "ini|min|max|step|big_step"), +
  • ’s’ for slider (parameters are "ini|min|max|step"), +
  • ’b’ for check box (parameter is "ini"; also understand "on"=1), +
  • ’c’ for choice (parameters are possible choices). +
+

Now, it work in FLTK-based mgllab and mglview only. +

+

You can make custom dialog in C/C++ code too by using one of following functions. +

+
+
Method on mglWnd: void MakeDialog (const char *ids, char const * const *args, const char *title)
+
Method on mglWnd: void MakeDialog (const std::string &ids, const std::vector<std::string> &args, const char *title)
+
C function: void mgl_wnd_make_dialog (HMGL gr, const char *ids, char const * const *args, const char *title)
+

Makes custom dialog for parameters ids of element properties defined by args. +

+ +

At this you need to provide callback function for setting up properties. You can do it by overloading Param() function of mglDraw class or set it manually. +

+
+
Method on mglDraw: void Param (char id, const char * val)
+
Method on mglWnd: void SetPropFunc (void (*prop)(char id, const char *val, void *p), void *par=NULL)
+
C function: void mgl_wnd_set_prop (void (*prop)(char id, const char *val, void *p), void *par)
+

Set callback function for properties setup. +

+ + +
+
+ + +
+ +
+

+Next: , Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

7.4 LaTeX package

+ + +

There is LaTeX package mgltex (was made by Diego Sejas Viscarra) which allow one to make figures directly from MGL script located in LaTeX file. +

+

For using this package you need to specify --shell-escape option for latex/pdflatex or manually run mglconv tool with produced MGL scripts for generation of images. Don’t forgot to run latex/pdflatex second time to insert generated images into the output document. Also you need to run pdflatex third time to update converted from EPS images if you are using vector EPS output (default). +

+

The package may have following options: draft, final — the same as in the graphicx package; on, off — to activate/deactivate the creation of scripts and graphics; comments, nocomments — to make visible/invisible comments contained inside mglcomment environments; jpg, jpeg, png — to export graphics as JPEG/PNG images; eps, epsz — to export to uncompressed/compressed EPS format as primitives; bps, bpsz — to export to uncompressed/compressed EPS format as bitmap (doesn’t work with pdflatex); pdf — to export to 3D PDF; tex — to export to LaTeX/tikz document. +

+

The package defines the following environments: +

+
mgl
+

It writes its contents to a general script which has the same name as the LaTeX document, but its extension is .mgl. The code in this environment is compiled and the image produced is included. It takes exactly the same optional arguments as the \includegraphics command, plus an additional argument imgext, which specifies the extension to save the image. +

+

An example of usage of ‘mgl’ environment would be: +

\begin{mglfunc}{prepare2d}
+  new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+  new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+\end{mglfunc}
+
+\begin{figure}[!ht]
+  \centering
+  \begin{mgl}[width=0.85\textwidth,height=7.5cm]
+    fog 0.5
+    call 'prepare2d'
+    subplot 2 2 0 : title 'Surf plot (default)' : rotate 50 60 : light on : box : surf a
+
+    subplot 2 2 1 : title '"\#" style; meshnum 10' : rotate 50 60 : box
+    surf a '#'; meshnum 10
+
+    subplot 2 2 2 : title 'Mesh plot' : rotate 50 60 : box
+    mesh a
+
+    new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+    new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+    new z 50 40 '0.8*cos(pi*(y+1)/2)'
+    subplot 2 2 3 : title 'parametric form' : rotate 50 60 : box
+    surf x y z 'BbwrR'
+  \end{mgl}
+\end{figure}
+
+
+
mgladdon
+

It adds its contents to the general script, without producing any image. +

+
mglcode
+

Is exactly the same as ‘mgl’, but it writes its contents verbatim to its own file, whose name is specified as a mandatory argument. +

+
mglscript
+

Is exactly the same as ‘mglcode’, but it doesn’t produce any image, nor accepts optional arguments. It is useful, for example, to create a MGL script, which can later be post processed by another package like "listings". +

+
mglblock
+

It writes its contents verbatim to a file, specified as a mandatory argument, and to the LaTeX document, and numerates each line of code. +

+
+
mglverbatim
+

Exactly the same as ‘mglblock’, but it doesn’t write to a file. This environment doesn’t have arguments. +

+
mglfunc
+

Is used to define MGL functions. It takes one mandatory argument, which is the name of the function, plus one additional argument, which specifies the number of arguments of the function. The environment needs to contain only the body of the function, since the first and last lines are appended automatically, and the resulting code is written at the end of the general script, after the stop command, which is also written automatically. The warning is produced if 2 or more function with the same name is defined. +

+
mglcomment
+

Is used to contain multiline comments. This comments will be visible/invisible in the output document, depending on the use of the package options comments and nocomments (see above), or the \mglcomments and \mglnocomments commands (see bellow). +

+
mglsetup
+

If many scripts with the same code are to be written, the repetitive code can be written inside this environment only once, then this code will be used automatically every time the ‘\mglplot’ command is used (see below). It takes one optional argument, which is a name to be associated to the corresponding contents of the environment; this name can be passed to the ‘\mglplot’ command to use the corresponding block of code automatically (see below). +

+
+ +

The package also defines the following commands: +

+
\mglplot
+

It takes one mandatory argument, which is MGL instructions separated by the symbol ‘:’ this argument can be more than one line long. It takes the same optional arguments as the ‘mgl’ environment, plus an additional argument setup, which indicates the name associated to a block of code inside a ‘mglsetup’ environment. The code inside the mandatory argument will be appended to the block of code specified, and the resulting code will be written to the general script. +

+

An example of usage of ‘\mglplot’ command would be: +

\begin{mglsetup}
+    box '@{W9}' : axis
+\end{mglsetup}
+\begin{mglsetup}[2d]
+  box : axis
+  grid 'xy' ';k'
+\end{mglsetup}
+\begin{mglsetup}[3d]
+  rotate 50 60
+  box : axis : grid 'xyz' ';k'
+\end{mglsetup}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5]{new a 200 'sin(pi*x)' : plot a '2B'}
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5,setup=2d]{
+    fplot 'sin(pi*x)' '2B' :
+    fplot 'cos(pi*x^2)' '2R'
+  }
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[setup=3d]{fsurf 'sin(pi*x)+cos(pi*y)'}
+\end{figure}
+
+
+
\mglgraphics
+

This command takes the same optional arguments as the ‘mgl’ environment, and one mandatory argument, which is the name of a MGL script. This command will compile the corresponding script and include the resulting image. It is useful when you have a script outside the LaTeX document, and you want to include the image, but you don’t want to type the script again. +

+
\mglinclude
+

This is like ‘\mglgraphics’ but, instead of creating/including the corresponding image, it writes the contents of the MGL script to the LaTeX document, and numerates the lines. +

+
\mgldir
+

This command can be used in the preamble of the document to specify a directory where LaTeX will save the MGL scripts and generate the corresponding images. This directory is also where ‘\mglgraphics’ and ‘\mglinclude’ will look for scripts. +

+
\mglquality
+

Adjust the quality of the MGL graphics produced similarly to quality. +

+
\mgltexon, \mgltexoff
+

Activate/deactivate the creation of MGL scripts and images. Notice these commands have local behavior in the sense that their effect is from the point they are called on. +

+
\mglcomment, \mglnocomment
+

Make visible/invisible the contents of the mglcomment environments. These commands have local effect too. +

+
\mglTeX
+

It just pretty prints the name of the package. +

+
+ +

As an additional feature, when an image is not found or cannot be included, instead of issuing an error, mgltex prints a box with the word ‘MGL image not found’ in the LaTeX document. +

+ + + +
+ +
+

+Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

7.5 mglParse class

+ + + +

Класс разбирает и выполняет скрипты MGL. Он определен в #include <mgl2/mgl.h>. +

+

Основная функция класса mglParse – Execute(), выполняющая построчный разбор скрипта. Также есть вспомогательные функции для поиска и создания переменных MGL (объектов, производных от mglDataA). Эти функции полезны для отображения значений массивов во внешних объектах (например, в отдельном окне) или для предоставления доступа к внутренним массивам. Функция AllowSetSize() позволяет запретить изменение размера картинки (запрещает команду setsize). Функция AllowFileIO() позволяет запретить доступ к файлам на диске. +

+ +
+
Конструктор класса mglParse: mglParse (bool setsize=false)
+
Конструктор класса mglParse: mglParse (HMPR pr)
+
Конструктор класса mglParse: mglParse (mglParse &pr)
+
Функция С: HMPR mgl_create_parser ()
+

Создает экземпляр класса mglParse и устанавливает значение AllowSetSize. +

+ +
+
Деструктор класса mglParse: ~mglParse ()
+
Функция С: void mgl_delete_parser (HMPR p)
+

Удаляет экземпляр класса. +

+ +
+
Метод класса mglParse: HMPR Self ()
+

Возвращает указатель на используемый объект типа HMPR. +

+ +
+
Метод класса mglParse: void Execute (mglGraph *gr, const char *text)
+
Метод класса mglParse: void Execute (mglGraph *gr, const wchar_t *text)
+
Функция С: void mgl_parse_text (HMGL gr, HMPR p, const char *text)
+
Функция С: void mgl_parse_textw (HMGL gr, HMPR p, const wchar_t *text)
+

Выполняет построчно скрипт MGL, содержащийся в text. Строки считаются разделенными символом ‘\n’. Это основная функция класса. +

+ +
+
Метод класса mglParse: void Execute (mglGraph *gr, FILE *fp, bool print=false)
+
Функция С: void mgl_parse_file (HMGL gr, HMPR p, FILE *fp, int print)
+

Аналогично предыдущему, но скрипт читается из файла fp. Если print=true, то предупреждения и информационные сообщения печатаются в stdout. +

+ +
+
Метод класса mglParse: int Parse (mglGraph *gr, const char *str, long pos=0)
+
Метод класса mglParse: int Parse (mglGraph *gr, const wchar_t *str, long pos=0)
+
Функция С: int mgl_parse_line (HMGL gr, HMPR p, const char *str, int pos)
+
Функция С: int mgl_parse_linew (HMGL gr, HMPR p, const wchar_t *str, int pos)
+

Выполняет строку str с выводом графики на gr. Возвращает код ошибки: 0 – нет ошибок, 1 – неправильные аргументы, 2 – неизвестная команда, 3 – строка слишком длинная, 4 – нет закрывающей скобки или ‘'’. Аргумент pos задает позицию строки в документе/файле для использования в команде for. +

+ +
+
Метод класса mglParse: mglData Calc (const char *formula)
+
Метод класса mglParse: mglData Calc (const wchar_t *formula)
+
Функция С: HMDT mgl_parser_calc (HMPR p, const char *formula)
+
Функция С: HMDT mgl_parser_calcw (HMPR p, const wchar_t *formula)
+

Разбирает строку formula и возвращает полученный массив. В отличие от AddVar() или FindVar(), это обычный массив данных, который следует удалить после использования. +

+ +
+
Метод класса mglParse: mglDataC CalcComplex (const char *formula)
+
Метод класса mglParse: mglDataC CalcComplex (const wchar_t *formula)
+
Функция С: HADT mgl_parser_calc_complex (HMPR p, const char *formula)
+
Функция С: HADT mgl_parser_calc_complexw (HMPR p, const wchar_t *formula)
+

Разбирает строку formula и возвращает полученный массив с комплексными значениями. В отличие от AddVar() или FindVar(), это обычный массив данных, который следует удалить после использования. +

+ + +
+
Метод класса mglParse: void AddParam (int n, const char *str)
+
Метод класса mglParse: void AddParam (int n, const wchar_t *str)
+
Функция С: void mgl_parser_add_param (HMPR p, int id, const char *val)
+
Функция С: void mgl_parser_add_paramw (HMPR p, int id, const wchar_t *val)
+

Устанавливает значение n-го параметра строкой str (n=0, 1 ... ’z’-’a’+10). Строка str не должна содержать символ ‘$’. +

+ +
+
Метод класса mglParse: mglVar * FindVar (const char *name)
+
Метод класса mglParse: mglVar * FindVar (const wchar_t *name)
+
Функция С: HMDT mgl_parser_find_var (HMPR p, const char *name)
+
Функция С: HMDT mgl_parser_find_varw (HMPR p, const wchar_t *name)
+

Возвращает указатель на переменную с именем name или NULL если переменная отсутствует. Используйте эту функцию для добавления внешних массивов в скрипт. Не удаляйте полученный массив! +

+
+
Метод класса mglParse: mglVar * AddVar (const char *name)
+
Метод класса mglParse: mglVar * AddVar (const wchar_t *name)
+
Функция С: HMDT mgl_parser_add_var (HMPR p, const char *name)
+
Функция С: HMDT mgl_parser_add_varw (HMPR p, const wchar_t *name)
+

Возвращает указатель на переменную с именем name. Если переменная отсутствует, то она будет создана. Используйте эту функцию для добавления внешних массивов в скрипт. Не удаляйте полученный массив! +

+ +
+
Метод класса mglParse: void OpenHDF (const char *fname)
+
Функция С: void mgl_parser_openhdf (HMPR pr, const char *fname)
+

Читает все массивы данных из HDF5 файла fname и создает переменные MGL с соответствующими именами. Если имя данных начинается с ‘!’, то будут созданы комплексные массивы. +

+ +
+
Метод класса mglParse (C++): void DeleteVar (const char *name)
+
Метод класса mglParse (C++): void DeleteVar (const wchar_t *name)
+
Функция С: void mgl_parser_del_var (HMPR p, const char *name)
+
Функция С: void mgl_parser_del_varw (HMPR p, const wchar_t *name)
+

Удаляет переменную по имени name. +

+ +
+
Метод класса mglParse (C++): void DeleteAll ()
+
Функция С: void mgl_parser_del_all (HMPR p)
+

Удаляет все переменные и сбрасывает список команд к списку по умолчанию в данном классе. +

+ +
+
Метод класса mglParse: void RestoreOnce ()
+
Функция С: void mgl_parser_restore_once (HMPR p)
+

Восстанавливает состояние флага Once. +

+ +
+
Метод класса mglParse: void AllowSetSize (bool a)
+
Функция С: void mgl_parser_allow_setsize (HMPR p, int a)
+

Разрешает/запрещает команду setsize. +

+ +
+
Метод класса mglParse: void AllowFileIO (bool a)
+
Функция С: void mgl_parser_allow_file_io (HMPR p, int a)
+

Разрешает/запрещает команды чтения файлов. +

+ +
+
Метод класса mglParse: void AllowDllCall (bool a)
+
Функция С: void mgl_parser_allow_dll_call (HMPR p, int a)
+

Разрешает/запрещает команду load. +

+ +
+
Метод класса mglParse: void Stop ()
+
Функция С: void mgl_parser_stop (HMPR p)
+

Посылает сигнал завершения выполнения для следующей команды. +

+ +
+
Метод класса mglParse: void SetVariant (int var=0)
+
Функция С: void mgl_parser_variant (HMPR p, int var=0)
+

Задает вариант аргумента(ов), разделенных символом ‘?’, для всех последующих комманд. +

+ +
+
Метод класса mglParse: void StartID (int id=0)
+
Функция С: void mgl_parser_start_id (HMPR p, int id)
+

Задает начальный id (обычно это номер строки) первой строки при последующем выполнении скрипта. +

+ + +
+
Метод класса mglParse: long GetCmdNum ()
+
Функция С: long mgl_parser_cmd_num (HMPR p)
+

Возвращает число зарегистрированных команд MGL. +

+ +
+
Метод класса mglParse: const char * GetCmdName (long id)
+
Функция С: const char * mgl_parser_cmd_name (HMPR p, long id)
+

Возвращает имя команды MGL с заданным номером id. +

+ +
+
Метод класса mglParse: int CmdType (const char *name)
+
Функция С: int mgl_parser_cmd_type (HMPR p, const char *name)
+

Возвращает тип команды MGL с именем name. Типы команд: 0 – не команда, 1 - графики по данным, 2 - прочие графики, 3 - настройка, 4 - обработка данных, 5 - создание данных, 6 - трансформация, 7 - ход выполнения, 8 - 1d графики, 9 - 2d графики, 10 - 3d графики, 11 - двойные графики, 12 - векторные поля, 13 - оси координат, 14 - примитивы, 15 - настройка осей, 16 - текст/легенда, 17 - изменение данных. +

+ +
+
Метод класса mglParse: const char * CmdFormat (const char *name)
+
Функция С: const char * mgl_parser_cmd_frmt (HMPR p, const char *name)
+

Возвращает формат аргументов команды MGL с именем name. +

+ +
+
Метод класса mglParse: const char * CmdDesc (const char *name)
+
Функция С: const char * mgl_parser_cmd_desc (HMPR p, const char *name)
+

Возвращает описание команды MGL с именем name. +

+ +
+
Метод класса mglParse: void RK_Step (const char *eqs, const char *vars, mreal dt=1)
+
Метод класса mglParse: void RK_Step (const wchar_t *eqs, const wchar_t *vars, mreal dt=1)
+
Функция С: void mgl_rk_step (HMPR p, const char *eqs, const char *vars, mreal dt)
+
Функция С: void mgl_rk_step_w (HMPR p, const wchar_t *eqs, const wchar_t *vars, mreal dt)
+

Make one step for ordinary differential equation(s) {var1’ = eq1, ... } with time-step dt. Here strings eqs and vars contain the equations and variable names separated by symbol ‘;’. The variable(s) ‘var1’, ... are the ones, defined in MGL script previously. The Runge-Kutta 4-th order method is used. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

8 UDAV

+ + +

UDAV (Universal Data Array Visualizator) is cross-platform program for data arrays visualization based on MathGL library. It support wide spectrum of graphics, simple script language and visual data handling and editing. It has window interface for data viewing, changing and plotting. Also it can execute MGL scripts, setup and rotate graphics and so on. UDAV hot-keys can be found in the appendix Hot-keys for UDAV. +

+ + + + + + + +
+ +
+

+Next: , Up: UDAV   [Contents][Index]

+
+ +

8.1 UDAV overview

+ + +

UDAV have main window divided by 2 parts in general case and optional bottom panel(s). Left side contain tabs for MGL script and data arrays. Right side contain tabs with graphics itself, with list of variables and with help on MGL. Bottom side may contain the panel with MGL messages and warnings, and the panel with calculator. +

+
Main window +
+

Main window is shown on the figure above. You can see the script (at left) with current line highlighted by light-yellow, and result of its execution at right. Each panel have its own set of toolbuttons. +

+

Editor toolbuttons allow: open and save script from/to file; undo and redo changes; cut, copy and paste selection; find/replace text; show dialogs for command arguments and for plot setup; show calculator at bottom. +

+

Graphics toolbuttons allow: enable/disable additional transparency and lighting; show grid of absolute coordinates; enable mouse rotation; restore image view; refresh graphics (execute the script); stop calculation; copy graphics into clipboard; add primitives (line, curve, box, rhombus, ellipse, mark, text) to the image; change view angles manually. Vertical toolbuttons allow: shift and zoom in/out of image as whole; show next and previous frame of animation, or start animation (if one present). +

+

Graphics panel support plot editing by mouse. +

    +
  • Axis range can be changed by mouse wheel or by dragging image by middle mouse button. Right button show popup menu. Left button show the coordinates of mouse click. At this double click will highlight plot under mouse and jump to the corresponded string of the MGL script. +
  • Pressing "mouse rotation" toolbutton will change mouse actions: dragging by left button will rotate plot, middle button will shift the plot as whole, right button will zoom in/out plot as whole and add perspective, mouse wheel will zoom in/out plot as whole. +
  • Manual primitives can be added by pressing corresponding toolbutton. They can be shifted as whole at any time by mouse dragging. At this double click open dialog with its properties. If toolbutton "grid of absolute coordinates" is pressed then editing of active points for primitives is enabled. +
+ +
Main window - help panel +
+

Short command description and list of its arguments are shown at the status-bar, when you move cursor to the new line of code. You can press F1 to see more detailed help on special panel. +

+
Main window - data viewing +
+

Also you can look the current list of variables, its dimensions and its size in the memory (right side of above figure). Toolbuttons allow: create new variable, edit variable, delete variable, preview variable plot and its properties, refresh list of variables. Pressing on any column will sort table according its contents. Double click on a variable will open panel with data cells of the variable, where you can view/edit each cell independently or apply a set of transformations. +

+
Main window - calculator and messages +
+

Finally, pressing F2 or F4 you can show/hide windows with messages/warnings and with calculator. Double click on a warning in message window will jump to corresponding line in editor. Calculator allow you type expression by keyboard as well as by toolbuttons. It know about all current variables, so you can use them in formulas. +

+ +
+ +
+

+Next: , Previous: , Up: UDAV   [Contents][Index]

+
+ +

8.2 UDAV dialogs

+ + +

There are a set of dialogs, which allow change/add a command, setup global plot properties, or setup UDAV itself. +

+
New command dialog +
+

One of most interesting dialog (hotkey Meta-C or Win-C) is dialog which help to enter new command or change arguments of existed one. It allows consequently select the category of command, command name in category and appropriate set of command arguments. At this right side show detailed command description. Required argument(s) are denoted by bold text. Strings are placed in apostrophes, like 'txt'. Buttons below table allow to call dialogs for changing style of command (if argument 'fmt' is present in the list of command arguments); to set variable or expression for argument(s); to add options for command. Note, you can click on a cell to enter value, or double-click to call corresponding dialog. +

+
Style dialog - pen style +
Style dialog - color scheme +
Style dialog - text style +
Style dialog - manual mask +
+

Dialog for changing style can be called independently, but usually is called from New command dialog or by double click on primitive. It contain 3 tabs: one for pen style, one for color scheme, one for text style. You should select appropriate one. Resulting string of style and sample picture are shown at bottom of dialog. Usually it can be called from New command dialog. +

+
Variable dialog +
+

Dialog for entering variable allow to select variable or expression which can be used as argument of a command. Here you can select the variable name; range of indexes in each directions; operation which will be applied (like, summation, finding minimal/maximal values and so on). Usually it can be called from New command dialog. +

+
Dialog for options of a command +
+

Dialog for command options allow to change Command options. Usually it can be called from New command dialog. +

+ + +
New inplot dialog +
+

Another interesting dialog, which help to select and properly setup a subplot, inplot, columnplot, stickplot and similar commands. +

+ +
Dialog for general properties +
Dialog for light properties +
+

There is dialog for setting general plot properties, including tab for setting lighting properties. It can be called by called by hotkey ??? and put setup commands at the beginning of MGL script. +

+
Dialog for script parameters +
+

Also you can set or change script parameters (‘$0’ ... ‘$9’, see MGL definition). +

+
Dialog for UDAV settings +
+

Finally, there is dialog for UDAV settings. It allow to change most of things in UDAV appearance and working, including colors of keywords and numbers, default font and image size, and so on (see figure above). +

+

There are also a set of dialogs for data handling, but they are too simple and clear. So, I will not put them here. +

+ +
+ +
+

+Previous: , Up: UDAV   [Contents][Index]

+
+ +

8.3 UDAV hints

+ + +
    +
  • You can shift axis range by pressing middle button and moving mouse. Also, you can zoom in/out axis range by using mouse wheel. +
  • You can rotate/shift/zoom whole plot by mouse. Just press ’Rotate’ toolbutton, click image and hold a mouse button: left button for rotation, right button for zoom/perspective, middle button for shift. +
  • You may quickly draw the data from file. Just use: udav ’filename.dat’ in command line. +
  • You can copy the current image to clipboard by pressing Ctrl-Shift-C. Later you can paste it directly into yours document or presentation. +
  • You can export image into a set of format (EPS, SVG, PNG, JPEG) by pressing right mouse button inside image and selecting ’Export as ...’. +
  • You can setup colors for script highlighting in Property dialog. Just select menu item ’Settings/Properties’. +
  • You can save the parameter of animation inside MGL script by using comment started from ’##a ’ or ’##c ’ for loops. +
  • New drawing never clears things drawn already. For example, you can make a surface with contour lines by calling commands ’surf’ and ’cont’ one after another (in any order). +
  • You can put several plots in the same image by help of commands ’subplot’ or ’inplot’. +
  • All indexes (of data arrays, subplots and so on) are always start from 0. +
  • You can edit MGL file in any text editor. Also you can run it in console by help of commands: mglconv, mglview. +
  • You can use command ’once on|off’ for marking the block which should be executed only once. For example, this can be the block of large data reading/creating/handling. Press F9 (or menu item ’Graphics/Reload’) to re-execute this block. +
  • You can use command ’stop’ for terminating script parsing. It is useful if you don’t want to execute a part of script. +
  • You can type arbitrary expression as input argument for data or number. In last case (for numbers), the first value of data array is used. +
  • There is powerful calculator with a lot of special functions. You can use buttons or keyboard to type the expression. Also you can use existed variables in the expression. +
  • The calculator can help you to put complex expression in the script. Just type the expression (which may depend on coordinates x,y,z and so on) and put it into the script. +
  • You can easily insert file or folder names, last fitted formula or numerical value of selection by using menu Edit|Insert. +
  • The special dialog (Edit|Insert|New Command) help you select the command, fill its arguments and put it into the script. +
  • You can put several plotting commands in the same line or in separate function, for highlighting all of them simultaneously. +
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

9 Other classes

+ + +

There are few end-user classes: mglGraph (see MathGL core), mglWindow and mglGLUT (see Widget classes), mglData (see Data processing), mglParse (see MGL scripts). Exactly these classes I recommend to use in most of user programs. All methods in all of these classes are inline and have exact C/Fortran analogue functions. This give compiler independent binary libraries for MathGL. +

+

However, sometimes you may need to extend MathGL by writing yours own plotting functions or handling yours own data structures. In these cases you may need to use low-level API. This chapter describes it. +

+
Class diagram for MathGL +
+

The internal structure of MathGL is rather complicated. There are C++ classes mglBase, mglCanvas, ... for drawing primitives and positioning the plot (blue ones in the figure). There is a layer of C functions, which include interface for most important methods of these classes. Also most of plotting functions are implemented as C functions. After it, there are “inline” front-end classes which are created for user convenience (yellow ones in the figure). Also there are widgets for FLTK and Qt libraries (green ones in the figure). +

+

Below I show how this internal classes can be used. +

+ + + + + + + + + +
+ + + +

9.1 Define new kind of plot (mglBase class)

+ + +

Basically most of new kinds of plot can be created using just MathGL primitives (see Primitives). However the usage of mglBase methods can give you higher speed of drawing and better control of plot settings. +

+

All plotting functions should use a pointer to mglBase class (or HMGL type in C functions) due to compatibility issues. Exactly such type of pointers are used in front-end classes (mglGraph, mglWindow) and in widgets (QMathGL, Fl_MathGL). +

+

MathGL tries to remember all vertexes and all primitives and plot creation stage, and to use them for making final picture by demand. Basically for making plot, you need to add vertexes by AddPnt() function, which return index for new vertex, and call one of primitive drawing function (like mark_plot(), arrow_plot(), line_plot(), trig_plot(), quad_plot(), text_plot()), using vertex indexes as argument(s). AddPnt() function use 2 mreal numbers for color specification. First one is positioning in textures – integer part is texture index, fractional part is relative coordinate in the texture. Second number is like a transparency of plot (or second coordinate in the 2D texture). +

+

I don’t want to put here detailed description of mglBase class. It was rather well documented in mgl2/base.h file. I just show and example of its usage on the base of circle drawing. +

+

First, we should prototype new function circle() as C function. +

#ifdef __cplusplus
+extern "C" {
+#endif
+void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt);
+#ifdef __cplusplus
+}
+#endif
+

This is done for generating compiler independent binary. Because only C-functions have standard naming mechanism, the same for any compilers. +

+

Now, we create a C++ file and put the code of function. I’ll write it line by line and try to comment all important points. +

void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+

First, we need to check all input arguments and send warnings if something is wrong. In our case it is negative value of r argument. We just send warning, since it is not critical situation – other plot still can be drawn. +

  if(r<=0)  { gr->SetWarn(mglWarnNeg,"Circle"); return; }
+

Next step is creating a group. Group keep some general setting for plot (like options) and useful for export in 3d files. +

  static int cgid=1;  gr->StartGroup("Circle",cgid++);
+

Now let apply options. Options are rather useful things, generally, which allow one easily redefine axis range(s), transparency and other settings (see Command options). +

  gr->SaveState(opt);
+

I use global setting for determining the number of points in circle approximation. Note, that user can change MeshNum by options easily. +

  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+

Let try to determine plot specific flags. MathGL functions expect that most of flags will be sent in string. In our case it is symbol ‘@’ which set to draw filled circle instead of border only (last will be default). Note, you have to handle NULL as string pointer. +

  bool fill = mglchr(stl,'@');
+

Now, time for coloring. I use palette mechanism because circle have few colors: one for filling and another for border. SetPenPal() function parse input string and write resulting texture index in pal. Function return the character for marker, which can be specified in string str. Marker will be plotted at the center of circle. I’ll show on next sample how you can use color schemes (smooth colors) too. +

  long pal=0;
+  char mk=gr->SetPenPal(stl,&pal);
+

Next step, is determining colors for filling and for border. First one for filling. +

  mreal c=gr->NextColor(pal), d;
+

Second one for border. I use black color (call gr->AddTexture('k')) if second color is not specified. +

  mreal k=(gr->GetNumPal(pal)>1)?gr->NextColor(pal):gr->AddTexture('k');
+

If user want draw only border (fill=false) then I use first color for border. +

  if(!fill) k=c;
+

Now we should reserve space for vertexes. This functions need n for border, n+1 for filling and 1 for marker. So, maximal number of vertexes is 2*n+2. Note, that such reservation is not required for normal work but can sufficiently speed up the plotting. +

  gr->Reserve(2*n+2);
+

We’ve done with setup and ready to start drawing. First, we need to add vertex(es). Let define NAN as normals, since I don’t want handle lighting for this plot, +

  mglPoint q(NAN,NAN);
+

and start adding vertexes. First one for central point of filling. I use -1 if I don’t need this point. The arguments of AddPnt() function is: mglPoint(x,y,z) – coordinate of vertex, c – vertex color, q – normal at vertex, -1 – vertex transparency (-1 for default), 3 bitwise flag which show that coordinates will be scaled (0x1) and will not be cutted (0x2). +

  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+

Similar for marker, but we use different color k. +

  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+

Draw marker. +

  if(mk)  gr->mark_plot(n2,mk);
+

Time for drawing circle itself. I use -1 for m1, n1 as sign that primitives shouldn’t be drawn for first point i=0. +

  for(i=0,m1=n1=-1;i<n;i++)
+  {
+

Each function should check Stop variable and return if it is non-zero. It is done for interrupting drawing for system which don’t support multi-threading. +

    if(gr->Stop)  return;
+

Let find coordinates of vertex. +

    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+

Save previous vertex and add next one +

    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+

and copy it for border but with different color. Such copying is much faster than adding new vertex using AddPnt(). +

    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+

Now draw triangle for filling internal part +

    if(fill)  gr->trig_plot(n0,n1,n2);
+

and draw line for border. +

    gr->line_plot(m1,m2);
+  }
+

Drawing is done. Let close group and return. +

  gr->EndGroup();
+}
+
+

Another sample I want to show is exactly the same function but with smooth coloring using color scheme. So, I’ll add comments only in the place of difference. +

+
void circle_cs(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+

In this case let allow negative radius too. Formally it is not the problem for plotting (formulas the same) and this allow us to handle all color range. +

//if(r<=0)  { gr->SetWarn(mglWarnNeg,"Circle"); return; }
+
+  static int cgid=1;  gr->StartGroup("CircleCS",cgid++);
+  gr->SaveState(opt);
+  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+  bool fill = mglchr(stl,'@');
+

Here is main difference. We need to create texture for color scheme specified by user +

  long ss = gr->AddTexture(stl);
+

But we need also get marker and color for it (if filling is enabled). Let suppose that marker and color is specified after ‘:’. This is standard delimiter which stop color scheme entering. So, just lets find it and use for setting pen. +

  const char *pen=0;
+  if(stl) pen = strchr(stl,':');
+  if(pen) pen++;
+

The substring is placed in pen and it will be used as line style. +

  long pal=0;
+  char mk=gr->SetPenPal(pen,&pal);
+

Next step, is determining colors for filling and for border. First one for filling. +

  mreal c=gr->GetC(ss,r);
+

Second one for border. +

  mreal k=gr->NextColor(pal);
+

The rest part is the same as in previous function. +

  if(!fill) k=c;
+
+  gr->Reserve(2*n+2);
+  mglPoint q(NAN,NAN);
+  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+  if(mk)  gr->mark_plot(n2,mk);
+  for(i=0,m1=n1=-1;i<n;i++)
+  {
+    if(gr->Stop)  return;
+    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+    if(fill)  gr->trig_plot(n0,n1,n2);
+    gr->line_plot(m1,m2);
+  }
+  gr->EndGroup();
+}
+
+

The last thing which we can do is derive our own class with new plotting functions. Good idea is to derive it from mglGraph (if you don’t need extended window), or from mglWindow (if you need to extend window). So, in our case it will be +

class MyGraph : public mglGraph
+{
+public:
+  inline void Circle(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle(p.x,p.y,p.z, r, stl, opt); }
+  inline void CircleCS(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle_cs(p.x,p.y,p.z, r, stl, opt); }
+};
+

Note, that I use inline modifier for using the same binary code with different compilers. +

+

So, the complete sample will be +

#include <mgl2/mgl.h>
+//---------------------------------------------------------
+#ifdef __cplusplus
+extern "C" {
+#endif
+void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt);
+void circle_cs(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt);
+#ifdef __cplusplus
+}
+#endif
+//---------------------------------------------------------
+class MyGraph : public mglGraph
+{
+public:
+  inline void CircleCF(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle(p.x,p.y,p.z, r, stl, opt); }
+  inline void CircleCS(mglPoint p, mreal r, const char *stl="", const char *opt="")
+  { circle_cs(p.x,p.y,p.z, r, stl, opt); }
+};
+//---------------------------------------------------------
+void circle(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+  if(r<=0)  { gr->SetWarn(mglWarnNeg,"Circle"); return; }
+  static int cgid=1;  gr->StartGroup("Circle",cgid++);
+  gr->SaveState(opt);
+  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+  bool fill = mglchr(stl,'@');
+  long pal=0;
+  char mk=gr->SetPenPal(stl,&pal);
+  mreal c=gr->NextColor(pal), d;
+  mreal k=(gr->GetNumPal(pal)>1)?gr->NextColor(pal):gr->AddTexture('k');
+  if(!fill) k=c;
+  gr->Reserve(2*n+2);
+  mglPoint q(NAN,NAN);
+  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+  if(mk)  gr->mark_plot(n2,mk);
+  for(i=0,m1=n1=-1;i<n;i++)
+  {
+    if(gr->Stop)  return;
+    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+    if(fill)  gr->trig_plot(n0,n1,n2);
+    gr->line_plot(m1,m2);
+  }
+  gr->EndGroup();
+}
+//---------------------------------------------------------
+void circle_cs(HMGL gr, mreal x, mreal y, mreal z, mreal r, const char *stl, const char *opt)
+{
+  static int cgid=1;  gr->StartGroup("CircleCS",cgid++);
+  gr->SaveState(opt);
+  const int n = gr->MeshNum>1?gr->MeshNum : 41;
+  bool fill = mglchr(stl,'@');
+  long ss = gr->AddTexture(stl);
+  const char *pen=0;
+  if(stl) pen = strchr(stl,':');
+  if(pen) pen++;
+  long pal=0;
+  char mk=gr->SetPenPal(pen,&pal);
+  mreal c=gr->GetC(ss,r);
+  mreal k=gr->NextColor(pal);
+  if(!fill) k=c;
+
+  gr->Reserve(2*n+2);
+  mglPoint q(NAN,NAN);
+  long n0,n1,n2,m1,m2,i;
+  n0 = fill ? gr->AddPnt(mglPoint(x,y,z),c,q,-1,3):-1;
+  n2 = mk ? gr->AddPnt(mglPoint(x,y,z),k,q,-1,3):-1;
+  if(mk)  gr->mark_plot(n2,mk);
+  for(i=0,m1=n1=-1;i<n;i++)
+  {
+    if(gr->Stop)  return;
+    mreal t = i*2*M_PI/(n-1.);
+    mglPoint p(x+r*cos(t), y+r*sin(t), z);
+    n2 = n1;  n1 = gr->AddPnt(p,c,q,-1,3);
+    m2 = m1;  m1 = gr->CopyNtoC(n1,k);
+    if(fill)  gr->trig_plot(n0,n1,n2);
+    gr->line_plot(m1,m2);
+  }
+  gr->EndGroup();
+}
+//---------------------------------------------------------
+int main()
+{
+  MyGraph gr;
+  gr.Box();
+  // first let draw circles with fixed colors
+  for(int i=0;i<10;i++)
+    gr.CircleCF(mglPoint(2*mgl_rnd()-1, 2*mgl_rnd()-1), mgl_rnd());
+  // now let draw circles with color scheme
+  for(int i=0;i<10;i++)
+    gr.CircleCS(mglPoint(2*mgl_rnd()-1, 2*mgl_rnd()-1), 2*mgl_rnd()-1);
+}
+
+ + + + +
+ +
+

+Next: , Previous: , Up: Other classes   [Contents][Index]

+
+ +

9.2 User defined types (mglDataA class)

+ + +

mglData class have abstract predecessor class mglDataA. Exactly the pointers to mglDataA instances are used in all plotting functions and some of data processing functions. This was done for taking possibility to define yours own class, which will handle yours own data (for example, complex numbers, or differently organized data). And this new class will be almost the same as mglData for plotting purposes. +

+

However, the most of data processing functions will be slower as if you used mglData instance. This is more or less understandable – I don’t know how data in yours particular class will be organized, and couldn’t optimize the these functions generally. +

+

There are few virtual functions which must be provided in derived classes. This functions give: +

    +
  • the sizes of the data (GetNx, GetNy, GetNz), +
  • give data value and numerical derivatives for selected cell (v, dvx, dvy, dvz), +
  • give maximal and minimal values (Maximal, Minimal) – you can use provided functions (like mgl_data_max and mgl_data_min), but yours own realization can be more efficient, +
  • give access to all element as in single array (vthr) – you need this only if you want using MathGL’s data processing functions. +
+ +

Let me, for example define class mglComplex which will handle complex number and draw its amplitude or phase, depending on flag use_abs: +

#include <complex>
+#include <mgl2/mgl.h>
+#define dual std::complex<double>
+class mglComplex : public mglDataA
+{
+public:
+  long nx;      ///< number of points in 1st dimensions ('x' dimension)
+  long ny;      ///< number of points in 2nd dimensions ('y' dimension)
+  long nz;      ///< number of points in 3d dimensions ('z' dimension)
+  dual *a;      ///< data array
+  bool use_abs; ///< flag to use abs() or arg()
+
+  inline mglComplex(long xx=1,long yy=1,long zz=1)
+  { a=0;  use_abs=true; Create(xx,yy,zz); }
+  virtual ~mglComplex()  { if(a)  delete []a; }
+
+  /// Get sizes
+  inline long GetNx() const { return nx;  }
+  inline long GetNy() const { return ny;  }
+  inline long GetNz() const { return nz;  }
+  /// Create or recreate the array with specified size and fill it by zero
+  inline void Create(long mx,long my=1,long mz=1)
+  { nx=mx;  ny=my;  nz=mz;  if(a) delete []a;
+  a = new dual[nx*ny*nz]; }
+  /// Get maximal value of the data
+  inline mreal Maximal() const  { return mgl_data_max(this);  }
+  /// Get minimal value of the data
+  inline mreal Minimal() const  { return mgl_data_min(this);  }
+
+protected:
+  inline mreal v(long i,long j=0,long k=0) const
+  { return use_abs ? abs(a[i+nx*(j+ny*k)]) : arg(a[i+nx*(j+ny*k)]);  }
+  inline mreal vthr(long i) const
+  { return use_abs ? abs(a[i]) : arg(a[i]);  }
+  inline mreal dvx(long i,long j=0,long k=0) const
+  { long i0=i+nx*(j+ny*k);
+    std::complex<double> res=i>0? (i<nx-1? (a[i0+1]-a[i0-1])/2.:a[i0]-a[i0-1]) : a[i0+1]-a[i0];
+    return use_abs? abs(res) : arg(res);  }
+  inline mreal dvy(long i,long j=0,long k=0) const
+  { long i0=i+nx*(j+ny*k);
+    std::complex<double> res=j>0? (j<ny-1? (a[i0+nx]-a[i0-nx])/2.:a[i0]-a[i0-nx]) : a[i0+nx]-a[i0];
+    return use_abs? abs(res) : arg(res);  }
+  inline mreal dvz(long i,long j=0,long k=0) const
+  { long i0=i+nx*(j+ny*k), n=nx*ny;
+    std::complex<double> res=k>0? (k<nz-1? (a[i0+n]-a[i0-n])/2.:a[i0]-a[i0-n]) : a[i0+n]-a[i0];
+    return use_abs? abs(res) : arg(res);  }
+};
+int main()
+{
+  mglComplex dat(20);
+  for(long i=0;i<20;i++)
+    dat.a[i] = 3*exp(-0.05*(i-10)*(i-10))*dual(cos(M_PI*i*0.3), sin(M_PI*i*0.3));
+  mglGraph gr;
+  gr.SetRange('y', -M_PI, M_PI);  gr.Box();
+
+  gr.Plot(dat,"r","legend 'abs'");
+  dat.use_abs=false;
+  gr.Plot(dat,"b","legend 'arg'");
+  gr.Legend();
+  gr.WritePNG("complex.png");
+  return 0;
+}
+
+ + +
+ +
+

+Next: , Previous: , Up: Other classes   [Contents][Index]

+
+ +

9.3 mglColor class

+ + + +

Structure for working with colors. This structure is defined in #include <mgl2/type.h>. +

+

There are two ways to set the color in MathGL. First one is using of mreal values of red, green and blue channels for precise color definition. The second way is the using of character id. There are a set of characters specifying frequently used colors. Normally capital letter gives more dark color than lowercase one. See Line styles. +

+
+
Parameter of mglColor: mreal r, g, b, a
+

Reg, green and blue component of color. +

+ +
+
Method on mglColor: mglColor (mreal R, mreal G, mreal B, mreal A=1)
+

Constructor sets the color by mreal values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1]. +

+
+
Method on mglColor: mglColor (char c='k', mreal bright=1)
+

Constructor sets the color from character id. The black color is used by default. Parameter br set additional “lightness” of color. +

+
+
Method on mglColor: void Set (mreal R, mreal G, mreal B, mreal A=1)
+

Sets color from values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1]. +

+
+
Method on mglColor: void Set (mglColor c, mreal bright=1)
+

Sets color as “lighted” version of color c. +

+
+
Method on mglColor: void Set (char p, mreal bright=1)
+

Sets color from symbolic id. +

+
+
Method on mglColor: bool Valid ()
+

Checks correctness of the color. +

+
+
Method on mglColor: mreal Norm ()
+

Gets maximal of spectral component. +

+
+
Method on mglColor: bool operator== (const mglColor &c)
+
Method on mglColor: bool operator!= (const mglColor &c)
+

Compare with another color +

+ +
+
Method on mglColor: bool operator*= (mreal v)
+

Multiplies color components by number v. +

+ +
+
Method on mglColor: bool operator+= (const mglColor &c)
+

Adds color c component by component. +

+ +
+
Method on mglColor: bool operator-= (const mglColor &c)
+

Subtracts color c component by component. +

+ + +
+
Library Function: mglColor operator+ (const mglColor &a, const mglColor &b)
+

Adds colors by its RGB values. +

+
+
Library Function: mglColor operator- (const mglColor &a, const mglColor &b)
+

Subtracts colors by its RGB values. +

+
+
Library Function: mglColor operator* (const mglColor &a, mreal b)
+
Library Function: mglColor operator* (mreal a, const mglColor &b)
+

Multiplies color by number. +

+
+
Library Function: mglColor operator/ (const mglColor &a, mreal b)
+

Divide color by number. +

+
+
Library Function: mglColor operator! (const mglColor &a)
+

Return inverted color. +

+ + +
+ +
+

+Previous: , Up: Other classes   [Contents][Index]

+
+ +

9.4 mglPoint class

+ + + +

Structure describes point in space. This structure is defined in #include <mgl2/type.h> +

+
+
Parameter of mglPoint: mreal x, y, z, c
+

Point coordinates {x,y,z} and one extra value c used for amplitude, transparency and so on. By default all values are zero. +

+ +
+
Method on mglPoint: mglPoint (mreal X=0, mreal Y=0, mreal Z=0, mreal C=0)
+

Constructor sets the color by mreal values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1]. +

+ +
+
Method on mglPoint: bool IsNAN ()
+

Returns true if point contain NAN values. +

+
+
Method on mglPoint: mreal norm ()
+

Returns the norm \sqrt{x^2+y^2+z^2} of vector. +

+
+
Method on mglPoint: void Normalize ()
+

Normalizes vector to be unit vector. +

+
+
Method on mglPoint: mreal val (int i)
+

Returns point component: x for i=0, y for i=1, z for i=2, c for i=3. +

+ + +
+
Library Function: mglPoint operator+ (const mglPoint &a, const mglPoint &b)
+

Point of summation (summation of vectors). +

+
+
Library Function: mglPoint operator- (const mglPoint &a, const mglPoint &b)
+

Point of difference (difference of vectors). +

+
+
Library Function: mglPoint operator* (mreal a, const mglPoint &b)
+
Library Function: mglPoint operator* (const mglPoint &a, mreal b)
+

Multiplies (scale) points by number. +

+
+
Library Function: mglPoint operator/ (const mglPoint &a, mreal b)
+

Multiplies (scale) points by number 1/b. +

+
+
Library Function: mreal operator* (const mglPoint &a, const mglPoint &b)
+

Scalar product of vectors. +

+ +
+
Library Function: mglPoint operator/ (const mglPoint &a, const mglPoint &b)
+

Return vector of element-by-element product. +

+ +
+
Library Function: mglPoint operator^ (const mglPoint &a, const mglPoint &b)
+

Cross-product of vectors. +

+
+
Library Function: mglPoint operator& (const mglPoint &a, const mglPoint &b)
+

The part of a which is perpendicular to vector b. +

+
+
Library Function: mglPoint operator| (const mglPoint &a, const mglPoint &b)
+

The part of a which is parallel to vector b. +

+ +
+
Library Function: mglPoint operator! (const mglPoint &a)
+

Return vector perpendicular to vector a. +

+
+
Library Function: mreal mgl_norm (const mglPoint &a)
+

Return the norm sqrt(|a|^2) of vector a. +

+ +
+
Library Function: bool operator== (const mglPoint &a, const mglPoint &b)
+

Return true if points are the same. +

+
+
Library Function: bool operator!= (const mglPoint &a, const mglPoint &b)
+

Return true if points are different. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

10 All samples

+ + +

This chapter contain alphabetical list of MGL and C++ samples for most of MathGL graphics and features. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: All samples   [Contents][Index]

+
+ +

10.1 Functions for initialization

+ + +

This section contain functions for input data for most of further samples. +

+

MGL code: +

+func 'prepare1d'
+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
+new x1 50 'x'
+new x2 50 '0.05-0.03*cos(pi*x)'
+new y1 50 '0.5-0.3*cos(pi*x)'
+new y2 50 '-0.3*sin(pi*x)'
+return
+
+func 'prepare2d'
+new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3d'
+new c 61 50 40 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 61 50 40 '1-2*tanh((x+y)*(x+y))'
+return
+
+func 'prepare2v'
+new a 20 30 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 20 30 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3v'
+define $1 pow(x*x+y*y+(z-0.3)*(z-0.3)+0.03,1.5)
+define $2 pow(x*x+y*y+(z+0.3)*(z+0.3)+0.03,1.5)
+new ex 10 10 10 '0.2*x/$1-0.2*x/$2'
+new ey 10 10 10 '0.2*y/$1-0.2*y/$2'
+new ez 10 10 10 '0.2*(z-0.3)/$1-0.2*(z+0.3)/$2'
+return
+
+

C++ code: +

void mgls_prepare1d(mglData *y, mglData *y1, mglData *y2, mglData *x1, mglData *x2)
+{
+	long n=50;
+	if(y)	y->Create(n,3);
+	if(x1)	x1->Create(n);
+	if(x2)	x2->Create(n);
+	if(y1)	y1->Create(n);
+	if(y2)	y2->Create(n);
+	for(long i=0;i<n;i++)
+	{
+		double xx = i/(n-1.);
+		if(y)
+		{
+			y->a[i] = 0.7*sin(2*M_PI*xx) + 0.5*cos(3*M_PI*xx) + 0.2*sin(M_PI*xx);
+			y->a[i+n] = sin(2*M_PI*xx);
+			y->a[i+2*n] = cos(2*M_PI*xx);
+		}
+		if(y1)	y1->a[i] = 0.5+0.3*cos(2*M_PI*xx);
+		if(y2)	y2->a[i] = 0.3*sin(2*M_PI*xx);
+		if(x1)	x1->a[i] = xx*2-1;
+		if(x2)	x2->a[i] = 0.05+0.03*cos(2*M_PI*xx);
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare2d(mglData *a, mglData *b, mglData *v)
+{
+	long n=50,m=40;
+	if(a)	a->Create(n,m);
+	if(b)	b->Create(n,m);
+	if(v)	{	v->Create(9);	v->Fill(-1,1);	}
+	for(long j=0;j<m;j++)	for(long i=0;i<n;i++)
+	{
+		double x = i/(n-1.), y = j/(m-1.);
+		long i0 = i+n*j;
+		if(a)	a->a[i0] = 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+		if(b)	b->a[i0] = 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare3d(mglData *a, mglData *b)
+{
+	long n=61,m=50,l=40;
+	if(a)	a->Create(n,m,l);
+	if(b)	b->Create(n,m,l);
+	for(long k=0;k<l;k++)	for(long j=0;j<m;j++)	for(long i=0;i<n;i++)
+	{
+		double x=2*i/(n-1.)-1, y=2*j/(m-1.)-1, z=2*k/(l-1.)-1;
+		long i0 = i+n*(j+m*k);
+		if(a)	a->a[i0] = -2*(x*x + y*y + z*z*z*z - z*z - 0.1);
+		if(b)	b->a[i0] = 1-2*tanh((x+y)*(x+y));
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare2v(mglData *a, mglData *b)
+{
+	long n=20,m=30;
+	if(a)	a->Create(n,m);
+	if(b)	b->Create(n,m);
+	for(long j=0;j<m;j++)	for(long i=0;i<n;i++)
+	{
+		double x=i/(n-1.), y=j/(m-1.);
+		long i0 = i+n*j;
+		if(a)	a->a[i0] = 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+		if(b)	b->a[i0] = 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
+	}
+}
+//-----------------------------------------------------------------------------
+void mgls_prepare3v(mglData *ex, mglData *ey, mglData *ez)
+{
+	long n=10;
+	double z0=0.3;
+	if(!ex || !ey || !ez)	return;
+	ex->Create(n,n,n);	ey->Create(n,n,n);	ez->Create(n,n,n);
+	for(long k=0;k<n;k++)	for(long j=0;j<n;j++)	for(long i=0;i<n;i++)
+	{
+		double x=2*i/(n-1.)-1, y=2*j/(n-1.)-1, z=2*k/(n-1.)-1;
+		long i0 = i+n*(j+k*n);
+		double r1 = pow(x*x+y*y+(z-z0)*(z-z0)+0.03,1.5);
+		double r2 = pow(x*x+y*y+(z+z0)*(z+z0)+0.03,1.5);
+		ex->a[i0]=0.2*x/r1 - 0.2*x/r2;
+		ey->a[i0]=0.2*y/r1 - 0.2*y/r2;
+		ez->a[i0]=0.2*(z-z0)/r1 - 0.2*(z+z0)/r2;
+	}
+}
+//-----------------------------------------------------------------------------
+
+
+ +
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.2 Sample ‘3wave

+ + +

Example of complex ode on basis of 3-wave decay. +

+

MGL code: +

define t 50
+ode !r '-b*f;a*conj(f);a*conj(b)-0.1*f' 'abf' [1,1e-3,0] 0.1 t
+ranges 0 t 0 r.max
+plot r(0) 'b';legend 'a'
+plot r(1) 'g';legend 'b'
+plot r(2) 'r';legend 'f'
+axis:box:legend
+
+

C++ code: +

void smgl_3wave(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Complex ODE sample");
+	double t=50;
+	mglData ini;	ini.SetList(3, 1., 1e-3, 0.);
+	mglDataC r(mglODEc("-b*f;a*conj(f);a*conj(b)-0.1*f","abf",ini,0.1,t));
+	gr->SetRanges(0, t, 0, r.Maximal());
+	gr->Plot(r.SubData(0),"b","legend 'a'");
+	gr->Plot(r.SubData(1),"g","legend 'b'");
+	gr->Plot(r.SubData(2),"r","legend 'f'");
+	gr->Axis();	gr->Box();	gr->Legend();
+}
+
Sample 3wave +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.3 Sample ‘alpha

+ + +

Example of light and alpha (transparency). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'default':rotate 50 60:box
+surf a
+subplot 2 2 1:title 'light on':rotate 50 60:box
+light on:surf a
+subplot 2 2 3:title 'light on; alpha on':rotate 50 60:box
+alpha on:surf a
+subplot 2 2 2:title 'alpha on':rotate 50 60:box
+light off:surf a
+
+

C++ code: +

void smgl_alpha(mglGraph *gr)	// alpha and lighting
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->SubPlot(2,2,0);	gr->Title("default");	gr->Rotate(50,60);
+	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,1);	gr->Title("light on");	gr->Rotate(50,60);
+	gr->Box();	gr->Light(true);	gr->Surf(a);
+	gr->SubPlot(2,2,3);	gr->Title("alpha on; light on");	gr->Rotate(50,60);
+	gr->Box();	gr->Alpha(true);	gr->Surf(a);
+	gr->SubPlot(2,2,2);	gr->Title("alpha on");	gr->Rotate(50,60);
+	gr->Box();	gr->Light(false);	gr->Surf(a);
+}
+
Sample alpha +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.4 Sample ‘apde

+ + +

Comparison of advanced PDE solver (apde) and ordinary one (pde). +

+

MGL code: +

ranges -1 1 0 2 0 2
+new ar 256 'exp(-2*(x+0.0)^2)'
+new ai 256
+
+apde res1 'exp(-x^2-p^2)' ar ai 0.01:transpose res1
+pde res2 'exp(-x^2-p^2)' ar ai 0.01
+
+subplot 1 2 0 '_':title 'Advanced PDE solver'
+ranges 0 2 -1 1:crange res1
+dens res1:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u = exp(-\i x^2+\partial_x^2)[\i u]' 'y'
+
+subplot 1 2 1 '_':title 'Simplified PDE solver'
+dens res2:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u \approx\ exp(-\i x^2)\i u+exp(\partial_x^2)[\i u]' 'y'
+
+

C++ code: +

void smgl_apde(mglGraph *gr)
+{
+	gr->SetRanges(-1,1,0,2,0,2);
+	mglData ar(256), ai(256);	gr->Fill(ar,"exp(-2*(x+0.0)^2)");
+
+	mglData res1(gr->APDE("exp(-x^2-p^2)",ar,ai,0.01));	res1.Transpose();
+	mglData res2(gr->PDE("exp(-x^2-p^2)",ar,ai,0.01));
+
+	gr->SubPlot(1,2,0,"_");	gr->Title("Advanced PDE solver");
+	gr->SetRanges(0,2,-1,1);	gr->SetRange('c',res1);
+	gr->Dens(res1);	gr->Axis();	gr->Box();
+	gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+	gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u = exp(-\\i x^2+\\partial_x^2)[\\i u]","y");
+
+	gr->SubPlot(1,2,1,"_");	gr->Title("Simplified PDE solver");
+	gr->Dens(res2);	gr->Axis();	gr->Box();
+	gr->Label('x',"\\i z");	gr->Label('y',"\\i x");
+	gr->Puts(mglPoint(-0.5,0.2),"i\\partial_z\\i u \\approx\\ exp(-\\i x^2)\\i u+exp(\\partial_x^2)[\\i u]","y");
+}
+
Sample apde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.5 Sample ‘area

+ + +

Function area fill the area between curve and axis plane. It support gradient filling if 2 colors per curve is specified. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0
+subplot 2 2 0 '':title 'Area plot (default)':box:area y
+subplot 2 2 1 '':title '2 colors':box:area y 'cbgGyr'
+subplot 2 2 2 '':title '"!" style':box:area y '!'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 3:title '3d variant':rotate 50 60:box
+area xc yc z 'r'
+area xc -yc z 'b#'
+
+

C++ code: +

void smgl_area(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Area plot (default)");	}
+	gr->Box();	gr->Area(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Area(y,"cbgGyr");
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style");	gr->Box();	gr->Area(y,"!");
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Area(xc,yc,z,"r");
+	yc.Modify("-sin(pi*(2*x-1))");	gr->Area(xc,yc,z,"b#");
+}
+
Sample area +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.6 Sample ‘aspect

+ + +

Example of subplot, inplot, rotate, aspect, shear. +

+

MGL code: +

subplot 2 2 0:box:text -1 1.1 'Just box' ':L'
+inplot 0.2 0.5 0.7 1 off:box:text 0 1.2 'InPlot example'
+subplot 2 2 1:title 'Rotate only':rotate 50 60:box
+subplot 2 2 2:title 'Rotate and Aspect':rotate 50 60:aspect 1 1 2:box
+subplot 2 2 3:title 'Shear':box 'c':shear 0.2 0.1:box
+
+

C++ code: +

void smgl_aspect(mglGraph *gr)	// transformation
+{
+	gr->SubPlot(2,2,0);	gr->Box();
+	gr->Puts(mglPoint(-1,1.1),"Just box",":L");
+	gr->InPlot(0.2,0.5,0.7,1,false);	gr->Box();
+	gr->Puts(mglPoint(0,1.2),"InPlot example");
+	gr->SubPlot(2,2,1);	gr->Title("Rotate only");
+	gr->Rotate(50,60);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Title("Rotate and Aspect");
+	gr->Rotate(50,60);	gr->Aspect(1,1,2);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Title("Shear");
+	gr->Box("c");		gr->Shear(0.2,0.1);	gr->Box();
+}
+
Sample aspect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.7 Sample ‘axial

+ + +

Function axial draw surfaces of rotation for contour lines. You can draw wire surfaces (‘#’ style) or ones rotated in other directions (‘x’, ‘z’ styles). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Axial plot (default)':light on:alpha on:rotate 50 60:box:axial a
+subplot 2 2 1:title '"x" style;"." style':light on:rotate 50 60:box:axial a 'x.'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:axial a 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:axial a '#'
+
+

C++ code: +

void smgl_axial(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Axial plot (default)");	}
+	gr->Light(true);	gr->Alpha(true);	gr->Rotate(50,60);	gr->Box();	gr->Axial(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'x' style; '.'style");	gr->Rotate(50,60);	gr->Box();	gr->Axial(a,"x.");
+	gr->SubPlot(2,2,2);	gr->Title("'z' style");	gr->Rotate(50,60);	gr->Box();	gr->Axial(a,"z");
+	gr->SubPlot(2,2,3);	gr->Title("'\\#' style");	gr->Rotate(50,60);	gr->Box();	gr->Axial(a,"#");
+}
+
Sample axial +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.8 Sample ‘axis

+ + +

Different forms of axis position. +

+

MGL code: +

subplot 2 2 0:title 'Axis origin, Grid':origin 0 0:axis:grid:fplot 'x^3'
+subplot 2 2 1:title '2 axis':ranges -1 1 -1 1:origin -1 -1:axis:ylabel 'axis_1':fplot 'sin(pi*x)' 'r2'
+ranges 0 1 0 1:origin 1 1:axis:ylabel 'axis_2':fplot 'cos(pi*x)'
+subplot 2 2 3:title 'More axis':origin nan nan:xrange -1 1:axis:xlabel 'x' 0:ylabel 'y_1' 0:fplot 'x^2' 'k'
+yrange -1 1:origin -1.3 -1:axis 'y' 'r':ylabel '#r{y_2}' 0.2:fplot 'x^3' 'r'
+
+subplot 2 2 2:title '4 segments, inverted axis':origin 0 0:
+inplot 0.5 1 0.5 1 on:ranges 0 10 0 2:axis
+fplot 'sqrt(x/2)':xlabel 'W' 1:ylabel 'U' 1
+inplot 0 0.5 0.5 1 on:ranges 1 0 0 2:axis 'x':fplot 'sqrt(x)+x^3':xlabel '\tau' 1
+inplot 0.5 1 0 0.5 on:ranges 0 10 4 0:axis 'y':fplot 'x/4':ylabel 'L' -1
+inplot 0 0.5 0 0.5 on:ranges 1 0 4 0:fplot '4*x^2'
+
+

C++ code: +

void smgl_axis(mglGraph *gr)
+{
+	gr->SubPlot(2,2,0);	gr->Title("Axis origin, Grid");	gr->SetOrigin(0,0);
+	gr->Axis();	gr->Grid();	gr->FPlot("x^3");
+
+	gr->SubPlot(2,2,1);	gr->Title("2 axis");
+	gr->SetRanges(-1,1,-1,1);	gr->SetOrigin(-1,-1,-1);	// first axis
+	gr->Axis();	gr->Label('y',"axis 1",0);	gr->FPlot("sin(pi*x)","r2");
+	gr->SetRanges(0,1,0,1);		gr->SetOrigin(1,1,1);		// second axis
+	gr->Axis();	gr->Label('y',"axis 2",0);	gr->FPlot("cos(pi*x)");
+
+	gr->SubPlot(2,2,3);	gr->Title("More axis");	gr->SetOrigin(NAN,NAN);	gr->SetRange('x',-1,1);
+	gr->Axis();	gr->Label('x',"x",0);	gr->Label('y',"y_1",0);	gr->FPlot("x^2","k");
+	gr->SetRanges(-1,1,-1,1);	gr->SetOrigin(-1.3,-1);	// second axis
+	gr->Axis("y","r");	gr->Label('y',"#r{y_2}",0.2);	gr->FPlot("x^3","r");
+
+	gr->SubPlot(2,2,2);	gr->Title("4 segments, inverted axis");		gr->SetOrigin(0,0);
+	gr->InPlot(0.5,1,0.5,1);	gr->SetRanges(0,10,0,2);	gr->Axis();
+	gr->FPlot("sqrt(x/2)");		gr->Label('x',"W",1);	gr->Label('y',"U",1);
+	gr->InPlot(0,0.5,0.5,1);	gr->SetRanges(1,0,0,2);	gr->Axis("x");
+	gr->FPlot("sqrt(x)+x^3");	gr->Label('x',"\\tau",-1);
+	gr->InPlot(0.5,1,0,0.5);	gr->SetRanges(0,10,4,0);	gr->Axis("y");
+	gr->FPlot("x/4");	gr->Label('y',"L",-1);
+	gr->InPlot(0,0.5,0,0.5);	gr->SetRanges(1,0,4,0);	gr->FPlot("4*x^2");
+}
+
Sample axis +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.9 Sample ‘barh

+ + +

Function barh is the similar to bars but draw horizontal bars. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 2 2 0 '':title 'Barh plot (default)':box:barh ys
+subplot 2 2 1 '':title '2 colors':box:barh ys 'cbgGyr'
+ranges -3 3 -1 1:subplot 2 2 2 '':title '"a" style':box:barh ys 'a'
+subplot 2 2 3 '': title '"f" style':box:barh ys 'f'
+
+

C++ code: +

void smgl_barh(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Barh plot (default)");	}
+	gr->Box();	gr->Barh(ys);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Barh(ys,"cbgGyr");
+	gr->SetRanges(-3,3,-1,1);	// increase range since summation can exceed [-1,1]
+	gr->SubPlot(2,2,2,"");	gr->Title("'a' style");	gr->Box();	gr->Barh(ys,"a");
+	gr->SubPlot(2,2,3,"");	gr->Title("'f' style");	gr->Box();	gr->Barh(ys,"f");
+}
+
Sample barh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.10 Sample ‘bars

+ + +

Function bars draw vertical bars. It have a lot of options: bar-above-bar (‘a’ style), fall like (‘f’ style), 2 colors for positive and negative values, wired bars (‘#’ style), 3D variant. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 3 2 0 '':title 'Bars plot (default)':box:bars ys
+subplot 3 2 1 '':title '2 colors':box:bars ys 'cbgGyr'
+subplot 3 2 4 '':title '"\#" style':box:bars ys '#'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:bars xc yc z 'r'
+ranges -1 1 -3 3:subplot 3 2 2 '':title '"a" style':box:bars ys 'a'
+subplot 3 2 3 '':title '"f" style':box:bars ys 'f'
+
+

C++ code: +

void smgl_bars(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(3,2,0,"");	gr->Title("Bars plot (default)");	}
+	gr->Box();	gr->Bars(ys);
+	if(big==3)	return;
+	gr->SubPlot(3,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Bars(ys,"cbgGyr");
+	gr->SubPlot(3,2,4,"");	gr->Title("'\\#' style");	gr->Box();	gr->Bars(ys,"#");
+	gr->SubPlot(3,2,5);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Bars(xc,yc,z,"r");
+	gr->SetRanges(-1,1,-3,3);	// increase range since summation can exceed [-1,1]
+	gr->SubPlot(3,2,2,"");	gr->Title("'a' style");	gr->Box();	gr->Bars(ys,"a");
+	gr->SubPlot(3,2,3,"");	gr->Title("'f' style");	gr->Box();	gr->Bars(ys,"f");
+}
+
Sample bars +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.11 Sample ‘belt

+ + +

Function belt draw surface by belts. You can use ‘x’ style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Belt plot':rotate 50 60:box:belt a
+
+

C++ code: +

void smgl_belt(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Belt plot");
+	gr->Rotate(50,60);	gr->Box();	gr->Belt(a);
+}
+
Sample belt +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.12 Sample ‘bifurcation

+ + +

Function bifurcation draw Bifurcation diagram for multiple stationary points of the map (like logistic map). +

+

MGL code: +

subplot 1 1 0 '<_':title 'Bifurcation sample'
+ranges 0 4 0 1:axis
+bifurcation 0.005 'x*y*(1-y)' 'r'
+
+

C++ code: +

void smgl_bifurcation(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Bifurcation sample");
+	gr->SetRanges(0,4,0,1);	gr->Axis();
+	gr->Bifurcation(0.005,"x*y*(1-y)","r");
+}
+
Sample bifurcation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.13 Sample ‘box

+ + +

Different styles of bounding box. +

+

MGL code: +

subplot 2 2 0:title 'Box (default)':rotate 50 60:box
+subplot 2 2 1:title 'colored':rotate 50 60:box 'r'
+subplot 2 2 2:title 'with faces':rotate 50 60:box '@'
+subplot 2 2 3:title 'both':rotate 50 60:box '@cm'
+
+

C++ code: +

void smgl_boxplot(mglGraph *gr)	// flow threads and density plot
+{
+	mglData a(10,7);	a.Modify("(2*rnd-1)^3/2");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Boxplot plot");	}
+	gr->Box();	gr->BoxPlot(a);
+}
+
Sample box +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.14 Sample ‘boxplot

+ + +

Function boxplot draw box-and-whisker diagram. +

+

MGL code: +

new a 10 7 '(2*rnd-1)^3/2'
+subplot 1 1 0 '':title 'Boxplot plot':box:boxplot a
+
+

C++ code: +

void smgl_boxplot(mglGraph *gr)	// flow threads and density plot
+{
+	mglData a(10,7);	a.Modify("(2*rnd-1)^3/2");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Boxplot plot");	}
+	gr->Box();	gr->BoxPlot(a);
+}
+
Sample boxplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.15 Sample ‘boxs

+ + +

Function boxs draw surface by boxes. You can use ‘#’ for drawing wire plot. +

+

MGL code: +

call 'prepare2d'
+origin 0 0 0
+subplot 2 2 0:title 'Boxs plot (default)':rotate 40 60:light on:box:boxs a
+subplot 2 2 1:title '"\@" style':rotate 50 60:box:boxs a '@'
+subplot 2 2 2:title '"\#" style':rotate 50 60:box:boxs a '#'
+subplot 2 2 3:title 'compare with Tile':rotate 50 60:box:tile a
+
+

C++ code: +

void smgl_boxs(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetOrigin(0,0,0);	gr->Light(true);
+	if(big!=3)	{gr->SubPlot(2,2,0);	gr->Title("Boxs plot (default)");}
+	gr->Rotate(40,60);	gr->Box();	gr->Boxs(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\@' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Boxs(a,"@");
+	gr->SubPlot(2,2,2);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Boxs(a,"#");
+	gr->SubPlot(2,2,3);	gr->Title("compare with Tile");
+	gr->Rotate(50,60);	gr->Box();	gr->Tile(a);
+}
+
Sample boxs +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.16 Sample ‘candle

+ + +

Function candle draw candlestick chart. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. +

+

MGL code: +

new y 30 'sin(pi*x/2)^2'
+subplot 1 1 0 '':title 'Candle plot (default)'
+yrange 0 1:box
+candle y y/2 (y+1)/2
+
+

C++ code: +

void smgl_candle(mglGraph *gr)
+{
+	mglData y(30);	gr->Fill(y,"sin(pi*x/2)^2");
+	mglData y1(30);	gr->Fill(y1,"v/2",y);
+	mglData y2(30);	gr->Fill(y2,"(1+v)/2",y);
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Candle plot (default)");	}
+	gr->SetRange('y',0,1);	gr->Box();	gr->Candle(y,y1,y2);
+}
+
Sample candle +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.17 Sample ‘chart

+ + +

Function chart draw colored boxes with width proportional to data values. Use ‘ ’ for empty box. It produce well known pie chart if drawn in polar coordinates. +

+

MGL code: +

new ch 7 2 'rnd+0.1':light on
+subplot 2 2 0:title 'Chart plot (default)':rotate 50 60:box:chart ch
+subplot 2 2 1:title '"\#" style':rotate 50 60:box:chart ch '#'
+subplot 2 2 2:title 'Pie chart; " " color':rotate 50 60:
+axis '(y+1)/2*cos(pi*x)' '(y+1)/2*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+subplot 2 2 3:title 'Ring chart; " " color':rotate 50 60:
+axis '(y+2)/3*cos(pi*x)' '(y+2)/3*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+
+

C++ code: +

void smgl_chart(mglGraph *gr)
+{
+	mglData ch(7,2);	for(int i=0;i<7*2;i++)	ch.a[i]=mgl_rnd()+0.1;
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Chart plot (default)");	}
+	gr->Light(true);	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch,"#");
+	gr->SubPlot(2,2,2);	gr->Title("Pie chart; ' ' color");
+	gr->SetFunc("(y+1)/2*cos(pi*x)","(y+1)/2*sin(pi*x)","");
+	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch,"bgr cmy#");
+	gr->SubPlot(2,2,3);	gr->Title("Ring chart; ' ' color");
+	gr->SetFunc("(y+2)/3*cos(pi*x)","(y+2)/3*sin(pi*x)","");
+	gr->Rotate(50,60);	gr->Box();	gr->Chart(ch,"bgr cmy#");
+}
+
Sample chart +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.18 Sample ‘cloud

+ + +

Function cloud draw cloud-like object which is less transparent for higher data values. Similar plot can be created using many (about 10...20 – surf3a a a;value 10) isosurfaces surf3a. +

+

MGL code: +

call 'prepare3d'
+subplot 2 2 0:title 'Cloud plot':rotate 50 60:alpha on:box:cloud c 'wyrRk'
+subplot 2 2 1:title '"i" style':rotate 50 60:box:cloud c 'iwyrRk'
+subplot 2 2 2:title '"." style':rotate 50 60:box:cloud c '.wyrRk'
+subplot 2 2 3:title 'meshnum 10':rotate 50 60:box:cloud c 'wyrRk'; meshnum 10
+
+

C++ code: +

void smgl_cloud(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Cloud plot");	}
+	gr->Rotate(50,60);	gr->Alpha(true);
+	gr->Box();	gr->Cloud(c,"wyrRk");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'i' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cloud(c,"iwyrRk");
+	gr->SubPlot(2,2,2);	gr->Title("'.' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cloud(c,".wyrRk");
+	gr->SubPlot(2,2,3);	gr->Title("meshnum 10");
+	gr->Rotate(50,60);	gr->Box();	gr->Cloud(c,"wyrRk","meshnum 10");
+}
+
Sample cloud +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.19 Sample ‘colorbar

+ + +

Example of colorbar position and styles. +

+

MGL code: +

call 'prepare2d'
+new v 9 'x'
+subplot 2 2 0:title 'Colorbar out of box':box
+colorbar '<':colorbar '>':colorbar '_':colorbar '^'
+subplot 2 2 1:title 'Colorbar near box':box
+colorbar '<I':colorbar '>I':colorbar '_I':colorbar '^I'
+subplot 2 2 2:title 'manual colors':box:contd v a
+colorbar v '<':colorbar v '>':colorbar v '_':colorbar v '^'
+subplot 2 2 3:title '':text -0.5 1.55 'Color positions' ':C' -2
+colorbar 'bwr>' 0.25 0:text -0.9 1.2 'Default'
+colorbar 'b{w,0.3}r>' 0.5 0:text -0.1 1.2 'Manual'
+crange 0.01 1e3
+colorbar '>' 0.75 0:text 0.65 1.2 'Normal scale':colorbar '>':text 1.35 1.2 'Log scale'
+
+

C++ code: +

void smgl_colorbar(mglGraph *gr)
+{
+	gr->SubPlot(2,2,0);	gr->Title("Colorbar out of box");	gr->Box();
+	gr->Colorbar("<");	gr->Colorbar(">");	gr->Colorbar("_");	gr->Colorbar("^");
+	gr->SubPlot(2,2,1);	gr->Title("Colorbar near box");		gr->Box();
+	gr->Colorbar("<I");	gr->Colorbar(">I");	gr->Colorbar("_I");	gr->Colorbar("^I");
+	gr->SubPlot(2,2,2);	gr->Title("manual colors");
+	mglData a,v;	mgls_prepare2d(&a,0,&v);
+	gr->Box();	gr->ContD(v,a);
+	gr->Colorbar(v,"<");	gr->Colorbar(v,">");	gr->Colorbar(v,"_");	gr->Colorbar(v,"^");
+
+	gr->SubPlot(2,2,3);	gr->Title(" ");
+	gr->Puts(mglPoint(-0.5,1.55),"Color positions",":C",-2);
+	gr->Colorbar("bwr>",0.25,0);	gr->Puts(mglPoint(-0.9,1.2),"Default");
+	gr->Colorbar("b{w,0.3}r>",0.5,0);	gr->Puts(mglPoint(-0.1,1.2),"Manual");
+
+	gr->Puts(mglPoint(1,1.55),"log-scale",":C",-2);
+	gr->SetRange('c',0.01,1e3);
+	gr->Colorbar(">",0.75,0);	gr->Puts(mglPoint(0.65,1.2),"Normal scale");
+	gr->SetFunc("","","","lg(c)");
+	gr->Colorbar(">");		gr->Puts(mglPoint(1.35,1.2),"Log scale");
+}
+
Sample colorbar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.20 Sample ‘combined

+ + +

Example of several plots in the same axis. +

+

MGL code: +

call 'prepare2v'
+call 'prepare3d'
+new v 10:fill v -0.5 1:copy d sqrt(a^2+b^2)
+subplot 2 2 0:title 'Surf + Cont':rotate 50 60:light on:box:surf a:cont a 'y'
+subplot 2 2 1 '':title 'Flow + Dens':light off:box:flow a b 'br':dens d
+subplot 2 2 2:title 'Mesh + Cont':rotate 50 60:box:mesh a:cont a '_'
+subplot 2 2 3:title 'Surf3 + ContF3':rotate 50 60:light on
+box:contf3 v c 'z' 0:contf3 v c 'x':contf3 v c
+cut 0 -1 -1 1 0 1.1
+contf3 v c 'z' c.nz-1:surf3 c -0.5
+
+

C++ code: +

void smgl_combined(mglGraph *gr)	// flow threads and density plot
+{
+	mglData a,b,d;	mgls_prepare2v(&a,&b);	d = a;
+	for(int i=0;i<a.nx*a.ny;i++)	d.a[i] = hypot(a.a[i],b.a[i]);
+	mglData c;	mgls_prepare3d(&c);
+	mglData v(10);	v.Fill(-0.5,1);
+	gr->SubPlot(2,2,1,"");	gr->Title("Flow + Dens");
+	gr->Flow(a,b,"br");	gr->Dens(d);	gr->Box();
+	gr->SubPlot(2,2,0);	gr->Title("Surf + Cont");	gr->Rotate(50,60);
+	gr->Light(true);	gr->Surf(a);	gr->Cont(a,"y");	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Title("Mesh + Cont");	gr->Rotate(50,60);
+	gr->Box();	gr->Mesh(a);	gr->Cont(a,"_");
+	gr->SubPlot(2,2,3);	gr->Title("Surf3 + ContF3");gr->Rotate(50,60);
+	gr->Box();	gr->ContF3(v,c,"z",0);	gr->ContF3(v,c,"x");	gr->ContF3(v,c);
+	gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+	gr->ContF3(v,c,"z",c.nz-1);	gr->Surf3(-0.5,c);
+}
+
Sample combined +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.21 Sample ‘cones

+ + +

Function cones is similar to bars but draw cones. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+light on:origin 0 0 0
+subplot 3 2 0:title 'Cones plot':rotate 50 60:box:cones ys
+subplot 3 2 1:title '2 colors':rotate 50 60:box:cones ys 'cbgGyr'
+subplot 3 2 2:title '"\#" style':rotate 50 60:box:cones ys '#'
+subplot 3 2 3:title '"a" style':rotate 50 60:zrange -2 2:box:cones ys 'a'
+subplot 3 2 4:title '"t" style':rotate 50 60:box:cones ys 't'
+subplot 3 2 5:title '"4" style':rotate 50 60:box:cones ys '4'
+
+

C++ code: +

void smgl_cones(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	gr->Light(true);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(3,2,0);	gr->Title("Cones plot");	}
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys);
+	if(big==3)	return;
+	gr->SubPlot(3,2,1);	gr->Title("2 colors");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"cbgGyr");
+	gr->SubPlot(3,2,2);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"#");
+	gr->SubPlot(3,2,3);	gr->Title("'a' style");
+	gr->SetRange('z',-2,2);	// increase range since summation can exceed [-1,1]
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"a");
+	gr->SubPlot(3,2,4);	gr->Title("'t' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"t");
+	gr->SubPlot(3,2,5);	gr->Title("'4' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Cones(ys,"4");
+}
+
Sample cones +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.22 Sample ‘cont

+ + +

Function cont draw contour lines for surface. You can select automatic (default) or manual levels for contours, print contour labels, draw it on the surface (default) or at plane (as Dens). +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'Cont plot (default)':rotate 50 60:box:cont a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:cont v a
+subplot 2 2 2:title '"\_" and "." styles':rotate 50 60:box:cont a '_':cont a '_.2k'
+subplot 2 2 3 '':title '"t" style':box:cont a 't'
+
+

C++ code: +

void smgl_cont3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Cont3 sample");
+	gr->Rotate(50,60);	gr->Box();
+	gr->Cont3(c,"x");	gr->Cont3(c);	gr->Cont3(c,"z");
+}
+
Sample cont +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.23 Sample ‘cont3

+ + +

Function contf3 draw ordinary contour lines but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box
+cont3 c 'x':cont3 c:cont3 c 'z'
+
+

C++ code: +

void smgl_cont3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Cont3 sample");
+	gr->Rotate(50,60);	gr->Box();
+	gr->Cont3(c,"x");	gr->Cont3(c);	gr->Cont3(c,"z");
+}
+
Sample cont3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.24 Sample ‘cont_xyz

+ + +

Functions contz, conty, contx draw contour lines on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Cont[XYZ] sample':rotate 50 60:box
+contx {sum c 'x'} '' -1:conty {sum c 'y'} '' 1:contz {sum c 'z'} '' -1
+
+

C++ code: +

void smgl_cont_xyz(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Cont[XYZ] sample");
+	gr->Rotate(50,60);	gr->Box();	gr->ContX(c.Sum("x"),"",-1);
+	gr->ContY(c.Sum("y"),"",1);		gr->ContZ(c.Sum("z"),"",-1);
+}
+
Sample cont_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.25 Sample ‘contd

+ + +

Function contd is similar to contf but with manual contour colors. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContD plot (default)':rotate 50 60:box:contd a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contd v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contd a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contd a1
+
+

C++ code: +

void smgl_contd(mglGraph *gr)
+{
+	mglData a,v(5),a1(30,40,3);	mgls_prepare2d(&a);	v.a[0]=-0.5;
+	v.a[1]=-0.15;	v.a[2]=0;	v.a[3]=0.15;	v.a[4]=0.5;
+	gr->Fill(a1,"0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)");
+
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("ContD plot (default)");	}
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("manual levels");
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(v,a);
+	gr->SubPlot(2,2,2);	gr->Title("'\\_' style");
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(a,"_");
+	gr->SubPlot(2,2,3);	gr->Title("several slices");
+	gr->Rotate(50,60);	gr->Box();	gr->ContD(a1);
+}
+
Sample contd +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.26 Sample ‘contf

+ + +

Function contf draw filled contours. You can select automatic (default) or manual levels for contours. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContF plot (default)':rotate 50 60:box:contf a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contf v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contf a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contf a1
+
+

C++ code: +

void smgl_contf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("ContF3 sample");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Box();
+	gr->ContF3(c,"x");	gr->ContF3(c);		gr->ContF3(c,"z");
+	gr->Cont3(c,"kx");	gr->Cont3(c,"k");	gr->Cont3(c,"kz");
+}
+
Sample contf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.27 Sample ‘contf3

+ + +

Function contf3 draw ordinary filled contours but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box:light on
+contf3 c 'x':contf3 c:contf3 c 'z'
+cont3 c 'xk':cont3 c 'k':cont3 c 'zk'
+
+

C++ code: +

void smgl_contf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("ContF3 sample");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Box();
+	gr->ContF3(c,"x");	gr->ContF3(c);		gr->ContF3(c,"z");
+	gr->Cont3(c,"kx");	gr->Cont3(c,"k");	gr->Cont3(c,"kz");
+}
+
Sample contf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.28 Sample ‘contf_xyz

+ + +

Functions contfz, contfy, contfx, draw filled contours on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'ContF[XYZ] sample':rotate 50 60:box
+contfx {sum c 'x'} '' -1:contfy {sum c 'y'} '' 1:contfz {sum c 'z'} '' -1
+
+

C++ code: +

void smgl_contf_xyz(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("ContF[XYZ] sample");
+	gr->Rotate(50,60);	gr->Box();	gr->ContFX(c.Sum("x"),"",-1);
+	gr->ContFY(c.Sum("y"),"",1);	gr->ContFZ(c.Sum("z"),"",-1);
+}
+
Sample contf_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.29 Sample ‘contv

+ + +

Function contv draw vertical cylinders (belts) at contour lines. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'ContV plot (default)':rotate 50 60:box:contv a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contv v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contv a '_'
+subplot 2 2 3:title 'ContV and ContF':rotate 50 60:light on:box
+contv a:contf a:cont a 'k'
+
+

C++ code: +

void smgl_contv(mglGraph *gr)
+{
+	mglData a,v(5);	mgls_prepare2d(&a);	v.a[0]=-0.5;
+	v.a[1]=-0.15;	v.a[2]=0;	v.a[3]=0.15;	v.a[4]=0.5;
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("ContV plot (default)");	}
+	gr->Rotate(50,60);	gr->Box();	gr->ContV(a);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("manual levels");
+	gr->Rotate(50,60);	gr->Box();	gr->ContV(v,a);
+	gr->SubPlot(2,2,2);	gr->Title("'\\_' style");
+	gr->Rotate(50,60);	gr->Box();	gr->ContV(a,"_");
+	gr->SubPlot(2,2,3);	gr->Title("ContV and ContF");
+	gr->Rotate(50,60);	gr->Box();	gr->Light(true);
+	gr->ContV(a);	gr->ContF(a);	gr->Cont(a,"k");
+}
+
Sample contv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.30 Sample ‘correl

+ + +

Test of correlation function (correl). +

+

MGL code: +

new a 100 'exp(-10*x^2)'
+new b 100 'exp(-10*(x+0.5)^2)'
+yrange 0 1
+subplot 1 2 0 '_':title 'Input fields'
+plot a:plot b:box:axis
+correl r a b 'x'
+norm r 0 1:swap r 'x' # make it human readable
+subplot 1 2 1 '_':title 'Correlation of a and b'
+plot r 'r':axis:box
+line 0.5 0 0.5 1 'B|'
+
+

C++ code: +

void smgl_correl(mglGraph *gr)
+{
+	mglData a(100),b(100);
+	gr->Fill(a,"exp(-10*x^2)");	gr->Fill(b,"exp(-10*(x+0.5)^2)");
+	gr->SetRange('y',0,1);
+	gr->SubPlot(1,2,0,"_");	gr->Title("Input fields");
+	gr->Plot(a);	gr->Plot(b);	gr->Axis();	gr->Box();
+	mglData r = a.Correl(b,"x");
+	r.Norm(0,1);	r.Swap("x");	// make it human readable
+	gr->SubPlot(1,2,1,"_");	gr->Title("Correlation of a and b");
+	gr->Plot(r,"r");	gr->Axis();	gr->Box();
+	gr->Line(mglPoint(0.5,0),mglPoint(0.5,1),"B|");
+}
+
Sample correl +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.31 Sample ‘curvcoor

+ + +

Some common curvilinear coordinates. +

+

MGL code: +

origin -1 1 -1
+subplot 2 2 0:title 'Cartesian':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' '':subplot 2 2 1:title 'Cylindrical':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis '2*y*x' 'y*y - x*x' '':subplot 2 2 2:title 'Parabolic':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' 'x+z':subplot 2 2 3:title 'Spiral':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+

C++ code: +

void smgl_curvcoor(mglGraph *gr)	// curvilinear coordinates
+{
+	gr->SetOrigin(-1,1,-1);
+
+	gr->SubPlot(2,2,0);	gr->Title("Cartesian");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+
+	gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)",0);
+	gr->SubPlot(2,2,1);	gr->Title("Cylindrical");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+
+	gr->SetFunc("2*y*x","y*y - x*x",0);
+	gr->SubPlot(2,2,2);	gr->Title("Parabolic");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+
+	gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)","x+z");
+	gr->SubPlot(2,2,3);	gr->Title("Spiral");	gr->Rotate(50,60);
+	gr->FPlot("2*t-1","0.5","0","r2");
+	gr->Axis(); gr->Grid();
+	gr->SetFunc(0,0,0);	// set to default Cartesian
+}
+
Sample curvcoor +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.32 Sample ‘cut

+ + +

Example of point cutting (cut. +

+

MGL code: +

call 'prepare2d'
+call 'prepare3d'
+subplot 2 2 0:title 'Cut on (default)':rotate 50 60:light on:box:surf a; zrange -1 0.5
+subplot 2 2 1:title 'Cut off':rotate 50 60:box:surf a; zrange -1 0.5; cut off
+subplot 2 2 2:title 'Cut in box':rotate 50 60:box:alpha on
+cut 0 -1 -1 1 0 1.1:surf3 c
+cut 0 0 0 0 0 0	# restore back
+subplot 2 2 3:title 'Cut by formula':rotate 50 60:box
+cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)':surf3 c
+
+

C++ code: +

void smgl_cut(mglGraph *gr)	// cutting
+{
+	mglData a,c,v(1);	mgls_prepare2d(&a);	mgls_prepare3d(&c);	v.a[0]=0.5;
+	gr->SubPlot(2,2,0);	gr->Title("Cut on (default)");	gr->Rotate(50,60);	gr->Light(true);
+	gr->Box();	gr->Surf(a,"","zrange -1 0.5");
+	gr->SubPlot(2,2,1);	gr->Title("Cut off");		gr->Rotate(50,60);
+	gr->Box();	gr->Surf(a,"","zrange -1 0.5; cut off");
+	gr->SubPlot(2,2,2);	gr->Title("Cut in box");	gr->Rotate(50,60);
+	gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
+	gr->Alpha(true);	gr->Box();	gr->Surf3(c);
+	gr->SetCutBox(mglPoint(0), mglPoint(0));	// switch it off
+	gr->SubPlot(2,2,3);	gr->Title("Cut by formula");	gr->Rotate(50,60);
+	gr->CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)");
+	gr->Box();	gr->Surf3(c);	gr->CutOff("");	// switch it off
+}
+
Sample cut +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.33 Sample ‘dat_diff

+ + +

Example of diff and integrate. +

+

MGL code: +

ranges 0 1 0 1 0 1:new a 30 40 'x*y'
+subplot 2 2 0:title 'a(x,y)':rotate 60 40:surf a:box
+subplot 2 2 1:title 'da/dx':rotate 60 40:diff a 'x':surf a:box
+subplot 2 2 2:title '\int da/dx dxdy':rotate 60 40:integrate a 'xy':surf a:box
+subplot 2 2 3:title '\int {d^2}a/dxdy dx':rotate 60 40:diff2 a 'y':surf a:box
+
+

C++ code: +

void smgl_dat_diff(mglGraph *gr)	// differentiate
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData a(30,40);	a.Modify("x*y");
+	gr->SubPlot(2,2,0);	gr->Title("a(x,y)");	gr->Rotate(60,40);
+	gr->Surf(a);		gr->Box();
+	gr->SubPlot(2,2,1);	gr->Title("da/dx");		gr->Rotate(60,40);
+	a.Diff("x");		gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Title("\\int da/dx dxdy");	gr->Rotate(60,40);
+	a.Integral("xy");	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Title("\\int {d^2}a/dxdy dx");	gr->Rotate(60,40);
+	a.Diff2("y");	gr->Surf(a);	gr->Box();
+}
+
Sample dat_diff +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.34 Sample ‘dat_extra

+ + +

Example of envelop, sew, smooth and resize. +

+

MGL code: +

subplot 2 2 0 '':title 'Envelop sample':new d1 1000 'exp(-8*x^2)*sin(10*pi*x)'
+axis:plot d1 'b':envelop d1 'x':plot d1 'r'
+subplot 2 2 1 '':title 'Smooth sample':ranges 0 1 0 1
+new y0 30 '0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd'
+copy y1 y0:smooth y1 'x3':plot y1 'r';legend '"3" style'
+copy y2 y0:smooth y2 'x5':plot y2 'g';legend '"5" style'
+copy y3 y0:smooth y3 'x':plot y3 'b';legend 'default'
+plot y0 '{m7}:s';legend 'none'
+legend:box
+subplot 2 2 2:title 'Sew sample':rotate 50 60:light on:alpha on
+new d2 100 100 'mod((y^2-(1-x)^2)/2,0.1)'
+box:surf d2 'b':sew d2 'xy' 0.1:surf d2 'r'
+subplot 2 2 3:title 'Resize sample (interpolation)'
+new x0 10 'rnd':new v0 10 'rnd'
+resize x1 x0 100:resize v1 v0 100
+plot x0 v0 'b+ ':plot x1 v1 'r-':label x0 v0 '%n'
+
+

C++ code: +

void smgl_dat_extra(mglGraph *gr)	// differentiate
+{
+	gr->SubPlot(2,2,0,"");	gr->Title("Envelop sample");
+	mglData d1(1000);	gr->Fill(d1,"exp(-8*x^2)*sin(10*pi*x)");
+	gr->Axis();			gr->Plot(d1, "b");
+	d1.Envelop('x');	gr->Plot(d1, "r");
+
+	gr->SubPlot(2,2,1,"");	gr->Title("Smooth sample");
+	mglData y0(30),y1,y2,y3;
+	gr->SetRanges(0,1,0,1);
+	gr->Fill(y0, "0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd");
+
+	y1=y0;	y1.Smooth("x3");
+	y2=y0;	y2.Smooth("x5");
+	y3=y0;	y3.Smooth("x");
+
+	gr->Plot(y0,"{m7}:s", "legend 'none'");	//gr->AddLegend("none","k");
+	gr->Plot(y1,"r", "legend ''3' style'");
+	gr->Plot(y2,"g", "legend ''5' style'");
+	gr->Plot(y3,"b", "legend 'default'");
+	gr->Legend();		gr->Box();
+
+	gr->SubPlot(2,2,2);		gr->Title("Sew sample");
+	mglData d2(100, 100);	gr->Fill(d2, "mod((y^2-(1-x)^2)/2,0.1)");
+	gr->Rotate(50, 60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();			gr->Surf(d2, "b");
+	d2.Sew("xy", 0.1);	gr->Surf(d2, "r");
+
+	gr->SubPlot(2,2,3);		gr->Title("Resize sample (interpolation)");
+	mglData x0(10), v0(10), x1, v1;
+	gr->Fill(x0,"rnd");		gr->Fill(v0,"rnd");
+	x1 = x0.Resize(100);	v1 = v0.Resize(100);
+	gr->Plot(x0,v0,"b+ ");	gr->Plot(x1,v1,"r-");
+	gr->Label(x0,v0,"%n");
+}
+
Sample dat_extra +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.35 Sample ‘data1

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:diff b 'x':subplot 5 3 0:call 'splot'
+copy b a:diff2 b 'x':subplot 5 3 1:call 'splot'
+copy b a:cumsum b 'x':subplot 5 3 2:call 'splot'
+copy b a:integrate b 'x':subplot 5 3 3:call 'splot'
+mirror b 'x':subplot 5 3 4:call 'splot'
+copy b a:diff b 'y':subplot 5 3 5:call 'splot'
+copy b a:diff2 b 'y':subplot 5 3 6:call 'splot'
+copy b a:cumsum b 'y':subplot 5 3 7:call 'splot'
+copy b a:integrate b 'y':subplot 5 3 8:call 'splot'
+mirror b 'y':subplot 5 3 9:call 'splot'
+copy b a:diff b 'z':subplot 5 3 10:call 'splot'
+copy b a:diff2 b 'z':subplot 5 3 11:call 'splot'
+copy b a:cumsum b 'z':subplot 5 3 12:call 'splot'
+copy b a:integrate b 'z':subplot 5 3 13:call 'splot'
+mirror b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box:surf3 b
+return
+
+

C++ code: +

void smgl_data1(mglGraph *gr)	// basic data operations
+{
+	mglData a(40,50,60),b;	gr->Fill(a,"exp(-x^2-4*y^2-16*z^2)");
+	gr->Light(true);		gr->Alpha(true);
+	b.Set(a);	b.Diff("x");	gr->SubPlot(5,3,0);	splot1(gr,b);
+	b.Set(a);	b.Diff2("x");	gr->SubPlot(5,3,1);	splot1(gr,b);
+	b.Set(a);	b.CumSum("x");	gr->SubPlot(5,3,2);	splot1(gr,b);
+	b.Set(a);	b.Integral("x");gr->SubPlot(5,3,3);	splot1(gr,b);
+	b.Mirror("x");	gr->SubPlot(5,3,4);	splot1(gr,b);
+	b.Set(a);	b.Diff("y");	gr->SubPlot(5,3,5);	splot1(gr,b);
+	b.Set(a);	b.Diff2("y");	gr->SubPlot(5,3,6);	splot1(gr,b);
+	b.Set(a);	b.CumSum("y");	gr->SubPlot(5,3,7);	splot1(gr,b);
+	b.Set(a);	b.Integral("y");gr->SubPlot(5,3,8);	splot1(gr,b);
+	b.Mirror("y");	gr->SubPlot(5,3,9);	splot1(gr,b);
+	b.Set(a);	b.Diff("z");	gr->SubPlot(5,3,10);splot1(gr,b);
+	b.Set(a);	b.Diff2("z");	gr->SubPlot(5,3,11);splot1(gr,b);
+	b.Set(a);	b.CumSum("z");	gr->SubPlot(5,3,12);splot1(gr,b);
+	b.Set(a);	b.Integral("z");gr->SubPlot(5,3,13);splot1(gr,b);
+	b.Mirror("z");	gr->SubPlot(5,3,14);splot1(gr,b);
+}
+
Sample data1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.36 Sample ‘data2

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:sinfft b 'x':subplot 5 3 0:call 'splot'
+copy b a:cosfft b 'x':subplot 5 3 1:call 'splot'
+copy b a:hankel b 'x':subplot 5 3 2:call 'splot'
+copy b a:swap b 'x':subplot 5 3 3:call 'splot'
+copy b a:smooth b 'x':subplot 5 3 4:call 'splot'
+copy b a:sinfft b 'y':subplot 5 3 5:call 'splot'
+copy b a:cosfft b 'y':subplot 5 3 6:call 'splot'
+copy b a:hankel b 'y':subplot 5 3 7:call 'splot'
+copy b a:swap b 'y':subplot 5 3 8:call 'splot'
+copy b a:smooth b 'y':subplot 5 3 9:call 'splot'
+copy b a:sinfft b 'z':subplot 5 3 10:call 'splot'
+copy b a:cosfft b 'z':subplot 5 3 11:call 'splot'
+copy b a:hankel b 'z':subplot 5 3 12:call 'splot'
+copy b a:swap b 'z':subplot 5 3 13:call 'splot'
+copy b a:smooth b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box
+surf3 b 0.5:surf3 b -0.5
+return
+
+

C++ code: +

void smgl_data2(mglGraph *gr)	// data transforms
+{
+	mglData a(40,50,60),b;	gr->Fill(a,"exp(-x^2-4*y^2-16*z^2)");
+	gr->Light(true);		gr->Alpha(true);
+	b.Set(a);	b.SinFFT("x");	gr->SubPlot(5,3,0);	splot2(gr,b);
+	b.Set(a);	b.CosFFT("x");	gr->SubPlot(5,3,1);	splot2(gr,b);
+	b.Set(a);	b.Hankel("x");	gr->SubPlot(5,3,2);	splot2(gr,b);
+	b.Set(a);	b.Swap("x");	gr->SubPlot(5,3,3);	splot2(gr,b);
+	b.Set(a);	b.Smooth("x");	gr->SubPlot(5,3,4);	splot2(gr,b);
+	b.Set(a);	b.SinFFT("y");	gr->SubPlot(5,3,5);	splot2(gr,b);
+	b.Set(a);	b.CosFFT("y");	gr->SubPlot(5,3,6);	splot2(gr,b);
+	b.Set(a);	b.Hankel("y");	gr->SubPlot(5,3,7);	splot2(gr,b);
+	b.Set(a);	b.Swap("y");	gr->SubPlot(5,3,8);	splot2(gr,b);
+	b.Set(a);	b.Smooth("y");	gr->SubPlot(5,3,9);	splot2(gr,b);
+	b.Set(a);	b.SinFFT("z");	gr->SubPlot(5,3,10);splot2(gr,b);
+	b.Set(a);	b.CosFFT("z");	gr->SubPlot(5,3,11);splot2(gr,b);
+	b.Set(a);	b.Hankel("z");	gr->SubPlot(5,3,12);splot2(gr,b);
+	b.Set(a);	b.Swap("z");	gr->SubPlot(5,3,13);splot2(gr,b);
+	b.Set(a);	b.Smooth("z");	gr->SubPlot(5,3,14);splot2(gr,b);
+}
+
Sample data2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.37 Sample ‘dens

+ + +

Function dens draw density plot (also known as color-map) for surface. +

+

MGL code: +

call 'prepare2d'
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0 '':title 'Dens plot (default)':box:dens a
+subplot 2 2 1:title '3d variant':rotate 50 60:box:dens a
+subplot 2 2 2 '':title '"\#" style; meshnum 10':box:dens a '#'; meshnum 10
+subplot 2 2 3:title 'several slices':rotate 50 60:box:dens a1
+
+

C++ code: +

void smgl_dens3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Dens3 sample");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->SetAlphaDef(0.7);
+	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Dens3(c,"x");	gr->Dens3(c);	gr->Dens3(c,"z");
+}
+
Sample dens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.38 Sample ‘dens3

+ + +

Function dens3 draw ordinary density plots but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Dens3 sample':rotate 50 60:alpha on:alphadef 0.7
+origin 0 0 0:box:axis '_xyz'
+dens3 c 'x':dens3 c ':y':dens3 c 'z'
+
+

C++ code: +

void smgl_dens3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Dens3 sample");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->SetAlphaDef(0.7);
+	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Dens3(c,"x");	gr->Dens3(c);	gr->Dens3(c,"z");
+}
+
Sample dens3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.39 Sample ‘dens_xyz

+ + +

Functions densz, densy, densx draw density plot on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Dens[XYZ] sample':rotate 50 60:box
+densx {sum c 'x'} '' -1:densy {sum c 'y'} '' 1:densz {sum c 'z'} '' -1
+
+

C++ code: +

void smgl_dens_xyz(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	gr->Title("Dens[XYZ] sample");
+	gr->Rotate(50,60);	gr->Box();	gr->DensX(c.Sum("x"),0,-1);
+	gr->DensY(c.Sum("y"),0,1);		gr->DensZ(c.Sum("z"),0,-1);
+}
+
Sample dens_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.40 Sample ‘detect

+ + +

Example of curve detect. +

+

MGL code: +

subplot 1 1 0 '':title 'Detect sample'
+new a 200 100 'exp(-30*(y-0.5*sin(pi*x))^2-rnd/10)+exp(-30*(y+0.5*sin(pi*x))^2-rnd/10)+exp(-30*(x+y)^2-rnd/10)'
+ranges 0 a.nx 0 a.ny:box
+alpha on:crange a:dens a
+
+detect r a 0.1 5
+plot r(0) r(1) '.'
+
+

C++ code: +

void smgl_detect(mglGraph *gr)
+{
+	mglData a(200, 100);
+	gr->Fill(a,"exp(-30*(y-0.5*sin(pi*x))^2-rnd/10)+exp(-30*(y+0.5*sin(pi*x))^2-rnd/10)+exp(-30*(x+y)^2-rnd/10)");
+	gr->SubPlot(1,1,0,"");
+	if(big!=3)	gr->Title("Detect sample");
+	gr->SetRanges(0,a.nx,0,a.ny);	gr->SetRange('c',a);
+	gr->Alpha(true);	gr->Box();	gr->Dens(a);
+	mglData r(a.Detect(0.1,5));
+	gr->Plot(r.SubData(0), r.SubData(1), ".");
+}
+
Sample detect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.41 Sample ‘dew

+ + +

Function dew is similar to vect but use drops instead of arrows. +

+

MGL code: +

call 'prepare2v'
+subplot 1 1 0 '':title 'Dew plot':light on:box:dew a b
+
+

C++ code: +

void smgl_dew(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2v(&a,&b);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("Dew plot");}
+	gr->Box();	gr->Light(true);	gr->Dew(a,b);
+}
+
Sample dew +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.42 Sample ‘diffract

+ + + + +

MGL code: +

define n 32	#number of points
+define m 20 # number of iterations
+define dt 0.01 # time step
+new res n m+1
+ranges -1 1 0 m*dt 0 1
+
+#tridmat periodic variant
+new !a n 'i',dt*(n/2)^2/2
+copy !b !(1-2*a)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xdc'
+put res u all $i+1
+next
+subplot 2 2 0 '<_':title 'Tridmat, periodic b.c.'
+axis:box:dens res
+
+#fourier variant
+new k n:fillsample k 'xk'
+copy !e !exp(-i1*dt*k^2)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+fourier u 'x'
+multo u e
+fourier u 'ix'
+put res u all $i+1
+next
+subplot 2 2 1 '<_':title 'Fourier method'
+axis:box:dens res
+
+#tridmat zero variant
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xd'
+put res u all $i+1
+next
+subplot 2 2 2 '<_':title 'Tridmat, zero b.c.'
+axis:box:dens res
+
+#diffract exp variant
+new !u n 'exp(-6*x^2)'
+define q dt*(n/2)^2/8 # need q<0.4 !!!
+put res u all 0
+for $i 0 m
+for $j 1 8	# due to smaller dt
+diffract u 'xe' q
+next
+put res u all $i+1
+next
+subplot 2 2 3 '<_':title 'Diffract, exp b.c.'
+axis:box:dens res
+
+

C++ code: +

void smgl_diffract(mglGraph *gr)
+{
+	long n=32;	// number of points
+	long m=20;	// number of iterations
+	double dt=0.01;	// time step
+	mglData res(n,m+1);
+	gr->SetRanges(-1,1, 0,m*dt, 0,1);
+
+	// tridmat periodic variant
+	mglDataC a(n), b(n);	a = dual(0,dt*n*n/8);
+	for(long i=0;i<n;i++)	b.a[i] = mreal(1)-mreal(2)*a.a[i];
+	mglDataC u(n);	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	for(long i=0;i<m;i++)
+	{
+		u = mglTridMatC(a,b,a,u,"xdc");
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,0,"<_");	gr->Title("Tridmat, periodic b.c.");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+
+	// fourier variant
+	mglData k(n);	k.FillSample("xk");
+	mglDataC e(n);	for(long i=0;i<n;i++)	e.a[i] = exp(-dual(0,dt*k.a[i]*k.a[i]));
+	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	for(long i=0;i<m;i++)
+	{
+		u.FFT("x");	u *= e;	u.FFT("ix");
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Fourier method");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+
+	// tridmat zero variant
+	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	for(long i=0;i<m;i++)
+	{
+		u = mglTridMatC(a,b,a,u,"xd");
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,2,"<_");	gr->Title("Tridmat, zero b.c.");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+	
+	// diffract exp variant
+	gr->Fill(u,"exp(-6*x^2)");	res.Put(u,-1,0);
+	double q=dt*n*n/4/8;	// NOTE: need q<0.4 !!!
+	for(long i=0;i<m;i++)
+	{
+		for(long j=0;j<8;j++)	// due to smaller dt
+			u.Diffraction("xe",q);
+		res.Put(u,-1,i+1);
+	}
+	gr->SubPlot(2,2,3,"<_");	gr->Title("Diffract, exp b.c.");
+	gr->Axis();	gr->Box();	gr->Dens(res);
+}
+
Sample diffract +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.43 Sample ‘dilate

+ + +

Example of dilate and erode. +

+

MGL code: +

subplot 2 2 0:title 'Dilate&Erode 1D sample'
+new y 11:put y 1 5
+ranges 0 10 0 1:axis:box
+plot y 'b*'
+dilate y 0.5 2
+plot y 'rs'
+erode y 0.5 1
+plot y 'g#o'
+
+subplot 2 2 1:title 'Dilate&Erode 2D sample':rotate 40 60
+ranges 0 10 0 10 0 3
+axis:box
+new z 11 11:put z 3 5 5
+boxs z 'b':boxs z 'k#'
+dilate z 1 2
+boxs z 'r':boxs z 'k#'
+erode z 1 1
+boxs 2*z 'g':boxs 2*z 'k#'
+
+subplot 2 2 2
+text 0.5 0.7 'initial' 'ba';size -2
+text 0.5 0.5 'dilate=2' 'ra';size -2
+text 0.5 0.3 'erode=1' 'ga';size -2
+
+subplot 2 2 3:title 'Dilate&Erode 3D sample'
+rotate 60 50:light on:alpha on
+ranges 0 10 0 10 0 10:crange 0 3
+axis:box
+new a 11 11 11:put a 3 5 5 5
+surf3a a a 1.5 'b'
+dilate a 1 2
+surf3a a a 0.5 'r'
+erode a 1 1
+surf3a 2*a 2*a 1 'g'
+
+

C++ code: +

void smgl_dilate(mglGraph *gr)
+{
+	mglData y(11),	z(11,11), a(11,11,11);
+	y.a[5]=1;	z.a[5+11*5]=a.a[5+11*(5+11*5)] = 3;
+
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Dilate&Erode 1D sample");	}
+	else	gr->SubPlot(1,1,0,"");
+	gr->SetRanges(0,10,0,1);	gr->Axis();	gr->Box();	gr->Plot(y,"b*");
+	y.Dilate(1,2);	gr->Plot(y,"rs");
+	y.Erode(1,1);	gr->Plot(y,"g#o");
+	if(big==3)	return;
+	
+	gr->SubPlot(2,2,1);	gr->Title("Dilate&Erode 2D sample");
+	gr->Rotate(40,60);	gr->SetRanges(0,10,0,10,0,3);
+	gr->Axis();	gr->Box();	gr->Boxs(z,"b");	gr->Boxs(z,"k#");
+	z.Dilate(1,2);			gr->Boxs(z,"r");	gr->Boxs(z,"k#");
+	z.Erode(1,1);	z*=2;	gr->Boxs(z,"g");	gr->Boxs(z,"k#");
+	
+	gr->SubPlot(2,2,2);
+	gr->Puts(0.5,0.7,"initial","ba",-2);
+	gr->Puts(0.5,0.5,"dilate=2","ra",-2);
+	gr->Puts(0.5,0.3,"erode=1","ga",-2);
+	
+	gr->SubPlot(2,2,3);	gr->Title("Dilate&Erode 3D sample");
+	gr->Rotate(60,50);	gr->Alpha(true);	gr->Light(true);
+	gr->SetRanges(0,10,0,10,0,10);	gr->SetRange('c',0,3);
+	gr->Axis();	gr->Box();	gr->Surf3A(1.5,a,a,"b");
+	a.Dilate(1,2);			gr->Surf3A(0.5,a,a,"r");
+	a.Erode(1,1);	a*=2;	gr->Surf3A(1,a,a,"g");
+}
+
Sample dilate +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.44 Sample ‘dots

+ + +

Function dots is another way to draw irregular points. Dots use color scheme for coloring (see Color scheme). +

+

MGL code: +

new t 2000 'pi*(rnd-0.5)':new f 2000 '2*pi*rnd'
+copy x 0.9*cos(t)*cos(f):copy y 0.9*cos(t)*sin(f):copy z 0.6*sin(t):copy c cos(2*t)
+subplot 2 2 0:title 'Dots sample':rotate 50 60
+box:dots x y z
+alpha on
+subplot 2 2 1:title 'add transparency':rotate 50 60
+box:dots x y z c
+subplot 2 2 2:title 'add colorings':rotate 50 60
+box:dots x y z x c
+subplot 2 2 3:title 'Only coloring':rotate 50 60
+box:tens x y z x ' .'
+
+

C++ code: +

void smgl_dots(mglGraph *gr)
+{
+	int i, n=1000;
+	mglData x(n),y(n),z(n),c(n);
+	for(i=0;i<n;i++)
+	{
+		double t=M_PI*(mgl_rnd()-0.5), f=2*M_PI*mgl_rnd();
+		x.a[i] = 0.9*cos(t)*cos(f);
+		y.a[i] = 0.9*cos(t)*sin(f);
+		z.a[i] = 0.6*sin(t);
+		c.a[i] = cos(2*t);
+	}
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Dots sample");	}
+	gr->Rotate(50,60);	gr->Box();	gr->Dots(x,y,z);
+	if(big==3)	return;
+	gr->Alpha(true);
+	gr->SubPlot(2,2,1);	gr->Title("add transparency");		gr->Rotate(50,60);	gr->Box();	gr->Dots(x,y,z,c);
+	gr->SubPlot(2,2,2);	gr->Title("add coloring");	gr->Rotate(50,60);	gr->Box();	gr->Dots(x,y,z,x,c);
+	gr->SubPlot(2,2,3);	gr->Title("Only coloring");		gr->Rotate(50,60);	gr->Box();	gr->Tens(x,y,z,x," .");
+}
+
Sample dots +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.45 Sample ‘earth

+ + +

Example of Earth map by using import. +

+

MGL code: +

import dat 'Equirectangular-projection.jpg' 'BbGYw' -1 1
+subplot 1 1 0 '<>':title 'Earth in 3D':rotate 40 60
+copy phi dat 'pi*x':copy tet dat 'pi*y/2'
+copy x cos(tet)*cos(phi)
+copy y cos(tet)*sin(phi)
+copy z sin(tet)
+
+light on
+surfc x y z dat 'BbGYw'
+contp [-0.51,-0.51] x y z dat 'y'
+
+

C++ code: +

void smgl_earth(mglGraph *gr)
+{
+	mglData dat;	dat.Import("Equirectangular-projection.jpg","BbGYw",-1,1);
+	// Calc proper 3d coordinates from projection
+	mglData phi(dat.nx,dat.ny);	phi.Fill(-M_PI,M_PI);
+	mglData tet(dat.nx,dat.ny);	tet.Fill(-M_PI/2,M_PI/2,'y');
+	mglData x(dat.nx,dat.ny), y(dat.nx,dat.ny), z(dat.nx,dat.ny);
+#pragma omp parallel for
+	for(long i=0;i<dat.nx*dat.ny;i++)
+	{	x.a[i] = cos(tet.a[i])*cos(phi.a[i]);
+		y.a[i] = cos(tet.a[i])*sin(phi.a[i]);
+		z.a[i] = sin(tet.a[i]);	}
+
+	gr->SubPlot(1,1,0,"<>");
+	if(big!=3)	gr->Title("Earth in 3D");
+	gr->Rotate(40,60);	gr->Light(true);
+	gr->SurfC(x,y,z,dat,"BbGYw");
+	mglData vals(1);	vals.a[0]=-0.51;
+	gr->ContP(vals, x,y,z,dat,"y");
+}
+
Sample earth +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.46 Sample ‘error

+ + +

Function error draw error boxes around the points. You can draw default boxes or semi-transparent symbol (like marker, see Line styles). Also you can set individual color for each box. See also error2 sample. +

+

MGL code: +

call 'prepare1d'
+new y 50 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2)'
+new x0 10 'x + 0.1*rnd-0.05':new ex 10 '0.1':new ey 10 '0.2'
+new y0 10 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2) + 0.2*rnd-0.1'
+subplot 2 2 0 '':title 'Error plot (default)':box:plot y:error x0 y0 ex ey 'k'
+subplot 2 2 1 '':title '"!" style; no e_x':box:plot y:error x0 y0 ey 'o!rgb'
+subplot 2 2 2 '':title '"\@" style':alpha on:box:plot y:error x0 y0 ex ey '@'; alpha 0.5
+subplot 2 2 3:title '3d variant':rotate 50 60:axis
+for $1 0 9
+	errbox 2*rnd-1 2*rnd-1 2*rnd-1 0.2 0.2 0.2 'bo'
+next
+
+

C++ code: +

void smgl_error2(mglGraph *gr)
+{
+	mglData x0(10), y0(10), ex(10), ey(10);
+	for(int i=0;i<10;i++)
+	{	x0.a[i] = mgl_rnd();	y0.a[i] = mgl_rnd();	ey.a[i] = ex.a[i] = 0.1;	}
+	gr->SetRanges(0,1,0,1);	gr->Alpha(true);
+	gr->SubPlot(4,3,0,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#+@");
+	gr->SubPlot(4,3,1,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#x@");
+	gr->SubPlot(4,3,2,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#s@","alpha 0.5");
+	gr->SubPlot(4,3,3,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"s@");
+	gr->SubPlot(4,3,4,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"d@");
+	gr->SubPlot(4,3,5,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#d@","alpha 0.5");
+	gr->SubPlot(4,3,6,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"+@");
+	gr->SubPlot(4,3,7,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"x@");
+	gr->SubPlot(4,3,8,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"o@");
+	gr->SubPlot(4,3,9,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#o@","alpha 0.5");
+	gr->SubPlot(4,3,10,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#.@");
+	gr->SubPlot(4,3,11,"");	gr->Box();	gr->Error(x0,y0,ex,ey);
+}
+
Sample error +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.47 Sample ‘error2

+ + +

Example of error kinds. +

+

MGL code: +

new x0 10 'rnd':new ex 10 '0.1'
+new y0 10 'rnd':new ey 10 '0.1'
+ranges 0 1 0 1
+subplot 4 3 0 '':box:error x0 y0 ex ey '#+@'
+subplot 4 3 1 '':box:error x0 y0 ex ey '#x@'
+subplot 4 3 2 '':box:error x0 y0 ex ey '#s@'; alpha 0.5
+subplot 4 3 3 '':box:error x0 y0 ex ey 's@'
+subplot 4 3 4 '':box:error x0 y0 ex ey 'd@'
+subplot 4 3 5 '':box:error x0 y0 ex ey '#d@'; alpha 0.5
+subplot 4 3 6 '':box:error x0 y0 ex ey '+@'
+subplot 4 3 7 '':box:error x0 y0 ex ey 'x@'
+subplot 4 3 8 '':box:error x0 y0 ex ey 'o@'
+subplot 4 3 9 '':box:error x0 y0 ex ey '#o@'; alpha 0.5
+subplot 4 3 10 '':box:error x0 y0 ex ey '#.@'
+subplot 4 3 11 '':box:error x0 y0 ex ey; alpha 0.5
+
+

C++ code: +

void smgl_error2(mglGraph *gr)
+{
+	mglData x0(10), y0(10), ex(10), ey(10);
+	for(int i=0;i<10;i++)
+	{	x0.a[i] = mgl_rnd();	y0.a[i] = mgl_rnd();	ey.a[i] = ex.a[i] = 0.1;	}
+	gr->SetRanges(0,1,0,1);	gr->Alpha(true);
+	gr->SubPlot(4,3,0,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#+@");
+	gr->SubPlot(4,3,1,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#x@");
+	gr->SubPlot(4,3,2,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#s@","alpha 0.5");
+	gr->SubPlot(4,3,3,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"s@");
+	gr->SubPlot(4,3,4,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"d@");
+	gr->SubPlot(4,3,5,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#d@","alpha 0.5");
+	gr->SubPlot(4,3,6,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"+@");
+	gr->SubPlot(4,3,7,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"x@");
+	gr->SubPlot(4,3,8,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"o@");
+	gr->SubPlot(4,3,9,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#o@","alpha 0.5");
+	gr->SubPlot(4,3,10,"");	gr->Box();	gr->Error(x0,y0,ex,ey,"#.@");
+	gr->SubPlot(4,3,11,"");	gr->Box();	gr->Error(x0,y0,ex,ey);
+}
+
Sample error2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.48 Sample ‘export

+ + +

Example of data export and import. +

+

MGL code: +

new a 100 100 'x^2*y':new b 100 100
+export a 'test_data.png' 'BbcyrR' -1 1
+import b 'test_data.png' 'BbcyrR' -1 1
+subplot 2 1 0 '':title 'initial':box:dens a
+subplot 2 1 1 '':title 'imported':box:dens b
+
+

C++ code: +

void smgl_export(mglGraph *gr)	// basic data operations
+{
+	mglData a(100,100), b; gr->Fill(a,"x^2*y");
+	a.Export("test_data.png","BbcyrR");
+	b.Import("test_data.png","BbcyrR",-1,1);
+	gr->SubPlot(2,1,0,"");	gr->Title("initial");	gr->Box();	gr->Dens(a);
+	gr->SubPlot(2,1,1,"");	gr->Title("imported");	gr->Box();	gr->Dens(b);
+}
+
Sample export +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.49 Sample ‘fall

+ + +

Function fall draw waterfall surface. You can use meshnum for changing number of lines to be drawn. Also you can use ‘x’ style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Fall plot':rotate 50 60:box:fall a
+
+

C++ code: +

void smgl_fall(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Fall plot");
+	gr->Rotate(50,60);	gr->Box();	gr->Fall(a);
+}
+
Sample fall +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.50 Sample ‘fexport

+ + +

Example of write to different file formats. +

+

MGL code: +

subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+write 'fexport.jpg':#write 'fexport.png'
+write 'fexport.bmp':write 'fexport.tga'
+write 'fexport.eps':write 'fexport.svg'
+write 'fexport.gif':write 'fexport.xyz'
+write 'fexport.stl':write 'fexport.off'
+write 'fexport.tex':write 'fexport.obj'
+write 'fexport.prc':write 'fexport.json'
+write 'fexport.mgld'
+
+

C++ code: +

void smgl_fexport(mglGraph *gr)	// test file export
+{
+	all_prims(gr);
+	gr->WriteJPEG("fexport.jpg");
+//	gr->WritePNG("fexport.png");
+	gr->WriteBMP("fexport.bmp");
+	gr->WriteTGA("fexport.tga");
+	gr->WriteEPS("fexport.eps");
+	gr->WriteSVG("fexport.svg");
+	gr->WriteGIF("fexport.gif");
+
+	gr->WriteXYZ("fexport.xyz");
+	gr->WriteSTL("fexport.stl");
+	gr->WriteOFF("fexport.off");
+	gr->WriteTEX("fexport.tex");
+	gr->WriteOBJ("fexport.obj");
+	gr->WritePRC("fexport.prc");
+	gr->WriteJSON("fexport.json");
+
+	gr->ExportMGLD("fexport.mgld");
+	gr->Clf();
+	gr->ImportMGLD("fexport.mgld");
+}
+
Sample fexport +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.51 Sample ‘fit

+ + +

Example of nonlinear fit. +

+

MGL code: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r':text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+

C++ code: +

void smgl_fit(mglGraph *gr)	// nonlinear fitting
+{
+	mglData dat(100), in(100), res;
+	gr->Fill(dat,"0.4*rnd+0.1+sin(2*pi*x)");
+	gr->Fill(in,"0.3+sin(2*pi*x)");
+	double ini[3] = {1,1,3};
+	mglData Ini(3,ini);
+	res = gr->Fit(dat, "a+b*sin(c*x)", "abc", Ini);
+	if(big!=3)	gr->Title("Fitting sample");
+	gr->SetRange('y',-2,2);	gr->Box();	gr->Plot(dat, "k. ");
+	gr->Axis();		gr->Plot(res, "r");	gr->Plot(in, "b");
+	gr->Puts(mglPoint(-0.9, -1.3), "fitted:", "r:L");
+	gr->PutsFit(mglPoint(0, -1.8), "y = ", "r");
+	gr->Puts(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "b");
+//	gr->SetRanges(mglPoint(-1,-1,-1),mglPoint(1,1,1));	gr->SetOrigin(0,0,0);
+}
+
Sample fit +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.52 Sample ‘flame2d

+ + +

Function flame2d generate points for flame fractals in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+new B 2 3 A.ny '0.3'
+put B 3 0 0 -1
+put B 3 0 1 -1
+put B 3 0 2 -1
+flame2d fx fy A B 1000000
+subplot 1 1 0 '<_':title 'Flame2d sample'
+ranges fx fy:box:axis
+plot fx fy 'r#o ';size 0.05
+
+

C++ code: +

void smgl_flame2d(mglGraph *gr)
+{
+	mglData A, B(2,3,5);
+	A.SetList(35, 0.33,0.,0.,0.33,0.,0.,0.2, 0.33,0.,0.,0.33,0.67,0.,0.2, 0.33,0.,0.,0.33,0.33,0.33,0.2,
+			0.33,0.,0.,0.33,0.,0.67,0.2, 0.33,0.,0.,0.33,0.67,0.67,0.2);
+	A.Rearrange(7);
+	for(long i=0;i<2*3*5;i++)	B.a[i] = 0.3;
+	for(long i=0;i<5;i++)	B.a[2*3*i] = B.a[2*3*i+1*2] = B.a[2*3*i+2*2] = 3;
+	mglData f(mglFlame2d(A,B,1000000));
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Flame2d sample");
+	gr->SetRanges(f.SubData(0), f.SubData(1));
+	gr->Axis();	gr->Box();
+	gr->Plot(f.SubData(0), f.SubData(1),"r#o ","size 0.05");
+}
+
Sample flame2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.53 Sample ‘flow

+ + +

Function flow is another standard way to visualize vector fields – it draw lines (threads) which is tangent to local vector field direction. MathGL draw threads from edges of bounding box and from central slices. Sometimes it is not most appropriate variant – you may want to use flowp to specify manual position of threads. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Flow plot (default)':box:flow a b
+subplot 2 2 1 '':title '"v" style':box:flow a b 'v'
+subplot 2 2 2 '':title '"#" and "." styles':box:flow a b '#':flow a b '.2k'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:flow ex ey ez
+
+

C++ code: +

void smgl_flow(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2v(&a,&b);
+	if(big!=3)	{gr->SubPlot(2,2,0,"");	gr->Title("Flow plot (default)");}
+	gr->Box();	gr->Flow(a,b);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("'v' style");
+	gr->Box();	gr->Flow(a,b,"v");
+	gr->SubPlot(2,2,2,"");	gr->Title("'\\#' and '.' styles");
+	gr->Box();	gr->Flow(a,b,"#");	gr->Flow(a,b,".2k");
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Flow(ex,ey,ez);
+}
+
Sample flow +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.54 Sample ‘flow3

+ + +

Function flow3 draw flow threads, which start from given plane. +

+

MGL code: +

call 'prepare3v'
+subplot 2 2 0:title 'Flow3 plot (default)':rotate 50 60:box
+flow3 ex ey ez
+subplot 2 2 1:title '"v" style, from boundary':rotate 50 60:box
+flow3 ex ey ez 'v' 0
+subplot 2 2 2:title '"t" style':rotate 50 60:box
+flow3 ex ey ez 't' 0
+subplot 2 2 3:title 'from \i z planes':rotate 50 60:box
+flow3 ex ey ez 'z' 0
+flow3 ex ey ez 'z' 9
+
+

C++ code: +

void smgl_flow3(mglGraph *gr)
+{
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	if(big!=3)	{gr->SubPlot(2,2,0);	gr->Title("Flow3 plot (default)");}
+	gr->Rotate(50,60);	gr->Box();		gr->Flow3(ex,ey,ez);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'v' style, from boundary");
+	gr->Rotate(50,60);	gr->Box();	gr->Flow3(ex,ey,ez,"v",0);
+	gr->SubPlot(2,2,2);	gr->Title("'t' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Flow3(ex,ey,ez,"t",0);
+	gr->SubPlot(2,2,3);	gr->Title("from \\i z planes");
+	gr->Rotate(50,60);	gr->Box();	gr->Flow3(ex,ey,ez,"z",0);	gr->Flow3(ex,ey,ez,"z",9);
+}
+
Sample flow3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.55 Sample ‘fog

+ + +

Example of fog. +

+

MGL code: +

call 'prepare2d'
+title 'Fog sample':rotate 50 60:light on:fog 1
+box:surf a:cont a 'y'
+
+

C++ code: +

void smgl_fog(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Fog sample");
+	gr->Light(true);	gr->Rotate(50,60);	gr->Fog(1);	gr->Box();
+	gr->Surf(a);	gr->Cont(a,"y");
+}
+
Sample fog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.56 Sample ‘fonts

+ + +

Example of font typefaces. +

+

MGL code: +

define d 0.25
+loadfont 'STIX':text 0 1.1 'default font (STIX)'
+loadfont 'adventor':text 0 1.1-d 'adventor font'
+loadfont 'bonum':text 0 1.1-2*d 'bonum font'
+loadfont 'chorus':text 0 1.1-3*d 'chorus font'
+loadfont 'cursor':text 0 1.1-4*d 'cursor font'
+loadfont 'heros':text 0 1.1-5*d 'heros font'
+loadfont 'heroscn':text 0 1.1-6*d 'heroscn font'
+loadfont 'pagella':text 0 1.1-7*d 'pagella font'
+loadfont 'schola':text 0 1.1-8*d 'schola font'
+loadfont 'termes':text 0 1.1-9*d 'termes font'
+loadfont ''
+
+

C++ code: +

void smgl_fonts(mglGraph *gr)	// font typefaces
+{
+	double h=1.1, d=0.25;
+	gr->LoadFont("STIX");		gr->Puts(mglPoint(0,h), "default font (STIX)");
+	gr->LoadFont("adventor");	gr->Puts(mglPoint(0,h-d), "adventor font");
+	gr->LoadFont("bonum");		gr->Puts(mglPoint(0,h-2*d), "bonum font");
+	gr->LoadFont("chorus");		gr->Puts(mglPoint(0,h-3*d), "chorus font");
+	gr->LoadFont("cursor");		gr->Puts(mglPoint(0,h-4*d), "cursor font");
+	gr->LoadFont("heros");		gr->Puts(mglPoint(0,h-5*d), "heros font");
+	gr->LoadFont("heroscn");	gr->Puts(mglPoint(0,h-6*d), "heroscn font");
+	gr->LoadFont("pagella");	gr->Puts(mglPoint(0,h-7*d), "pagella font");
+	gr->LoadFont("schola");		gr->Puts(mglPoint(0,h-8*d), "schola font");
+	gr->LoadFont("termes");		gr->Puts(mglPoint(0,h-9*d), "termes font");
+	gr->LoadFont("");
+}
+
Sample fonts +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.57 Sample ‘grad

+ + +

Function grad draw gradient lines for matrix. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Grad plot':box:grad a:dens a '{u8}w{q8}'
+
+

C++ code: +

void smgl_grad(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("Grad plot");}
+	gr->Box();	gr->Grad(a);	gr->Dens(a,"{u8}w{q8}");
+}
+
Sample grad +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.58 Sample ‘hist

+ + +

Example of hist (histogram). +

+

MGL code: +

new x 10000 '2*rnd-1':new y 10000 '2*rnd-1':copy z exp(-6*(x^2+y^2))
+hist xx x z:norm xx 0 1:hist yy y z:norm yy 0 1
+multiplot 3 3 3 2 2 '':ranges -1 1 -1 1 0 1:box:dots x y z 'wyrRk'
+multiplot 3 3 0 2 1 '':ranges -1 1 0 1:box:bars xx
+multiplot 3 3 5 1 2 '':ranges 0 1 -1 1:box:barh yy
+subplot 3 3 2:text 0.5 0.5 'Hist and\n{}MultiPlot\n{}sample' 'a' -3
+
+

C++ code: +

void smgl_hist(mglGraph *gr)
+{
+	mglData x(10000), y(10000), z(10000);	gr->Fill(x,"2*rnd-1");	gr->Fill(y,"2*rnd-1");	gr->Fill(z,"exp(-6*(v^2+w^2))",x,y);
+	mglData xx=gr->Hist(x,z), yy=gr->Hist(y,z);	xx.Norm(0,1);	yy.Norm(0,1);
+	gr->MultiPlot(3,3,3,2,2,"");	gr->SetRanges(-1,1,-1,1,0,1);	gr->Box();	gr->Dots(x,y,z,"wyrRk");
+	gr->MultiPlot(3,3,0,2,1,"");	gr->SetRanges(-1,1,0,1);	gr->Box();	gr->Bars(xx);
+	gr->MultiPlot(3,3,5,1,2,"");	gr->SetRanges(0,1,-1,1);	gr->Box();	gr->Barh(yy);
+	gr->SubPlot(3,3,2);		gr->Puts(mglPoint(0.5,0.5),"Hist and\nMultiPlot\nsample","a",-3);
+}
+
Sample hist +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.59 Sample ‘ifs2d

+ + +

Function ifs2d generate points for fractals using iterated function system in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+ifs2d fx fy A 100000
+subplot 1 1 0 '<_':title 'IFS 2d sample'
+ranges fx fy:axis
+plot fx fy 'r#o ';size 0.05
+
+

C++ code: +

void smgl_ifs2d(mglGraph *gr)
+{
+	mglData A;
+	A.SetList(35, 0.33,0.,0.,0.33,0.,0.,0.2, 0.33,0.,0.,0.33,0.67,0.,0.2, 0.33,0.,0.,0.33,0.33,0.33,0.2, 0.33,0.,0.,0.33,0.,0.67,0.2, 0.33,0.,0.,0.33,0.67,0.67,0.2);
+	A.Rearrange(7);
+	mglData f(mglIFS2d(A,100000));
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("IFS 2d sample");
+	gr->SetRanges(f.SubData(0), f.SubData(1));
+	gr->Axis();	gr->Plot(f.SubData(0), f.SubData(1),"r#o ","size 0.05");
+}
+
Sample ifs2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.60 Sample ‘ifs3d

+ + +

Function ifs3d generate points for fractals using iterated function system in 3d case. +

+

MGL code: +

list A [0,0,0,0,.18,0,0,0,0,0,0,0,.01] [.85,0,0,0,.85,.1,0,-0.1,0.85,0,1.6,0,.85]\
+	[.2,-.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07] [-.2,.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07]
+ifs3d f A 100000
+title 'IFS 3d sample':rotate 50 60
+ranges f(0) f(1) f(2):axis:box
+dots f(0) f(1) f(2) 'G#o';size 0.05
+
+

C++ code: +

void smgl_ifs3d(mglGraph *gr)
+{
+	mglData A;
+	A.SetList(52, 0.,0.,0.,0.,.18,0.,0.,0.,0.,0.,0.,0.,.01, .85,0.,0.,0.,.85,.1,0.,-0.1,0.85,0.,1.6,0.,.85,
+			.2,-.2,0.,.2,.2,0.,0.,0.,0.3,0.,0.8,0.,.07, -.2,.2,0.,.2,.2,0.,0.,0.,0.3,0.,0.8,0.,.07);
+	A.Rearrange(13);
+	mglData f(mglIFS3d(A,100000));
+	if(big!=3)	gr->Title("IFS 3d sample");
+	gr->SetRanges(f.SubData(0), f.SubData(1), f.SubData(2));
+	gr->Rotate(50,60);	gr->Axis();	gr->Box();
+	gr->Dots(f.SubData(0), f.SubData(1), f.SubData(2),"G#o","size 0.05");
+}
+
Sample ifs3d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.61 Sample ‘indirect

+ + +

Comparison of subdata vs evaluate/ +

+

MGL code: +

subplot 1 1 0 '':title 'SubData vs Evaluate'
+new in 9 'x^3/1.1':plot in 'ko ':box
+new arg 99 '4*x+4'
+evaluate e in arg off:plot e 'b.'; legend 'Evaluate'
+subdata s in arg:plot s 'r.';legend 'SubData'
+legend 2
+
+

C++ code: +

void smgl_indirect(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"");	gr->Title("SubData vs Evaluate");
+	mglData in(9), arg(99), e, s;
+	gr->Fill(in,"x^3/1.1");	gr->Fill(arg,"4*x+4");
+	gr->Plot(in,"ko ");		gr->Box();
+	e = in.Evaluate(arg,false);	gr->Plot(e,"b.","legend 'Evaluate'");
+	s = in.SubData(arg);	gr->Plot(s,"r.","legend 'SubData'");
+	gr->Legend(2);
+}
+
Sample indirect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.62 Sample ‘inplot

+ + +

Example of inplot, multiplot, columnplot, gridplot, shearplot, stickplot. +

+

MGL code: +

subplot 3 2 0:title 'StickPlot'
+stickplot 3 0 20 30:box 'r':text 0 0 0 '0' 'r'
+stickplot 3 1 20 30:box 'g':text 0 0 0 '1' 'g'
+stickplot 3 2 20 30:box 'b':text 0 9 0 '2' 'b'
+subplot 3 2 3 '':title 'ColumnPlot'
+columnplot 3 0:box 'r':text 0 0 '0' 'r'
+columnplot 3 1:box 'g':text 0 0 '1' 'g'
+columnplot 3 2:box 'b':text 0 0 '2' 'b'
+subplot 3 2 4 '':title 'GridPlot'
+gridplot 2 2 0:box 'r':text 0 0 '0' 'r'
+gridplot 2 2 1:box 'g':text 0 0 '1' 'g'
+gridplot 2 2 2:box 'b':text 0 0 '2' 'b'
+gridplot 2 2 3:box 'm':text 0 0 '3' 'm'
+subplot 3 2 5 '':title 'InPlot':box
+inplot 0.4 1 0.6 1 on:box 'r'
+multiplot 3 2 1 2 1 '':title 'MultiPlot and ShearPlot':box
+shearplot 3 0 0.2 0.1:box 'r':text 0 0 '0' 'r'
+shearplot 3 1 0.2 0.1:box 'g':text 0 0 '1' 'g'
+shearplot 3 2 0.2 0.1:box 'b':text 0 0 '2' 'b'
+
+

C++ code: +

void smgl_inplot(mglGraph *gr)
+{
+	gr->SubPlot(3,2,0);	gr->Title("StickPlot");
+	gr->StickPlot(3, 0, 20, 30);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->StickPlot(3, 1, 20, 30);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->StickPlot(3, 2, 20, 30);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+	gr->SubPlot(3,2,3,"");	gr->Title("ColumnPlot");
+	gr->ColumnPlot(3, 0);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->ColumnPlot(3, 1);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->ColumnPlot(3, 2);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+	gr->SubPlot(3,2,4,"");	gr->Title("GridPlot");
+	gr->GridPlot(2, 2, 0);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->GridPlot(2, 2, 1);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->GridPlot(2, 2, 2);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+	gr->GridPlot(2, 2, 3);	gr->Box("m");	gr->Puts(mglPoint(0),"3","m");
+	gr->SubPlot(3,2,5,"");	gr->Title("InPlot");	gr->Box();
+	gr->InPlot(0.4, 1, 0.6, 1, true);	gr->Box("r");
+	gr->MultiPlot(3,2,1, 2, 1,"");	gr->Title("MultiPlot and ShearPlot");	gr->Box();
+	gr->ShearPlot(3, 0, 0.2, 0.1);	gr->Box("r");	gr->Puts(mglPoint(0),"0","r");
+	gr->ShearPlot(3, 1, 0.2, 0.1);	gr->Box("g");	gr->Puts(mglPoint(0),"1","g");
+	gr->ShearPlot(3, 2, 0.2, 0.1);	gr->Box("b");	gr->Puts(mglPoint(0),"2","b");
+}
+
Sample inplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.63 Sample ‘iris

+ + +

Function iris draw Iris plot for columns of data array. +

+

MGL code: +

read a 'iris.dat'
+crop a 0 4 'x':rearrange a a.nx 50
+subplot 1 1 0 '':title 'Iris plot'
+iris a 'sepal\n length;sepal\n width;petal\n length;petal\n width' '. ';value -1.5;size -2
+
+

C++ code: +

void smgl_iris(mglGraph *gr)
+{
+	mglData a("iris.dat");	a.Crop(0,4,'x');	a.Rearrange(4,50);
+	gr->SubPlot(1,1,0,"");
+	if(big!=3)	gr->Title("Iris sample");
+	gr->Iris(a, "sepal\nlength;sepal\nwidth;petal\nlength;petal\nwidth", ". ", "value -1.5;size -2");
+}
+
Sample iris +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.64 Sample ‘label

+ + +

Function label print text at data points. The string may contain ‘%x’, ‘%y’, ‘%z’ for x-, y-, z-coordinates of points, ‘%n’ for point index. +

+

MGL code: +

new ys 10 '0.2*rnd-0.8*sin(pi*x)'
+subplot 1 1 0 '':title 'Label plot':box:plot ys ' *':label ys 'y=%y'
+
+

C++ code: +

void smgl_label(mglGraph *gr)
+{
+	mglData ys(10);	ys.Modify("0.8*sin(pi*2*x)+0.2*rnd");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Label plot");	}
+	gr->Box();	gr->Plot(ys," *");	gr->Label(ys,"y=%y");
+}
+
Sample label +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.65 Sample ‘lamerey

+ + +

Function lamerey draw Lamerey diagram. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Lamerey sample'
+axis:xlabel '\i x':ylabel '\bar{\i x} = 2 \i{x}'
+fplot 'x' 'k='
+fplot '2*x' 'b'
+lamerey 0.00097 '2*x' 'rv~';size 2
+lamerey -0.00097 '2*x' 'rv~';size 2
+
+

C++ code: +

void smgl_lamerey(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Lamerey sample");
+	gr->Axis();	gr->Label('x',"\\i x");	gr->Label('y',"\\bar{\\i x} = 2 \\i{x}");
+	gr->FPlot("x","k=");	gr->FPlot("2*x","b");
+	gr->Lamerey( 0.00097,"2*x","rv~");
+	gr->Lamerey(-0.00097,"2*x","rv~");
+}
+
Sample lamerey +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.66 Sample ‘legend

+ + +

Example of legend styles. +

+

MGL code: +

addlegend 'sin(\pi {x^2})' 'b':addlegend 'sin(\pi x)' 'g*'
+addlegend 'sin(\pi \sqrt{x})' 'rd':addlegend 'jsut text' ' ':addlegend 'no indent for this' ''
+subplot 2 2 0 '':title 'Legend (default)':box:legend
+legend 1 0.5 '^':text 0.49 0.88 'Style "\^"' 'A:L'
+legend 3 'A#':text 0.75 0.65 'Absolute position' 'A'
+subplot 2 2 2 '':title 'coloring':box:legend 0 'r#':legend 1 'Wb#':legend 2 'ygr#'
+subplot 2 2 3 '':title 'manual position':box
+legend 0.5 1:text 0.5 0.5 'at x=0.5, y=1' 'a'
+legend 1 '#-':text 0.75 0.25 'Horizontal legend' 'a'
+
+

C++ code: +

void smgl_legend(mglGraph *gr)
+{
+	gr->AddLegend("sin(\\pi {x^2})","b");
+	gr->AddLegend("sin(\\pi x)","g*");
+	gr->AddLegend("sin(\\pi \\sqrt{x})","rd");
+	gr->AddLegend("just text"," ");
+	gr->AddLegend("no indent for this","");
+	if(big!=3)	{gr->SubPlot(2,2,0,"");	gr->Title("Legend (default)");}
+	gr->Box();	gr->Legend();
+	if(big==3)	return;
+	gr->Legend(1,0.5,"^");	gr->Puts(0.49, 0.88, "Style '\\^'","A:L");
+	gr->Legend(3,"A#");
+	gr->Puts(mglPoint(0.75,0.65),"Absolute position","A");
+	gr->SubPlot(2,2,2,"");	gr->Title("coloring");	gr->Box();
+	gr->Legend(0,"r#");	gr->Legend(1,"Wb#");	gr->Legend(2,"ygr#");
+	gr->SubPlot(2,2,3,"");	gr->Title("manual position");	gr->Box();
+	gr->Legend(0.5,1);
+	gr->Puts(mglPoint(0.5,0.5),"at x=0.5, y=1","a");
+	gr->Legend(1,"#-");
+	gr->Puts(mglPoint(0.75,0.25),"Horizontal legend","a");
+}
+
Sample legend +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.67 Sample ‘light

+ + +

Example of light with different types. +

+

MGL code: +

light on:attachlight on
+call 'prepare2d'
+subplot 2 2 0:title 'Default':rotate 50 60:box:surf a
+line -1 -0.7 1.7 -1 -0.7 0.7 'BA'
+
+subplot 2 2 1:title 'Local':rotate 50 60
+light 0 1 0 1 -2 -1 -1
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 2:title 'no diffuse':rotate 50 60
+diffuse 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 3:title 'diffusive only':rotate 50 60
+diffuse 0.5:light 0 1 0 1 -2 -1 -1 'w' 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+

C++ code: +

void smgl_light(mglGraph *gr)	// local light sources
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->Light(true);	gr->AttachLight(true);
+	if(big==3)
+	{	gr->Rotate(50,60);	gr->Box();	gr->Surf(a);	return;	}
+	gr->SubPlot(2,2,0);	gr->Title("Default");	gr->Rotate(50,60);
+	gr->Line(mglPoint(-1,-0.7,1.7),mglPoint(-1,-0.7,0.7),"BA");	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,1);	gr->Title("Local");	gr->Rotate(50,60);
+	gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1));
+	gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,2);	gr->Title("no diffuse");	gr->Rotate(50,60);
+	gr->SetDiffuse(0);
+	gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,2,3);	gr->Title("diffusive only");	gr->Rotate(50,60);
+	gr->SetDiffuse(0.5);
+	gr->AddLight(0,mglPoint(1,0,1),mglPoint(-2,-1,-1),'w',0);
+	gr->Line(mglPoint(1,0,1),mglPoint(-1,-1,0),"BAO");	gr->Box();	gr->Surf(a);
+}
+
Sample light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.68 Sample ‘loglog

+ + +

Example of log- and log-log- axis labels. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Semi-log axis':ranges 0.01 100 -1 1:axis 'lg(x)' '' ''
+axis:grid 'xy' 'g':fplot 'sin(1/x)':xlabel 'x' 0:ylabel 'y = sin 1/x' 0
+subplot 2 2 1 '<_':title 'Log-log axis':ranges 0.01 100 0.1 100:axis 'lg(x)' 'lg(y)' ''
+axis:grid '!' 'h=':grid:fplot 'sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = \sqrt{1+x^2}' 0
+subplot 2 2 2 '<_':title 'Minus-log axis':ranges -100 -0.01 -100 -0.1:axis '-lg(-x)' '-lg(-y)' ''
+axis:fplot '-sqrt(1+x^2)':xlabel 'x' 0:ylabel 'y = -\sqrt{1+x^2}' 0
+subplot 2 2 3 '<_':title 'Log-ticks':ranges 0.01 100 0 100:axis 'sqrt(x)' '' ''
+axis:fplot 'x':xlabel 'x' 1:ylabel 'y = x' 0
+
+

C++ code: +

void smgl_loglog(mglGraph *gr)	// log-log axis
+{
+	gr->SubPlot(2,2,0,"<_");	gr->Title("Semi-log axis");	gr->SetRanges(0.01,100,-1,1);	gr->SetFunc("lg(x)","");
+	gr->Axis();	gr->Grid("xy","g");	gr->FPlot("sin(1/x)");	gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0);
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Log-log axis");	gr->SetRanges(0.01,100,0.1,100);	gr->SetFunc("lg(x)","lg(y)");
+	gr->Axis();	gr->Grid("!","h=");	gr->Grid();	gr->FPlot("sqrt(1+x^2)");	gr->Label('x',"x",0); gr->Label('y', "y = \\sqrt{1+x^2}",0);
+	gr->SubPlot(2,2,2,"<_");	gr->Title("Minus-log axis");	gr->SetRanges(-100,-0.01,-100,-0.1);	gr->SetFunc("-lg(-x)","-lg(-y)");
+	gr->Axis();	gr->FPlot("-sqrt(1+x^2)");	gr->Label('x',"x",0); gr->Label('y', "y = -\\sqrt{1+x^2}",0);
+	gr->SubPlot(2,2,3,"<_");	gr->Title("Log-ticks");	gr->SetRanges(0.1,100,0,100);	gr->SetFunc("sqrt(x)","");
+	gr->Axis();	gr->FPlot("x");	gr->Label('x',"x",1); gr->Label('y', "y = x",0);
+}
+
Sample loglog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.69 Sample ‘map

+ + +

Example of map. +

+

MGL code: +

new a 50 40 'x':new b 50 40 'y':zrange -2 2:text 0 0 '\to'
+subplot 2 1 0:text 0 1.1 '\{x, y\}' '' -2:box:map a b 'brgk'
+subplot 2 1 1:text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2
+box:fill a '(x^3+y^3)/2':fill b '(x-y)/2':map a b 'brgk'
+
+

C++ code: +

void smgl_map(mglGraph *gr)	// example of mapping
+{
+	mglData a(50, 40), b(50, 40);
+	gr->Puts(mglPoint(0, 0), "\\to", ":C", -1.4);
+	gr->SetRanges(-1,1,-1,1,-2,2);
+
+	gr->SubPlot(2, 1, 0);
+	gr->Fill(a,"x");	gr->Fill(b,"y");
+	gr->Puts(mglPoint(0, 1.1), "\\{x, y\\}", ":C", -2);		gr->Box();
+	gr->Map(a, b, "brgk");
+
+	gr->SubPlot(2, 1, 1);
+	gr->Fill(a,"(x^3+y^3)/2");	gr->Fill(b,"(x-y)/2");
+	gr->Puts(mglPoint(0, 1.1), "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", ":C", -2);
+	gr->Box();
+	gr->Map(a, b, "brgk");
+}
+
Sample map +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.70 Sample ‘mark

+ + +

Example of mark. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Mark plot (default)':box:mark y y1 's'
+
+

C++ code: +

void smgl_mark(mglGraph *gr)
+{
+	mglData y,y1;	mgls_prepare1d(&y,&y1);
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Mark plot (default)");	}
+	gr->Box();	gr->Mark(y,y1,"s");
+}
+
Sample mark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.71 Sample ‘mask

+ + +

Example of mask kinds. +

+

MGL code: +

new a 10 10 'x'
+subplot 5 4 0 '':title '"-" mask':dens a '3-'
+subplot 5 4 1 '':title '"+" mask':dens a '3+'
+subplot 5 4 2 '':title '"=" mask':dens a '3='
+subplot 5 4 3 '':title '";" mask':dens a '3;'
+subplot 5 4 4 '':title '";I" mask':dens a '3;I'
+subplot 5 4 5 '':title '"o" mask':dens a '3o'
+subplot 5 4 6 '':title '"O" mask':dens a '3O'
+subplot 5 4 7 '':title '"s" mask':dens a '3s'
+subplot 5 4 8 '':title '"S" mask':dens a '3S'
+subplot 5 4 9 '':title '";/" mask':dens a '3;/'
+subplot 5 4 10 '':title '"~" mask':dens a '3~'
+subplot 5 4 11 '':title '"<" mask':dens a '3<'
+subplot 5 4 12 '':title '">" mask':dens a '3>'
+subplot 5 4 13 '':title '"j" mask':dens a '3j'
+subplot 5 4 14 '':title '"-;\" mask':dens a '3\;'
+subplot 5 4 15 '':title '"d" mask':dens a '3d'
+subplot 5 4 16 '':title '"D" mask':dens a '3D'
+subplot 5 4 17 '':title '"*" mask':dens a '3*'
+subplot 5 4 18 '':title '"\^" mask':dens a '3^'
+subplot 5 4 19 '':title 'manual mask'
+mask '+' '24242424FF0101FF':dens a '3+'
+
+

C++ code: +

void smgl_mask(mglGraph *gr)
+{
+	mglData a(10,10);	a.Fill(-1,1);
+	gr->SubPlot(5,4,0,"");	gr->Title("'-' mask");	gr->Dens(a,"3-");
+	gr->SubPlot(5,4,1,"");	gr->Title("'+' mask");	gr->Dens(a,"3+");
+	gr->SubPlot(5,4,2,"");	gr->Title("'=' mask");	gr->Dens(a,"3=");
+	gr->SubPlot(5,4,3,"");	gr->Title("';' mask");	gr->Dens(a,"3;");
+	gr->SubPlot(5,4,4,"");	gr->Title("';I' mask");	gr->Dens(a,"3;I");
+	gr->SubPlot(5,4,5,"");	gr->Title("'o' mask");	gr->Dens(a,"3o");
+	gr->SubPlot(5,4,6,"");	gr->Title("'O' mask");	gr->Dens(a,"3O");
+	gr->SubPlot(5,4,7,"");	gr->Title("'s' mask");	gr->Dens(a,"3s");
+	gr->SubPlot(5,4,8,"");	gr->Title("'S' mask");	gr->Dens(a,"3S");
+	gr->SubPlot(5,4,9,"");	gr->Title("';/' mask");	gr->Dens(a,"3;/");
+	gr->SubPlot(5,4,10,"");	gr->Title("'~' mask");	gr->Dens(a,"3~");
+	gr->SubPlot(5,4,11,"");	gr->Title("'<' mask");	gr->Dens(a,"3<");
+	gr->SubPlot(5,4,12,"");	gr->Title("'>' mask");	gr->Dens(a,"3>");
+	gr->SubPlot(5,4,13,"");	gr->Title("'j' mask");	gr->Dens(a,"3j");
+	gr->SubPlot(5,4,14,"");	gr->Title("';\\\\' mask");	gr->Dens(a,"3;\\");
+	gr->SubPlot(5,4,15,"");	gr->Title("'d' mask");	gr->Dens(a,"3d");
+	gr->SubPlot(5,4,16,"");	gr->Title("'D' mask");	gr->Dens(a,"3D");
+	gr->SubPlot(5,4,17,"");	gr->Title("'*' mask");	gr->Dens(a,"3*");
+	gr->SubPlot(5,4,18,"");	gr->Title("'\\^' mask");	gr->Dens(a,"3^");
+	gr->SubPlot(5,4,19,"");	gr->Title("manual mask");
+	gr->SetMask('+', "24242424FF0101FF");	gr->Dens(a,"3+");
+}
+
Sample mask +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.72 Sample ‘mesh

+ + +

Function mesh draw wired surface. You can use meshnum for changing number of lines to be drawn. +

+

MGL code: +

call 'prepare2d'
+title 'Mesh plot':rotate 50 60:box:mesh a
+
+

C++ code: +

void smgl_mesh(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Mesh plot");
+	gr->Rotate(50,60);	gr->Box();	gr->Mesh(a);
+}
+
Sample mesh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.73 Sample ‘mirror

+ + +

Example of using options. +

+

MGL code: +

new a 31 41 '-pi*x*exp(-(y+1)^2-4*x^2)'
+subplot 2 2 0:title 'Options for coordinates':alpha on:light on:rotate 40 60:box
+surf a 'r';yrange 0 1:surf a 'b';yrange 0 -1
+subplot 2 2 1:title 'Option "meshnum"':rotate 40 60:box
+mesh a 'r'; yrange 0 1:mesh a 'b';yrange 0 -1; meshnum 5
+subplot 2 2 2:title 'Option "alpha"':rotate 40 60:box
+surf a 'r';yrange 0 1; alpha 0.7:surf a 'b';yrange 0 -1; alpha 0.3
+subplot 2 2 3 '<_':title 'Option "legend"'
+fplot 'x^3' 'r'; legend 'y = x^3':fplot 'cos(pi*x)' 'b'; legend 'y = cos \pi x'
+box:axis:legend 2
+
+

C++ code: +

void smgl_mirror(mglGraph *gr)	// flag #
+{
+	mglData a(31,41);
+	gr->Fill(a,"-pi*x*exp(-(y+1)^2-4*x^2)");
+
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Options for coordinates");	}
+	gr->Alpha(true);	gr->Light(true);
+	gr->Rotate(40,60);	gr->Box();
+	gr->Surf(a,"r","yrange 0 1"); gr->Surf(a,"b","yrange 0 -1");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("Option 'meshnum'");
+	gr->Rotate(40,60);	gr->Box();
+	gr->Mesh(a,"r","yrange 0 1"); gr->Mesh(a,"b","yrange 0 -1; meshnum 5");
+	gr->SubPlot(2,2,2);	gr->Title("Option 'alpha'");
+	gr->Rotate(40,60);	gr->Box();
+	gr->Surf(a,"r","yrange 0 1; alpha 0.7"); gr->Surf(a,"b","yrange 0 -1; alpha 0.3");
+	gr->SubPlot(2,2,3,"<_");	gr->Title("Option 'legend'");
+	gr->FPlot("x^3","r","legend 'y = x^3'"); gr->FPlot("cos(pi*x)","b","legend 'y = cos \\pi x'");
+	gr->Box();	gr->Axis();	gr->Legend(2,"");
+}
+
Sample mirror +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.74 Sample ‘molecule

+ + +

Example of drawing molecules. +

+

MGL code: +

alpha on:light on
+subplot 2 2 0 '':title 'Methane, CH_4':rotate 60 120
+sphere 0 0 0 0.25 'k':drop 0 0 0 0 0 1 0.35 'h' 1 2:sphere 0 0 0.7 0.25 'g'
+drop 0 0 0 -0.94 0 -0.33 0.35 'h' 1 2:sphere -0.66 0 -0.23 0.25 'g'
+drop 0 0 0 0.47 0.82 -0.33 0.35 'h' 1 2:sphere 0.33 0.57 -0.23 0.25 'g'
+drop 0 0 0 0.47 -0.82 -0.33 0.35 'h' 1 2:sphere 0.33 -0.57 -0.23 0.25 'g'
+subplot 2 2 1 '':title 'Water, H{_2}O':rotate 60 100
+sphere 0 0 0 0.25 'r':drop 0 0 0 0.3 0.5 0 0.3 'm' 1 2:sphere 0.3 0.5 0 0.25 'g'
+drop 0 0 0 0.3 -0.5 0 0.3 'm' 1 2:sphere 0.3 -0.5 0 0.25 'g'
+subplot 2 2 2 '':title 'Oxygen, O_2':rotate 60 120
+drop 0 0.5 0 0 -0.3 0 0.3 'm' 1 2:sphere 0 0.5 0 0.25 'r'
+drop 0 -0.5 0 0 0.3 0 0.3 'm' 1 2:sphere 0 -0.5 0 0.25 'r'
+subplot 2 2 3 '':title 'Ammonia, NH_3':rotate 60 120
+sphere 0 0 0 0.25 'b':drop 0 0 0 0.33 0.57 0 0.32 'n' 1 2
+sphere 0.33 0.57 0 0.25 'g':drop 0 0 0 0.33 -0.57 0 0.32 'n' 1 2
+sphere 0.33 -0.57 0 0.25 'g':drop 0 0 0 -0.65 0 0 0.32 'n' 1 2
+sphere -0.65 0 0 0.25 'g'
+
+

C++ code: +

void smgl_molecule(mglGraph *gr)	// example of moleculas
+{
+	gr->VertexColor(false);	gr->Compression(false); // per-vertex colors and compression are detrimental to transparency
+	gr->DoubleSided(false); // we do not get into atoms, while rendering internal surface has negative impact on trasparency
+	gr->Alpha(true);	gr->Light(true);
+
+	gr->SubPlot(2,2,0,"");	gr->Title("Methane, CH_4");
+	gr->StartGroup("Methane");
+	gr->Rotate(60,120);
+	gr->Sphere(mglPoint(0,0,0),0.25,"k");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0,0,1),0.35,"h",1,2);
+	gr->Sphere(mglPoint(0,0,0.7),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(-0.94,0,-0.33),0.35,"h",1,2);
+	gr->Sphere(mglPoint(-0.66,0,-0.23),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.47,0.82,-0.33),0.35,"h",1,2);
+	gr->Sphere(mglPoint(0.33,0.57,-0.23),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.47,-0.82,-0.33),0.35,"h",1,2);
+	gr->Sphere(mglPoint(0.33,-0.57,-0.23),0.25,"g");
+	gr->EndGroup();
+
+	gr->SubPlot(2,2,1,"");	gr->Title("Water, H_{2}O");
+	gr->StartGroup("Water");
+	gr->Rotate(60,100);
+	gr->StartGroup("Water_O");
+	gr->Sphere(mglPoint(0,0,0),0.25,"r");
+	gr->EndGroup();
+	gr->StartGroup("Water_Bond_1");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.3,0.5,0),0.3,"m",1,2);
+	gr->EndGroup();
+	gr->StartGroup("Water_H_1");
+	gr->Sphere(mglPoint(0.3,0.5,0),0.25,"g");
+	gr->EndGroup();
+	gr->StartGroup("Water_Bond_2");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.3,-0.5,0),0.3,"m",1,2);
+	gr->EndGroup();
+	gr->StartGroup("Water_H_2");
+	gr->Sphere(mglPoint(0.3,-0.5,0),0.25,"g");
+	gr->EndGroup();
+	gr->EndGroup();
+
+	gr->SubPlot(2,2,2,"");	gr->Title("Oxygen, O_2");
+	gr->StartGroup("Oxygen");
+	gr->Rotate(60,120);
+	gr->Drop(mglPoint(0,0.5,0),mglPoint(0,-0.3,0),0.3,"m",1,2);
+	gr->Sphere(mglPoint(0,0.5,0),0.25,"r");
+	gr->Drop(mglPoint(0,-0.5,0),mglPoint(0,0.3,0),0.3,"m",1,2);
+	gr->Sphere(mglPoint(0,-0.5,0),0.25,"r");
+	gr->EndGroup();
+
+	gr->SubPlot(2,2,3,"");	gr->Title("Ammonia, NH_3");
+	gr->StartGroup("Ammonia");
+	gr->Rotate(60,120);
+	gr->Sphere(mglPoint(0,0,0),0.25,"b");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.33,0.57,0),0.32,"n",1,2);
+	gr->Sphere(mglPoint(0.33,0.57,0),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(0.33,-0.57,0),0.32,"n",1,2);
+	gr->Sphere(mglPoint(0.33,-0.57,0),0.25,"g");
+	gr->Drop(mglPoint(0,0,0),mglPoint(-0.65,0,0),0.32,"n",1,2);
+	gr->Sphere(mglPoint(-0.65,0,0),0.25,"g");
+	gr->EndGroup();
+	gr->DoubleSided( true ); // put back
+}
+
Sample molecule +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.75 Sample ‘ode

+ + +

Example of phase plain created by ode solving, contour lines (cont) and flow threads. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Cont':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new f 100 100 'y^2+2*x^3-x^2-0.5':cont f
+
+subplot 2 2 1 '<_':title 'Flow':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new fx 100 100 'x-3*x^2'
+new fy 100 100 'y'
+flow fy fx 'v';value 7
+
+subplot 2 2 2 '<_':title 'ODE':box
+axis:xlabel 'x':ylabel '\dot{x}'
+for $x -1 1 0.1
+  ode r 'y;x-3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+  ode r '-y;-x+3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+next
+
+

C++ code: +

void smgl_ode(mglGraph *gr)
+{
+	gr->SubPlot(2,2,0,"<_");	gr->Title("Cont");	gr->Box();
+	gr->Axis();	gr->Label('x',"x");	gr->Label('y',"\\dot{x}");
+	mglData f(100,100);	gr->Fill(f,"y^2+2*x^3-x^2-0.5");
+	gr->Cont(f);
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Flow");	gr->Box();
+	gr->Axis();	gr->Label('x',"x");	gr->Label('y',"\\dot{x}");
+	mglData fx(100,100), fy(100,100);	gr->Fill(fx,"x-3*x^2");	gr->Fill(fy,"y");
+	gr->Flow(fy,fx,"v","value 7");
+	gr->SubPlot(2,2,2,"<_");	gr->Title("ODE");	gr->Box();
+	gr->Axis();	gr->Label('x',"x");	gr->Label('y',"\\dot{x}");
+	for(double x=-1;x<1;x+=0.1)
+	{
+		mglData in(2), r;	in.a[0]=x;
+		r = mglODE("y;x-3*x^2","xy",in);
+		gr->Plot(r.SubData(0), r.SubData(1));
+		r = mglODE("-y;-x+3*x^2","xy",in);
+		gr->Plot(r.SubData(0), r.SubData(1));
+	}
+}
+
Sample ode +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.76 Sample ‘ohlc

+ + +

Function ohlc draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high) and minimal(low) values, as well as horizontal lines before/after vertical line for initial(open)/final(close) values of some process. +

+

MGL code: +

new o 10 '0.5*sin(pi*x)'
+new c 10 '0.5*sin(pi*(x+2/9))'
+new l 10 '0.3*rnd-0.8'
+new h 10 '0.3*rnd+0.5'
+subplot 1 1 0 '':title 'OHLC plot':box:ohlc o h l c
+
+

C++ code: +

void smgl_ohlc(mglGraph *gr)	// flow threads and density plot
+{
+	mglData o(10), h(10), l(10), c(10);
+	gr->Fill(o,"0.5*sin(pi*x)");	gr->Fill(c,"0.5*sin(pi*(x+2/9))");
+	gr->Fill(l,"0.3*rnd-0.8");		gr->Fill(h,"0.3*rnd+0.5");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("OHLC plot");	}
+	gr->Box();	gr->OHLC(o,h,l,c);
+}
+
Sample ohlc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.77 Sample ‘param1

+ + +

Example of parametric plots for 1D data. +

+

MGL code: +

new x 100 'sin(pi*x)'
+new y 100 'cos(pi*x)'
+new z 100 'sin(2*pi*x)'
+new c 100 'cos(2*pi*x)'
+
+subplot 4 3 0:rotate 40 60:box:plot x y z
+subplot 4 3 1:rotate 40 60:box:area x y z
+subplot 4 3 2:rotate 40 60:box:tens x y z c
+subplot 4 3 3:rotate 40 60:box:bars x y z
+subplot 4 3 4:rotate 40 60:box:stem x y z
+subplot 4 3 5:rotate 40 60:box:textmark x y z c*2 '\alpha'
+subplot 4 3 6:rotate 40 60:box:tube x y z c/10
+subplot 4 3 7:rotate 40 60:box:mark x y z c 's'
+subplot 4 3 8:box:error x y z/10 c/10
+subplot 4 3 9:rotate 40 60:box:step x y z
+subplot 4 3 10:rotate 40 60:box:torus x z 'z';light on
+subplot 4 3 11:rotate 40 60:box:label x y z '%z'
+
+

C++ code: +

void smgl_param1(mglGraph *gr)	// 1d parametric plots
+{
+	mglData x(100), y(100), z(100), c(100);
+	gr->Fill(x,"sin(pi*x)");	gr->Fill(y,"cos(pi*x)");
+	gr->Fill(z,"sin(2*pi*x)");	gr->Fill(c,"cos(2*pi*x)");
+
+	gr->SubPlot(4,3,0);	gr->Rotate(40,60);	gr->Box();	gr->Plot(x,y,z);
+	gr->SubPlot(4,3,1);	gr->Rotate(40,60);	gr->Box();	gr->Area(x,y,z);
+	gr->SubPlot(4,3,2);	gr->Rotate(40,60);	gr->Box();	gr->Tens(x,y,z,c);
+	gr->SubPlot(4,3,3);	gr->Rotate(40,60);	gr->Box();	gr->Bars(x,y,z);
+	gr->SubPlot(4,3,4);	gr->Rotate(40,60);	gr->Box();	gr->Stem(x,y,z);
+	gr->SubPlot(4,3,5);	gr->Rotate(40,60);	gr->Box();	gr->TextMark(x,y,z,c*2,"\\alpha");
+	gr->SubPlot(4,3,6);	gr->Rotate(40,60);	gr->Box();	gr->Tube(x,y,z,c/10,"","light on");
+	gr->SubPlot(4,3,7);	gr->Rotate(40,60);	gr->Box();	gr->Mark(x,y,z,c,"s");
+	gr->SubPlot(4,3,8);	gr->Rotate(40,60);	gr->Box();	gr->Error(x,y,z/10,c/10);
+	gr->SubPlot(4,3,9);	gr->Rotate(40,60);	gr->Box();	gr->Step(x,y,z);
+	gr->SubPlot(4,3,10);gr->Rotate(40,60);	gr->Box();	gr->Torus(x,z,"z","light on");
+	gr->SubPlot(4,3,11);gr->Rotate(40,60);	gr->Box();	gr->Label(x,y,z,"%z");
+}
+
Sample param1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.78 Sample ‘param2

+ + +

Example of parametric plots for 2D data. +

+

MGL code: +

new x 100 100 'sin(pi*(x+y)/2)*cos(pi*y/2)'
+new y 100 100 'cos(pi*(x+y)/2)*cos(pi*y/2)'
+new z 100 100 'sin(pi*y/2)'
+new c 100 100 'cos(pi*x)'
+
+subplot 4 4 0:rotate 40 60:box:surf x y z
+subplot 4 4 1:rotate 40 60:box:surfc x y z c
+subplot 4 4 2:rotate 40 60:box:surfa x y z c;alpha 1
+subplot 4 4 3:rotate 40 60:box:mesh x y z;meshnum 10
+subplot 4 4 4:rotate 40 60:box:tile x y z;meshnum 10
+subplot 4 4 5:rotate 40 60:box:tiles x y z c;meshnum 10
+subplot 4 4 6:rotate 40 60:box:axial x y z;alpha 0.5;light on
+subplot 4 4 7:rotate 40 60:box:cont x y z
+subplot 4 4 8:rotate 40 60:box:contf x y z;light on:contv x y z;light on
+subplot 4 4 9:rotate 40 60:box:belt x y z 'x';meshnum 10;light on
+subplot 4 4 10:rotate 40 60:box:dens x y z;alpha 0.5
+subplot 4 4 11:rotate 40 60:box
+fall x y z 'g';meshnum 10:fall x y z 'rx';meshnum 10
+subplot 4 4 12:rotate 40 60:box:belt x y z '';meshnum 10;light on
+subplot 4 4 13:rotate 40 60:box:boxs x y z '';meshnum 10;light on
+subplot 4 4 14:rotate 40 60:box:boxs x y z '#';meshnum 10;light on
+subplot 4 4 15:rotate 40 60:box:boxs x y z '@';meshnum 10;light on
+
+

C++ code: +

void smgl_param2(mglGraph *gr)	// 2d parametric plots
+{
+	mglData x(100,100), y(100,100), z(100,100), c(100,100);
+	gr->Fill(x,"sin(pi*(x+y)/2)*cos(pi*y/2)");	gr->Fill(y,"cos(pi*(x+y)/2)*cos(pi*y/2)");
+	gr->Fill(z,"sin(pi*y/2)");	gr->Fill(c,"cos(pi*x)");
+
+	gr->SubPlot(4,4,0);	gr->Rotate(40,60);	gr->Box();	gr->Surf(x,y,z);
+	gr->SubPlot(4,4,1);	gr->Rotate(40,60);	gr->Box();	gr->SurfC(x,y,z,c);
+	gr->SubPlot(4,4,2);	gr->Rotate(40,60);	gr->Box();	gr->SurfA(x,y,z,c,"","alpha 1");
+	gr->SubPlot(4,4,3);	gr->Rotate(40,60);	gr->Box();	gr->Mesh(x,y,z,"","meshnum 10");
+	gr->SubPlot(4,4,4);	gr->Rotate(40,60);	gr->Box();	gr->Tile(x,y,z,"","meshnum 10");
+	gr->SubPlot(4,4,5);	gr->Rotate(40,60);	gr->Box();	gr->TileS(x,y,z,c,"","meshnum 10");
+	gr->SubPlot(4,4,6);	gr->Rotate(40,60);	gr->Box();	gr->Axial(x,y,z,"","alpha 0.5;light on");
+	gr->SubPlot(4,4,7);	gr->Rotate(40,60);	gr->Box();	gr->Cont(x,y,z);
+	gr->SubPlot(4,4,8);	gr->Rotate(40,60);	gr->Box();	gr->ContF(x,y,z,"","light on");	gr->ContV(x,y,z,"","light on");
+	gr->SubPlot(4,4,9);	gr->Rotate(40,60);	gr->Box();	gr->Belt(x,y,z,"x","meshnum 10;light on");
+	gr->SubPlot(4,4,10);gr->Rotate(40,60);	gr->Box();	gr->Dens(x,y,z,"","alpha 0.5");
+	gr->SubPlot(4,4,11);gr->Rotate(40,60);	gr->Box();
+	gr->Fall(x,y,z,"g","meshnum 10");	gr->Fall(x,y,z,"rx","meshnum 10");
+	gr->SubPlot(4,4,12);	gr->Rotate(40,60);	gr->Box();	gr->Belt(x,y,z,"","meshnum 10;light on");
+	gr->SubPlot(4,4,13);	gr->Rotate(40,60);	gr->Box();	gr->Boxs(x,y,z,"","meshnum 10;light on");
+	gr->SubPlot(4,4,14);	gr->Rotate(40,60);	gr->Box();	gr->Boxs(x,y,z,"#","meshnum 10");
+	gr->SubPlot(4,4,15);	gr->Rotate(40,60);	gr->Box();	gr->Boxs(x,y,z,"@","meshnum 10;light on");
+}
+
Sample param2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.79 Sample ‘param3

+ + +

Example of parametric plots for 3D data. +

+

MGL code: +

new x 50 50 50 '(x+2)/3*sin(pi*y/2)'
+new y 50 50 50 '(x+2)/3*cos(pi*y/2)'
+new z 50 50 50 'z'
+new c 50 50 50 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 50 50 50 '1-2*tanh(2*(x+y)^2)'
+
+alpha on:light on
+subplot 4 3 0:rotate 40 60:box:surf3 x y z c
+subplot 4 3 1:rotate 40 60:box:surf3c x y z c d
+subplot 4 3 2:rotate 40 60:box:surf3a x y z c d
+subplot 4 3 3:rotate 40 60:box:cloud x y z c
+subplot 4 3 4:rotate 40 60:box:cont3 x y z c:cont3 x y z c 'x':cont3 x y z c 'z'
+subplot 4 3 5:rotate 40 60:box:contf3 x y z c:contf3 x y z c 'x':contf3 x y z c 'z'
+subplot 4 3 6:rotate 40 60:box:dens3 x y z c:dens3 x y z c 'x':dens3 x y z c 'z'
+subplot 4 3 7:rotate 40 60:box:dots x y z c;meshnum 15
+subplot 4 3 8:rotate 40 60:box:densx c '' 0:densy c '' 0:densz c '' 0
+subplot 4 3 9:rotate 40 60:box:contx c '' 0:conty c '' 0:contz c '' 0
+subplot 4 3 10:rotate 40 60:box:contfx c '' 0:contfy c '' 0:contfz c '' 0
+
+

C++ code: +

void smgl_param3(mglGraph *gr)	// 3d parametric plots
+{
+	mglData x(50,50,50), y(50,50,50), z(50,50,50), c(50,50,50), d(50,50,50);
+	gr->Fill(x,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y,"(x+2)/3*cos(pi*y/2)");	gr->Fill(z,"z");
+	gr->Fill(c,"-2*(x^2+y^2+z^4-z^2)+0.2");	gr->Fill(d,"1-2*tanh(2*(x+y)^2)");
+
+	gr->Light(true);	gr->Alpha(true);
+	gr->SubPlot(4,3,0);	gr->Rotate(40,60);	gr->Box();	gr->Surf3(x,y,z,c);
+	gr->SubPlot(4,3,1);	gr->Rotate(40,60);	gr->Box();	gr->Surf3C(x,y,z,c,d);
+	gr->SubPlot(4,3,2);	gr->Rotate(40,60);	gr->Box();	gr->Surf3A(x,y,z,c,d);
+	gr->SubPlot(4,3,3);	gr->Rotate(40,60);	gr->Box();	gr->Cloud(x,y,z,c);
+	gr->SubPlot(4,3,4);	gr->Rotate(40,60);	gr->Box();	gr->Cont3(x,y,z,c);	gr->Cont3(x,y,z,c,"x");	gr->Cont3(x,y,z,c,"z");
+	gr->SubPlot(4,3,5);	gr->Rotate(40,60);	gr->Box();	gr->ContF3(x,y,z,c);gr->ContF3(x,y,z,c,"x");gr->ContF3(x,y,z,c,"z");
+	gr->SubPlot(4,3,6);	gr->Rotate(40,60);	gr->Box();	gr->Dens3(x,y,z,c);	gr->Dens3(x,y,z,c,"x");	gr->Dens3(x,y,z,c,"z");
+	gr->SubPlot(4,3,7);	gr->Rotate(40,60);	gr->Box();	gr->Dots(x,y,z,c,"","meshnum 15");
+	gr->SubPlot(4,3,8);	gr->Rotate(40,60);	gr->Box();	gr->DensX(c,"",0);	gr->DensY(c,"",0);	gr->DensZ(c,"",0);
+	gr->SubPlot(4,3,9);	gr->Rotate(40,60);	gr->Box();	gr->ContX(c,"",0);	gr->ContY(c,"",0);	gr->ContZ(c,"",0);
+	gr->SubPlot(4,3,10);gr->Rotate(40,60);	gr->Box();	gr->ContFX(c,"",0);	gr->ContFY(c,"",0);	gr->ContFZ(c,"",0);
+}
+
Sample param3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.80 Sample ‘paramv

+ + +

Example of parametric plots for vector fields. +

+

MGL code: +

new x 20 20 20 '(x+2)/3*sin(pi*y/2)'
+new y 20 20 20 '(x+2)/3*cos(pi*y/2)'
+new z 20 20 20 'z+x'
+new ex 20 20 20 'x'
+new ey 20 20 20 'x^2+y'
+new ez 20 20 20 'y^2+z'
+
+new x1 50 50 '(x+2)/3*sin(pi*y/2)'
+new y1 50 50 '(x+2)/3*cos(pi*y/2)'
+new e1 50 50 'x'
+new e2 50 50 'x^2+y'
+
+subplot 3 3 0:rotate 40 60:box:vect x1 y1 e1 e2
+subplot 3 3 1:rotate 40 60:box:flow x1 y1 e1 e2
+subplot 3 3 2:rotate 40 60:box:pipe x1 y1 e1 e2
+subplot 3 3 3:rotate 40 60:box:dew x1 y1 e1 e2
+subplot 3 3 4:rotate 40 60:box:vect x y z ex ey ez
+subplot 3 3 5:rotate 40 60:box
+vect3 x y z ex ey ez:vect3 x y z ex ey ez 'x':vect3 x y z ex ey ez 'z'
+grid3 x y z z '{r9}':grid3 x y z z '{g9}x':grid3 x y z z '{b9}z'
+subplot 3 3 6:rotate 40 60:box:flow x y z ex ey ez
+subplot 3 3 7:rotate 40 60:box:pipe x y z ex ey ez
+
+

C++ code: +

void smgl_paramv(mglGraph *gr)	// parametric plots for vector field
+{
+	mglData x(20,20,20), y(20,20,20), z(20,20,20), ex(20,20,20), ey(20,20,20), ez(20,20,20);
+	gr->Fill(x,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y,"(x+2)/3*cos(pi*y/2)");	gr->Fill(z,"x+z");
+	gr->Fill(ex,"x");	gr->Fill(ey,"x^2+y");	gr->Fill(ez,"y^2+z");
+	mglData x1(20,20), y1(20,20), e1(20,20), e2(20,20);
+	gr->Fill(x1,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y1,"(x+2)/3*cos(pi*y/2)");
+	gr->Fill(e1,"x");	gr->Fill(e2,"x^2+y");
+
+	gr->SubPlot(3,3,0);	gr->Rotate(40,60);	gr->Box();	gr->Vect(x1,y1,e1,e2);
+	gr->SubPlot(3,3,1);	gr->Rotate(40,60);	gr->Box();	gr->Flow(x1,y1,e1,e2);
+	gr->SubPlot(3,3,2);	gr->Rotate(40,60);	gr->Box();	gr->Pipe(x1,y1,e1,e2);
+	gr->SubPlot(3,3,3);	gr->Rotate(40,60);	gr->Box();	gr->Dew(x1,y1,e1,e2);
+	gr->SubPlot(3,3,4);	gr->Rotate(40,60);	gr->Box();	gr->Vect(x,y,z,ex,ey,ez);
+	gr->SubPlot(3,3,5);	gr->Rotate(40,60);	gr->Box();
+	gr->Vect3(x,y,z,ex,ey,ez);	gr->Vect3(x,y,z,ex,ey,ez,"x");	gr->Vect3(x,y,z,ex,ey,ez,"z");
+	gr->Grid3(x,y,z,z,"{r9}");	gr->Grid3(x,y,z,z,"{g9}x");		gr->Grid3(x,y,z,z,"{b9}z");
+	gr->SubPlot(3,3,6);	gr->Rotate(40,60);	gr->Box();	gr->Flow(x,y,z,ex,ey,ez);
+	gr->SubPlot(3,3,7);	gr->Rotate(40,60);	gr->Box();	gr->Pipe(x,y,z,ex,ey,ez);
+}
+
Sample paramv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.81 Sample ‘parser

+ + +

Basic MGL script. +

+

MGL code: +

title 'MGL parser sample'
+# call function
+call 'sample'
+
+# ordinary for-loop
+for $0 -1 1 0.1
+if $0<0:line 0 0 1 $0 'r':else:line 0 0 1 $0 'g':endif
+next
+
+# if-elseif-else
+for $i -1 1 0.5
+if $i<0
+text 1.1 $i '$i' 'b'
+elseif $i>0
+text 1.1 $i '$i' 'r'
+else
+text 1.1 $i '$i'
+endif
+next
+
+# ordinary do-while
+do
+defnum $i $i-0.2
+line 0 0 $i 1 'b'
+while $i>0
+
+# do-next-break
+do
+defnum $i $i-0.2
+if $i<-1 then break
+line 0 0 $i 1 'm'
+next
+
+# for-while-continue
+for $i -5 10
+text $i/5 1.1 'a'+($i+5)
+if $i<0
+text $i/5-0.06 1.1 '--' 'b'
+elseif mod($i,2)=0
+text $i/5-0.06 1.1 '~' 'r'
+else
+# NOTE: 'continue' bypass the 'while'!
+continue
+endif
+# NOTE: 'while' limit the actual number of iterations
+while $i<5
+
+# nested loops
+for $i 0 1 0.1
+for $j 0 1 0.1
+ball $i $j
+if $j>0.5 then continue
+ball $i $j 'b+'
+next
+next
+
+func 'sample'
+new dat 100 'sin(2*pi*(i/99+1))'
+plot dat;xrange -1 0
+box:axis
+xlabel 'x':ylabel 'y'
+return
+
+

C++ code: +

void smgl_parser(mglGraph *gr)	// example of MGL parsing
+{	// NOTE: MGL version show much more variants of loops and conditions.
+	gr->Title("MGL parser sample");
+	double a[100];   // let a_i = sin(4*pi*x), x=0...1
+	for(int i=0;i<100;i++)a[i]=sin(2*M_PI*i/99);
+	mglParse *parser = new mglParse;
+	// Add MGL variable and set yours data to it.
+	mglData *d = dynamic_cast<mglData*>(parser->AddVar("dat"));
+	if(d)	d->Set(a,100);
+	parser->Execute(gr, "plot dat; xrange -1 0\nbox\naxis");
+	// You may break script at any line do something
+	// and continue after that.
+	parser->Execute(gr, "xlabel 'x'\nylabel 'y'\nbox");
+	// Also you may use cycles or conditions in script.
+	parser->Execute(gr, "for $0 -1 1 0.1\nif $0<0\n"
+		"line 0 0 1 $0 'r':else:line 0 0 1 $0 'g'\n"
+		"endif\nnext");
+	// You may use for or do-while loops as C/C++ one
+	double i=1;
+	do	{
+		char buf[64];	sprintf(buf,"line 0 0 %g 1 'b'",i);
+		parser->Execute(gr, buf);	i=i-0.2;
+	} while(i>0);
+	// or as MGL one.
+	parser->Execute(gr, "for $i -1 1 0.5\n"
+		"if $i<0\ntext 1.1 $i '$i' 'b'\n"
+		"elseif $i>0\ntext 1.1 $i '$i' 'r'\n"
+		"else\ntext 1.1 $i '$i'\nendif\nnext\n");
+	// There are 'break' and 'continue' commands in MGL too.
+	// NOTE: 'next' act as "while(1)" in do-while loops.
+	parser->Execute(gr, "do\ndefnum $i $i-0.2\n"
+		"if $i<-1 then break\nline 0 0 $i 1 'm'\nnext\n");
+	// One issue with 'continue' -- it bypass 'while' checking
+	parser->Execute(gr, "for $i -5 10\ntext $i/5 1.1 'a'+($i+5)\nif $i<0\n"
+		"text $i/5-0.06 1.1 '--' 'b'\n"
+		"elseif mod($i,2)=0\ntext $i/5-0.06 1.1 '~' 'r'\n"
+		"else\ncontinue\nendif\n"
+		// NOTE: 'while' limit the actual number of iterations in for-loop.
+		"while $i<5\n");
+	// Finally, MGL support nested loops too.
+	parser->Execute(gr, "for $i 0 1 0.1\nfor $j 0 1 0.1\nball $i $j\n"
+		"if $j>0.5 then continue\nball $i $j 'b+'\nnext\nnext\n");
+	// Clean up memory.
+	delete parser;
+}
+
Sample parser +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.82 Sample ‘pde

+ + +

Example of pde solver. +

+

MGL code: +

new re 128 'exp(-48*(x+0.7)^2)':new im 128
+pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30
+transpose a
+subplot 1 1 0 '<_':title 'PDE solver'
+axis:xlabel '\i x':ylabel '\i z'
+crange 0 1:dens a 'wyrRk'
+fplot '-x' 'k|'
+text 0 0.95 'Equation: ik_0\partial_zu + \Delta u + x\cdot u + i \frac{x+z}{2}\cdot u = 0\n{}absorption: (x+z)/2 for x+z>0'
+
+

C++ code: +

void smgl_pde(mglGraph *gr)	// PDE sample
+{
+	mglData a,re(128),im(128);
+	gr->Fill(re,"exp(-48*(x+0.7)^2)");
+	a = gr->PDE("p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, 0.01, 30);
+	a.Transpose("yxz");
+	if(big!=3)	{gr->SubPlot(1,1,0,"<_");	gr->Title("PDE solver");	}
+	gr->SetRange('c',0,1);	gr->Dens(a,"wyrRk");
+	gr->Axis();	gr->Label('x', "\\i x");	gr->Label('y', "\\i z");
+	gr->FPlot("-x", "k|");
+	gr->Puts(mglPoint(0, 0.95), "Equation: ik_0\\partial_zu + \\Delta u + x\\cdot u + i \\frac{x+z}{2}\\cdot u = 0\nabsorption: (x+z)/2 for x+z>0");
+}
+
Sample pde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.83 Sample ‘pendelta

+ + +

Example of pendelta for lines and glyphs smoothing. +

+

MGL code: +

quality 6
+list a 0.25 0.5 1 2 4
+for $0 0 4
+pendelta a($0)
+define $1 0.5*$0-1
+line -1 $1 1 $1 'r'
+text 0 $1 'delta=',a($0)
+next
+
+

C++ code: +

void smgl_pendelta(mglGraph *gr)
+{
+	double a[5]={0.25,0.5,1,2,4};
+	gr->SetQuality(6);
+	char buf[64];
+	for(int i=0;i<5;i++)
+	{
+		gr->SetPenDelta(a[i]);
+		gr->Line(mglPoint(-1,0.5*i-1), mglPoint(1,0.5*i-1),"r");
+		sprintf(buf,"delta=%g",a[i]);
+		gr->Puts(mglPoint(0,0.5*i-1),buf);
+	}
+}
+
Sample pendelta +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.84 Sample ‘pipe

+ + +

Function pipe is similar to flow but draw pipes (tubes) which radius is proportional to the amplitude of vector field. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Pipe plot (default)':light on:box:pipe a b
+subplot 2 2 1 '':title '"i" style':box:pipe a b 'i'
+subplot 2 2 2 '':title 'from edges only':box:pipe a b '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:pipe ex ey ez '' 0.1
+
+

C++ code: +

void smgl_pipe(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2v(&a,&b);
+	if(big!=3)	{gr->SubPlot(2,2,0,"");	gr->Title("Pipe plot (default)");}
+	gr->Light(true);	gr->Box();	gr->Pipe(a,b);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("'i' style");	gr->Box();	gr->Pipe(a,b,"i");
+	gr->SubPlot(2,2,2,"");	gr->Title("'\\#' style");	gr->Box();	gr->Pipe(a,b,"#");
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Pipe(ex,ey,ez,"",0.1);
+}
+
Sample pipe +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.85 Sample ‘plot

+ + +

Function plot is most standard way to visualize 1D data array. By default, Plot use colors from palette. However, you can specify manual color/palette, and even set to use new color for each points by using ‘!’ style. Another feature is ‘ ’ style which draw only markers without line between points. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Plot plot (default)':box:plot y
+subplot 2 2 2 '':title ''!' style; 'rgb' palette':box:plot y 'o!rgb'
+subplot 2 2 3 '':title 'just markers':box:plot y ' +'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:plot xc yc z 'rs'
+
+

C++ code: +

void smgl_plot(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Plot plot (default)");	}
+	gr->Box();	gr->Plot(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style; 'rgb' palette");	gr->Box();	gr->Plot(y,"o!rgb");
+	gr->SubPlot(2,2,3,"");	gr->Title("just markers");	gr->Box();	gr->Plot(y," +");
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Plot(xc,yc,z,"rs");
+}
+
Sample plot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.86 Sample ‘pmap

+ + +

Function pmap draw Poincare map – show intersections of the curve and the surface. +

+

MGL code: +

subplot 1 1 0 '<_^':title 'Poincare map sample'
+ode r 'cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)' 'xyz' [0.1,0,0] 0.1 100
+rotate 40 60:copy x r(0):copy y r(1):copy z r(2)
+ranges x y z
+axis:plot x y z 'b'
+xlabel '\i x' 0:ylabel '\i y' 0:zlabel '\i z'
+pmap x y z z 'b#o'
+fsurf '0'
+
+

C++ code: +

void smgl_pmap(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_^");
+	if(big!=3)	gr->Title("Poincare map sample");
+	mglData ini(3);	ini[0]=0.1;
+	mglData r(mglODE("cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)","xyz",ini,0.1,100));
+	mglData x(r.SubData(0)),y(r.SubData(1)), z(r.SubData(2));
+	gr->Rotate(40,60);	gr->SetRanges(x,y,z);
+	gr->Axis();	gr->FSurf("0");	gr->Plot(x,y,z,"b");
+	gr->Label('x',"\\i x",0);	gr->Label('y',"\\i y",0);	gr->Label('z',"\\i z",0);
+	gr->Pmap(x,y,z,z, "b#o");
+}
+
Sample pmap +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.87 Sample ‘primitives

+ + +

Example of primitives: line, curve, rhomb, ellipse, face, sphere, drop, cone. +

+

MGL code: +

subplot 2 2 0 '':title 'Line, Curve, Rhomb, Ellipse' '' -1.5
+line -1 -1 -0.5 1 'qAI'
+curve -0.6 -1 1 1 0 1 1 1 'rA'
+ball 0 -0.5 '*':ball 1 -0.1 '*'
+rhomb 0 0.4 1 0.9 0.2 'b#'
+rhomb 0 0 1 0.4 0.2 'cg@'
+ellipse 0 -0.5 1 -0.1 0.2 'u#'
+ellipse 0 -1 1 -0.6 0.2 'm@'
+
+subplot 2 3 1 '':title 'Arc, Polygon, Symbol';size -1.2
+arc -0.6 0 -0.6 0.3 180 '2kA':ball -0.6 0
+polygon 0 0 0 0.4 6 'r'
+new x 50 'cos(3*pi*x)':new y 50 'sin(pi*x)'
+addsymbol 'a' x y
+symbol 0.7 0 'a'
+
+light on
+subplot 2 3 3 '<^>' 0 -0.2:title 'Face[xyz]';size -1.5:rotate 50 60:box
+facex 1 0 -1 1 1 'r':facey -1 -1 -1 1 1 'g':facez 1 -1 -1 -1 1 'b'
+face -1 -1 1 -1 1 1 1 -1 0 1 1 1 'bmgr'
+
+subplot 2 3 5 '':title 'Cone';size -1.5
+cone -0.7 -0.3 0 -0.7 0.7 0.5 0.2 0.1 'b':text -0.7 -0.7 'no edges\n(default)';size -1.5
+cone 0 -0.3 0 0 0.7 0.5 0.2 0.1 'g@':text 0 -0.7 'with edges\n("\@" style)';size -1.5
+cone 0.7 -0.3 0 0.7 0.7 0.5 0.2 0 'Ggb':text 0.7 -0.7 '"arrow" with\n{}gradient';size -1.5
+subplot 2 2 2 '':title 'Sphere and Drop'
+line -0.9 0 1 0.9 0 1
+text -0.9 0.4 'sh=0':drop -0.9 0 0 1 0.5 'r' 0:ball -0.9 0 1 'k'
+text -0.3 0.6 'sh=0.33':drop -0.3 0 0 1 0.5 'r' 0.33:ball -0.3 0 1 'k'
+text 0.3 0.8 'sh=0.67':drop 0.3 0 0 1 0.5 'r' 0.67:ball 0.3 0 1 'k'
+text 0.9 1. 'sh=1':drop 0.9 0 0 1 0.5 'r' 1:ball 0.9 0 1 'k'
+
+text -0.9 -1.1 'asp=0.33':drop -0.9 -0.7 0 1 0.5 'b' 0 0.33
+text -0.3 -1.1 'asp=0.67':drop -0.3 -0.7 0 1 0.5 'b' 0 0.67
+text 0.3 -1.1 'asp=1':drop 0.3 -0.7 0 1 0.5 'b' 0 1
+text 0.9 -1.1 'asp=1.5':drop 0.9 -0.7 0 1 0.5 'b' 0 1.5
+
+

C++ code: +

void smgl_primitives(mglGraph *gr)	// flag #
+{
+	gr->SubPlot(2,2,0,"");	gr->Title("Line, Curve, Rhomb, Ellipse","",-1.5);
+	gr->Line(mglPoint(-1,-1),mglPoint(-0.5,1),"qAI");
+	gr->Curve(mglPoint(-0.6,-1),mglPoint(1,1),mglPoint(0,1),mglPoint(1,1),"rA");
+	gr->Rhomb(mglPoint(0,0.4),mglPoint(1,0.9),0.2,"b#");
+	gr->Rhomb(mglPoint(0,0),mglPoint(1,0.4),0.2,"cg@");
+	gr->Ellipse(mglPoint(0,-0.5),mglPoint(1,-0.1),0.2,"u#");
+	gr->Ellipse(mglPoint(0,-1),mglPoint(1,-0.6),0.2,"m@");
+	gr->Mark(mglPoint(0,-0.5),"*");	gr->Mark(mglPoint(1,-0.1),"*");
+
+	gr->SubPlot(2,3,1,"");	gr->Title("Arc, Polygon, Symbol","", -1.2*2);
+	gr->Arc(mglPoint(-0.6,0), mglPoint(-0.6,0.3), 180, "2kA");	gr->Ball(-0.6,0);
+	gr->Polygon(mglPoint(), mglPoint(0,0.4), 6, "r");
+	mglData x(50), y(50);	gr->Fill(x,"cos(3*pi*x)");	gr->Fill(y,"sin(pi*x)");
+	gr->DefineSymbol('a',x,y);	gr->Symbol(mglPoint(0.7),'a');
+
+	gr->Light(true);
+	gr->SubPlot(2,3,3,"<^>",0,-0.2);	gr->Title("Face[xyz]", "", -1.5*2);
+	gr->Rotate(50,60);	gr->Box();
+	gr->FaceX(mglPoint(1,0,-1),1,1,"r");
+	gr->FaceY(mglPoint(-1,-1,-1),1,1,"g");
+	gr->FaceZ(mglPoint(1,-1,-1),-1,1,"b");
+	gr->Face(mglPoint(-1,-1,1),mglPoint(-1,1,1),mglPoint(1,-1,0),mglPoint(1,1,1),"bmgr");
+
+	gr->SubPlot(2,3,5,"");	gr->Title("Cone", "", -1.5*2);
+	gr->Cone(mglPoint(-0.7,-0.3),mglPoint(-0.7,0.7,0.5),0.2,0.1,"b");
+	gr->Puts(mglPoint(-0.7,-0.7),"no edges\n(default)","", -1.5);
+	gr->Cone(mglPoint(0,-0.3),mglPoint(0,0.7,0.5),0.2,0.1,"g@");
+	gr->Puts(mglPoint(0,-0.7),"with edges\n('\\@' style)","", -1.5);
+	gr->Cone(mglPoint(0.7,-0.3),mglPoint(0.7,0.7,0.5),0.2,0,"ry");
+	gr->Puts(mglPoint(0.7,-0.7),"'arrow' with\ngradient","", -1.5);
+
+	gr->SubPlot(2,2,2,"");	gr->Title("Sphere and Drop");	gr->Alpha(false);
+	gr->Puts(mglPoint(-0.9,0.4),"sh=0");		gr->Ball(mglPoint(-0.9,0,1),'k');
+	gr->Drop(mglPoint(-0.9,0),mglPoint(0,1),0.5,"r",0);
+	gr->Puts(mglPoint(-0.3,0.6),"sh=0.33");	gr->Ball(mglPoint(-0.3,0,1),'k');
+	gr->Drop(mglPoint(-0.3,0),mglPoint(0,1),0.5,"r",0.33);
+	gr->Puts(mglPoint(0.3,0.8),"sh=0.67");		gr->Ball(mglPoint(0.3,0,1),'k');
+	gr->Drop(mglPoint(0.3,0),mglPoint(0,1),0.5,"r",0.67);
+	gr->Puts(mglPoint(0.9,1),"sh=1");			gr->Ball(mglPoint(0.9,0,1),'k');
+	gr->Drop(mglPoint(0.9,0),mglPoint(0,1),0.5,"r",1);
+	gr->Line(mglPoint(-0.9,0,1),mglPoint(0.9,0,1),"b");
+
+	gr->Puts(mglPoint(-0.9,-1.1),"asp=0.33");
+	gr->Drop(mglPoint(-0.9,-0.7),mglPoint(0,1),0.5,"b",0,0.33);
+	gr->Puts(mglPoint(-0.3,-1.1),"asp=0.67");
+	gr->Drop(mglPoint(-0.3,-0.7),mglPoint(0,1),0.5,"b",0,0.67);
+	gr->Puts(mglPoint(0.3,-1.1),"asp=1");
+	gr->Drop(mglPoint(0.3,-0.7),mglPoint(0,1),0.5,"b",0,1);
+	gr->Puts(mglPoint(0.9,-1.1),"asp=1.5");
+	gr->Drop(mglPoint(0.9,-0.7),mglPoint(0,1),0.5,"b",0,1.5);
+}
+
Sample primitives +
+
+ + + +

10.88 Sample ‘projection

+ + +

Example of plot projection (ternary=4). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample':ternary 4:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+

C++ code: +

void smgl_projection(mglGraph *gr)	// flag #
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+	a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+	x.Modify("0.25*(1+cos(2*pi*x))");
+	y.Modify("0.25*(1+sin(2*pi*x))");
+	rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+	z.Modify("x");
+
+	if(big!=3)	gr->Title("Projection sample");
+	gr->Ternary(4);
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('x',"X",1);	gr->Label('y',"Y",1);	gr->Label('z',"Z",1);
+}
+
Sample projection +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.89 Sample ‘projection5

+ + +

Example of plot projection in ternary coordinates (ternary=5). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample (ternary)':ternary 5:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+

C++ code: +

void smgl_projection5(mglGraph *gr)	// flag #
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+	a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+	x.Modify("0.25*(1+cos(2*pi*x))");
+	y.Modify("0.25*(1+sin(2*pi*x))");
+	rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+	z.Modify("x");
+
+	if(big!=3)	gr->Title("Projection sample (ternary)");
+	gr->Ternary(5);
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('x',"X",1);	gr->Label('y',"Y",1);	gr->Label('z',"Z",1);
+}
+
Sample projection5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.90 Sample ‘pulse

+ + +

Example of pulse parameter determining. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Pulse sample'
+new a 100 'exp(-6*x^2)':ranges 0 a.nx-1 0 1
+axis:plot a
+
+pulse b a 'x'
+
+define m a.max
+
+line b(1) 0 b(1) m 'r='
+line b(1)-b(3)/2 0  b(1)-b(3)/2 m 'm|'
+line b(1)+b(3)/2 0  b(1)+b(3)/2 m 'm|'
+line 0 0.5*m a.nx-1 0.5*m 'h'
+new x 100 'x'
+plot b(0)*(1-((x-b(1))/b(2))^2) 'g'
+
+

C++ code: +

void smgl_pulse(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Pulse sample");
+	mglData a(100);	gr->Fill(a,"exp(-6*x^2)");
+	gr->SetRanges(0, a.nx-1, 0, 1);
+	gr->Axis();	gr->Plot(a);
+	mglData b(a.Pulse('x'));
+	double m = b[0];
+	gr->Line(mglPoint(b[1],0), mglPoint(b[1],m),"r=");
+	gr->Line(mglPoint(b[1]-b[3]/2,0), mglPoint(b[1]-b[3]/2,m),"m|");
+	gr->Line(mglPoint(b[1]+b[3]/2,0), mglPoint(b[1]+b[3]/2,m),"m|");
+	gr->Line(mglPoint(0,m/2), mglPoint(a.nx-1,m/2),"h");
+	char func[128];	sprintf(func,"%g*(1-((x-%g)/%g)^2)",b[0],b[1],b[2]);
+	gr->FPlot(func,"g");
+}
+
Sample pulse +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.91 Sample ‘qo2d

+ + +

Example of PDE solving by quasioptical approach qo2d. +

+

MGL code: +

define $1 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)'
+subplot 1 1 0 '<_':title 'Beam and ray tracing'
+ray r $1 -0.7 -1 0 0 0.5 0 0.02 2:plot r(0) r(1) 'k'
+axis:xlabel '\i x':ylabel '\i z'
+new re 128 'exp(-48*x^2)':new im 128
+new xx 1:new yy 1
+qo2d a $1 re im r 1 30 xx yy
+crange 0 1:dens xx yy a 'wyrRk':fplot '-x' 'k|'
+text 0 0.85 'absorption: (x+y)/2 for x+y>0'
+text 0.7 -0.05 'central ray'
+
+

C++ code: +

void smgl_qo2d(mglGraph *gr)
+{
+	mglData r, xx, yy, a, im(128), re(128);
+	const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+	r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+	if(big!=3)	{gr->SubPlot(1,1,0,"<_");	gr->Title("Beam and ray tracing");}
+	gr->Plot(r.SubData(0), r.SubData(1), "k");
+	gr->Axis();	gr->Label('x', "\\i x");	gr->Label('y', "\\i y");
+	// now start beam tracing
+	gr->Fill(re,"exp(-48*x^2)");
+	a = mglQO2d(ham, re, im, r, xx, yy, 1, 30);
+	gr->SetRange('c',0, 1);
+	gr->Dens(xx, yy, a, "wyrRk");
+	gr->FPlot("-x", "k|");
+	gr->Puts(mglPoint(0, 0.85), "absorption: (x+y)/2 for x+y>0");
+	gr->Puts(mglPoint(0.7, -0.05), "central ray");
+}
+
Sample qo2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.92 Sample ‘quality0

+ + +

Show all kind of primitives in quality=0. +

+

MGL code: +

quality 0
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality0(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(0);	all_prims(gr);
+}
+
Sample quality0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.93 Sample ‘quality1

+ + +

Show all kind of primitives in quality=1. +

+

MGL code: +

quality 1
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality1(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(1);	all_prims(gr);	
+}
+
Sample quality1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.94 Sample ‘quality2

+ + +

Show all kind of primitives in quality=2. +

+

MGL code: +

quality 2
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality2(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(2);	all_prims(gr);	
+}
+
Sample quality2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.95 Sample ‘quality4

+ + +

Show all kind of primitives in quality=4. +

+

MGL code: +

quality 4
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality4(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(4);	all_prims(gr);	
+}
+
Sample quality4 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.96 Sample ‘quality5

+ + +

Show all kind of primitives in quality=5. +

+

MGL code: +

quality 5
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality5(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(5);	all_prims(gr);	
+}
+
Sample quality5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.97 Sample ‘quality6

+ + +

Show all kind of primitives in quality=6. +

+

MGL code: +

quality 6
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality6(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(6);	all_prims(gr);	
+}
+
Sample quality6 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.98 Sample ‘quality8

+ + +

Show all kind of primitives in quality=8. +

+

MGL code: +

quality 8
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+

C++ code: +

void smgl_quality8(mglGraph *gr)	// test file export
+{
+	gr->SetQuality(8);	all_prims(gr);	
+}
+
Sample quality8 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.99 Sample ‘radar

+ + +

The radar plot is variant of plot, which make plot in polar coordinates and draw radial rays in point directions. If you just need a plot in polar coordinates then I recommend to use Curvilinear coordinates or plot in parametric form with x=r*cos(fi); y=r*sin(fi);. +

+

MGL code: +

new yr 10 3 '0.4*sin(pi*(x+1.5+y/2)+0.1*rnd)'
+subplot 1 1 0 '':title 'Radar plot (with grid, "\#")':radar yr '#'
+
+

C++ code: +

void smgl_radar(mglGraph *gr)
+{
+	mglData yr(10,3);	yr.Modify("0.4*sin(pi*(2*x+y))+0.1*rnd");
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("Radar plot (with grid, '\\#')");	}
+	gr->Radar(yr,"#");
+}
+
Sample radar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.100 Sample ‘refill

+ + +

Example of refill and gspline. +

+

MGL code: +

new x 10 '0.5+rnd':cumsum x 'x':norm x -1 1
+copy y sin(pi*x)/1.5
+subplot 2 2 0 '<_':title 'Refill sample'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:refill r x y:plot r 'r'
+
+subplot 2 2 1 '<_':title 'Global spline'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:gspline r x y:plot r 'r'
+
+new y 10 '0.5+rnd':cumsum y 'x':norm y -1 1
+copy xx x:extend xx 10
+copy yy y:extend yy 10:transpose yy
+copy z sin(pi*xx*yy)/1.5
+alpha on:light on
+subplot 2 2 2:title '2d regular':rotate 40 60
+box:axis:mesh xx yy z 'k'
+new rr 100 100:refill rr x y z:surf rr
+
+new xx 10 10 '(x+1)/2*cos(y*pi/2-1)':new yy 10 10 '(x+1)/2*sin(y*pi/2-1)'
+copy z sin(pi*xx*yy)/1.5
+subplot 2 2 3:title '2d non-regular':rotate 40 60
+box:axis:plot xx yy z 'ko '
+new rr 100 100:refill rr xx yy z:surf rr
+
+

C++ code: +

void smgl_refill(mglGraph *gr)
+{
+	mglData x(10), y(10), r(100);
+	x.Modify("0.5+rnd");	x.CumSum("x");	x.Norm(-1,1);
+	y.Modify("sin(pi*v)/1.5",x);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"<_");	gr->Title("Refill sample");	}
+	gr->Axis();	gr->Box();	gr->Plot(x,y,"o ");
+	gr->Refill(r,x,y);	// or you can use r.Refill(x,y,-1,1);
+	gr->Plot(r,"r");	gr->FPlot("sin(pi*x)/1.5","B:");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"<_");	gr->Title("Global spline");
+	gr->Axis();	gr->Box();	gr->Plot(x,y,"o ");
+	r.RefillGS(x,y,-1,1);	gr->Plot(r,"r");
+	gr->FPlot("sin(pi*x)/1.5","B:");
+
+	gr->Alpha(true);	gr->Light(true);
+	mglData z(10,10), xx(10,10), yy(10,10), rr(100,100);
+	y.Modify("0.5+rnd");	y.CumSum("x");	y.Norm(-1,1);
+	for(int i=0;i<10;i++)	for(int j=0;j<10;j++)
+		z.a[i+10*j] = sin(M_PI*x.a[i]*y.a[j])/1.5;
+	gr->SubPlot(2,2,2);	gr->Title("2d regular");	gr->Rotate(40,60);
+	gr->Axis();	gr->Box();	gr->Mesh(x,y,z,"k");
+	gr->Refill(rr,x,y,z);	gr->Surf(rr);
+
+	gr->Fill(xx,"(x+1)/2*cos(y*pi/2-1)");
+	gr->Fill(yy,"(x+1)/2*sin(y*pi/2-1)");
+	for(int i=0;i<10*10;i++)
+		z.a[i] = sin(M_PI*xx.a[i]*yy.a[i])/1.5;
+	gr->SubPlot(2,2,3);	gr->Title("2d non-regular");	gr->Rotate(40,60);
+	gr->Axis();	gr->Box();	gr->Plot(xx,yy,z,"ko ");
+	gr->Refill(rr,xx,yy,z);	gr->Surf(rr);
+}
+
Sample refill +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.101 Sample ‘region

+ + +

Function region fill the area between 2 curves. It support gradient filling if 2 colors per curve is specified. Also it can fill only the region y1<y<y2 if style ‘i’ is used. +

+

MGL code: +

call 'prepare1d'
+copy y1 y(:,1):copy y2 y(:,2)
+subplot 2 2 0 '':title 'Region plot (default)':box:region y1 y2:plot y1 'k2':plot y2 'k2'
+subplot 2 2 1 '':title '2 colors':box:region y1 y2 'yr':plot y1 'k2':plot y2 'k2'
+subplot 2 2 2 '':title '"i" style':box:region y1 y2 'ir':plot y1 'k2':plot y2 'k2'
+subplot 2 2 3 '^_':title '3d variant':rotate 40 60:box
+new x1 100 'sin(pi*x)':new y1 100 'cos(pi*x)':new z 100 'x'
+new x2 100 'sin(pi*x+pi/3)':new y2 100 'cos(pi*x+pi/3)'
+plot x1 y1 z 'r2':plot x2 y2 z 'b2'
+region x1 y1 z x2 y2 z 'cmy!'
+
+

C++ code: +

void smgl_region(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);
+	mglData y1 = y.SubData(-1,1), y2 = y.SubData(-1,2);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Region plot (default)");	}
+	gr->Box();	gr->Region(y1,y2);	gr->Plot(y1,"k2");	gr->Plot(y2,"k2");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("2 colors");	gr->Box();	gr->Region(y1,y2,"yr");	gr->Plot(y1,"k2");	gr->Plot(y2,"k2");
+	gr->SubPlot(2,2,2,"");	gr->Title("'i' style");	gr->Box();	gr->Region(y1,y2,"ir");	gr->Plot(y1,"k2");	gr->Plot(y2,"k2");
+	gr->SubPlot(2,2,3,"^_");	gr->Title("3d variant");	gr->Rotate(40,60);	gr->Box();
+	gr->Fill(y1,"cos(pi*x)");	gr->Fill(y2,"cos(pi*x+pi/3)");
+	mglData x1(y1.nx), x2(y1.nx), z(y1.nx);
+	gr->Fill(x1,"sin(pi*x)");	gr->Fill(x2,"sin(pi*x+pi/3)");	gr->Fill(z,"x");
+	gr->Plot(x1,y1,z,"r2");		gr->Plot(x2,y2,z,"b2");
+	gr->Region(x1,y1,z,x2,y2,z,"cmy!");
+}
+
Sample region +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.102 Sample ‘scanfile

+ + +

Example of scanfile for reading ’named’ data. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Save and scanfile sample'
+list a 1 -1 0
+save 'This is test: 0 -> ',a(0),' q' 'test.txt' 'w'
+save 'This is test: 1 -> ',a(1),' q' 'test.txt'
+save 'This is test: 2 -> ',a(2),' q' 'test.txt'
+
+scanfile a 'test.txt' 'This is test: %g -> %g'
+ranges a(0) a(1):axis:plot a(0) a(1) 'o'
+
+

C++ code: +

void smgl_scanfile(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Save and scanfile sample");
+	FILE *fp=fopen("test.txt","w");
+	fprintf(fp,"This is test: 0 -> 1 q\n");
+	fprintf(fp,"This is test: 1 -> -1 q\n");
+	fprintf(fp,"This is test: 2 -> 0 q\n");
+	fclose(fp);
+
+	mglData a;
+	a.ScanFile("test.txt","This is test: %g -> %g");
+	gr->SetRanges(a.SubData(0), a.SubData(1));
+	gr->Axis();	gr->Plot(a.SubData(0),a.SubData(1),"o");
+}
+
Sample scanfile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.103 Sample ‘schemes

+ + +

Example of popular color schemes. +

+

MGL code: +

new x 100 100 'x':new y 100 100 'y'
+call 'sch' 0 'kw'
+call 'sch' 1 '%gbrw'
+call 'sch' 2 'kHCcw'
+call 'sch' 3 'kBbcw'
+call 'sch' 4 'kRryw'
+call 'sch' 5 'kGgew'
+call 'sch' 6 'BbwrR'
+call 'sch' 7 'BbwgG'
+call 'sch' 8 'GgwmM'
+call 'sch' 9 'UuwqR'
+call 'sch' 10 'QqwcC'
+call 'sch' 11 'CcwyY'
+call 'sch' 12 'bcwyr'
+call 'sch' 13 'bwr'
+call 'sch' 14 'wUrqy'
+call 'sch' 15 'UbcyqR'
+call 'sch' 16 'BbcyrR'
+call 'sch' 17 'bgr'
+call 'sch' 18 'BbcyrR|'
+call 'sch' 19 'b{g,0.3}r'
+stop
+func 'sch' 2
+subplot 2 10 $1 '<>_^' 0.2 0:surfa x y $2
+text 0.07+0.5*mod($1,2) 0.92-0.1*int($1/2) $2 'A'
+return
+
+

C++ code: +

void smgl_schemes(mglGraph *gr)	// Color table
+{
+	mglData a(256,2), b(256,2);	a.Fill(-1,1);	b.Fill(-1,1,'y');
+	gr->SubPlot(2,10,0,NULL,0.2);	gr->Dens(a,"kw");		gr->Puts(0.07, 0.92, "kw", "A");
+	gr->SubPlot(2,10,1,NULL,0.2);	gr->SurfA(a,b,"%gbrw");	gr->Puts(0.57, 0.92, "%gbrw", "A");
+	gr->SubPlot(2,10,2,NULL,0.2);	gr->Dens(a,"kHCcw");	gr->Puts(0.07, 0.82, "kHCcw", "A");
+	gr->SubPlot(2,10,3,NULL,0.2);	gr->Dens(a,"kBbcw");	gr->Puts(0.57, 0.82, "kBbcw", "A");
+	gr->SubPlot(2,10,4,NULL,0.2);	gr->Dens(a,"kRryw");	gr->Puts(0.07, 0.72, "kRryw", "A");
+	gr->SubPlot(2,10,5,NULL,0.2);	gr->Dens(a,"kGgew");	gr->Puts(0.57, 0.72, "kGgew", "A");
+	gr->SubPlot(2,10,6,NULL,0.2);	gr->Dens(a,"BbwrR");	gr->Puts(0.07, 0.62, "BbwrR", "A");
+	gr->SubPlot(2,10,7,NULL,0.2);	gr->Dens(a,"BbwgG");	gr->Puts(0.57, 0.62, "BbwgG", "A");
+	gr->SubPlot(2,10,8,NULL,0.2);	gr->Dens(a,"GgwmM");	gr->Puts(0.07, 0.52, "GgwmM", "A");
+	gr->SubPlot(2,10,9,NULL,0.2);	gr->Dens(a,"UuwqR");	gr->Puts(0.57, 0.52, "UuwqR", "A");
+	gr->SubPlot(2,10,10,NULL,0.2);	gr->Dens(a,"QqwcC");	gr->Puts(0.07, 0.42, "QqwcC", "A");
+	gr->SubPlot(2,10,11,NULL,0.2);	gr->Dens(a,"CcwyY");	gr->Puts(0.57, 0.42, "CcwyY", "A");
+	gr->SubPlot(2,10,12,NULL,0.2);	gr->Dens(a,"bcwyr");	gr->Puts(0.07, 0.32, "bcwyr", "A");
+	gr->SubPlot(2,10,13,NULL,0.2);	gr->Dens(a,"bwr");		gr->Puts(0.57, 0.32, "bwr", "A");
+	gr->SubPlot(2,10,14,NULL,0.2);	gr->Dens(a,"wUrqy");	gr->Puts(0.07, 0.22, "wUrqy", "A");
+	gr->SubPlot(2,10,15,NULL,0.2);	gr->Dens(a,"UbcyqR");	gr->Puts(0.57, 0.22, "UbcyqR", "A");
+	gr->SubPlot(2,10,16,NULL,0.2);	gr->Dens(a,"BbcyrR");	gr->Puts(0.07, 0.12, "BbcyrR", "A");
+	gr->SubPlot(2,10,17,NULL,0.2);	gr->Dens(a,"bgr");		gr->Puts(0.57, 0.12, "bgr", "A");
+	gr->SubPlot(2,10,18,NULL,0.2);	gr->Dens(a,"BbcyrR|");	gr->Puts(0.07, 0.02, "BbcyrR|", "A");
+	gr->SubPlot(2,10,19,NULL,0.2);	gr->Dens(a,"b{g,0.3}r");		gr->Puts(0.57, 0.02, "b\\{g,0.3\\}r", "A");
+}
+
Sample schemes +
+
+ + + +

10.104 Sample ‘section

+ + +

Example of section to separate data and join it back. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Section&Join sample'
+axis:box:line -1 0 1 0 'h:'
+# first lets demonstrate 'join'
+new aa 11 'x^2':new a1 3 '-x':new a2 15 'x^3'
+join aa a1:join aa a2
+# add x-coordinate
+new xx aa.nx 'x':join aa xx
+plot aa(:,1) aa(:,0) '2y'
+# now select 1-st (id=0) section between zeros
+section b1 aa 0 'x' 0
+plot b1(:,1) b1(:,0) 'bo'
+# next, select 3-d (id=2) section between zeros
+section b3 aa 2 'x' 0
+plot b3(:,1) b3(:,0) 'gs'
+# finally, select 2-nd (id=-2) section from the end
+section b4 aa -2 'x' 0
+plot b4(:,1) b4(:,0) 'r#o'
+
+

C++ code: +

void smgl_section(mglGraph *gr)
+{
+	gr->SubPlot(1,1,0,"<_");
+	if(big!=3)	gr->Title("Section&Join sample");
+	gr->Axis();	gr->Box();	gr->Line(mglPoint(-1,0),mglPoint(1,0),"h:");
+	// first lets demonstrate 'join'
+	mglData aa(11), a1(3), a2(15);
+	gr->Fill(aa,"x^2");	gr->Fill(a1,"-x");	gr->Fill(a2,"x^3");
+	aa.Join(a1);	aa.Join(a2);
+	// add x-coordinate
+	mglData xx(aa.nx);	gr->Fill(xx,"x");	aa.Join(xx);
+	gr->Plot(aa.SubData(-1,1), aa.SubData(-1,0), "2y");
+	// now select 1-st (id=0) section between zeros
+	mglData b1(aa.Section(0,'x',0));
+	gr->Plot(b1.SubData(-1,1), b1.SubData(-1,0), "bo");
+	// next, select 3-d (id=2) section between zeros
+	mglData b2(aa.Section(2,'x',0));
+	gr->Plot(b2.SubData(-1,1), b2.SubData(-1,0), "gs");
+	// finally, select 2-nd (id=-2) section from the end
+	mglData b3(aa.Section(-2,'x',0));
+	gr->Plot(b3.SubData(-1,1), b3.SubData(-1,0), "r#o");
+}
+
Sample section +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.105 Sample ‘several_light

+ + +

Example of using several light sources. +

+

MGL code: +

call 'prepare2d'
+title 'Several light sources':rotate 50 60:light on
+light 1 0 1 0 'c':light 2 1 0 0 'y':light 3 0 -1 0 'm'
+box:surf a 'h'
+
+

C++ code: +

void smgl_several_light(mglGraph *gr)	// several light sources
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Several light sources");
+	gr->Rotate(50,60);	gr->Light(true);	gr->AddLight(1,mglPoint(0,1,0),'c');
+	gr->AddLight(2,mglPoint(1,0,0),'y');	gr->AddLight(3,mglPoint(0,-1,0),'m');
+	gr->Box();	gr->Surf(a,"h");
+}
+
Sample several_light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.106 Sample ‘solve

+ + +

Example of solve for root finding. +

+

MGL code: +

zrange 0 1
+new x 20 30 '(x+2)/3*cos(pi*y)'
+new y 20 30 '(x+2)/3*sin(pi*y)'
+new z 20 30 'exp(-6*x^2-2*sin(pi*y)^2)'
+
+subplot 2 1 0:title 'Cartesian space':rotate 30 -40
+axis 'xyzU':box
+xlabel 'x':ylabel 'y'
+origin 1 1:grid 'xy'
+mesh x y z
+
+# section along 'x' direction
+solve u x 0.5 'x'
+var v u.nx 0 1
+evaluate yy y u v
+evaluate xx x u v
+evaluate zz z u v
+plot xx yy zz 'k2o'
+
+# 1st section along 'y' direction
+solve u1 x -0.5 'y'
+var v1 u1.nx 0 1
+evaluate yy y v1 u1
+evaluate xx x v1 u1
+evaluate zz z v1 u1
+plot xx yy zz 'b2^'
+
+# 2nd section along 'y' direction
+solve u2 x -0.5 'y' u1
+evaluate yy y v1 u2
+evaluate xx x v1 u2
+evaluate zz z v1 u2
+plot xx yy zz 'r2v'
+
+subplot 2 1 1:title 'Accompanied space'
+ranges 0 1 0 1:origin 0 0
+axis:box:xlabel 'i':ylabel 'j':grid2 z 'h'
+
+plot u v 'k2o':line 0.4 0.5 0.8 0.5 'kA'
+plot v1 u1 'b2^':line 0.5 0.15 0.5 0.3 'bA'
+plot v1 u2 'r2v':line 0.5 0.7 0.5 0.85 'rA'
+
+

C++ code: +

void smgl_solve(mglGraph *gr)	// solve and evaluate
+{
+	gr->SetRange('z',0,1);
+	mglData x(20,30), y(20,30), z(20,30), xx,yy,zz;
+	gr->Fill(x,"(x+2)/3*cos(pi*y)");
+	gr->Fill(y,"(x+2)/3*sin(pi*y)");
+	gr->Fill(z,"exp(-6*x^2-2*sin(pi*y)^2)");
+
+	gr->SubPlot(2,1,0);	gr->Title("Cartesian space");	gr->Rotate(30,-40);
+	gr->Axis("xyzU");	gr->Box();	gr->Label('x',"x");	gr->Label('y',"y");
+	gr->SetOrigin(1,1);	gr->Grid("xy");
+	gr->Mesh(x,y,z);
+
+	// section along 'x' direction
+	mglData u = x.Solve(0.5,'x');
+	mglData v(u.nx);	v.Fill(0,1);
+	xx = x.Evaluate(u,v);	yy = y.Evaluate(u,v);	zz = z.Evaluate(u,v);
+	gr->Plot(xx,yy,zz,"k2o");
+
+	// 1st section along 'y' direction
+	mglData u1 = x.Solve(-0.5,'y');
+	mglData v1(u1.nx);	v1.Fill(0,1);
+	xx = x.Evaluate(v1,u1);	yy = y.Evaluate(v1,u1);	zz = z.Evaluate(v1,u1);
+	gr->Plot(xx,yy,zz,"b2^");
+
+	// 2nd section along 'y' direction
+	mglData u2 = x.Solve(-0.5,'y',u1);
+	xx = x.Evaluate(v1,u2);	yy = y.Evaluate(v1,u2);	zz = z.Evaluate(v1,u2);
+	gr->Plot(xx,yy,zz,"r2v");
+
+	gr->SubPlot(2,1,1);	gr->Title("Accompanied space");
+	gr->SetRanges(0,1,0,1);	gr->SetOrigin(0,0);
+	gr->Axis();	gr->Box();	gr->Label('x',"i");	gr->Label('y',"j");
+	gr->Grid(z,"h");
+
+	gr->Plot(u,v,"k2o");	gr->Line(mglPoint(0.4,0.5),mglPoint(0.8,0.5),"kA");
+	gr->Plot(v1,u1,"b2^");	gr->Line(mglPoint(0.5,0.15),mglPoint(0.5,0.3),"bA");
+	gr->Plot(v1,u2,"r2v");	gr->Line(mglPoint(0.5,0.7),mglPoint(0.5,0.85),"rA");
+}
+
Sample solve +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.107 Sample ‘stem

+ + +

Function stem draw vertical bars. It is most attractive if markers are drawn too. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Stem plot (default)':box:stem y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:stem xc yc z 'rx'
+subplot 2 2 2 '':title '"!" style':box:stem y 'o!rgb'
+
+

C++ code: +

void smgl_stem(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Stem plot (default)");	}
+	gr->Box();	gr->Stem(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Stem(xc,yc,z,"rx");
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style");	gr->Box();	gr->Stem(y,"o!rgb");
+}
+
Sample stem +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.108 Sample ‘step

+ + +

Function step plot data as stairs. At this stairs can be centered if sizes are differ by 1. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Step plot (default)':box:step y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:step xc yc z 'r'
+subplot 2 2 2 '':title '"!" style':box:step y 's!rgb'
+
+

C++ code: +

void smgl_step(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Step plot (default)");	}
+	gr->Box();	gr->Step(y);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);
+	gr->Box();	gr->Step(xc,yc,z,"r");
+	gr->SubPlot(2,2,2,"");	gr->Title("'!' style");	gr->Box();	gr->Step(y,"s!rgb");
+}
+
Sample step +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.109 Sample ‘stereo

+ + +

Example of stereo image of surf. +

+

MGL code: +

call 'prepare2d'
+light on
+subplot 2 1 0:rotate 50 60+1:box:surf a
+subplot 2 1 1:rotate 50 60-1:box:surf a
+
+

C++ code: +

void smgl_stereo(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	gr->Light(true);
+	gr->SubPlot(2,1,0);	gr->Rotate(50,60+1);
+	gr->Box();	gr->Surf(a);
+	gr->SubPlot(2,1,1);	gr->Rotate(50,60-1);
+	gr->Box();	gr->Surf(a);
+}
+
Sample stereo +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.110 Sample ‘stfa

+ + +

Example of stfa. +

+

MGL code: +

new a 2000:new b 2000
+fill a 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)'
+subplot 1 2 0 '<_':title 'Initial signal':plot a:axis:xlabel '\i t'
+subplot 1 2 1 '<_':title 'STFA plot':stfa a b 64:axis:ylabel '\omega' 0:xlabel '\i t'
+
+

C++ code: +

void smgl_stfa(mglGraph *gr)	// STFA sample
+{
+	mglData a(2000), b(2000);
+	gr->Fill(a,"cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+	cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)");
+	gr->SubPlot(1, 2, 0,"<_");	gr->Title("Initial signal");
+	gr->Plot(a);
+	gr->Axis();
+	gr->Label('x', "\\i t");
+
+	gr->SubPlot(1, 2, 1,"<_");	gr->Title("STFA plot");
+	gr->STFA(a, b, 64);
+	gr->Axis();
+	gr->Label('x', "\\i t");
+	gr->Label('y', "\\omega", 0);
+}
+
Sample stfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.111 Sample ‘style

+ + +

Example of colors and styles for plots. +

+

MGL code: +

+
+

C++ code: +

void smgl_style(mglGraph *gr)	// pen styles
+{
+	gr->SubPlot(2,2,0);
+	double d,x1,x2,x0,y=1.1, y1=1.15;
+	d=0.3, x0=0.2, x1=0.5, x2=0.6;
+	gr->Line(mglPoint(x0,y1-0*d),mglPoint(x1,y1-0*d),"k-");	gr->Puts(mglPoint(x2,y-0*d),"Solid '-'",":rL");
+	gr->Line(mglPoint(x0,y1-1*d),mglPoint(x1,y1-1*d),"k|");	gr->Puts(mglPoint(x2,y-1*d),"Long Dash '|'",":rL");
+	gr->Line(mglPoint(x0,y1-2*d),mglPoint(x1,y1-2*d),"k;");	gr->Puts(mglPoint(x2,y-2*d),"Dash ';'",":rL");
+	gr->Line(mglPoint(x0,y1-3*d),mglPoint(x1,y1-3*d),"k=");	gr->Puts(mglPoint(x2,y-3*d),"Small dash '='",":rL");
+	gr->Line(mglPoint(x0,y1-4*d),mglPoint(x1,y1-4*d),"kj");	gr->Puts(mglPoint(x2,y-4*d),"Dash-dot 'j'",":rL");
+	gr->Line(mglPoint(x0,y1-5*d),mglPoint(x1,y1-5*d),"ki");	gr->Puts(mglPoint(x2,y-5*d),"Small dash-dot 'i'",":rL");
+	gr->Line(mglPoint(x0,y1-6*d),mglPoint(x1,y1-6*d),"k:");	gr->Puts(mglPoint(x2,y-6*d),"Dots ':'",":rL");
+	gr->Line(mglPoint(x0,y1-7*d),mglPoint(x1,y1-7*d),"k ");	gr->Puts(mglPoint(x2,y-7*d),"None ' '",":rL");
+	gr->Line(mglPoint(x0,y1-8*d),mglPoint(x1,y1-8*d),"k{df090}");	gr->Puts(mglPoint(x2,y-8*d),"Manual '{df090}'",":rL");
+
+	d=0.25; x1=-1; x0=-0.8;	y = -0.05;
+	gr->Mark(mglPoint(x1,5*d),"k.");		gr->Puts(mglPoint(x0,y+5*d),"'.'",":rL");
+	gr->Mark(mglPoint(x1,4*d),"k+");		gr->Puts(mglPoint(x0,y+4*d),"'+'",":rL");
+	gr->Mark(mglPoint(x1,3*d),"kx");		gr->Puts(mglPoint(x0,y+3*d),"'x'",":rL");
+	gr->Mark(mglPoint(x1,2*d),"k*");		gr->Puts(mglPoint(x0,y+2*d),"'*'",":rL");
+	gr->Mark(mglPoint(x1,d),"ks");		gr->Puts(mglPoint(x0,y+d),"'s'",":rL");
+	gr->Mark(mglPoint(x1,0),"kd");		gr->Puts(mglPoint(x0,y),"'d'",":rL");
+	gr->Mark(mglPoint(x1,-d,0),"ko");	gr->Puts(mglPoint(x0,y-d),"'o'",":rL");
+	gr->Mark(mglPoint(x1,-2*d,0),"k^");	gr->Puts(mglPoint(x0,y-2*d),"'\\^'",":rL");
+	gr->Mark(mglPoint(x1,-3*d,0),"kv");	gr->Puts(mglPoint(x0,y-3*d),"'v'",":rL");
+	gr->Mark(mglPoint(x1,-4*d,0),"k<");	gr->Puts(mglPoint(x0,y-4*d),"'<'",":rL");
+	gr->Mark(mglPoint(x1,-5*d,0),"k>");	gr->Puts(mglPoint(x0,y-5*d),"'>'",":rL");
+
+	d=0.25; x1=-0.5; x0=-0.3;	y = -0.05;
+	gr->Mark(mglPoint(x1,5*d),"k#.");	gr->Puts(mglPoint(x0,y+5*d),"'\\#.'",":rL");
+	gr->Mark(mglPoint(x1,4*d),"k#+");	gr->Puts(mglPoint(x0,y+4*d),"'\\#+'",":rL");
+	gr->Mark(mglPoint(x1,3*d),"k#x");	gr->Puts(mglPoint(x0,y+3*d),"'\\#x'",":rL");
+	gr->Mark(mglPoint(x1,2*d),"k#*");	gr->Puts(mglPoint(x0,y+2*d),"'\\#*'",":rL");
+	gr->Mark(mglPoint(x1,d),"k#s");		gr->Puts(mglPoint(x0,y+d),"'\\#s'",":rL");
+	gr->Mark(mglPoint(x1,0),"k#d");		gr->Puts(mglPoint(x0,y),"'\\#d'",":rL");
+	gr->Mark(mglPoint(x1,-d,0),"k#o");	gr->Puts(mglPoint(x0,y-d),"'\\#o'",":rL");
+	gr->Mark(mglPoint(x1,-2*d,0),"k#^");	gr->Puts(mglPoint(x0,y-2*d),"'\\#\\^'",":rL");
+	gr->Mark(mglPoint(x1,-3*d,0),"k#v");	gr->Puts(mglPoint(x0,y-3*d),"'\\#v'",":rL");
+	gr->Mark(mglPoint(x1,-4*d,0),"k#<");	gr->Puts(mglPoint(x0,y-4*d),"'\\#<'",":rL");
+	gr->Mark(mglPoint(x1,-5*d,0),"k#>");	gr->Puts(mglPoint(x0,y-5*d),"'\\#>'",":rL");
+
+	gr->SubPlot(2,2,1);
+	double a=0.1,b=0.4,c=0.5;
+	gr->Line(mglPoint(a,1),mglPoint(b,1),"k-A");		gr->Puts(mglPoint(c,1),"Style 'A' or 'A\\_'",":rL");
+	gr->Line(mglPoint(a,0.8),mglPoint(b,0.8),"k-V");	gr->Puts(mglPoint(c,0.8),"Style 'V' or 'V\\_'",":rL");
+	gr->Line(mglPoint(a,0.6),mglPoint(b,0.6),"k-K");	gr->Puts(mglPoint(c,0.6),"Style 'K' or 'K\\_'",":rL");
+	gr->Line(mglPoint(a,0.4),mglPoint(b,0.4),"k-I");	gr->Puts(mglPoint(c,0.4),"Style 'I' or 'I\\_'",":rL");
+	gr->Line(mglPoint(a,0.2),mglPoint(b,0.2),"k-D");	gr->Puts(mglPoint(c,0.2),"Style 'D' or 'D\\_'",":rL");
+	gr->Line(mglPoint(a,0),mglPoint(b,0),"k-S");		gr->Puts(mglPoint(c,0),"Style 'S' or 'S\\_'",":rL");
+	gr->Line(mglPoint(a,-0.2),mglPoint(b,-0.2),"k-O");	gr->Puts(mglPoint(c,-0.2),"Style 'O' or 'O\\_'",":rL");
+	gr->Line(mglPoint(a,-0.4),mglPoint(b,-0.4),"k-T");	gr->Puts(mglPoint(c,-0.4),"Style 'T' or 'T\\_'",":rL");
+	gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"k-X");	gr->Puts(mglPoint(c,-0.6),"Style 'X' or 'X\\_'",":rL");
+	gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-_");	gr->Puts(mglPoint(c,-0.8),"Style '\\_' or none",":rL");
+	gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-AS");		gr->Puts(mglPoint(c,-1),"Style 'AS'",":rL");
+	gr->Line(mglPoint(a,-1.2),mglPoint(b,-1.2),"k-_A");	gr->Puts(mglPoint(c,-1.2),"Style '\\_A'",":rL");
+
+	a=-1;	b=-0.7;	c=-0.6;
+	gr->Line(mglPoint(a,1),mglPoint(b,1),"kAA");		gr->Puts(mglPoint(c,1),"Style 'AA'",":rL");
+	gr->Line(mglPoint(a,0.8),mglPoint(b,0.8),"kVV");	gr->Puts(mglPoint(c,0.8),"Style 'VV'",":rL");
+	gr->Line(mglPoint(a,0.6),mglPoint(b,0.6),"kKK");	gr->Puts(mglPoint(c,0.6),"Style 'KK'",":rL");
+	gr->Line(mglPoint(a,0.4),mglPoint(b,0.4),"kII");	gr->Puts(mglPoint(c,0.4),"Style 'II'",":rL");
+	gr->Line(mglPoint(a,0.2),mglPoint(b,0.2),"kDD");	gr->Puts(mglPoint(c,0.2),"Style 'DD'",":rL");
+	gr->Line(mglPoint(a,0),mglPoint(b,0),"kSS");		gr->Puts(mglPoint(c,0),"Style 'SS'",":rL");
+	gr->Line(mglPoint(a,-0.2),mglPoint(b,-0.2),"kOO");	gr->Puts(mglPoint(c,-0.2),"Style 'OO'",":rL");
+	gr->Line(mglPoint(a,-0.4),mglPoint(b,-0.4),"kTT");	gr->Puts(mglPoint(c,-0.4),"Style 'TT'",":rL");
+	gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"kXX");	gr->Puts(mglPoint(c,-0.6),"Style 'XX'",":rL");
+	gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-__");	gr->Puts(mglPoint(c,-0.8),"Style '\\_\\_'",":rL");
+	gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-VA");		gr->Puts(mglPoint(c,-1),"Style 'VA'",":rL");
+	gr->Line(mglPoint(a,-1.2),mglPoint(b,-1.2),"k-AV");	gr->Puts(mglPoint(c,-1.2),"Style 'AV'",":rL");
+
+	gr->SubPlot(2,2,2);
+	//#LENUQ
+	gr->FaceZ(mglPoint(-1,	-1), 0.4, 0.3, "L#");	gr->Puts(mglPoint(-0.8,-0.9), "L", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-1), 0.4, 0.3, "E#");	gr->Puts(mglPoint(-0.4,-0.9), "E", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-1), 0.4, 0.3, "N#");	gr->Puts(mglPoint(0,  -0.9), "N", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-1), 0.4, 0.3, "U#");	gr->Puts(mglPoint(0.4,-0.9), "U", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-1), 0.4, 0.3, "Q#");	gr->Puts(mglPoint(0.8,-0.9), "Q", "w:C", -1.4);
+	//#lenuq
+	gr->FaceZ(mglPoint(-1,	-0.7), 0.4, 0.3, "l#");	gr->Puts(mglPoint(-0.8,-0.6), "l", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-0.7), 0.4, 0.3, "e#");	gr->Puts(mglPoint(-0.4,-0.6), "e", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-0.7), 0.4, 0.3, "n#");	gr->Puts(mglPoint(0,  -0.6), "n", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-0.7), 0.4, 0.3, "u#");	gr->Puts(mglPoint(0.4,-0.6), "u", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-0.7), 0.4, 0.3, "q#");	gr->Puts(mglPoint(0.8,-0.6), "q", "k:C", -1.4);
+	//#CMYkP
+	gr->FaceZ(mglPoint(-1,	-0.4), 0.4, 0.3, "C#");	gr->Puts(mglPoint(-0.8,-0.3), "C", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-0.4), 0.4, 0.3, "M#");	gr->Puts(mglPoint(-0.4,-0.3), "M", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-0.4), 0.4, 0.3, "Y#");	gr->Puts(mglPoint(0,  -0.3), "Y", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-0.4), 0.4, 0.3, "k#");	gr->Puts(mglPoint(0.4,-0.3), "k", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-0.4), 0.4, 0.3, "P#");	gr->Puts(mglPoint(0.8,-0.3), "P", "w:C", -1.4);
+	//#cmywp
+	gr->FaceZ(mglPoint(-1,	-0.1), 0.4, 0.3, "c#");	gr->Puts(mglPoint(-0.8, 0), "c", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,-0.1), 0.4, 0.3, "m#");	gr->Puts(mglPoint(-0.4, 0), "m", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,-0.1), 0.4, 0.3, "y#");	gr->Puts(mglPoint(0,   0), "y", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	-0.1), 0.4, 0.3, "w#");	gr->Puts(mglPoint(0.4, 0), "w", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	-0.1), 0.4, 0.3, "p#");	gr->Puts(mglPoint(0.8, 0), "p", "k:C", -1.4);
+	//#BGRHW
+	gr->FaceZ(mglPoint(-1,	0.2), 0.4, 0.3, "B#");	gr->Puts(mglPoint(-0.8, 0.3), "B", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,0.2), 0.4, 0.3, "G#");	gr->Puts(mglPoint(-0.4, 0.3), "G", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,0.2), 0.4, 0.3, "R#");	gr->Puts(mglPoint(0,   0.3), "R", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	0.2), 0.4, 0.3, "H#");	gr->Puts(mglPoint(0.4, 0.3), "H", "w:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	0.2), 0.4, 0.3, "W#");	gr->Puts(mglPoint(0.8, 0.3), "W", "w:C", -1.4);
+	//#bgrhw
+	gr->FaceZ(mglPoint(-1,	0.5), 0.4, 0.3, "b#");	gr->Puts(mglPoint(-0.8, 0.6), "b", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,0.5), 0.4, 0.3, "g#");	gr->Puts(mglPoint(-0.4, 0.6), "g", "k:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,0.5), 0.4, 0.3, "r#");	gr->Puts(mglPoint(0,   0.6), "r", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	0.5), 0.4, 0.3, "h#");	gr->Puts(mglPoint(0.4, 0.6), "h", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	0.5), 0.4, 0.3, "w#");	gr->Puts(mglPoint(0.8, 0.6), "w", "k:C", -1.4);
+	//#brighted
+	gr->FaceZ(mglPoint(-1,	0.8), 0.4, 0.3, "{r1}#");	gr->Puts(mglPoint(-0.8, 0.9), "\\{r1\\}", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.6,0.8), 0.4, 0.3, "{r3}#");	gr->Puts(mglPoint(-0.4, 0.9), "\\{r3\\}", "w:C", -1.4);
+	gr->FaceZ(mglPoint(-0.2,0.8), 0.4, 0.3, "{r5}#");	gr->Puts(mglPoint(0,   0.9), "\\{r5\\}", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.2,	0.8), 0.4, 0.3, "{r7}#");	gr->Puts(mglPoint(0.4, 0.9), "\\{r7\\}", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0.6,	0.8), 0.4, 0.3, "{r9}#");	gr->Puts(mglPoint(0.8, 0.9), "\\{r9\\}", "k:C", -1.4);
+	// HEX
+	gr->FaceZ(mglPoint(-1, -1.3), 1, 0.3, "{xff9966}#");	gr->Puts(mglPoint(-0.5,-1.2), "\\{xff9966\\}", "k:C", -1.4);
+	gr->FaceZ(mglPoint(0,  -1.3), 1, 0.3, "{x83CAFF}#");	gr->Puts(mglPoint( 0.5,-1.2), "\\{x83CAFF\\}", "k:C", -1.4);
+
+	gr->SubPlot(2,2,3);
+	char stl[3]="r1", txt[4]="'1'";
+	for(int i=0;i<10;i++)
+	{
+		txt[1]=stl[1]='0'+i;
+		gr->Line(mglPoint(-1,0.2*i-1),mglPoint(1,0.2*i-1),stl);
+		gr->Puts(mglPoint(1.05,0.2*i-1),txt,":L");
+	}
+}
+
Sample style +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.112 Sample ‘surf

+ + +

Function surf is most standard way to visualize 2D data array. Surf use color scheme for coloring (see Color scheme). You can use ‘#’ style for drawing black meshes on the surface. +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Surf plot (default)':rotate 50 60:light on:box:surf a
+subplot 2 2 1:title '"\#" style; meshnum 10':rotate 50 60:box:surf a '#'; meshnum 10
+subplot 2 2 2:title '"." style':rotate 50 60:box:surf a '.'
+new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+new z 50 40 '0.8*cos(pi*(y+1)/2)'
+subplot 2 2 3:title 'parametric form':rotate 50 60:box:surf x y z 'BbwrR'
+
+

C++ code: +

void smgl_surf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Surf3 plot (default)");	}
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3(c);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,"#");
+	gr->SubPlot(2,2,2);	gr->Title("'.' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,".");
+}
+
Sample surf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.113 Sample ‘surf3

+ + +

Function surf3 is one of most suitable (for my opinion) functions to visualize 3D data. It draw the isosurface(s) – surface(s) of constant amplitude (3D analogue of contour lines). You can draw wired isosurfaces if specify ‘#’ style. +

+

MGL code: +

call 'prepare3d'
+light on:alpha on
+subplot 2 2 0:title 'Surf3 plot (default)'
+rotate 50 60:box:surf3 c
+subplot 2 2 1:title '"\#" style'
+rotate 50 60:box:surf3 c '#'
+subplot 2 2 2:title '"." style'
+rotate 50 60:box:surf3 c '.'
+
+

C++ code: +

void smgl_surf3(mglGraph *gr)
+{
+	mglData c;	mgls_prepare3d(&c);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Surf3 plot (default)");	}
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3(c);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'\\#' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,"#");
+	gr->SubPlot(2,2,2);	gr->Title("'.' style");
+	gr->Rotate(50,60);	gr->Box();	gr->Surf3(c,".");
+}
+
Sample surf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.114 Sample ‘surf3a

+ + +

Function surf3c is similar to surf3 but its transparency is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3A plot':rotate 50 60:light on:alpha on:box:surf3a c d
+
+

C++ code: +

void smgl_surf3a(mglGraph *gr)
+{
+	mglData c,d;	mgls_prepare3d(&c,&d);
+	if(big!=3)	gr->Title("Surf3A plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3A(c,d);
+}
+
Sample surf3a +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.115 Sample ‘surf3c

+ + +

Function surf3c is similar to surf3 but its coloring is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3C plot':rotate 50 60:light on:alpha on:box:surf3c c d
+
+

C++ code: +

void smgl_surf3c(mglGraph *gr)
+{
+	mglData c,d;	mgls_prepare3d(&c,&d);
+	if(big!=3)	gr->Title("Surf3C plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3C(c,d);
+}
+
Sample surf3c +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.116 Sample ‘surf3ca

+ + +

Function surf3c is similar to surf3 but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3CA plot':rotate 50 60:light on:alpha on:box:surf3ca c d c
+
+

C++ code: +

void smgl_surf3ca(mglGraph *gr)
+{
+	mglData c,d;	mgls_prepare3d(&c,&d);
+	if(big!=3)	gr->Title("Surf3CA plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
+	gr->Box();	gr->Surf3CA(c,d,c);
+}
+
Sample surf3ca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.117 Sample ‘surfa

+ + +

Function surfa is similar to surf but its transparency is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfA plot':rotate 50 60:light on:alpha on:box:surfa a b
+
+

C++ code: +

void smgl_surfa(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	gr->Title("SurfA plot");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->Light(true);	gr->Box();
+	gr->SurfA(a,b);
+}
+
Sample surfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.118 Sample ‘surfc

+ + +

Function surfc is similar to surf but its coloring is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfC plot':rotate 50 60:light on:box:surfc a b
+
+

C++ code: +

void smgl_surfc(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	gr->Title("SurfC plot");
+	gr->Rotate(50,60);	gr->Light(true);	gr->Box();	gr->SurfC(a,b);
+}
+
Sample surfc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.119 Sample ‘surfca

+ + +

Function surfca is similar to surf but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare2d'
+title 'SurfCA plot':rotate 50 60:light on:alpha on:box:surfca a b a
+
+

C++ code: +

void smgl_surfca(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	gr->Title("SurfCA plot");
+	gr->Rotate(50,60);	gr->Alpha(true);	gr->Light(true);	gr->Box();
+	gr->SurfCA(a,b,a);
+}
+
Sample surfca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.120 Sample ‘table

+ + +

Function table draw table with data values. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+subplot 2 2 0:title 'Table sample':box
+table ys 'y_1\n{}y_2\n{}y_3'
+
+subplot 2 2 1:title 'no borders, colored'
+table ys 'y_1\n{}y_2\n{}y_3' 'r|'
+
+subplot 2 2 2:title 'no font decrease'
+table ys 'y_1\n{}y_2\n{}y_3' '#'
+
+subplot 2 2 3:title 'manual width and position':box
+table 0.5 0.95 ys 'y_1\n{}y_2\n{}y_3' '#';value 0.7
+
+

C++ code: +

void smgl_table(mglGraph *gr)
+{
+	mglData ys(10,3);	ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Table plot");	}
+	gr->Table(ys,"y_1\ny_2\ny_3");	gr->Box();
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("no borders, colored");
+	gr->Table(ys,"y_1\ny_2\ny_3","r|");
+	gr->SubPlot(2,2,2);	gr->Title("no font decrease");
+	gr->Table(ys,"y_1\ny_2\ny_3","#");
+	gr->SubPlot(2,2,3);	gr->Title("manual width, position");
+	gr->Table(0.5, 0.95, ys,"y_1\ny_2\ny_3","#", "value 0.7");	gr->Box();
+}
+
Sample table +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.121 Sample ‘tape

+ + +

Function tape draw tapes which rotate around the curve as transverse orts of accompanied coordinates. +

+

MGL code: +

call 'prepare1d'
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x'
+subplot 2 2 0 '':title 'Tape plot (default)':box:tape y:plot y 'k'
+subplot 2 2 1:title '3d variant, 2 colors':rotate 50 60:light on
+box:plot xc yc z 'k':tape xc yc z 'rg'
+subplot 2 2 2:title '3d variant, x only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'xr':tape xc yc z 'xr#'
+subplot 2 2 3:title '3d variant, z only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'zg':tape xc yc z 'zg#'
+
+

C++ code: +

void smgl_tape(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);
+	mglData xc(50), yc(50), z(50);
+	yc.Modify("sin(pi*(2*x-1))");
+	xc.Modify("cos(pi*2*x-pi)");	z.Fill(-1,1);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Tape plot (default)");	}
+	gr->Box();	gr->Tape(y);	gr->Plot(y,"k");
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("3d variant, 2 colors");	gr->Rotate(50,60);	gr->Light(true);
+	gr->Box();	gr->Plot(xc,yc,z,"k");	gr->Tape(xc,yc,z,"rg");
+	gr->SubPlot(2,2,2);	gr->Title("3d variant, x only");	gr->Rotate(50,60);
+	gr->Box();	gr->Plot(xc,yc,z,"k");	gr->Tape(xc,yc,z,"xr");	gr->Tape(xc,yc,z,"xr#");
+	gr->SubPlot(2,2,3);	gr->Title("3d variant, z only");	gr->Rotate(50,60);
+	gr->Box();	gr->Plot(xc,yc,z,"k");	gr->Tape(xc,yc,z,"zg");	gr->Tape(xc,yc,z,"zg#");
+}
+
Sample tape +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.122 Sample ‘tens

+ + +

Function tens is variant of plot with smooth coloring along the curves. At this, color is determined as for surfaces (see Color scheme). +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Tens plot (default)':box:tens y(:,0) y(:,1)
+subplot 2 2 2 '':title '" " style':box:tens y(:,0) y(:,1) 'o '
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:tens xc yc z z 's'
+
+

C++ code: +

void smgl_tens(mglGraph *gr)
+{
+	mglData y;	mgls_prepare1d(&y);	gr->SetOrigin(0,0,0);
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Tens plot (default)");	}
+	gr->Box();	gr->Tens(y.SubData(-1,0), y.SubData(-1,1));
+	if(big==3)	return;
+	gr->SubPlot(2,2,2,"");	gr->Title("' ' style");	gr->Box();	gr->Tens(y.SubData(-1,0), y.SubData(-1,1),"o ");
+	gr->SubPlot(2,2,1);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();
+	mglData yc(30), xc(30), z(30);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->Tens(xc,yc,z,z,"s");
+}
+
Sample tens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.123 Sample ‘ternary

+ + +

Example of ternary coordinates. +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+subplot 2 2 0:title 'Ordinary axis 3D':rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':zlabel 'Z'
+
+subplot 2 2 1:title 'Ternary axis (x+y+t=1)':ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y 'r2':plot rx ry 'q^ ':cont a:line 0.5 0 0 0.75 'g2'
+xlabel 'B':ylabel 'C':tlabel 'A'
+
+subplot 2 2 2:title 'Quaternary axis 3D':rotate 50 60:ternary 2
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'D'
+
+subplot 2 2 3:title 'Ternary axis 3D':rotate 50 60:ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'Z'
+
+

C++ code: +

void smgl_ternary(mglGraph *gr)	// flag #
+{
+	gr->SetRanges(0,1,0,1,0,1);
+	mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
+	a.Modify("30*x*y*(1-x-y)^2*(x+y<1)");
+	x.Modify("0.25*(1+cos(2*pi*x))");
+	y.Modify("0.25*(1+sin(2*pi*x))");
+	rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
+	z.Modify("x");
+
+	gr->SubPlot(2,2,0);	gr->Title("Ordinary axis 3D");
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"BbcyrR#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('x',"B",1);	gr->Label('y',"C",1);	gr->Label('z',"Z",1);
+
+	gr->SubPlot(2,2,1);	gr->Title("Ternary axis (x+y+t=1)");
+	gr->Ternary(1);
+	gr->Plot(x,y,"r2");	gr->Plot(rx,ry,"q^ ");	gr->Cont(a);
+	gr->Line(mglPoint(0.5,0), mglPoint(0,0.75), "g2");
+	gr->Axis(); gr->Grid("xyz","B;");
+	gr->Label('x',"B");	gr->Label('y',"C");	gr->Label('t',"A");
+
+	gr->SubPlot(2,2,2);	gr->Title("Quaternary axis 3D");
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Ternary(2);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"BbcyrR#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('t',"A",1);	gr->Label('x',"B",1);
+	gr->Label('y',"C",1);	gr->Label('z',"D",1);
+
+	gr->SubPlot(2,2,3);	gr->Title("Ternary axis 3D");
+	gr->Rotate(50,60);		gr->Light(true);
+	gr->Ternary(1);
+	gr->Plot(x,y,z,"r2");	gr->Surf(a,"BbcyrR#");
+	gr->Axis(); gr->Grid();	gr->Box();
+	gr->Label('t',"A",1);	gr->Label('x',"B",1);
+	gr->Label('y',"C",1);	gr->Label('z',"Z",1);
+}
+
Sample ternary +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.124 Sample ‘text

+ + +

Example of text possibilities. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 ''
+text 0 1 'Text can be in ASCII and in Unicode'
+text 0 0.6 'It can be \wire{wire}, \big{big} or #r{colored}'
+text 0 0.2 'One can change style in string: \b{bold}, \i{italic, \b{both}}'
+text 0 -0.2 'Easy to \a{overline} or \u{underline}'
+text 0 -0.6 'Easy to change indexes ^{up} _{down} @{center}'
+text 0 -1 'It parse TeX: \int \alpha \cdot \
+\sqrt3{sin(\pi x)^2 + \gamma_{i_k}} dx'
+subplot 2 2 1 ''
+ text 0 0.5 '\sqrt{\frac{\alpha^{\gamma^2}+\overset 1{\big\infty}}{\sqrt3{2+b}}}' '@' -2
+text 0 -0.1 'More text position: \frac{a}{b}, \dfrac{a}{b}, [\stack{a}{bbb}], [\stackl{a}{bbb}], [\stackr{a}{bbb}], \sup{a}{sup}, \sub{a}{sub}'text 0 -0.5 'Text can be printed\n{}on several lines'
+text 0 -0.9 'or with color gradient' 'BbcyrR'
+subplot 2 2 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn above a curve' 'Tr'
+subplot 2 2 3 '':line -1 -1 1 -1 'rA':text 0 -1 1 -1 'Horizontal'
+line -1 -1 1 1 'rA':text 0 0 1 1 'At angle' '@'
+line -1 -1 -1 1 'rA':text -1 0 -1 1 'Vertical'
+
+

C++ code: +

void smgl_text(mglGraph *gr)	// text drawing
+{
+	if(big!=3)	gr->SubPlot(2,2,0,"");
+	gr->Putsw(mglPoint(0,1),L"Text can be in ASCII and in Unicode");
+	gr->Puts(mglPoint(0,0.6),"It can be \\wire{wire}, \\big{big} or #r{colored}");
+	gr->Puts(mglPoint(0,0.2),"One can change style in string: "
+	"\\b{bold}, \\i{italic, \\b{both}}");
+	gr->Puts(mglPoint(0,-0.2),"Easy to \\a{overline} or "
+	"\\u{underline}");
+	gr->Puts(mglPoint(0,-0.6),"Easy to change indexes ^{up} _{down} @{center}");
+	gr->Puts(mglPoint(0,-1),"It parse TeX: \\int \\alpha \\cdot "
+	"\\sqrt3{sin(\\pi x)^2 + \\gamma_{i_k}} dx");
+	if(big==3)	return;
+
+	gr->SubPlot(2,2,1,"");
+	gr->Puts(mglPoint(0,0.5), "\\sqrt{\\frac{\\alpha^{\\gamma^2}+\\overset 1{\\big\\infty}}{\\sqrt3{2+b}}}", "@", -2);
+	gr->Puts(mglPoint(0,-0.1),"More text position: \\frac{a}{b}, \\dfrac{a}{b}, [\\stack{a}{bbb}], [\\stackl{a}{bbb}], [\\stackr{a}{bbb}], \\sup{a}{sup}, \\sub{a}{sub}");
+	gr->Puts(mglPoint(0,-0.5),"Text can be printed\non several lines");
+	gr->Puts(mglPoint(0,-0.9),"or with col\bor gradient","BbcyrR");
+
+	gr->SubPlot(2,2,2,"");
+	mglData y;	mgls_prepare1d(&y);
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k");
+	gr->Text(y,"Another string drawn under a curve","Tr");
+
+	gr->SubPlot(2,2,3,"");
+	gr->Line(mglPoint(-1,-1),mglPoint(1,-1),"rA");	gr->Puts(mglPoint(0,-1),mglPoint(1,-1),"Horizontal");
+	gr->Line(mglPoint(-1,-1),mglPoint(1,1),"rA");	gr->Puts(mglPoint(0,0),mglPoint(1,1),"At angle","@");
+	gr->Line(mglPoint(-1,-1),mglPoint(-1,1),"rA");	gr->Puts(mglPoint(-1,0),mglPoint(-1,1),"Vertical");
+}
+
Sample text +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.125 Sample ‘text2

+ + +

Example of text along curve. +

+

MGL code: +

call 'prepare1d'
+subplot 1 3 0 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn under a curve' 'Tr'
+subplot 1 3 1 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:C'
+text y 'Another string drawn under a curve' 'Tr:C'
+subplot 1 3 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:R'
+text y 'Another string drawn under a curve' 'Tr:R'
+
+

C++ code: +

void smgl_text2(mglGraph *gr)	// text drawing
+{
+	mglData y;	mgls_prepare1d(&y);
+	if(big!=3)	gr->SubPlot(1,3,0,"");
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k");
+	gr->Text(y,"Another string drawn under a curve","Tr");
+	if(big==3)	return;
+
+	gr->SubPlot(1,3,1,"");
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k:C");
+	gr->Text(y,"Another string drawn under a curve","Tr:C");
+
+	gr->SubPlot(1,3,2,"");
+	gr->Box();	gr->Plot(y.SubData(-1,0));
+	gr->Text(y,"This is very very long string drawn along a curve","k:R");
+	gr->Text(y,"Another string drawn under a curve","Tr:R");
+}
+
Sample text2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.126 Sample ‘textmark

+ + +

Function textmark is similar to mark but draw text instead of markers. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'TextMark plot (default)':box:textmark y y1 '\gamma' 'r'
+
+

C++ code: +

void smgl_textmark(mglGraph *gr)
+{
+	mglData y,y1;	mgls_prepare1d(&y,&y1);
+	if(big!=3)	{	gr->SubPlot(1,1,0,"");	gr->Title("TextMark plot (default)");	}
+	gr->Box();	gr->TextMark(y,y1,"\\gamma","r");
+}
+
Sample textmark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.127 Sample ‘ticks

+ + +

Example of axis ticks. +

+

MGL code: +

subplot 3 3 0:title 'Usual axis with ":" style'
+axis ':'
+
+subplot 3 3 1:title 'Too big/small range'
+ranges -1000 1000 0 0.001:axis
+
+subplot 3 3 2:title 'LaTeX-like labels'
+axis 'F!'
+
+subplot 3 3 3:title 'Too narrow range'
+ranges 100 100.1 10 10.01:axis
+
+subplot 3 3 4:title 'No tuning, manual "+"'
+axis '+!'
+# for version <2.3 you can use
+#tuneticks off:axis
+
+subplot 3 3 5:title 'Template for ticks'
+xtick 'xxx:%g':ytick 'y:%g'
+axis
+
+xtick '':ytick '' # switch it off for other plots
+
+subplot 3 3 6:title 'No tuning, higher precision'
+axis '!4'
+
+subplot 3 3 7:title 'Manual ticks'
+ranges -pi pi 0 2
+xtick pi 3 '\pi'
+xtick 0.886 'x^*' on # note this will disable subticks drawing
+# or you can use
+#xtick -pi '\pi' -pi/2 '-\pi/2' 0 '0' 0.886 'x^*' pi/2 '\pi/2' pi 'pi'
+list v 0 0.5 1 2:ytick v '0
+0.5
+1
+2'
+axis:grid:fplot '2*cos(x^2)^2' 'r2'
+
+subplot 3 3 8:title 'Time ticks'
+xrange 0 3e5:ticktime 'x':axis
+
+

C++ code: +

void smgl_ticks(mglGraph *gr)
+{
+	gr->SubPlot(3,3,0);	gr->Title("Usual axis with ':' style");	gr->Axis(":");
+	gr->SubPlot(3,3,1);	gr->Title("Too big/small range");
+	gr->SetRanges(-1000,1000,0,0.001);	gr->Axis();
+	gr->SubPlot(3,3,2);	gr->Title("LaTeX-like labels");
+	gr->Axis("F!");
+	gr->SubPlot(3,3,3);	gr->Title("Too narrow range");
+	gr->SetRanges(100,100.1,10,10.01);	gr->Axis();
+	gr->SubPlot(3,3,4);	gr->Title("No tuning, manual '+'");
+	// for version<2.3 you need first call gr->SetTuneTicks(0);
+	gr->Axis("+!");
+	gr->SubPlot(3,3,5);	gr->Title("Template for ticks");
+	gr->SetTickTempl('x',"xxx:%g");	gr->SetTickTempl('y',"y:%g");
+	gr->Axis();
+	// now switch it off for other plots
+	gr->SetTickTempl('x',"");	gr->SetTickTempl('y',"");
+	gr->SubPlot(3,3,6);	gr->Title("No tuning, higher precision");
+	gr->Axis("!4");
+	gr->SubPlot(3,3,7);	gr->Title("Manual ticks");	gr->SetRanges(-M_PI,M_PI, 0, 2);
+	gr->SetTicks('x',M_PI,0,0,"\\pi");	gr->AddTick('x',0.886,"x^*");
+	// alternatively you can use following lines
+	double val[]={0, 0.5, 1, 2};
+	gr->SetTicksVal('y', mglData(4,val), "0\n0.5\n1\n2");
+	gr->Axis();	gr->Grid();	gr->FPlot("2*cos(x^2)^2", "r2");
+	gr->SubPlot(3,3,8);	gr->Title("Time ticks");	gr->SetRange('x',0,3e5);
+	gr->SetTicksTime('x',0);	gr->Axis();
+}
+
Sample ticks +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.128 Sample ‘tile

+ + +

Function tile draw surface by tiles. +

+

MGL code: +

call 'prepare2d'
+title 'Tile plot':rotate 50 60:box:tile a
+
+

C++ code: +

void smgl_tile(mglGraph *gr)
+{
+	mglData a;	mgls_prepare2d(&a);
+	if(big!=3)	gr->Title("Tile plot");
+	gr->Rotate(40,60);	gr->Box();	gr->Tile(a);
+}
+
Sample tile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.129 Sample ‘tiles

+ + +

Function tiles is similar to tile but tile sizes is determined by another data. This allows one to simulate transparency of the plot. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Tiles plot':box:tiles a b
+
+

C++ code: +

void smgl_tiles(mglGraph *gr)
+{
+	mglData a,b;	mgls_prepare2d(&a,&b);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("TileS plot");}
+	gr->Box();	gr->TileS(a,b);
+}
+
Sample tiles +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.130 Sample ‘torus

+ + +

Function torus draw surface of the curve rotation. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0:title 'Torus plot (default)':light on:rotate 50 60:box:torus y1 y2
+subplot 2 2 1:title '"x" style':light on:rotate 50 60:box:torus y1 y2 'x'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:torus y1 y2 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:torus y1 y2 '#'
+
+

C++ code: +

void smgl_torus(mglGraph *gr)
+{
+	mglData y1,y2;	mgls_prepare1d(0,&y1,&y2);
+	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Torus plot (default)");	}
+	gr->Light(true);	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1);	gr->Title("'x' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"x");
+	gr->SubPlot(2,2,2);	gr->Title("'z' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"z");
+	gr->SubPlot(2,2,3);	gr->Title("'\\#' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"#");
+}
+
Sample torus +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.131 Sample ‘traj

+ + +

Function traj is 1D analogue of vect. It draw vectors from specified points. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Traj plot':box:plot x1 y:traj x1 y y1 y2
+
+

C++ code: +

void smgl_traj(mglGraph *gr)
+{
+	mglData x,y,y1,y2;	mgls_prepare1d(&y,&y1,&y2,&x);
+	if(big!=3)	{gr->SubPlot(1,1,0,"");	gr->Title("Traj plot");}
+	gr->Box();	gr->Plot(x,y);	gr->Traj(x,y,y1,y2);
+}
+
Sample traj +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.132 Sample ‘triangulation

+ + +

Example of use triangulate for arbitrary placed points. +

+

MGL code: +

new x 100 '2*rnd-1':new y 100 '2*rnd-1':copy z x^2-y^2
+new g 30 30:triangulate d x y
+title 'Triangulation'
+rotate 50 60:box:light on
+triplot d x y z:triplot d x y z '#k'
+datagrid g x y z:mesh g 'm'
+
+

C++ code: +

void smgl_triangulation(mglGraph *gr)	// surface triangulation
+{
+	mglData x(100), y(100), z(100);
+	gr->Fill(x,"2*rnd-1");	gr->Fill(y,"2*rnd-1");	gr->Fill(z,"v^2-w^2",x,y);
+	mglData d = mglTriangulation(x,y), g(30,30);
+
+	if(big!=3)	gr->Title("Triangulation");
+	gr->Rotate(40,60);	gr->Box();	gr->Light(true);
+	gr->TriPlot(d,x,y,z);	gr->TriPlot(d,x,y,z,"#k");
+
+	gr->DataGrid(g,x,y,z);	gr->Mesh(g,"m");
+}
+
Sample triangulation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.133 Sample ‘triplot

+ + +

Functions triplot and quadplot draw set of triangles (or quadrangles, correspondingly) for irregular data arrays. Note, that you have to provide not only vertexes, but also the indexes of triangles or quadrangles. I.e. perform triangulation by some other library. See also triangulate. +

+

MGL code: +

list q 0 1 2 3 | 4 5 6 7 | 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7
+list xq -1 1 -1 1 -1 1 -1 1
+list yq -1 -1 1 1 -1 -1 1 1
+list zq -1 -1 -1 -1 1 1 1 1
+light on
+subplot 2 2 0:title 'QuadPlot sample':rotate 50 60
+quadplot q xq yq zq 'yr'
+quadplot q xq yq zq '#k'
+subplot 2 2 2:title 'QuadPlot coloring':rotate 50 60
+quadplot q xq yq zq yq 'yr'
+quadplot q xq yq zq '#k'
+list t 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0
+list yt -1 -1 1 0
+list zt -1 -1 -1 1
+subplot 2 2 1:title 'TriPlot sample':rotate 50 60
+triplot t xt yt zt 'b'
+triplot t xt yt zt '#k'
+subplot 2 2 3:title 'TriPlot coloring':rotate 50 60
+triplot t xt yt zt yt 'cb'
+triplot t xt yt zt '#k'
+tricont t xt yt zt 'B'
+
+

C++ code: +

void smgl_triplot(mglGraph *gr)
+{
+	double q[] = {0,1,2,3, 4,5,6,7, 0,2,4,6, 1,3,5,7, 0,4,1,5, 2,6,3,7};
+	double xc[] = {-1,1,-1,1,-1,1,-1,1}, yc[] = {-1,-1,1,1,-1,-1,1,1}, zc[] = {-1,-1,-1,-1,1,1,1,1};
+	mglData qq(6,4,q), xx(8,xc), yy(8,yc), zz(8,zc);
+	gr->Light(true);	//gr->Alpha(true);
+	gr->SubPlot(2,2,0);	gr->Title("QuadPlot sample");	gr->Rotate(50,60);
+	gr->QuadPlot(qq,xx,yy,zz,"yr");
+	gr->QuadPlot(qq,xx,yy,zz,"k#");
+	gr->SubPlot(2,2,2);	gr->Title("QuadPlot coloring");	gr->Rotate(50,60);
+	gr->QuadPlot(qq,xx,yy,zz,yy,"yr");
+	gr->QuadPlot(qq,xx,yy,zz,"k#");
+
+	double t[] = {0,1,2, 0,1,3, 0,2,3, 1,2,3};
+	double xt[] = {-1,1,0,0}, yt[] = {-1,-1,1,0}, zt[] = {-1,-1,-1,1};
+	mglData tt(4,3,t), uu(4,xt), vv(4,yt), ww(4,zt);
+	gr->SubPlot(2,2,1);	gr->Title("TriPlot sample");	gr->Rotate(50,60);
+	gr->TriPlot(tt,uu,vv,ww,"b");
+	gr->TriPlot(tt,uu,vv,ww,"k#");
+	gr->SubPlot(2,2,3);	gr->Title("TriPlot coloring");	gr->Rotate(50,60);
+	gr->TriPlot(tt,uu,vv,ww,vv,"cb");
+	gr->TriPlot(tt,uu,vv,ww,"k#");
+	gr->TriCont(tt,uu,vv,ww,"B");
+}
+
Sample triplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.134 Sample ‘tube

+ + +

Function tube draw tube with variable radius. +

+

MGL code: +

call 'prepare1d'
+light on
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x':divto y1 20
+subplot 2 2 0 '':title 'Tube plot (default)':box:tube y 0.05
+subplot 2 2 1 '':title 'variable radius':box:tube y y1
+subplot 2 2 2 '':title '"\#" style':box:tube y 0.05 '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:tube xc yc z y2 'r'
+
+

C++ code: +

void smgl_tube(mglGraph *gr)
+{
+	mglData y,y1,y2;	mgls_prepare1d(&y,&y1,&y2);	y1/=20;
+	if(big!=3)	{	gr->SubPlot(2,2,0,"");	gr->Title("Tube plot (default)");	}
+	gr->Light(true);	gr->Box();	gr->Tube(y,0.05);
+	if(big==3)	return;
+	gr->SubPlot(2,2,1,"");	gr->Title("variable radius");	gr->Box();	gr->Tube(y,y1);
+	gr->SubPlot(2,2,2,"");	gr->Title("'\\#' style");	gr->Box();	gr->Tube(y,0.05,"#");
+	mglData yc(50), xc(50), z(50);	z.Modify("2*x-1");
+	yc.Modify("sin(pi*(2*x-1))");	xc.Modify("cos(pi*2*x-pi)");
+	gr->SubPlot(2,2,3);	gr->Title("3d variant");	gr->Rotate(50,60);	gr->Box();	gr->Tube(xc,yc,z,y2,"r");
+}
+
Sample tube +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.135 Sample ‘type0

+ + +

Example of ordinary transparency (transptype=0). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 0:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+

C++ code: +

void smgl_type0(mglGraph *gr)	// TranspType = 0
+{
+	gr->Alpha(true);	gr->Light(true);
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetTranspType(0);	gr->Clf();
+	gr->SubPlot(2,2,0);	gr->Rotate(50,60);	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,1);	gr->Rotate(50,60);	gr->Dens(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Rotate(50,60);	gr->Cont(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Rotate(50,60);	gr->Axial(a);	gr->Box();
+}
+
Sample type0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.136 Sample ‘type1

+ + +

Example of glass-like transparency (transptype=1). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 1:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+

C++ code: +

void smgl_type1(mglGraph *gr)	// TranspType = 1
+{
+	gr->Alpha(true);	gr->Light(true);
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetTranspType(1);	gr->Clf();
+	gr->SubPlot(2,2,0);	gr->Rotate(50,60);	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,1);	gr->Rotate(50,60);	gr->Dens(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Rotate(50,60);	gr->Cont(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Rotate(50,60);	gr->Axial(a);	gr->Box();
+}
+
Sample type1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.137 Sample ‘type2

+ + +

Example of lamp-like transparency (transptype=2). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 2:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+

C++ code: +

void smgl_type2(mglGraph *gr)	// TranspType = 2
+{
+	gr->Alpha(true);	gr->Light(true);
+	mglData a;	mgls_prepare2d(&a);
+	gr->SetTranspType(2);	gr->Clf();
+	gr->SubPlot(2,2,0);	gr->Rotate(50,60);	gr->Surf(a);	gr->Box();
+	gr->SubPlot(2,2,1);	gr->Rotate(50,60);	gr->Dens(a);	gr->Box();
+	gr->SubPlot(2,2,2);	gr->Rotate(50,60);	gr->Cont(a);	gr->Box();
+	gr->SubPlot(2,2,3);	gr->Rotate(50,60);	gr->Axial(a);	gr->Box();
+}
+
Sample type2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.138 Sample ‘vect

+ + +

Function vect is most standard way to visualize vector fields – it draw a lot of arrows or hachures for each data cell. It have a lot of options which can be seen on the figure (and in the sample code), and use color scheme for coloring (see Color scheme). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 3 2 0 '':title 'Vect plot (default)':box:vect a b
+subplot 3 2 1 '':title '"." style; "=" style':box:vect a b '.='
+subplot 3 2 2 '':title '"f" style':box:vect a b 'f'
+subplot 3 2 3 '':title '">" style':box:vect a b '>'
+subplot 3 2 4 '':title '"<" style':box:vect a b '<'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:vect ex ey ez
+
+

C++ code: +

void smgl_vect3(mglGraph *gr)
+{
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	if(big!=3)	{	gr->SubPlot(2,1,0);	gr->Title("Vect3 sample");	}
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"x");	gr->Vect3(ex,ey,ez);	gr->Vect3(ex,ey,ez,"z");
+	if(big==3)	return;
+	gr->SubPlot(2,1,1);	gr->Title("'f' style");
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"fx");	gr->Vect3(ex,ey,ez,"f");	gr->Vect3(ex,ey,ez,"fz");
+	gr->Grid3(ex,"Wx");	gr->Grid3(ex,"W");	gr->Grid3(ex,"Wz");
+}
+
Sample vect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

10.139 Sample ‘vect3

+ + +

Function vect3 draw ordinary vector field plot but at slices of 3D data. +

+

MGL code: +

call 'prepare3v'
+subplot 2 1 0:title 'Vect3 sample':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'x':vect3 ex ey ez:vect3 ex ey ez 'z'
+subplot 2 1 1:title '"f" style':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'fx':vect3 ex ey ez 'f':vect3 ex ey ez 'fz'
+grid3 ex 'Wx':grid3 ex 'W':grid3 ex 'Wz'
+
+

C++ code: +

void smgl_vect3(mglGraph *gr)
+{
+	mglData ex,ey,ez;	mgls_prepare3v(&ex,&ey,&ez);
+	if(big!=3)	{	gr->SubPlot(2,1,0);	gr->Title("Vect3 sample");	}
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"x");	gr->Vect3(ex,ey,ez);	gr->Vect3(ex,ey,ez,"z");
+	if(big==3)	return;
+	gr->SubPlot(2,1,1);	gr->Title("'f' style");
+	gr->Rotate(50,60);	gr->SetOrigin(0,0,0);	gr->Axis("_xyz");	gr->Box();
+	gr->Vect3(ex,ey,ez,"fx");	gr->Vect3(ex,ey,ez,"f");	gr->Vect3(ex,ey,ez,"fz");
+	gr->Grid3(ex,"Wx");	gr->Grid3(ex,"W");	gr->Grid3(ex,"Wz");
+}
+
Sample vect3 +
+
+ +
+

+Previous: , Up: All samples   [Contents][Index]

+
+ +

10.140 Sample ’venn’

+ + +

Example of venn-like diagram. +

+

MGL code: +

list x -0.3 0 0.3:list y 0.3 -0.3 0.3:list e 0.7 0.7 0.7
+subplot 1 1 0:title 'Venn-like diagram'
+transptype 1:alpha on:error x y e e '!rgb@#o';alpha 0.1
+
+

C++ code: +

void smgl_venn(mglGraph *gr)
+{
+	double xx[3]={-0.3,0,0.3}, yy[3]={0.3,-0.3,0.3}, ee[3]={0.7,0.7,0.7};
+	mglData x(3,xx), y(3,yy), e(3,ee);
+	gr->SubPlot(1,1,0);	gr->Title("Venn-like diagram");
+	gr->SetTranspType(1);	gr->Alpha(true);	gr->Error(x,y,e,e,"!rgb@#o","alpha 0.1");
+}
+
Sample venn +
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix A Symbols and hot-keys

+ + +

This appendix contain the full list of symbols (characters) used by MathGL for setting up plot. Also it contain sections for full list of hot-keys supported by mglview tool and by UDAV program. +

+ + + + + + + +
+ + + +

A.1 Symbols for styles

+ + +

Below is full list of all characters (symbols) which MathGL use for setting up the plot. +

+
+
space ' '
+

empty line style (see Line styles); +

+

empty color in chart. +

+
+
!
+

set to use new color from palette for each point (not for each curve, as default) in 1D plotting; +

+

set to disable ticks tuning in axis and colorbar; +

+

set to draw grid lines at subticks coordinates too; +

+

define complex variable/expression in MGL script if placed at beginning. +

+
+
#
+

set to use solid marks (see Line styles) or solid error boxes; +

+

set to draw wired plot for axial, surf3, surf3a, surf3c, triplot, quadplot, area, region, bars, barh, tube, tape, cone, boxs and draw boundary only for circle, ellipse, rhomb; +

+

set to draw also mesh lines for surf, surfc, surfa, dens, densx, densy, densz, dens3, or boundary for chart, facex, facey, facez, rect; +

+

set to draw boundary and box for legend, title, or grid lines for table; +

+

set to draw grid for radar; +

+

set to start flow threads and pipes from edges only for flow, pipe; +

+

set to use whole are for axis range in subplot, inplot; +

+

change text color inside a string (see Font styles); +

+

start comment in MGL scripts or in Command options. +

+
+
$
+

denote parameter of MGL scripts. +

+
+
%
+

set color scheme along 2 coordinates Color scheme; +

+

operation in Textual formulas. +

+
+
&
+
+

set to pass long integer number in tick template xtick, ytick, ztick, ctick; +

+

specifier of drawing user-defined symbols as mark (see Line styles); +

+

operation in Textual formulas. +

+
+
+

denote string in MGL scripts or in Command options. +

+
+
*
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to start flow threads from 2d array inside data (see flow); +

+

operation in Textual formulas. +

+
+
+
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

set to print ‘+’ for positive numbers in axis, label, table; +

+

operation of increasing last character value in MGL strings; +

+

operation in Textual formulas. +

+
+
,
+

separator for color positions (see Color styles) or items in a list +

+

concatenation of MGL string with another string or numerical value. +

+
+
-
+

solid line style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

place entries horizontally in legend; +

+

set to use usual ‘-’ for negative numbers in axis, label, table; +

+

operation in Textual formulas. +

+
+
.
+

one of marks (see Line styles) or kind of error boxes; +

+

set to draw hachures instead of arrows for vect, vect3; +

+

set to use dots instead of faces for cloud, torus, axial, surf3, surf3a, surf3c, surf, surfa, surfc, dens, map; +

+

delimiter of fractional parts for numbers. +

+
+
/
+

operation in Textual formulas. +

+
+
:
+

line dashing style (see Line styles); +

+

stop color scheme parsing (see Color scheme); +

+

range operation in MGL scripts; +

+

style for axis; +

+

separator of commands in MGL scripts. +

+
+
;
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

start of an option in MGL scripts or in Command options; +

+

separator of equations in ode; +

+

separator of labels in iris. +

+
+
<
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align left in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+ +
+
>
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align right in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
=
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to use equidistant columns for table; +

+

set to use color gradient for vect, vect3; +

+

operation in Textual formulas. +

+
+
@
+

set to draw box around text for text and similar functions; +

+

set to draw boundary and fill it for circle, ellipse, rhomb; +

+

set to fill faces for box; +

+

set to draw large semitransparent mark instead of error box for error; +

+

set to draw edges for cone; +

+

set to draw filled boxes for boxs; +

+

reduce text size inside a string (see Font styles); +

+

operation in Textual formulas. +

+
+
^
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set outer position for legend; +

+

inverse default position for axis; +

+

switch to upper index inside a string (see Font styles); +

+

align center in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
_
+

empty arrow style (see Line styles); +

+

disable drawing of tick labels for axis; +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set to draw contours at bottom for cont, contf, contd, contv, tricont; +

+

switch to lower index inside a string (see Font styles). +

+
+
[]
+

contain symbols excluded from color scheme parsing (see Color scheme); +

+

operation of getting n-th character from MGL string. +

+
+
{}
+

contain extended specification of color (see Color styles), dashing (see Line styles) or mask (see Color scheme); +

+

denote special operation in MGL scripts; +

+

denote ’meta-symbol’ for LaTeX like string parsing (see Font styles). +

+
+
|
+

line dashing style (see Line styles); +

+

set to use sharp color scheme (see Color scheme); +

+

set to limit width by subplot width for table; +

+

delimiter in list command; +

+

operation in Textual formulas. +

+
+
\
+

string continuation symbol on next line for MGL scripts. +

+
+
~
+

disable drawing of tick labels for axis and colorbar; +

+

disable first segment in lamerey; +

+

reduce number of segments in plot and tens; +

+

one of mask for face filling (see Color scheme). +

+
+
0,1,2,3,4,5,6,7,8,9
+

line width (see Line styles); +

+

brightness of a color (see Color styles); +

+

precision of numbers in axis, label, table; +

+

kind of smoothing (for digits 1,3,5) in smooth; +

+

digits for a value. +

+
+
4,6,8
+

set to draw square, hex- or octo-pyramids instead of cones in cone, cones. +

+
+
A,B,C,D,E,F,a,b,c,d,e,f
+

can be hex-digit for color specification if placed inside {} (see Color styles). +

+
+
A
+

arrow style (see Line styles); +

+

set to use absolute position in whole picture for text, colorbar, legend. +

+
+
a
+

set to use absolute position in subplot for text; +

+

style of plot, radar, tens, area, region to draw segments between points outside of axis range; +

+

style of bars, barh, cones. +

+
+
B
+

dark blue color (see Color styles). +

+
+
b
+

blue color (see Color styles); +

+

bold font face if placed after ‘:’ (see Font styles). +

+
+
C
+

dark cyan color (see Color styles); +

+

align text to center if placed after ‘:’ (see Font styles). +

+
+
c
+

cyan color (see Color styles); +

+

name of color axis; +

+

cosine transform for transform. +

+
+
D
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
d
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-dash description if placed inside {} (see Line styles). +

+
+
E
+

dark green-yellow color (see Color styles). +

+
+
e
+

green-yellow color (see Color styles). +

+
+
F
+
+

set fixed bar widths in bars, barh; +

+

set LaTeX-like format for numbers in axis, label, table. +

+
+
f
+

style of bars, barh; +

+

style of vect, vect3; +

+

set fixed format for numbers in axis, label, table; +

+

Fourier transform for transform. +

+
+
G
+

dark green color (see Color styles). +

+
+
g
+

green color (see Color styles). +

+
+
H
+

dark gray color (see Color styles). +

+
+
h
+

gray color (see Color styles); +

+

Hankel transform for transform. +

+
+
I
+

arrow style (see Line styles); +

+

set colorbar position near boundary. +

+
+
i
+

line dashing style (see Line styles); +

+

italic font face if placed after ‘:’ (see Font styles). +

+

set to use inverse values for cloud, pipe, dew; +

+

set to fill only area with y1<y<y2 for region; +

+

inverse Fourier transform for transform, transforma, fourier. +

+
+
j
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
K
+

arrow style (see Line styles). +

+
+
k
+

black color (see Color styles). +

+
+
L
+

dark green-blue color (see Color styles); +

+

align text to left if placed after ‘:’ (see Font styles). +

+
+
l
+

green-blue color (see Color styles). +

+
+
M
+

dark magenta color (see Color styles). +

+
+
m
+

magenta color (see Color styles). +

+
+
N
+

dark sky-blue color (see Color styles). +

+
+
n
+

sky-blue color (see Color styles). +

+
+
O
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
o
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

over-line text if placed after ‘:’ (see Font styles). +

+
+
P
+

dark purple color (see Color styles). +

+
+
p
+

purple color (see Color styles). +

+
+
Q
+

dark orange or brown color (see Color styles). +

+
+
q
+

orange color (see Color styles). +

+
+
R
+

dark red color (see Color styles); +

+

align text to right if placed after ‘:’ (see Font styles). +

+
+
r
+

red color (see Color styles). +

+
+
S
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
s
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-mask description if placed inside {} (see Color scheme); +

+

sine transform for transform. +

+
+
t
+

draw tubes instead of cones in cone, cones; +

+
+
T
+

arrow style (see Line styles); +

+

place text under the curve for text, cont, cont3. +

+
+
t
+

set to draw text labels for cont, cont3; +

+

name of t-axis (one of ternary axis); +

+

variable in Textual formulas, which usually is varied in range [0,1]. +

+
+
U
+

dark blue-violet color (see Color styles); +

+

disable rotation of tick labels for axis. +

+
+
u
+

blue-violet color (see Color styles); +

+

under-line text if placed after ‘:’ (see Font styles); +

+

name of u-axis (one of ternary axis); +

+

variable in Textual formulas, which usually denote array itself. +

+
+
V
+

arrow style (see Line styles); +

+

place text centering on vertical direction for text. +

+
+
v
+

one of marks (see Line styles); +

+

set to draw vectors on flow threads for flow and on segments for lamerey. +

+
+
W
+

bright gray color (see Color styles). +

+
+
w
+

white color (see Color styles); +

+

wired text if placed after ‘:’ (see Font styles); +

+

name of w-axis (one of ternary axis); +

+
+
X
+

arrow style (see Line styles). +

+
+
x
+
+

name of x-axis or x-direction or 1st dimension of a data array; +

+

start hex-color description if placed inside {} (see Color styles); +

+

one of marks (see Line styles) or kind of error boxes; +

+

tiles orientation perpendicular to x-axis in tile, tiles; +

+

style of tape. +

+
+
Y
+

dark yellow or gold color (see Color styles). +

+
+
y
+

yellow color (see Color styles); +

+

name of y-axis or y-direction or 2nd dimension of a data array; +

+

tiles orientation perpendicular to y-axis in tile, tiles. +

+
+
z
+
+

name of z-axis or z-direction or 3d dimension of a data array; +

+

style of tape. +

+
+
+ + + +
+ + + +

A.2 Hot-keys for mglview

+ + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-POpen printer dialog and print graphics.
Ctrl-WClose window.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop drawing and script execution.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Shift-GCopy graphics to clipboard.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + +
+ + + +

A.3 Hot-keys for UDAV

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-NCreate new window with empty script. Note, all scripts share variables. So, second window can be used to see some additional information of existed variables.
Ctrl-OOpen and execute/show script or data from file. You may switch off automatic exection in UDAV properties
Ctrl-SSave script to a file.
Ctrl-POpen printer dialog and print graphics.
Ctrl-ZUndo changes in script editor.
Ctrl-Shift-ZRedo changes in script editor.
Ctrl-XCut selected text into clipboard.
Ctrl-CCopy selected text into clipboard.
Ctrl-VPaste selected text from clipboard.
Ctrl-ASelect all text in editor.
Ctrl-FShow dialog for text finding.
F3Find next occurrence of the text.
Win-C or Meta-CShow dialog for new command and put it into the script.
Win-F or Meta-FInsert last fitted formula with found coefficients.
Win-S or Meta-SShow dialog for styles and put it into the script. Styles define the plot view (color scheme, marks, dashing and so on).
Win-O or Meta-OShow dialog for options and put it into the script. Options are used for additional setup the plot.
Win-N or Meta-NReplace selected expression by its numerical value.
Win-P or Meta-PSelect file and insert its file name into the script.
Win-G or Meta-GShow dialog for plot setup and put resulting code into the script. This dialog setup axis, labels, lighting and other general things.
Ctrl-Shift-OLoad data from file. Data will be deleted only at exit but UDAV will not ask to save it.
Ctrl-Shift-SSave data to a file.
Ctrl-Shift-CCopy range of numbers to clipboard.
Ctrl-Shift-VPaste range of numbers from clipboard.
Ctrl-Shift-NRecreate the data with new sizes and fill it by zeros.
Ctrl-Shift-RResize (interpolate) the data to specified sizes.
Ctrl-Shift-TTransform data along dimension(s).
Ctrl-Shift-MMake another data.
Ctrl-Shift-HFind histogram of data.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-GSwitch on/off grid of absolute coordinates.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop script execution and drawing.
F8Show/hide tool window with list of hidden plots.
F9Restore status for ’once’ command and reload data.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-WOpen dialog with slideshow options.
Ctrl-Shift-GCopy graphics to clipboard.
F1Show help on MGL commands
F2Show/hide tool window with messages and information.
F4Show/hide calculator which evaluate and help to type textual formulas. Textual formulas may contain data variables too.
Meta-Shift-Up, Meta-Shift-DownChange view angle \theta.
Meta-Shift-Left, Meta-Shift-RightChange view angle \phi.
Alt-Minus, Alt-EqualZoom in/out whole image.
Alt-Up, Alt-Down, Alt-Right, Alt-LeftShift whole image.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix B File formats

+ + +

This appendix contain description of file formats used by MathGL. +

+ + + + + + + + +
+ +
+

+Next: , Up: File formats   [Contents][Index]

+
+ +

B.1 Font files

+ + +

Starting from v.1.6 the MathGL library uses new font files. The font is defined in 4 files with suffixes ‘*.vfm’, ‘*_b.vfm’, ‘*_i.vfm’, ‘*_bi.vfm’. These files are text files containing the data for roman font, bold font, italic font and bold italic font. The files (or some symbols in the files) for bold, italic or bold italic fonts can be absent. In this case the roman glyph will be used for them. By analogy, if the bold italic font is absent but the bold font is present then bold glyph will be used for bold italic. You may create these font files by yourself from *.ttf, *.otf files with the help of program font_tools. This program can be found at MathGL home site. +

+

The format of font files (*.vfm – vector font for MathGL) is the following. +

    +
  1. First string contains human readable comment and is always ignored. +
  2. Second string contains 3 numbers, delimited by space or tabulation. The order of numbers is the following: numg – the number of glyphs in the file (integer), fact – the factor for glyph sizing (mreal), size – the size of buffer for glyph description (integer). +
  3. After it numg-th strings with glyphs description are placed. Each string contains 6 positive numbers, delimited by space of tabulation. The order of numbers is the following: Unicode glyph ID, glyph width, number of lines in glyph, position of lines coordinates in the buffer (length is 2*number of lines), number of triangles in glyph, position of triangles coordinates in the buffer (length is 6*number of triangles). +
  4. The end of file contains the buffer with point coordinates at lines or triangles vertexes. The size of buffer (the number of integer) is size. +
+ +

Each font file can be compressed by gzip. +

+

Note: the closing contour line is done automatically (so the last segment may be absent). For starting new contour use a point with coordinates {0x3fff, 0x3fff}. +

+ + +
+ +
+

+Next: , Previous: , Up: File formats   [Contents][Index]

+
+ +

B.2 MGLD format

+ + +

MGLD is textual file, which contain all required information for drawing 3D image, i.e. it contain vertexes with colors and normales, primitives with all properties, textures, and glyph descriptions. MGLD file can be imported or viewed separately, without parsing data files itself. +

+

MGLD file start from string +

MGLD npnts nprim ntxtr nglfs # optional description
+

which contain signature ‘MGLD’ and number of points npnts, number of primitives nprim, number of textures ntxtr, number of glyph descriptions nglfs, and optional description. Empty strings and string with ‘#’ are ignored. +

+

Next, file contain npnts strings with points coordinates and colors. The format of each string is +

x y z c t ta u v w r g b a
+

Here x, y, z are coordinates, c, t are color indexes in texture, ta is normalized t according to current alpha setting, u, v, w are coordinates of normal vector (can be NAN if disabled), r, g, b, a are RGBA color values. +

+

Next, file contain nprim strings with properties of primitives. The format of each string is +

type n1 n2 n3 n4 id s w p
+

Here type is kind of primitive (0 - mark, 1 - line, 2 - triangle, 3 - quadrangle, 4 - glyph), n1...n4 is index of point for vertexes, id is primitive identification number, s and w are size and width if applicable, p is scaling factor for glyphs. +

+

Next, file contain ntxtr strings with descriptions of textures. The format of each string is +

smooth alpha colors
+

Here smooth set to enable smoothing between colors, alpha set to use half-transparent texture, colors contain color scheme itself as it described in Color scheme. +

+

Finally, file contain nglfs entries with description of each glyph used in the figure. The format of entries are +

nT nL
+xA yA xB yB xC yC ...
+xP yP ...
+

Here nT is the number of triangles; nL is the number of line vertexes; xA, yA, xB, yB, xC, yC are coordinates of triangles; and xP, yP, xQ, yQ are coordinates of lines. Line coordinate xP=0x3fff, yP=0x3fff denote line breaking. +

+ +
+ +
+

+Next: , Previous: , Up: File formats   [Contents][Index]

+
+ +

B.3 JSON format

+ + +

MathGL can save points and primitives of 3D object. It contain a set of variables listed below. +

+
+
width
+

width of the image; +

+
height
+

height of the image +

+
depth
+

depth of the image, usually =sqrt(width*height); +

+
+
npnts
+

number of points (vertexes); +

+
pnts
+

array of coordinates of points (vertexes), each element is array in form [x, y, z]; +

+
+
nprim
+

number of primitives; +

+
prim
+

array of primitives, each element is array in form [type, n1, n2, n3, n4, id, s, w, p, z, color]. +

+

Here type is kind of primitive (0 - mark, 1 - line, 2 - triangle, 3 - quadrangle, 4 - glyph), n1...n4 is index of point for vertexes and n2 can be index of glyph coordinate, s and w are size and width if applicable, z is average z-coordinate, id is primitive identification number, p is scaling factor for glyphs. +

+
+
ncoor
+

number of glyph positions +

+
coor
+

array of glyph positions, each element is array in form [dx,dy] +

+
+
nglfs
+

number of glyph descriptions +

+
glfs
+

array of glyph descriptions, each element is array in form [nL, [xP0, yP0, xP1, yP1 ...]]. Here nL is the number of line vertexes; and xP, yP, xQ, yQ are coordinates of lines. Line coordinate xP=0x3fff, yP=0x3fff denote line breaking. +

+
+
+ + +
+ +
+

+Previous: , Up: File formats   [Contents][Index]

+
+ +

B.4 IFS format

+ + +

MathGL can read IFS fractal parameters (see ifsfile) from a IFS file. Let remind IFS file format. File may contain several records. Each record contain the name of fractal (‘binary’ in the example below) and the body of fractal, which is enclosed in curly braces {}. Symbol ‘;’ start the comment. If the name of fractal contain ‘(3D)’ or ‘(3d)’ then the 3d IFS fractal is specified. The sample below contain two fractals: ‘binary’ – usual 2d fractal, and ‘3dfern (3D)’ – 3d fractal. +

+
 binary
+ { ; comment allowed here
+  ; and here
+  .5  .0 .0 .5 -2.563477 -0.000003 .333333   ; also comment allowed here
+  .5  .0 .0 .5  2.436544 -0.000003 .333333
+  .0 -.5 .5 .0  4.873085  7.563492 .333333
+  }
+
+ 3dfern (3D) {
+   .00  .00 0 .0 .18 .0 0  0.0 0.00 0 0.0 0 .01
+   .85  .00 0 .0 .85 .1 0 -0.1 0.85 0 1.6 0 .85
+   .20 -.20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  -.20  .20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  }
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix C Время отрисовки

+ +

В таблице показаны времена создания графика для всех примеров из файла examples/samples.cpp. Тест выполнен на моем ноутбуке (i5-2430M) с 64-bit Debian. +

+

Несколько слов о скорости. Во-первых, прямое рисование в память (Quality=4,5,6) быстрее буферизованного (Quality=0,1,2), но иногда результат некоректен (см. cloud) и пропадает возможность экспорта в векторные и 3d форматы (например, EPS, SVG, PDF, ...). Во-вторых, обычно картинка худшего качества рисуется быстрее, т.е. Quality=1 быстрее Quality=2, и Quality=0 быстрее Quality=1. Однако, если график содержит множество граней (например cloud, surf3, pipe, dew), то Quality=0 может быть достаточно медленным, особенно для маленьких картинок. Наконец, картинки меньшего размера рисуются быстрее. +

+

Результаты для изображения размером 800*600 (по умолчанию). +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nameq=0q=1q=2q=4q=5q=6q=8
3wave0.03220.06270.07210.04250.110.1360.0271
alpha0.08920.1080.1130.04730.1240.1450.0297
apde48.247.447.647.447.848.447.9
area0.03760.07280.07520.0330.1410.1650.0186
aspect0.04420.05720.05510.0310.09990.1030.0146
axial0.6390.9170.9260.1950.5250.5520.119
axis0.06830.1070.1080.04660.1960.2020.0169
barh0.02850.05470.06030.02920.1010.1150.0114
bars0.04140.07030.08430.10.1850.1840.0295
belt0.02860.05320.05770.03840.07350.10.0131
bifurcation0.5890.6350.6090.5310.5720.5790.512
box0.06820.08050.08280.03140.1240.1210.0169
boxplot0.01020.03170.03470.020.04990.05540.0167
boxs0.2390.3630.40.07980.2160.2340.0721
candle0.02860.05490.0530.02630.04830.05640.0109
chart0.4160.6130.7070.261.071.590.191
cloud0.03124.154.110.03060.7150.9240.0168
colorbar0.1080.1720.1770.07870.2580.2660.0452
combined0.360.3360.3320.1980.3160.330.196
cones0.1450.1390.140.09370.2480.2760.0363
cont0.09870.1410.1410.05850.2070.1940.0455
cont30.03230.0580.05870.03040.07260.08370.0162
cont_xyz0.04170.05850.06120.04170.08330.08450.0294
contd0.1910.2450.2360.1040.1890.2010.0902
contf0.1620.1790.1820.07890.1660.1770.067
contf30.1230.120.1340.0650.1230.1550.0538
contf_xyz0.07510.09220.1110.07560.08790.09560.0462
contv0.09470.1230.1360.07570.1630.180.0469
correl0.03390.06290.05990.02880.1150.1380.0165
curvcoor0.1120.1640.1710.08640.2960.2980.0739
cut0.6950.4650.4840.3030.3850.3710.316
dat_diff0.04570.0790.08250.03460.1360.1580.0186
dat_extra0.1750.1810.1730.08770.1630.1730.0463
data12.391.761.751.331.381.371.4
data21.421.261.281.171.241.291.14
dens0.08670.1220.1310.06150.1450.1680.032
dens30.07220.07690.09370.04370.09470.1510.0797
dens_xyz0.05990.08750.09610.04630.0890.08970.0315
detect0.1330.1510.1760.08610.1160.1380.0721
dew1.481.070.9710.4730.5370.4160.195
diffract0.08780.1270.1390.06070.2190.2370.0274
dilate0.07780.1280.1380.05920.2420.2320.0298
dots0.06850.10.1010.06940.1340.1290.0261
earth0.01470.0330.02180.01680.01680.01910.00177
error0.03120.07070.07090.02880.1350.1370.016
error20.05810.09640.09580.05950.1730.1870.0444
export0.1160.1580.1670.07990.1320.1330.0685
fall0.0350.0510.05770.0180.05850.07090.0142
fexport1.521.761.780.2780.6040.6061.35
fit0.03710.06530.06660.02770.0810.08370.014
flame2d5.375.545.53.043.213.091.13
flow0.3680.4510.4440.360.50.480.352
fog0.04060.06450.06880.03790.07930.08940.0156
fonts0.04770.09260.1120.03470.05180.05190.0413
grad0.06070.1040.1290.07150.1030.120.0633
hist0.1250.1480.1590.09190.1160.1290.0372
ifs2d0.5940.6230.620.3150.3490.330.109
ifs3d0.7870.7770.7840.2940.3530.3660.117
indirect0.02860.05170.05430.0310.06120.1040.0144
inplot0.06870.09790.09930.06220.1810.1950.0444
iris0.008460.0250.01980.003490.01720.01820.0018
label0.02850.0450.0580.02670.05250.06180.014
lamerey0.03050.03720.04550.0190.06040.06330.0024
legend0.07640.2020.2070.04550.1380.1480.0162
light0.09030.1290.1220.05730.1320.1440.021
loglog0.1030.1680.160.08060.2280.2350.0802
map0.03030.06530.07210.03370.08210.08660.015
mark0.01910.03240.03680.02610.05330.0450.0072
mask0.04420.09640.1010.03430.2050.2110.0115
mesh0.0340.07740.06820.01920.07650.07420.0145
mirror0.0920.1280.1420.06070.1740.1760.0312
molecule0.08270.08420.08590.04430.09970.1460.0115
ode0.1490.2020.2020.1470.2820.3160.133
ohlc0.00590.02780.02710.01520.05170.0450.0152
param10.1610.2520.260.09410.3010.3410.0466
param20.5350.580.5390.260.4520.4750.189
param31.752.372.320.6770.8990.9070.758
paramv1.211.391.360.7880.9740.9680.69
parser0.03460.05820.06870.03170.1080.110.0275
pde0.3290.3580.3730.2720.3110.3640.264
pendelta0.06530.05250.06480.05170.05310.05220.0653
pipe0.5980.7370.7380.3820.4930.5050.34
plot0.03970.06420.1140.04440.1230.1180.0194
pmap0.09130.1150.1250.05720.09990.1130.0469
primitives0.05810.1080.1280.06490.1810.210.00928
projection0.130.2640.2860.07040.3510.3490.0683
projection50.1170.2070.2150.07170.30.3120.0437
pulse0.02730.03950.04130.01830.05760.06350.0023
qo2d0.2180.2460.2740.1980.2430.2550.177
quality00.08590.09020.0870.08080.08080.08230.0796
quality10.1890.1660.1710.1750.170.1730.166
quality20.1830.1830.1750.1720.1710.1830.184
quality40.0820.07130.07280.06360.08430.06510.0592
quality50.3660.3590.3630.3660.3540.3560.357
quality60.3730.3670.3650.3660.3680.3830.366
quality80.01930.0190.02890.02980.01650.02440.0229
radar0.01930.03690.05450.01580.05250.05320.0115
refill0.1530.1680.1660.07460.2390.2580.0467
region0.03960.07230.08590.03420.1330.1590.017
scanfile0.03150.0360.04970.01690.04860.0530.014
schemes0.07030.1140.1170.0620.2040.210.019
section0.02940.04830.0540.02210.08040.08210.00568
several_light0.04410.05410.07010.02990.06020.08150.0117
solve0.04610.1090.1050.04620.180.1910.0184
stem0.04180.05990.05910.03080.1260.1390.015
step0.03990.06140.05540.03150.09580.1130.0145
stereo0.05690.06520.08110.0310.08070.0930.0163
stfa0.04250.1170.1110.04160.1150.1210.0157
style0.08920.1970.2040.05960.3490.3690.0158
surf0.1090.1330.1570.06570.160.1580.0315
surf31.792.62.570.9492.362.440.625
surf3a0.4310.2810.2970.1760.2350.2520.178
surf3c0.4230.2850.3010.1750.2020.2650.177
surf3ca0.4280.3030.310.1760.2030.2650.19
surfa0.04090.05770.07140.02650.0620.07250.0154
surfc0.04220.04530.0580.02820.06280.07490.0161
surfca0.04160.05980.0580.02540.05410.06710.015
table0.1030.2130.2140.04840.1120.1170.0156
tape0.04090.07840.08360.03470.1240.1380.0164
tens0.03290.04850.04410.02790.08050.07570.00561
ternary0.1040.2180.2140.06340.3930.4250.0352
text0.08270.1560.150.02610.1140.1270.015
text20.07190.120.1310.1150.1290.1370.016
textmark0.04030.07490.07880.02230.06070.06530.014
ticks0.08680.1930.1950.06110.2590.2490.0275
tile0.03490.04440.05970.03080.05460.05470.0111
tiles0.03930.05850.05340.02050.06480.05970.0174
torus0.1140.1970.1930.07130.3940.4570.0306
traj0.02510.04130.0430.01780.06280.09680.0129
triangulation0.03280.06590.07920.03190.09660.08880.0155
triplot0.03020.07050.1020.01980.09730.1270.0143
tube0.0770.1430.1920.05930.1910.210.0197
type00.1770.1720.1980.06730.1410.20.0576
type10.1740.1730.20.06480.1530.170.0571
type20.1880.1980.1970.07730.1860.1930.0647
vect0.1290.3360.1940.06080.1740.1770.043
vect30.03170.07810.08690.03660.1550.1590.0174
venn0.01530.05030.07870.01150.06650.0750.00249
+ +

Результаты для изображения размером 1920*1440 (для печати) +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nameq=0q=1q=2q=4q=5q=6q=8
3wave0.07630.1340.1570.07640.1980.2070.0598
alpha0.1110.1760.2540.1040.2440.2720.0591
apde4847.647.547.147.247.747
area0.07830.1690.2450.1070.2770.3350.0408
aspect0.06220.1050.1290.06380.1850.2340.0478
axial0.6811.381.610.2970.8781.120.141
axis0.08630.1530.170.07730.2740.2970.0479
barh0.06310.1180.1340.06610.2180.2590.049
bars0.06540.1260.1530.08030.280.3180.0479
belt0.06240.110.1330.06140.2280.3540.0454
bifurcation0.6040.6960.7580.6020.6560.6920.572
box0.0810.1520.2110.07540.2040.2380.0516
boxplot0.04580.0720.1080.04930.1060.120.0329
boxs0.2760.6230.8230.1310.3870.520.0935
candle0.05660.10.1130.0590.1260.1540.0435
chart0.461.081.780.3772.573.840.19
cloud0.06185.786.760.0611.492.720.0441
colorbar0.1440.2590.2970.1420.3830.4550.075
combined0.4290.4570.5560.2860.4740.5640.245
cones0.170.2260.2720.1570.5210.6670.0624
cont0.09890.1930.2350.09520.2850.3040.0637
cont30.06450.110.1220.06290.130.1520.0479
cont_xyz0.06760.1050.1290.06280.1340.1480.0523
contd0.2370.3070.3680.1510.2940.3460.106
contf0.1930.2620.3050.1360.2740.3220.0921
contf30.1690.2060.30.1170.2320.3530.0796
contf_xyz0.1180.180.2060.1030.1770.2310.0661
contv0.1310.2260.2590.1140.2820.3340.0753
correl0.05780.1080.1150.06160.1930.2160.0463
curvcoor0.1250.2030.2190.120.4540.5040.0933
cut0.7680.6610.730.430.530.6690.431
dat_diff0.09220.1510.1930.0920.2350.2740.0439
dat_extra0.2020.2360.2630.1320.2540.2920.0747
data12.622.072.141.431.691.831.56
data21.511.411.491.221.431.441.24
dens0.1150.2360.320.1340.2710.3270.0746
dens30.1010.1540.2140.09810.1730.2440.0429
dens_xyz0.1020.1790.2420.1190.1640.220.0495
detect0.170.2830.3570.1290.2170.2930.0927
dew1.631.11.190.5570.7970.8810.288
diffract0.09610.2530.3460.1140.3820.430.0508
dilate0.0980.2310.2590.1010.3470.4040.0539
dots0.09860.1390.1670.1060.240.2210.223
earth0.04550.05320.06590.04480.04040.05920.0294
error0.07640.1280.1340.07580.2030.2270.076
error20.07390.1660.1880.09340.3740.4160.0608
export0.1770.2730.3820.1310.2440.3120.0968
fall0.04810.1270.1140.0510.1150.1250.0442
fexport2.332.692.811.121.431.522.19
fit0.0720.1120.1210.06570.1540.1660.0442
flame2d6.166.346.313.713.913.751.26
flow0.430.5290.5570.4030.5820.5990.372
fog0.06510.1460.2090.070.1720.2420.0466
fonts0.08420.130.1350.06690.09690.09650.0696
grad0.1110.2230.3180.1330.2160.2840.0783
hist0.1850.2270.250.1360.2340.2530.0632
ifs2d0.70.7770.7620.3960.4570.4430.133
ifs3d0.8270.8350.8930.3690.450.4840.127
indirect0.05790.09040.1160.05990.1280.1520.0316
inplot0.09310.1510.190.1070.320.3290.0601
iris0.04460.05440.07510.04680.04570.05780.0371
label0.04840.08790.1050.06010.1120.1640.078
lamerey0.07230.07280.09780.06110.1040.1540.0522
legend0.1230.2820.30.07960.2320.3110.041
light0.120.1860.4480.1040.220.4170.0528
loglog0.1360.2520.2520.1250.4050.4810.0956
map0.07680.1570.1950.07340.1680.2320.0471
mark0.06590.09090.08810.07180.2390.1510.0372
mask0.08780.2070.3260.09440.2790.3470.0511
mesh0.07190.1310.1630.06830.1470.1810.0418
mirror0.1350.2170.2590.1050.2960.3080.0548
molecule0.09790.1460.2370.09530.2410.3610.044
ode0.1930.280.290.1910.4190.4360.163
ohlc0.04820.0710.09360.05740.1090.1210.0447
param10.1860.3480.4240.150.5450.8450.0861
param20.570.7320.8060.3130.6980.8270.23
param31.912.562.930.7671.171.580.844
paramv1.291.551.50.8161.121.110.718
parser0.06310.1120.140.06430.2090.2320.0467
pde0.370.5110.5540.3180.4290.4550.284
pendelta0.1080.1150.1020.1080.1150.1040.105
pipe0.6610.9221.040.4140.6690.8280.36
plot0.09610.1160.1420.09320.220.2370.0457
pmap0.1370.1840.2160.09940.1650.210.0737
primitives0.09780.1910.2890.09710.3040.3530.0386
projection0.1660.4030.4840.1240.5780.6260.078
projection50.1490.3230.360.1170.4960.5460.0722
pulse0.04880.07510.09110.05030.1120.130.0347
qo2d0.2520.3890.4550.2440.3540.4140.208
quality00.1120.1120.1190.1190.110.1230.114
quality10.2390.2540.240.240.2520.260.232
quality20.2760.2730.2720.2770.2750.2740.278
quality40.1070.1040.1030.1040.1040.1120.107
quality50.4550.4480.460.4660.450.450.456
quality60.4890.4780.480.4890.480.4790.492
quality80.05750.04670.04530.04390.0470.04620.0486
radar0.0580.06750.08720.070.09690.1230.0284
refill0.1860.2320.2780.1290.3560.3890.07
region0.07060.1660.210.08030.2740.30.0442
scanfile0.05630.07690.08840.04690.08910.1060.0341
schemes0.1210.2270.2830.1890.2840.3380.0454
section0.05930.09480.09740.06220.1590.1750.0417
several_light0.0760.1090.2440.06970.1230.2460.0442
solve0.09250.1880.1950.1080.3440.3340.0485
stem0.06330.1290.1450.08270.2030.2120.0407
step0.06320.1020.1140.1120.1830.1940.0447
stereo0.09010.1260.2060.08070.1510.2370.0441
stfa0.09250.2450.2910.08010.2140.2990.0438
style0.1140.2710.3210.1020.440.4680.0451
surf0.1490.2410.3030.120.240.3190.0498
surf32.013.413.441.413.343.330.667
surf3a0.5140.3970.5370.240.3970.740.205
surf3c0.4820.40.5330.2350.4230.7280.208
surf3ca0.4940.4010.5360.260.4020.7090.243
surfa0.06430.1050.1810.05720.1220.1920.0456
surfc0.06440.1110.1840.06090.1280.1990.0399
surfca0.06450.1060.1810.06960.1280.2010.044
table0.1280.2630.290.08130.1760.1970.0481
tape0.07790.1430.1670.07880.2240.2420.0463
tens0.06050.09560.09350.06990.1460.1620.046
ternary0.130.3340.3570.1160.5890.650.061
text0.110.2140.2250.06780.1720.190.0438
text20.08090.1750.1890.07970.220.2350.0425
textmark0.07420.1290.140.05740.1260.1430.0438
ticks0.1260.2520.2740.1110.3290.3590.0488
tile0.0620.0910.1350.06050.110.1560.0613
tiles0.060.1190.1580.06040.1290.1630.0466
torus0.1480.2770.3910.1210.8171.190.0653
traj0.04760.08990.1080.05590.1530.1620.0336
triangulation0.06220.1590.2180.06670.1730.2440.0451
triplot0.04940.1810.3710.06080.1810.320.0308
tube0.1080.2860.3730.1040.3110.3790.0493
type00.2380.3260.50.1440.3140.4790.108
type10.2370.340.5310.1370.3170.50.102
type20.2430.3350.5090.1480.3170.4840.115
vect0.110.2480.3280.1270.3540.3250.0732
vect30.06920.1530.1730.08840.5260.3660.0356
venn0.04940.1940.2890.06640.1580.2360.044
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix D Символы TeX

+ + +

The full list of TeX-like commands recognizable by MathGL is shown below. If command is not recognized then it will be printed as is by ommitting ‘\’ symbol. For example, ‘\#’ produce “#”, ‘\\’ produce “\”, ‘\qq’ produce “qq”. +

+

Change case: _, ^, @. +

+

Text style: \big, \b, \textbf, \i, \textit, \bi, \r, \textrm, \a, \overline, \u, \underline, \w, \wire, #, \color[wkrgbcymhRGBCYMHWlenupqLENUPQ] +

+

Roots: \sqrt, \sqrt3, \sqrt4 +

+

Fractions: \frac, \dfrac, \stack, \overset, \underset, \stackr, \stackl +

+

Accents: \hat, \tilde, \dot, \ddot, \dddot, \ddddot, \acute, \check, \grave, \vec, \bar, \breve +

+

Special symbols: +

+

\# (#), \% (%), \& (&), \^ (^). +

+

\AA (Å), \AE (Æ), \APLboxquestion (⍰), \APLboxupcaret (⍓), \APLnotbackslash (⍀), \APLnotslash (⌿), \Alpha (Α), \And (&), \Angstrom (Å), \Barv (⫧), \BbbC (ℂ), \BbbGamma (ℾ), \BbbH (ℍ), \BbbN (ℕ), \BbbP (ℙ), \BbbPi (ℿ), \BbbQ (ℚ), \BbbR (ℝ), \BbbZ (ℤ), \Bbbgamma (ℽ), \Bbbpi (ℼ), \Bbbsum (⅀), \Beta (Β), \Bumpeq (≎), \Cap (⋒), \Chi (Χ), \Colon (∷), \Coloneq (⩴), \Cup (⋓), \DDownarrow (⟱), \DH (Ð), \DJ (Đ), \DashV (⫥), \DashVDash (⟚), \Dashv (⫤), \Ddownarrow (⤋), \Delta (Δ), \Digamma (Ϝ), \Doteq (≑), \Downarrow (⇓), \Epsilon (Ε), \Equiv (≣), \Eta (Η), \Eulerconst (ℇ), \Exclam (‼), \Finv (Ⅎ), \Game (⅁), \Gamma (Γ), \Gt (⪢), \Hermaphrodite (⚥), \Im (ℑ), \Iota (Ι), \Kappa (Κ), \Koppa (Ϟ), \L (Ł), \LLeftarrow (⭅), \Lambda (Λ), \Lbrbrak (⟬), \Ldsh (↲), \Leftarrow (⇐), \Leftrightarrow (⇔), \Lleftarrow (⇚), \Longleftarrow (⟸), \Longleftrightarrow (⟺), \Longmapsfrom (⟽), \Longmapsto (⟾), \Longrightarrow (⟹), \Lparengtr (⦕), \Lsh (↰), \Lt (⪡), \Lvzigzag (⧚), \Mapsfrom (⤆), \Mapsto (⤇), \Mu (Μ), \NG (Ŋ), \Nearrow (⇗), \Not (⫬), \Nu (Ν), \Nwarrow (⇖), \O (Ø), \OE (Œ), \Ohorn (Ơ), \Omega (Ω), \Omicron (Ο), \Otimes (⨷), \P (¶), \Phi (Φ), \Pi (Π), \Planckconst (ℎ), \Prec (⪻), \PropertyLine (⅊), \Psi (Ψ), \QED (∎), \Question (⁇), \RRightarrow (⭆), \Rbrbrak (⟭), \Rdsh (↳), \Re (ℜ), \Rho (Ρ), \Rightarrow (⇒), \Rparenless (⦖), \Rrightarrow (⇛), \Rsh (↱), \Rvzigzag (⧛), \S (§), \Sc (⪼), \Searrow (⇘), \Sigma (Σ), \Sqcap (⩎), \Sqcup (⩏), \Stigma (Ϛ), \Subset (⋐), \Supset (⋑), \Swarrow (⇙), \TH (Þ), \Tau (Τ), \Theta (Θ), \UUparrow (⟰), \Uhorn (Ư), \Uparrow (⇑), \Updownarrow (⇕), \Uuparrow (⤊), \VDash (⊫), \Vbar (⫫), \Vdash (⊩), \Vee (⩔), \Vert (‖), \Vvdash (⊪), \Vvert (⦀), \Wedge (⩓), \XBox (☒), \Xi (Ξ), \Yup (⅄), \Zbar (Ƶ), \Zeta (Ζ). +

+

\aa (å), \ac (∾), \accurrent (⏦), \acidfree (♾), \acwcirclearrow (⥀), \acwgapcirclearrow (⟲), \acwleftarcarrow (⤹), \acwopencirclearrow (↺), \acwoverarcarrow (⤺), \acwundercurvearrow (⤻), \adots (⋰), \ae (æ), \aleph (ℵ), \alpha (α), \amalg (⨿), \angdnr (⦟), \angle (∠), \angles (⦞), \angleubar (⦤), \approx (≈), \approxeq (≊), \approxeqq (⩰), \approxident (≋), \arceq (≘), \aries (♈), \assert (⊦), \ast (∗), \asteq (⩮), \astrosun (☉), \asymp (≍), \awint (⨑). +

+

\bNot (⫭), \backcong (≌), \backdprime (‶), \backepsilon (϶), \backprime (‵), \backsim (∽), \backsimeq (⋍), \backslash (\), \backtrprime (‷), \bagmember (⋿), \barV (⫪), \barcap (⩃), \barcup (⩂), \bardownharpoonleft (⥡), \bardownharpoonright (⥝), \barleftarrow (⇤), \barleftarrowrightarrowbar (↹), \barleftharpoondown (⥖), \barleftharpoonup (⥒), \barovernorthwestarrow (↸), \barrightarrowdiamond (⤠), \barrightharpoondown (⥟), \barrightharpoonup (⥛), \baruparrow (⤒), \barupharpoonleft (⥘), \barupharpoonright (⥔), \barvee (⊽), \barwedge (⊼), \bbrktbrk (⎶), \bdHrule (═), \bdVrule (║), \bdbVbH (╬), \bdbVbh (╫), \bdbVlH (╣), \bdbVlh (╢), \bdbVrH (╠), \bdbVrh (╟), \bdbvbH (╪), \bdbvbh (┼), \bdbvlH (╡), \bdbvlh (┤), \bdbvrH (╞), \bdbvrh (├), \bddVbH (╦), \bddVbh (╥), \bddVlH (╗), \bddVlh (╖), \bddVrH (╔), \bddVrh (╓), \bddvbH (╤), \bddvbh (┬), \bddvlH (╕), \bddvlh (┐), \bddvrH (╒), \bddvrh (┌), \bdhrule (─), \bdnesw (╱), \bdnwse (╲), \bdquadhdash (┈), \bdquadvdash (┊), \bdtriplevdash (┆), \bduVbH (╩), \bduVbh (╨), \bduVlH (╝), \bduVlh (╜), \bduVrH (╚), \bduVrh (╙), \bduvbH (╧), \bduvbh (┴), \bduvlH (╛), \bduvlh (┘), \bduvrH (╘), \bduvrh (└), \bdvrule (│), \because (∵), \benzenr (⏣), \beta (β), \beth (ℶ), \between (≬), \bigblacktriangledown (▼), \bigblacktriangleup (▲), \bigbot (⟘), \bigcap (⋂), \bigcup (⋃), \bigslopedvee (⩗), \bigslopedwedge (⩘), \bigstar (★), \bigtop (⟙), \bigtriangledown (▽), \bigtriangleup (△), \bigvee (⋁), \bigwedge (⋀), \bigwhitestar (☆), \blackcircledownarrow (⧭), \blackcircledrightdot (⚈), \blackcircledsanseight (➑), \blackcircledsansfive (➎), \blackcircledsansfour (➍), \blackcircledsansnine (➒), \blackcircledsansone (➊), \blackcircledsansseven (➐), \blackcircledsanssix (➏), \blackcircledsansten (➓), \blackcircledsansthree (➌), \blackcircledsanstwo (➋), \blackcircledtwodots (⚉), \blackcircleulquadwhite (◕), \blackdiamonddownarrow (⧪), \blackhourglass (⧗), \blackinwhitediamond (◈), \blackinwhitesquare (▣), \blacklefthalfcircle (◖), \blackpointerleft (◄), \blackpointerright (►), \blackrighthalfcircle (◗), \blacksmiley (☻), \blacktriangle (▴), \blacktriangledown (▾), \blacktriangleleft (◀), \blacktriangleright (▶), \blkhorzoval (⬬), \blkvertoval (⬮), \blockfull (█), \blockhalfshaded (▒), \blocklefthalf (▌), \blocklowhalf (▄), \blockqtrshaded (░), \blockrighthalf (▐), \blockthreeqtrshaded (▓), \blockuphalf (▀), \bot (⊥), \botsemicircle (◡), \bowtie (⋈), \box (◻), \boxast (⧆), \boxbar (◫), \boxbox (⧈), \boxbslash (⧅), \boxcircle (⧇), \boxdiag (⧄), \boxdot (⊡), \boxminus (⊟), \boxonbox (⧉), \boxplus (⊞), \boxtimes (⊠), \bsimilarleftarrow (⭁), \bsimilarrightarrow (⭇), \bsolhsub (⟈), \btimes (⨲), \bullet (∙), \bullseye (◎), \bumpeq (≏), \bumpeqq (⪮). +

+

\calB (ℬ), \calE (ℰ), \calF (ℱ), \calH (ℋ), \calM (ℳ), \calR (ℛ), \cap (∩), \capdot (⩀), \capwedge (⩄), \caretinsert (‸), \carreturn (⏎), \carriagereturn (↵), \ccwundercurvearrow (⤿), \cdot (⋅), \cdotp (·), \cdots (⋯), \cdprime (ʺ), \checkmark (✓), \chi (χ), \cirE (⧃), \cirbot (⟟), \circ (∘), \circeq (≗), \circfint (⨐), \circlebottomhalfblack (◒), \circledA (Ⓐ), \circledB (Ⓑ), \circledC (Ⓒ), \circledD (Ⓓ), \circledE (Ⓔ), \circledF (Ⓕ), \circledG (Ⓖ), \circledH (Ⓗ), \circledI (Ⓘ), \circledJ (Ⓙ), \circledK (Ⓚ), \circledL (Ⓛ), \circledM (Ⓜ), \circledN (Ⓝ), \circledO (Ⓞ), \circledP (Ⓟ), \circledQ (Ⓠ), \circledR (Ⓡ), \circledS (Ⓢ), \circledT (Ⓣ), \circledU (Ⓤ), \circledV (Ⓥ), \circledW (Ⓦ), \circledX (Ⓧ), \circledY (Ⓨ), \circledZ (Ⓩ), \circleda (ⓐ), \circledast (⊛), \circledb (ⓑ), \circledbullet (⦿), \circledc (ⓒ), \circledcirc (⊚), \circledd (ⓓ), \circleddash (⊝), \circlede (ⓔ), \circledeight (⑧), \circledequal (⊜), \circledf (ⓕ), \circledfive (⑤), \circledfour (④), \circledg (ⓖ), \circledh (ⓗ), \circledi (ⓘ), \circledj (ⓙ), \circledk (ⓚ), \circledl (ⓛ), \circledm (ⓜ), \circledn (ⓝ), \circlednine (⑨), \circledo (ⓞ), \circledone (①), \circledownarrow (⧬), \circledp (ⓟ), \circledparallel (⦷), \circledq (ⓠ), \circledr (ⓡ), \circledrightdot (⚆), \circleds (ⓢ), \circledsanseight (➇), \circledsansfive (➄), \circledsansfour (➃), \circledsansnine (➈), \circledsansone (➀), \circledsansseven (➆), \circledsanssix (➅), \circledsansten (➉), \circledsansthree (➂), \circledsanstwo (➁), \circledseven (⑦), \circledsix (⑥), \circledstar (✪), \circledt (ⓣ), \circledthree (③), \circledtwo (②), \circledtwodots (⚇), \circledu (ⓤ), \circledv (ⓥ), \circledvert (⦶), \circledw (ⓦ), \circledwhitebullet (⦾), \circledx (ⓧ), \circledy (ⓨ), \circledz (ⓩ), \circledzero (⓪), \circlehbar (⦵), \circlelefthalfblack (◐), \circlellquad (◵), \circlelrquad (◶), \circleonleftarrow (⬰), \circleonrightarrow (⇴), \circlerighthalfblack (◑), \circletophalfblack (◓), \circleulquad (◴), \circleurquad (◷), \circleurquadblack (◔), \circlevertfill (◍), \cirmid (⫯), \cirscir (⧂), \clangle (〈), \closedvarcap (⩍), \closedvarcup (⩌), \closedvarcupsmashprod (⩐), \closure (⁐), \cloverleaf (⌘), \clubsuit (♣), \colon (:), \colon (∶), \coloneq (≔), \commaminus (⨩), \complement (∁), \concavediamond (⟡), \concavediamondtickleft (⟢), \concavediamondtickright (⟣), \cong (≅), \congdot (⩭), \conictaper (⌲), \conjunction (☌), \coprod (∐), \cprime (ʹ), \crangle (〉), \csub (⫏), \csube (⫑), \csup (⫐), \csupe (⫒), \cuberoot (∛), \cup (∪), \cupdot (⊍), \cupleftarrow (⊌), \cupvee (⩅), \curlyeqprec (⋞), \curlyeqsucc (⋟), \curlyvee (⋎), \curlywedge (⋏), \curvearrowleft (↶), \curvearrowleftplus (⤽), \curvearrowright (↷), \curvearrowrightminus (⤼), \cwcirclearrow (⥁), \cwgapcirclearrow (⟳), \cwopencirclearrow (↻), \cwrightarcarrow (⤸), \cwundercurvearrow (⤾), \cylcty (⌭). +

+

\dag (†), \dagger (†), \daleth (ℸ), \danger (☡), \dashV (⫣), \dashVdash (⟛), \dashcolon (∹), \dashleftharpoondown (⥫), \dashrightharpoondown (⥭), \dashv (⊣), \dbkarow (⤏), \ddag (‡), \ddagger (‡), \ddots (⋱), \ddotseq (⩷), \delta (δ), \dh (ð), \diameter (⌀), \diamond (◇), \diamondbotblack (⬙), \diamondcdot (⟐), \diamondleftarrow (⤝), \diamondleftarrowbar (⤟), \diamondleftblack (⬖), \diamondrightblack (⬗), \diamondsuit (♢), \diamondtopblack (⬘), \dicei (⚀), \diceii (⚁), \diceiii (⚂), \diceiv (⚃), \dicev (⚄), \dicevi (⚅), \digamma (ϝ), \dingasterisk (✽), \dircurrent (⎓), \disin (⋲), \div (÷), \divideontimes (⋇), \dj (đ), \dlcrop (⌍), \doteq (≐), \dotequiv (⩧), \dotminus (∸), \dotplus (∔), \dots (…), \dotsim (⩪), \dotsminusdots (∺), \dottedcircle (◌), \dottedsquare (⬚), \dottimes (⨰), \doublebarvee (⩢), \doublebarwedge (⩞), \doubleplus (⧺), \downarrow (↓), \downarrowbar (⤓), \downarrowbarred (⤈), \downdasharrow (⇣), \downdownarrows (⇊), \downfishtail (⥿), \downharpoonleft (⇃), \downharpoonleftbar (⥙), \downharpoonright (⇂), \downharpoonrightbar (⥕), \downharpoonsleftright (⥥), \downrightcurvedarrow (⤵), \downtriangleleftblack (⧨), \downtrianglerightblack (⧩), \downuparrows (⇵), \downupharpoonsleftright (⥯), \downwhitearrow (⇩), \downzigzagarrow (↯), \dprime (″), \draftingarrow (➛), \drbkarow (⤐), \drcrop (⌌), \dsol (⧶), \dsub (⩤), \dualmap (⧟). +

+

\earth (♁), \egsdot (⪘), \eighthnote (♪), \elinters (⏧), \ell (ℓ), \elsdot (⪗), \emdash (—), \emptyset (∅), \emptysetoarr (⦳), \emptysetoarrl (⦴), \emptysetobar (⦱), \emptysetocirc (⦲), \endash (–), \enleadertwodots (‥), \envelope (✉), \eparsl (⧣), \epsilon (ϵ), \eqcirc (≖), \eqcolon (≕), \eqdef (≝), \eqdot (⩦), \eqeq (⩵), \eqeqeq (⩶), \eqgtr (⋝), \eqless (⋜), \eqqgtr (⪚), \eqqless (⪙), \eqqplus (⩱), \eqqsim (⩳), \eqqslantgtr (⪜), \eqqslantless (⪛), \eqsim (≂), \eqslantgtr (⪖), \eqslantless (⪕), \equalleftarrow (⭀), \equalparallel (⋕), \equalrightarrow (⥱), \equiv (≡), \equivDD (⩸), \equivVert (⩨), \equivVvert (⩩), \eqvparsl (⧥), \errbarblackcircle (⧳), \errbarblackdiamond (⧱), \errbarblacksquare (⧯), \errbarcircle (⧲), \errbardiamond (⧰), \errbarsquare (⧮), \eta (η), \euro (€), \exists (∃). +

+

\fallingdotseq (≒), \fbowtie (⧓), \fcmp (⨾), \fdiagovnearrow (⤯), \fdiagovrdiag (⤬), \female (♀), \figdash (‒), \fint (⨏), \fisheye (◉), \flat (♭), \fltns (⏥), \forall (∀), \forks (⫝̸), \forksnot (⫝), \forkv (⫙), \fourthroot (∜), \fourvdots (⦙), \fracfiveeighths (⅝), \fracfivesixths (⅚), \fracfourfifths (⅘), \fraconeeighth (⅛), \fraconefifth (⅕), \fraconesixth (⅙), \fraconethird (⅓), \fracseveneights (⅞), \fracslash (⁄), \fracthreeeighths (⅜), \fracthreefifths (⅗), \fractwofifths (⅖), \fractwothirds (⅔), \frakC (ℭ), \frakH (ℌ), \frakZ (ℨ), \frown (⌢), \frownie (☹), \fullouterjoin (⟗). +

+

\gamma (γ), \ge (≥), \geq (≥), \geqq (≧), \geqslant (⩾), \gescc (⪩), \gesdot (⪀), \gesdoto (⪂), \gesdotol (⪄), \gesles (⪔), \gets (←), \gg (≫), \ggg (⋙), \gggnest (⫸), \gimel (ℷ), \glE (⪒), \gla (⪥), \gleichstark (⧦), \glj (⪤), \gnapprox (⪊), \gneq (⪈), \gneqq (≩), \gnsim (⋧), \greater (>), \gsime (⪎), \gsiml (⪐), \gtcc (⪧), \gtcir (⩺), \gtlpar (⦠), \gtquest (⩼), \gtrapprox (⪆), \gtrarr (⥸), \gtrdot (⋗), \gtreqless (⋛), \gtreqqless (⪌), \gtrless (≷), \gtrsim (≳), \guillemotleft («), \guillemotright (»), \guilsinglleft (‹), \guilsinglright (›). +

+

\harrowextender (⎯), \hatapprox (⩯), \hbar (ℏ), \heartsuit (♡), \hermitmatrix (⊹), \hexagon (⎔), \hexagonblack (⬣), \hiraganano (の), \hknearrow (⤤), \hknwarrow (⤣), \hksearow (⤥), \hkswarow (⤦), \hookleftarrow (↩), \hookrightarrow (↪), \horizbar (―), \hourglass (⧖), \house (⌂), \hrectangle (▭), \hrectangleblack (▬), \hslash (ℏ), \hyphenbullet (⁃), \hzigzag (〰). +

+

\iiiint (⨌), \iiint (∭), \iinfin (⧜), \iint (∬), \imageof (⊷), \in (∈), \incare (℅), \increment (∆), \infty (∞), \int (∫), \intBar (⨎), \intbar (⨍), \intbottom (⌡), \intcap (⨙), \intclockwise (∱), \intcup (⨚), \intercal (⊺), \interleave (⫴), \intextender (⎮), \intlharhk (⨗), \intprod (⨼), \intprodr (⨽), \inttop (⌠), \intx (⨘), \inversebullet (◘), \inversewhitecircle (◙), \invnot (⌐), \invwhitelowerhalfcircle (◛), \invwhiteupperhalfcircle (◚), \iota (ι), \ipasupgamma (ˠ), \ipasupl (ˡ), \ipasuprerglotstpp (ˤ), \ipasups (ˢ), \ipasupx (ˣ), \ipaunaspirated (˭), \ipavoicing (ˬ), \isinE (⋹), \isindot (⋵), \isinobar (⋷), \isins (⋴), \isinvb (⋸), \itBbbD (ⅅ), \itBbbd (ⅆ), \itBbbe (ⅇ), \itBbbi (ⅈ), \itBbbj (ⅉ). +

+

\jupiter (♃), \kappa (κ), \kernelcontraction (∻), \koppa (ϟ). +

+

\l (ł), \lAngle (⟪), \lBrace (⦃), \lBrack (⟦), \lParen (⦅), \lambda (λ), \lambdabar (ƛ), \langle (⟨), \langledot (⦑), \laplac (⧠), \lasp (ʽ), \lat (⪫), \late (⪭), \lbag (⟅), \lblkbrbrak (⦗), \lbrace ({), \lbracelend (⎩), \lbracemid (⎨), \lbraceuend (⎧), \lbrack ([), \lbrackextender (⎢), \lbracklend (⎣), \lbracklltick (⦏), \lbrackubar (⦋), \lbrackuend (⎡), \lbrackultick (⦍), \lbrbrak (❲), \lceil (⌈), \lcurvyangle (⧼), \ldasharrhead (⇠), \le (≤), \leadsto (↝), \leftarrow (←), \leftarrowapprox (⭊), \leftarrowbackapprox (⭂), \leftarrowbsimilar (⭋), \leftarrowless (⥷), \leftarrowonoplus (⬲), \leftarrowplus (⥆), \leftarrowshortrightarrow (⥃), \leftarrowsimilar (⥳), \leftarrowsubset (⥺), \leftarrowtail (↢), \leftarrowtriangle (⇽), \leftarrowx (⬾), \leftbkarrow (⤌), \leftcurvedarrow (⬿), \leftdasharrow (⇠), \leftdasharrowhead (⇡), \leftdbkarrow (⤎), \leftdbltail (⤛), \leftdotarrow (⬸), \leftdowncurvedarrow (⤶), \leftfishtail (⥼), \leftharpoondown (↽), \leftharpoondownbar (⥞), \leftharpoonsupdown (⥢), \leftharpoonup (↼), \leftharpoonupbar (⥚), \leftharpoonupdash (⥪), \leftleftarrows (⇇), \leftmoon (☾), \leftouterjoin (⟕), \leftrightarrow (↔), \leftrightarrowcircle (⥈), \leftrightarrows (⇆), \leftrightarrowtriangle (⇿), \leftrightharpoondowndown (⥐), \leftrightharpoondownup (⥋), \leftrightharpoons (⇋), \leftrightharpoonsdown (⥧), \leftrightharpoonsup (⥦), \leftrightharpoonupdown (⥊), \leftrightharpoonupup (⥎), \leftrightsquigarrow (↭), \leftsquigarrow (↜), \leftsquigarrow (⇜), \lefttail (⤙), \leftthreearrows (⬱), \leftthreetimes (⋋), \leftwhitearrow (⇦), \leq (≤), \leqq (≦), \leqqslant (⫹), \leqqslant (⫺), \leqslant (⩽), \lescc (⪨), \lesdot (⩿), \lesdoto (⪁), \lesdotor (⪃), \lesges (⪓), \less (<), \lessapprox (⪅), \lessdot (⋖), \lesseqgtr (⋚), \lesseqqgtr (⪋), \lessgtr (≶), \lesssim (≲), \lfbowtie (⧑), \lfloor (⌊), \lftimes (⧔), \lgE (⪑), \lgblkcircle (⬤), \lgblksquare (⬛), \lgwhtcircle (◯), \lgwhtsquare (⬜), \lhd (⊲), \linefeed (↴), \ll (≪), \llangle (⦉), \llarc (◟), \llblacktriangle (◣), \llcorner (⌞), \lll (⋘), \lllnest (⫷), \llparenthesis (⦇), \lltriangle (◺), \lmoustache (⎰), \lnapprox (⪉), \lneq (⪇), \lneqq (≨), \lnsim (⋦), \longdashv (⟞), \longdivision (⟌), \longleftarrow (⟵), \longleftrightarrow (⟷), \longleftsquigarrow (⬳), \longmapsfrom (⟻), \longmapsto (⟼), \longrightarrow (⟶), \longrightsquigarrow (⟿), \looparrowleft (↫), \looparrowright (↬), \lowint (⨜), \lozenge (◊), \lozengeminus (⟠), \lparenextender (⎜), \lparenlend (⎝), \lparenless (⦓), \lparenuend (⎛), \lq (‘), \lrarc (◞), \lrblacktriangle (◢), \lrcorner (⌟), \lrtriangle (◿), \lrtriangleeq (⧡), \lsime (⪍), \lsimg (⪏), \lsqhook (⫍), \ltcc (⪦), \ltcir (⩹), \ltimes (⋉), \ltlarr (⥶), \ltquest (⩻), \ltrivb (⧏), \lvboxline (⎸), \lvzigzag (⧘). +

+

\male (♂), \maltese (✠), \mapsdown (↧), \mapsfrom (↤), \mapsto (↦), \mapsup (↥), \mdblkdiamond (⬥), \mdblklozenge (⬧), \mdblkrcl (⚫), \mdblksquare (◼), \mdlgblkcircle (●), \mdlgblkdiamond (◆), \mdlgblklozenge (⧫), \mdlgblksquare (■), \mdlgwhtcircle (○), \mdlgwhtdiamond (◇), \mdlgwhtsquare (□), \mdsmblkcircle (⦁), \mdsmblksquare (◾), \mdsmwhtcircl (⚬), \mdsmwhtsquare (◽), \mdwhtcircl (⚪), \mdwhtdiamond (⬦), \mdwhtlozenge (⬨), \mdwhtsquare (◻), \measangledltosw (⦯), \measangledrtose (⦮), \measangleldtosw (⦫), \measanglelutonw (⦩), \measanglerdtose (⦪), \measanglerutone (⦨), \measangleultonw (⦭), \measangleurtone (⦬), \measeq (≞), \measuredangle (∡), \measuredangleleft (⦛), \measuredrightangle (⊾), \medblackstar (⭑), \medmathspace ( ), \medwhitestar (⭐), \mercury (☿), \mho (℧), \mid (∣), \midbarvee (⩝), \midbarwedge (⩜), \midcir (⫰), \minus (−), \minusdot (⨪), \minusfdots (⨫), \minusrdots (⨬), \mlcp (⫛), \models (⊧), \mp (∓), \mu (μ), \multimap (⊸), \multimapinv (⟜). +

+

\nHdownarrow (⇟), \nHuparrow (⇞), \nLeftarrow (⇍), \nLeftrightarrow (⇎), \nRightarrow (⇏), \nVDash (⊯), \nVdash (⊮), \nVleftarrow (⇺), \nVleftarrowtail (⬺), \nVleftrightarrow (⇼), \nVrightarrow (⇻), \nVrightarrowtail (⤕), \nVtwoheadleftarrow (⬵), \nVtwoheadleftarrowtail (⬽), \nVtwoheadrightarrow (⤁), \nVtwoheadrightarrowtail (⤘), \nabla (∇), \napprox (≉), \nasymp (≭), \natural (♮), \ncong (≇), \ne (≠), \nearrow (↗), \neg (¬), \neovnwarrow (⤱), \neovsearrow (⤮), \neptune (♆), \neq (≠), \nequiv (≢), \neswarrow (⤢), \neuter (⚲), \nexists (∄), \ng (ŋ), \ngeq (≱), \ngtr (≯), \ngtrless (≹), \ngtrsim (≵), \nhVvert (⫵), \nhpar (⫲), \ni (∋), \niobar (⋾), \nis (⋼), \nisd (⋺), \nleftarrow (↚), \nleftrightarrow (↮), \nleq (≰), \nless (≮), \nlessgtr (≸), \nlesssim (≴), \nmid (∤), \nni (∌), \nobreakhyphen (‑), \notin (∉), \nparallel (∦), \npolint (⨔), \nprec (⊀), \npreccurlyeq (⋠), \nrightarrow (↛), \nsim (≁), \nsime (≄), \nsqsubseteq (⋢), \nsqsupseteq (⋣), \nsubset (⊄), \nsubseteq (⊈), \nsucc (⊁), \nsucccurlyeq (⋡), \nsupset (⊅), \nsupseteq (⊉), \ntriangleleft (⋪), \ntrianglelefteq (⋬), \ntriangleright (⋫), \ntrianglerighteq (⋭), \nu (ν), \nvDash (⊭), \nvLeftarrow (⤂), \nvLeftrightarrow (⤄), \nvRightarrow (⤃), \nvdash (⊬), \nvinfty (⧞), \nvleftarrow (⇷), \nvleftarrowtail (⬹), \nvleftrightarrow (⇹), \nvrightarrow (⇸), \nvrightarrowtail (⤔), \nvtwoheadleftarrow (⬴), \nvtwoheadleftarrowtail (⬼), \nvtwoheadrightarrow (⤀), \nvtwoheadrightarrowtail (⤗), \nwarrow (↖), \nwovnearrow (⤲), \nwsearrow (⤡). +

+

\o (ø), \obar (⌽), \obot (⦺), \obrbrak (⏠), \obslash (⦸), \odiv (⨸), \odot (⊙), \odotslashdot (⦼), \oe (œ), \ogreaterthan (⧁), \ohorn (ơ), \oiiint (∰), \oiint (∯), \oint (∮), \ointctrclockwise (∳), \olcross (⦻), \oldKoppa (Ϙ), \oldkoppa (ϙ), \olessthan (⧀), \omega (ω), \omicron (ο), \ominus (⊖), \operp (⦹), \oplus (⊕), \opluslhrim (⨭), \oplusrhrim (⨮), \origof (⊶), \oslash (⊘), \otimes (⊗), \otimeshat (⨶), \otimeslhrim (⨴), \otimesrhrim (⨵), \overbrace (⏞), \overbracket (⎴), \overline (‾), \overparen (⏜), \owns (∋). +

+

\parallel (∥), \parallelogram (▱), \parallelogramblack (▰), \parsim (⫳), \partial (∂), \partialmeetcontraction (⪣), \pentagon (⬠), \pentagonblack (⬟), \perp (⟂), \perps (⫡), \phi (ϕ), \phone (☎), \pi (π), \pitchfork (⋔), \plusdot (⨥), \pluseqq (⩲), \plushat (⨣), \plussim (⨦), \plussubtwo (⨧), \plustrif (⨨), \pluto (♇), \pm (±), \pointnt (⨕), \postalmark (〒), \prec (≺), \precapprox (⪷), \preccurlyeq (≼), \preceq (⪯), \preceqq (⪳), \precnapprox (⪹), \precneq (⪱), \precneqq (⪵), \precnsim (⋨), \precsim (≾), \prime (′), \prod (∏), \profalar (⌮), \profline (⌒), \profsurf (⌓), \propto (∝), \prurel (⊰), \psi (ψ), \pullback (⟓), \pushout (⟔). +

+

\qprime (⁗), \quarternote (♩), \questeq (≟), \quotdblbase („), \quotdblright (‟), \quotsinglbase (‚), \quotsinglright (‛). +

+

\rAngle (⟫), \rBrace (⦄), \rBrack (⟧), \rParen (⦆), \rangle (⟩), \rangledot (⦒), \rangledownzigzagarrow (⍼), \rasp (ʼ), \rbag (⟆), \rblkbrbrak (⦘), \rbrace (}), \rbracelend (⎭), \rbracemid (⎬), \rbraceuend (⎫), \rbrack (]), \rbrackextender (⎥), \rbracklend (⎦), \rbracklrtick (⦎), \rbrackubar (⦌), \rbrackuend (⎤), \rbrackurtick (⦐), \rbrbrak (❳), \rceil (⌉), \rcurvyangle (⧽), \rdiagovfdiag (⤫), \rdiagovsearrow (⤰), \recorder (⌕), \revangle (⦣), \revangleubar (⦥), \revemptyset (⦰), \revnmid (⫮), \rfbowtie (⧒), \rfloor (⌋), \rftimes (⧕), \rhd (⊳), \rho (ρ), \righarrowbsimilar (⭌), \rightangle (∟), \rightanglemdot (⦝), \rightanglesqr (⦜), \rightarrow (→), \rightarrowapprox (⥵), \rightarrowbackapprox (⭈), \rightarrowbar (⇥), \rightarrowdiamond (⤞), \rightarrowgtr (⭃), \rightarrowonoplus (⟴), \rightarrowplus (⥅), \rightarrowshortleftarrow (⥂), \rightarrowsimilar (⥴), \rightarrowsupset (⭄), \rightarrowtail (↣), \rightarrowtriangle (⇾), \rightarrowx (⥇), \rightbkarrow (⤍), \rightcurvedarrow (⤳), \rightdasharrow (⇢), \rightdbltail (⤜), \rightdotarrow (⤑), \rightdowncurvedarrow (⤷), \rightfishtail (⥽), \rightharpoondown (⇁), \rightharpoondownbar (⥗), \rightharpoonsupdown (⥤), \rightharpoonup (⇀), \rightharpoonupbar (⥓), \rightharpoonupdash (⥬), \rightimply (⥰), \rightleftarrows (⇄), \rightleftharpoons (⇌), \rightleftharpoonsdown (⥩), \rightleftharpoonsup (⥨), \rightmoon (☽), \rightouterjoin (⟖), \rightpentagon (⭔), \rightpentagonblack (⭓), \rightrightarrows (⇉), \rightsquigarrow (↝), \rightsquigarrow (⇝), \righttail (⤚), \rightthreearrows (⇶), \rightthreetimes (⋌), \rightwhitearrow (⇨), \ringplus (⨢), \risingdotseq (≓), \rmoustache (⎱), \rparenextender (⎟), \rparengtr (⦔), \rparenlend (⎠), \rparenuend (⎞), \rppolint (⨒), \rq (’), \rrangle (⦊), \rrparenthesis (⦈), \rsolbar (⧷), \rsqhook (⫎), \rsub (⩥), \rtimes (⋊), \rtriltri (⧎), \ruledelayed (⧴), \rvboxline (⎹), \rvzigzag (⧙). +

+

\sampi (ϡ), \sansLmirrored (⅃), \sansLturned (⅂), \saturn (♄), \scissors (✂), \scpolint (⨓), \scrB (ℬ), \scrE (ℰ), \scrF (ℱ), \scrH (ℋ), \scrI (ℐ), \scrL (ℒ), \scrM (ℳ), \scrR (ℛ), \scre (ℯ), \scrg (ℊ), \scro (ℴ), \scurel (⊱), \searrow (↘), \seovnearrow (⤭), \setminus (∖), \setminus (⧵), \sharp (♯), \shortdowntack (⫟), \shortleftarrow (←), \shortlefttack (⫞), \shortrightarrow (→), \shortrightarrowleftarrow (⥄), \shortuptack (⫠), \shuffle (⧢), \sigma (σ), \silon (υ), \silon (ϒ), \sim (∼), \simeq (≃), \simgE (⪠), \simgtr (⪞), \similarleftarrow (⭉), \similarrightarrow (⥲), \simlE (⪟), \simless (⪝), \simminussim (⩬), \simneqq (≆), \simplus (⨤), \simrdots (⩫), \sinewave (∿), \slash (∕), \smallblacktriangleleft (◂), \smallblacktriangleright (▸), \smalldiamond (⋄), \smallin (∊), \smallint (∫), \smallni (∍), \smallsetminus (∖), \smalltriangleleft (◃), \smalltriangleright (▹), \smashtimes (⨳), \smblkdiamond (⬩), \smblklozenge (⬪), \smblksquare (▪), \smeparsl (⧤), \smile (⌣), \smiley (☺), \smt (⪪), \smte (⪬), \smwhitestar (⭒), \smwhtcircle (◦), \smwhtlozenge (⬫), \smwhtsquare (▫), \spadesuit (♠), \sphericalangle (∢), \sphericalangleup (⦡), \sqcap (⊓), \sqcup (⊔), \sqint (⨖), \sqlozenge (⌑), \sqrt (√), \sqrt3 (∛), \sqrt4 (∜), \sqrtbottom (⎷), \sqsubset (⊏), \sqsubseteq (⊑), \sqsubsetneq (⋤), \sqsupset (⊐), \sqsupseteq (⊒), \sqsupsetneq (⋥), \squarecrossfill (▩), \squaregrayfill (▩), \squarehfill (▤), \squarehvfill (▦), \squareleftblack (◧), \squareleftblack (◨), \squarellblack (⬕), \squarellquad (◱), \squarelrblack (◪), \squarelrquad (◲), \squareneswfill (▨), \squarenwsefill (▧), \squareulblack (◩), \squareulquad (◰), \squareurblack (⬔), \squareurquad (◳), \squarevfill (▥), \squoval (▢), \ss (ß), \star (⋆), \stareq (≛), \sterling (£), \stigma (ϛ), \strns (⏤), \subedot (⫃), \submult (⫁), \subrarr (⥹), \subset (⊂), \subsetapprox (⫉), \subsetcirc (⟃), \subsetdot (⪽), \subseteq (⊆), \subseteqq (⫅), \subsetneq (⊊), \subsetneqq (⫋), \subsetplus (⪿), \subsim (⫇), \subsub (⫕), \subsup (⫓), \succ (≻), \succapprox (⪸), \succcurlyeq (≽), \succeq (⪰), \succeqq (⪴), \succnapprox (⪺), \succneq (⪲), \succneqq (⪶), \succnsim (⋩), \succsim (≿), \sum (∑), \sumbottom (⎳), \sumint (⨋), \sumtop (⎲), \sun (☼), \supdsub (⫘), \supedot (⫄), \suphsol (⟉), \suphsub (⫗), \suplarr (⥻), \supmult (⫂), \supn (ⁿ), \supset (⊃), \supsetapprox (⫊), \supsetcirc (⟄), \supsetdot (⪾), \supseteq (⊇), \supseteqq (⫆), \supsetneq (⊋), \supsetneqq (⫌), \supsetplus (⫀), \supsim (⫈), \supsub (⫔), \supsup (⫖), \surd (√), \swarrow (↙). +

+

\talloblong (⫾), \target (⌖), \tau (τ), \taurus (♉), \testhookx (ᶍ), \textAsterisks (⁑), \textacute (ˊ), \textadvanced (˖), \textain (Ê¿), \textasciiacute (´), \textasciicircum (^), \textasciidieresis (¨), \textasciigrave (‘), \textasciimacron (¯), \textasciitilde (~), \textasterisklow (⁎), \textbackdprime (‶), \textbackprime (‵), \textbacktrprime (‷), \textbardotlessj (ɟ), \textbardotlessjvar (ʄ), \textbarglotstop (Ê¡), \textbari (ɨ), \textbarl (ƚ), \textbaro (ɵ), \textbarrevglotstop (Ê¢), \textbaru (ʉ), \textbeltl (ɬ), \textbenttailyogh (ƺ), \textbreve (˘), \textbrokenbar (¦), \textbullet (•), \textbullseye (ʘ), \textcent (¢), \textcircledP (℗), \textcloseepsilon (ʚ), \textcloseomega (É·), \textcloserevepsilon (ɞ), \textcopyright (©), \textcrb (ƀ), \textcrh (ħ), \textcrinvglotstop (ƾ), \textcrlambda (ƛ), \textcrtwo (Æ»), \textctc (ɕ), \textctd (È¡), \textctesh (ʆ), \textctj (ʝ), \textctl (È´), \textctn (ȵ), \textctt (ȶ), \textctyogh (ʓ), \textctz (ʑ), \textcurrency (¤), \textdctzlig (Ê¥), \textdegree (°), \textdiscount (⁒), \textdollar ($), \textdotaccent (˙), \textdotlessj (È·), \textdoubleacute (˝), \textdoublebarpipe (ǂ), \textdoublepipe (ǁ), \textdprime (″), \textdptr (˅), \textdyoghlig (ʤ), \textdzlig (Ê£), \textepsilon (ɛ), \textesh (ʃ), \textestimated (℮), \textexclam (ǃ), \textexclamdown (¡), \textfishhookr (ɾ), \textflorin (ƒ), \textfranc (₣), \textgamma (É£), \textglotstop (ʔ), \textgrave (ˋ), \texthalflength (ˑ), \texthamza (ʾ), \texthen (ꜧ), \textheng (ꜧ), \texthooks (ᶊ), \texthookz (ᶎ), \texthtb (ɓ), \texthtc (ƈ), \texthtd (ɗ), \texthtg (É ), \texthth (ɦ), \texththeng (ɧ), \texthtk (ƙ), \texthtp (Æ¥), \texthtq (Ê ), \texthtscg (ʛ), \texthtt (Æ­), \texthvlig (ƕ), \texthyphen (‐), \textinvglotstop (ʖ), \textinvscr (ʁ), \textiota (É©), \textlengthmark (ː), \textlhalfring (˓), \textlhookd (ᶁ), \textlhookk (ᶄ), \textlhookl (ᶅ), \textlhookt (Æ«), \textlhti (É¿), \textlira (₤), \textlonglegr (ɼ), \textlongy (Ê®), \textlongy (ʯ), \textlooptoprevesh (ƪ), \textlowacute (ˏ), \textlowered (˕), \textlowgrave (ˎ), \textlowmacron (ˍ), \textlptr (˂), \textltailm (ɱ), \textltailn (ɲ), \textltilde (É«), \textlyoghlig (É®), \textmacron (ˉ), \textmu (µ), \textnumero (№), \textogonek (˛), \textohm (Ω), \textonehalf (½), \textonequarter (¼), \textonesuperior (¹), \textopeno (ɔ), \textordfeminine (ª), \textordmasculine (º), \textovercross (˟), \textoz (℥), \textpertenthousand (‱), \textperthousand (‰), \textpesetas (₧), \textphi (ɸ), \textpipe (ǀ), \textprime (′), \textprimstress (ˈ), \textqprime (⁗), \textquestiondown (¿), \textquotedbl ("), \textquotedblleft (“), \textquotedblright (”), \textraised (˔), \textraiseglotstop (ˀ), \textraiserevglotstop (ˁ), \textramshorns (ɤ), \textrecipe (℞), \textreferencemark (※), \textregistered (®), \textretracted (˗), \textreve (ɘ), \textrevepsilon (ɜ), \textrevglotstop (ʕ), \textrhalfring (˒), \textrhookrevepsilon (ɝ), \textrhookschwa (ɚ), \textrhoticity (˞), \textringaccent (˚), \textrptr (˃), \textrtaild (ɖ), \textrtaill (É­), \textrtailn (ɳ), \textrtailr (ɽ), \textrtails (ʂ), \textrtailt (ʈ), \textrtailz (ʐ), \textsca (ᴀ), \textscb (ʙ), \textsce (ᴇ), \textscg (É¢), \textsch (ʜ), \textschwa (ə), \textsci (ɪ), \textscl (ʟ), \textscn (É´), \textscoelig (ɶ), \textscr (ʀ), \textscripta (ɑ), \textscriptg (É¡), \textscriptv (ʋ), \textscu (ᴜ), \textscy (ʏ), \textsecstress (ˌ), \textsemicolonreversed (⁏), \textsilon (Î¥), \textsmalltilde (˜), \textstretchcvar (ʗ), \textsubw (w), \textsuph (ʰ), \textsuphth (ʱ), \textsupinvscr (ʶ), \textsupj (ʲ), \textsupr (ʳ), \textsupturnr (Ê´), \textsupturnrrtail (ʵ), \textsupw (Ê·), \textsupy (ʸ), \texttctctlig (ʧ), \texttctctlig (ʨ), \textthreequarters (¾), \textthreesuperior (³), \texttrademark (™), \texttrprime (‴), \texttslig (ʦ), \textturna (ɐ), \textturncomma (Ê»), \textturnh (É¥), \textturnk (ʞ), \textturnlonglegr (ɺ), \textturnm (ɯ), \textturnmrleg (ɰ), \textturnr (ɹ), \textturnrrtail (É»), \textturnscripta (ɒ), \textturnt (ʇ), \textturnv (ʌ), \textturnw (ʍ), \textturny (ʎ), \texttwosuperior (²), \textupsilon (ʊ), \textuptr (˄), \textvibyi (ʅ), \textvisiblespace (␣), \textyogh (ʒ), \th (þ), \therefore (∴), \thermod (â§§), \theta (θ), \thickapprox (≈), \thicksim (∼), \threedangle (⟀), \threedotcolon (â«¶), \tieconcat (⁀), \tieinfty (⧝), \times (×), \timesbar (⨱), \tminus (â§¿), \to (→), \toea (⤨), \tona (⤧), \tonebarextrahigh (Ë¥), \tonebarextralow (Ë©), \tonebarhigh (˦), \tonebarlow (˨), \tonebarmid (˧), \top (⊤), \topbot (⌶), \topcir (⫱), \topfork (⫚), \topsemicircle (◠), \tosa (⤩), \towa (⤪), \tplus (â§¾), \trapezium (⏢), \trianglecdot (◬), \triangledown (▿), \triangleexclam (⚠), \triangleleft (◁), \triangleleftblack (◭), \trianglelefteq (⊴), \triangleminus (⨺), \triangleodot (⧊), \triangleplus (⨹), \triangleq (≜), \triangleright (▷), \trianglerightblack (◮), \trianglerighteq (⊵), \triangles (⧌), \triangleserifs (⧍), \triangletimes (⨻), \triangleubar (⧋), \tripleplus (â§»), \trprime (‴), \turnangle (⦢), \turnediota (℩), \turnednot (⌙), \twocaps (⩋), \twocups (⩊), \twoheaddownarrow (↡), \twoheadleftarrow (↞), \twoheadleftarrowtail (⬻), \twoheadleftdbkarrow (⬷), \twoheadmapsfrom (⬶), \twoheadmapsto (⤅), \twoheadrightarrow (↠), \twoheadrightarrowtail (⤖), \twoheaduparrow (↟), \twoheaduparrowcircle (⥉), \twolowline (‗), \twonotes (♫), \typecolon (⦂). +

+

\ubrbrak (⏡), \uhorn (ư), \ularc (◜), \ulblacktriangle (◤), \ulcorner (⌜), \ulcrop (⌏), \ultriangle (◸), \uminus (⩁), \underbrace (⏟), \underbracket (⎵), \underparen (⏝), \unlhd (⊴), \unrhd (⊵), \upand (⅋), \uparrow (↑), \uparrowbarred (⤉), \uparrowoncircle (⦽), \updasharrow (⇢), \updownarrow (↕), \updownarrowbar (↨), \updownarrows (⇅), \updownharpoonleftleft (⥑), \updownharpoonleftright (⥍), \updownharpoonrightleft (⥌), \updownharpoonrightright (⥏), \updownharpoonsleftright (⥮), \upfishtail (⥾), \upharpoonleft (↿), \upharpoonleftbar (⥠), \upharpoonright (↾), \upharpoonrightbar (⥜), \upharpoonsleftright (⥣), \upin (⟒), \upint (⨛), \uplus (⊎), \uprightcurvearrow (⤴), \upuparrows (⇈), \upwhitearrow (⇧), \urarc (◝), \urblacktriangle (◥), \urcorner (⌝), \urcrop (⌎), \urtriangle (◹). +

+

\v (ˇ), \vBar (⫨), \vBarv (⫩), \vDash (⊨), \vDdash (⫢), \varTheta (ϴ), \varVdash (⫦), \varbarwedge (⌅), \varbeta (ϐ), \varclubsuit (♧), \vardiamondsuit (♦), \vardoublebarwedge (⌆), \varepsilon (ε), \varheartsuit (♥), \varhexagon (⬡), \varhexagonblack (⬢), \varhexagonlrbonds (⌬), \varin (∈), \varisinobar (⋶), \varisins (⋳), \varkappa (ϰ), \varlrtriangle (⊿), \varni (∋), \varniobar (⋽), \varnis (⋻), \varnothing (∅), \varointclockwise (∲), \varphi (φ), \varpi (ϖ), \varpropto (∝), \varrho (ϱ), \varrowextender (⏐), \varsigma (ς), \varspadesuit (♤), \varstar (✶), \vartheta (ϑ), \vartriangle (▵), \vartriangleleft (⊲), \vartriangleright (⊳), \varveebar (⩡), \vbraceextender (⎪), \vbrtri (⧐), \vdash (⊢), \vdots (⋮), \vectimes (⨯), \vee (∨), \veebar (⊻), \veedot (⟇), \veedoublebar (⩣), \veeeq (≚), \veemidvert (⩛), \veeodot (⩒), \veeonvee (⩖), \veeonwedge (⩙), \vert (|), \viewdata (⌗), \vlongdash (⟝), \vrectangle (▯), \vrectangleblack (▮), \vysmlblksquare (⬝), \vysmlwhtsquare (⬞), \vzigzag (⦚). +

+

\watchicon (⌚), \wedge (∧), \wedgebar (⩟), \wedgedot (⟑), \wedgedoublebar (⩠), \wedgemidvert (⩚), \wedgeodot (⩑), \wedgeonwedge (⩕), \wedgeq (≙), \whitearrowupfrombar (⇪), \whiteinwhitetriangle (⟁), \whitepointerleft (◅), \whitepointerright (▻), \whitesquaretickleft (⟤), \whitesquaretickright (⟥), \whthorzoval (⬭), \whtvertoval (⬯), \wideangledown (⦦), \wideangleup (⦧), \wp (℘), \wr (≀). +

+

\xbsol (⧹), \xi (ξ), \xsol (⧸), \yen (¥), \zeta (ζ), \zpipe (⨠), +

+

IF ANYBODY WILL CHECK WHETHER ALL NAMES CORRESPOND TO RIGHT TEX SYMBOLS I SHALL APPRECIATE IT GREATLY. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix E GNU Free Documentation License

+
Version 1.2, November 2002 +
+ +
+
Copyright © 2000,2001,2002 Free Software Foundation, Inc.
+51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+ +
    +
  1. PREAMBLE + +

    The purpose of this License is to make a manual, textbook, or other +functional and useful document free in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. +

    +

    This License is a kind of “copyleft”, which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. +

    +

    We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. +

    +
  2. APPLICABILITY AND DEFINITIONS + +

    This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The “Document”, below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as “you”. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. +

    +

    A “Modified Version” of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. +

    +

    A “Secondary Section” is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document’s overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. +

    +

    The “Invariant Sections” are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. +

    +

    The “Cover Texts” are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. +

    +

    A “Transparent” copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not “Transparent” is called “Opaque”. +

    +

    Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input +format, SGML or XML using a publicly available +DTD, and standard-conforming simple HTML, +PostScript or PDF designed for human modification. Examples +of transparent image formats include PNG, XCF and +JPG. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, SGML or +XML for which the DTD and/or processing tools are +not generally available, and the machine-generated HTML, +PostScript or PDF produced by some word processors for +output purposes only. +

    +

    The “Title Page” means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, “Title Page” means +the text near the most prominent appearance of the work’s title, +preceding the beginning of the body of the text. +

    +

    A section “Entitled XYZ” means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as “Acknowledgements”, +“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” +of such a section when you modify the Document means that it remains a +section “Entitled XYZ” according to this definition. +

    +

    The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. +

    +
  3. VERBATIM COPYING + +

    You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. +

    +

    You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +

    +
  4. COPYING IN QUANTITY + +

    If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document’s license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. +

    +

    If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. +

    +

    If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. +

    +

    It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. +

    +
  5. MODIFICATIONS + +

    You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: +

    +
      +
    1. Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +
    2. List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +
    3. State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +
    4. Preserve all the copyright notices of the Document. + +
    5. Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +
    6. Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +
    7. Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document’s license notice. + +
    8. Include an unaltered copy of this License. + +
    9. Preserve the section Entitled “History”, Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled “History” in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +
    10. Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the “History” section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +
    11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +
    12. Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +
    13. Delete any section Entitled “Endorsements”. Such a section +may not be included in the Modified Version. + +
    14. Do not retitle any existing section to be Entitled “Endorsements” or +to conflict in title with any Invariant Section. + +
    15. Preserve any Warranty Disclaimers. +
    + +

    If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version’s license notice. +These titles must be distinct from any other section titles. +

    +

    You may add a section Entitled “Endorsements”, provided it contains +nothing but endorsements of your Modified Version by various +parties—for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. +

    +

    You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. +

    +

    The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +

    +
  6. COMBINING DOCUMENTS + +

    You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. +

    +

    The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. +

    +

    In the combination, you must combine any sections Entitled “History” +in the various original documents, forming one section Entitled +“History”; likewise combine any sections Entitled “Acknowledgements”, +and any sections Entitled “Dedications”. You must delete all +sections Entitled “Endorsements.” +

    +
  7. COLLECTIONS OF DOCUMENTS + +

    You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. +

    +

    You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. +

    +
  8. AGGREGATION WITH INDEPENDENT WORKS + +

    A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an “aggregate” if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation’s users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. +

    +

    If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document’s Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. +

    +
  9. TRANSLATION + +

    Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. +

    +

    If a section in the Document is Entitled “Acknowledgements”, +“Dedications”, or “History”, the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. +

    +
  10. TERMINATION + +

    You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. +

    +
  11. FUTURE REVISIONS OF THIS LICENSE + +

    The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. +

    +

    Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License “or any later version” applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +

+ + +

ADDENDUM: How to use this License for your documents

+ +

To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: +

+
+
  Copyright (C)  year  your name.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.2
+  or any later version published by the Free Software Foundation;
+  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+  Texts.  A copy of the license is included in the section entitled ``GNU
+  Free Documentation License''.
+
+ +

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the “with…Texts.” line with this: +

+
+
    with the Invariant Sections being list their titles, with
+    the Front-Cover Texts being list, and with the Back-Cover Texts
+    being list.
+
+ +

If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. +

+

If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. +

+ + +
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

Индекс

+ +
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +Н +   +О +   +С +   +Т +   +Ц +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

A
AddLegend: Legend
AddLight: Lighting
AddTick: Ticks
Adjust: Ticks
alpha: Command options
Alpha: Transparency
alphadef: Command options
AlphaDef: Transparency
Ambient: Lighting
Area: 1D plotting
ArrowSize: Default sizes
ask: Program flow commands
Aspect: Subplots and rotation
AutoCorrel: Make another data
Axial: 2D plotting
Axis: Curved coordinates
Axis: Axis and Colorbar
AxisStl: Ticks

B
Ball: Primitives
Barh: 1D plotting
Bars: 1D plotting
BarWidth: Default sizes
Beam: 3D plotting
Belt: 2D plotting
Box: Axis and Colorbar
BoxPlot: 1D plotting
Boxs: 2D plotting

C
call: Program flow commands
Candle: 1D plotting
Chart: 1D plotting
chdir: Program flow commands
Clean: Data resizing
ClearLegend: Legend
Clf: Background
CloseGIF: Frames/Animation
Cloud: 3D plotting
Colorbar: Axis and Colorbar
Column: Make another data
ColumnPlot: Subplots and rotation
Combine: Parallelization
Combine: Make another data
Cone: Primitives
Cones: 1D plotting
Cont: 2D plotting
Cont3: 3D plotting
ContD: 2D plotting
ContF: 2D plotting
ContF3: 3D plotting
ContFXYZ: Other plotting
ContXYZ: Other plotting
CopyFont: Font settings
Correl: Make another data
CosFFT: Data changing
CRange: Ranges (bounding box)
Create: Data resizing
Crop: Data resizing
Crust: Other plotting
CTick: Ticks
CumSum: Data changing
Curve: Primitives
cut: Command options
Cut: Cutting
CutOff: Cutting

D
DataGrid: Data manipulation
defchr: Program flow commands
define: Program flow commands
defnum: Program flow commands
Delete: Data resizing
Dens: 2D plotting
Dens3: 3D plotting
DensXYZ: Other plotting
Dew: Vector fields
Diff: Data changing
Diff2: Data changing
do: Program flow commands
Dots: Other plotting
Drop: Primitives

E
else: Program flow commands
elseif: Program flow commands
EndFrame: Frames/Animation
endif: Program flow commands
Envelop: Data changing
Error: Primitives
Error: 1D plotting
Evaluate: Make another data
Export: File I/O
Extend: Data resizing

F
Face: Primitives
FaceX: Primitives
FaceY: Primitives
FaceZ: Primitives
Fall: 2D plotting
fgets: Text printing
Fill: Data manipulation
Fill: Data filling
Find: Data information
FindAny: Data information
Fit: Nonlinear fitting
Fit2: Nonlinear fitting
Fit3: Nonlinear fitting
FitS: Nonlinear fitting
Flow: Vector fields
FlowP: Vector fields
Fl_MathGL: Widget classes
Fl_MathGL: Fl_MathGL class
Fog: Fog
Font: Font settings
fontsize: Command options
for: Program flow commands
FPlot: Other plotting
FSurf: Other plotting
func: Program flow commands

G
GetNumFrame: Frames/Animation
GetNx: Data information
GetNy: Data information
GetNz: Data information
GetWarn: Error handling
Glyph: Primitives
Grad: 2D plotting
Grid: Axis and Colorbar
Grid: 2D plotting
Grid3: 3D plotting

H
Hankel: Data changing
Hist: Data manipulation
Hist: Make another data

I
if: Program flow commands
Import: File I/O
InPlot: Subplots and rotation
Insert: Data resizing
Integral: Data changing

J
Join: Data resizing

L
Label: Axis and Colorbar
Label: 1D plotting
Last: Data information
legend: Command options
Legend: Legend
Light: Lighting
Line: Primitives
Linear: Interpolation
Linear1: Interpolation
Linear1: Interpolation
List: Data filling
load: Program flow commands
LoadBackground: Background
LoadFont: Font settings

M
Map: Dual plotting
Mark: Primitives
Mark: 1D plotting
MarkSize: Default sizes
Max: Make another data
Maximal: Data information
Mesh: 2D plotting
meshnum: Command options
MeshNum: Default sizes
Message: Error handling
mglColor: mglColor class
mglData: Data constructor
mglDraw: mglDraw class
mglFitPnts: Nonlinear fitting
mglGLUT: Widget classes
mglGraph: MathGL core
mglParse: mglParse class
mglPoint: mglPoint class
mglWnd: Widget classes
mglWnd: mglWnd class
Min: Make another data
Minimal: Data information
Mirror: Data changing
Modify: Data filling
Momentum: Make another data
Momentum: Data information
MPI_Recv: Parallelization
MPI_Send: Parallelization
MultiPlot: Subplots and rotation

N
NeedStop: Stop drawing
NewFrame: Frames/Animation
next: Program flow commands
Norm: Data changing
NormSl: Data changing

O
once: Program flow commands
Origin: Ranges (bounding box)

P
Palette: Palette and colors
Perspective: Subplots and rotation
Pipe: Vector fields
Plot: 1D plotting
Pop: Subplots and rotation
PrintInfo: Data information
Push: Subplots and rotation
Puts: Text printing
PutsFit: Nonlinear fitting
Putsw: Text printing

Q
QMathGL: Widget classes
QMathGL: QMathGL class
QuadPlot: Other plotting

R
Radar: 1D plotting
Ranges: Ranges (bounding box)
Rasterize: Background
Read: File I/O
ReadAll: File I/O
ReadHDF: File I/O
ReadMat: File I/O
ReadRange: File I/O
Rearrange: Data resizing
Refill: Data filling
Region: 1D plotting
ResetFrames: Frames/Animation
Resize: Make another data
RestoreFont: Font settings
return: Program flow commands
rkstep: Program flow commands
Roll: Data changing
Roots: Make another data
Rotate: Subplots and rotation
RotateN: Subplots and rotation
RotateText: Font settings

S
Save: File I/O
SaveHDF: File I/O
Set: Data filling
SetAlphaDef: Transparency
SetAmbient: Lighting
SetArrowSize: Default sizes
SetAxisStl: Ticks
SetBarWidth: Default sizes
SetCoor: Curved coordinates
SetCut: Cutting
SetCutBox: Cutting
SetEventFunc: Stop drawing
SetFontDef: Font settings
SetFontSize: Font settings
SetFontSizeCM: Font settings
SetFontSizeIN: Font settings
SetFontSizePT: Font settings
SetFunc: Curved coordinates
SetLegendBox: Legend
SetLegendMarks: Legend
SetMarkSize: Default sizes
SetMask: Masks
SetMaskAngle: Masks
SetMeshNum: Default sizes
SetOrigin: Ranges (bounding box)
SetOriginTick: Ticks
SetPalette: Palette and colors
SetPlotId: Default sizes
SetRange: Ranges (bounding box)
SetRanges: Ranges (bounding box)
SetRotatedText: Font settings
SetSize: Export picture
SetTickLen: Ticks
SetTickRotate: Ticks
SetTicks: Ticks
SetTickSkip: Ticks
SetTicksVal: Ticks
SetTickTempl: Ticks
SetTickTime: Ticks
SetTranspType: Transparency
SetTuneTicks: Ticks
SetWarn: Error handling
Sew: Data changing
ShowImage: Export to file
SinFFT: Data changing
Smooth: Data changing
Sort: Data resizing
Sphere: Primitives
Spline: Interpolation
Spline1: Interpolation
Spline1: Interpolation
Squeeze: Data resizing
StartGIF: Frames/Animation
Stem: 1D plotting
Step: 1D plotting
STFA: Dual plotting
StickPlot: Subplots and rotation
Stop: Stop drawing
stop: Program flow commands
SubData: Make another data
SubPlot: Subplots and rotation
Sum: Make another data
Surf: 2D plotting
Surf3: 3D plotting
Surf3A: Dual plotting
Surf3C: Dual plotting
SurfA: Dual plotting
SurfC: Dual plotting
Swap: Data changing

T
Tape: 1D plotting
Tens: 1D plotting
Ternary: Curved coordinates
Text: Text printing
TextMark: 1D plotting
TickLen: Ticks
Tile: 2D plotting
TileS: Dual plotting
Title: Subplots and rotation
Torus: 1D plotting
Trace: Make another data
Traj: Vector fields
Transpose: Data resizing
TranspType: Transparency
TriCont: Other plotting
TriPlot: Other plotting
Tube: 1D plotting

V
value: Command options
Var: Data filling
variant: Program flow commands
Vect: Vector fields
View: Subplots and rotation

W
while: Program flow commands
widgets: Using MathGL window
widgets: Widget classes
widgets: Fl_MathGL class
widgets: QMathGL class
widgets: wxMathGL class
window: Using MathGL window
window: Widget classes
window: mglWnd class
Write: Export to file
WriteBMP: Export to file
WriteBPS: Export to file
WriteEPS: Export to file
WriteFrame: Export to file
WriteGIF: Export to file
WriteJPEG: Export to file
WriteOBJ: Export to file
WritePNG: Export to file
WritePRC: Export to file
WriteSVG: Export to file
WriteTEX: Export to file
WriteTGA: Export to file
WriteWGL: Export to file
wxMathGL: wxMathGL class

X
xrange: Command options
XRange: Ranges (bounding box)
XTick: Ticks

Y
yrange: Command options
YRange: Ranges (bounding box)
YTick: Ticks

Z
zrange: Command options
ZRange: Ranges (bounding box)
ZTick: Ticks

Н
Настройка MathGL: Graphics setup

О
Обзор MathGL: Overview

С
Стиль линий: Line styles
Стиль маркеров: Line styles
Стиль стрелок: Line styles
Стиль текста: Font styles

Т
Текстовые формулы: Textual formulas

Ц
Цветовая схема: Color scheme

+
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +Н +   +О +   +С +   +Т +   +Ц +   +
+ +
+ + + +
+ diff --git a/website/mgl_en.html b/website/mgl_en.html new file mode 100644 index 0000000..71a8063 --- /dev/null +++ b/website/mgl_en.html @@ -0,0 +1,12618 @@ + + + + + + +MGL script language for version 2.4.2 + + + + + + + + + + + + + + + + +

MGL script language for version 2.4.2

+ + + + + +

Table of Contents

+ +
+ + +
+ + + +
+

+Next: , Up: (dir)   [Contents][Index]

+
+ +

MGL script language

+ +

This file documents the MGL script language. It corresponds to release 2.4.2 of the MathGL library. Please report any errors in this manual to mathgl.abalakin@gmail.org. More information about MGL and MathGL can be found at the project homepage, http://mathgl.sourceforge.net/. +

+

Copyright © 2008-2012 Alexey A. Balakin. +

+
+

Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 +or any later version published by the Free Software Foundation; +with no Invariant Sections, no Front-Cover Texts, and no Back-Cover +Texts. A copy of the license is included in the section entitled “GNU +Free Documentation License.” +

+ + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ + +

1 MGL scripts

+ + +

MathGL library supports the simplest scripts for data handling and plotting. These scripts can be used independently (with the help of UDAV, mglconv, mglview programs and others +

+ + + + + + + + + +
+ + + +

1.1 MGL definition

+ + +

MGL script language is rather simple. Each string is a command. First word of string is the name of command. Other words are command arguments. Words are separated from each other by space or tabulation symbol. The upper or lower case of words is important, i.e. variables a and A are different variables. Symbol `#` starts the comment (all characters after # will be ignored). The exception is situation when `#` is a part of some string. Also options can be specified after symbol `;` (see Command options). Symbol `:` starts new command (like new line character) if it is not placed inside a string or inside brackets. +

+

If string contain references to external parameters (substrings `$0`, `$1` ... `$9`) or definitions (substrings `$a`, `$b` ... `$z`) then before execution the values of parameter/definition will be substituted instead of reference. It allows to use the same MGL script for different parameters (filenames, paths, condition and so on). +

+

Argument can be a string, a variable (data arrays) or a number (scalars). +

    +
  • The string is any symbols between ordinary marks `'`. Long strings can be concatenated from several lines by `\` symbol. I.e. the string `'a +\<br> b'` will give string `'a + b'` (here `<br>` is newline). There are several operations which can be performed with string: +
      +
    • Concatenation of strings and numbers using `,` with out spaces (for example, `'max(u)=',u.max,' a.u.'` or `'u=',!(1+i2)` for complex numbers); +
    • Getting n-th symbol of the string using `[]` (for example, `'abc'[1]` will give 'b'); +
    • Adding value to the last character of the string using `+` (for example, `'abc'+3` will give 'abf'). +
    + +
  • Usually variable have a name which is arbitrary combination of symbols (except spaces and `'`) started from a letter. Note, you can start an expression with `!` symbol if you want to use complex values. For example, the code new x 100 'x':copy !b !exp(1i*x) will create real valued data x and complex data b, which is equal to exp(I*x), where I^2=-1. A temporary array can be used as variable too: +
      +
    • sub-arrays (like in subdata command) as command argument. For example, a(1) or a(1,:) or a(1,:,:) is second row, a(:,2) or a(:,2,:) is third column, a(:,:,0) is first slice and so on. Also you can extract a part of array from m-th to n-th element by code a(m:n,:,:) or just a(m:n). + +
    • any column combinations defined by formulas, like a('n*w^2/exp(t)') if names for data columns was specified (by idset command or in the file at string started with ##). + +
    • any expression (without spaces) of existed variables produce temporary variable. For example, `sqrt(dat(:,5)+1)` will produce temporary variable with data values equal to tmp[i,j] = sqrt(dat[i,5,j]+1). At this symbol ``` will return transposed data array: both ``sqrt(dat(:,5)+1)` and `sqrt(`dat(:,5)+1)` will produce temporary variable with data values equal to tmp[i,j] = sqrt(dat[j,5,i]+1). + +
    • temporary variable of higher dimensions by help of []. For example, `[1,2,3]` will produce a temporary vector of 3 elements {1, 2, 3}; `[[11,12],[21,22]]` will produce matrix 2*2 and so on. Here you can join even an arrays of the same dimensions by construction like `[v1,v2,...,vn]`. + +
    • result of code for making new data (see Make another data) inside {}. For example, `{sum dat 'x'}` produce temporary variable which contain result of summation of dat along direction `x`. This is the same array tmp as produced by command `sum tmp dat 'x'`. You can use nested constructions, like `{sum {max dat 'z'} 'x'}`. +
    +

    Temporary variables can not be used as 1st argument for commands which create (return) the data (like `new`, `read`, `hist` and so on). +

    +
  • Special names nan=#QNAN, inf=INFINITY, rnd=random value, pi=3.1415926..., on=1, off=0, all=-1, :=-1, variables with suffixes (see Data information), names defined by define command, time values (in format "hh-mm-ss_DD.MM.YYYY", "hh-mm-ss" or "DD.MM.YYYY") are treated as number. Also results of formulas with sizes 1x1x1 are treated as number (for example, `pi/dat.nx`). +
+

Before the first using all variables must be defined with the help of commands, like, new, var, list, copy, read, hist, sum and so on (see sections Data constructor, Data filling and Make another data). +

+

Command may have several set of possible arguments (for example, plot ydat and plot xdat ydat). All command arguments for a selected set must be specified. However, some arguments can have default values. These argument are printed in [], like text ydat ['stl'=''] or text x y 'txt' ['fnt'='' size=-1]. At this, the record [arg1 arg2 arg3 ...] means [arg1 [arg2 [arg3 ...]]], i.e. you can omit only tailing arguments if you agree with its default values. For example, text x y 'txt' '' 1 or text x y 'txt' '' is correct, but text x y 'txt' 1 is incorrect (argument 'fnt' is missed). +

+

You can provide several variants of arguments for a command by using `?` symbol for separating them. The actual argument being used is set by variant. At this, the last argument is used if the value of variant is large than the number of provided variants. By default the first argument is used (i.e. as for variant 0). For example, the first plot will be drawn by blue (default is the first argument `b`), but the plot after variant 1 will be drawn by red dash (the second is `r|`): +

fplot 'x' 'b'?'r'
+variant 1
+fplot 'x^3' 'b'?'r|'
+
+ + +
+ +
+

+Next: , Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

1.2 Program flow commands

+ + +

Below I show commands to control program flow, like, conditions, loops, define script arguments and so on. Other commands can be found in chapters MathGL core and Data processing. Note, that some of program flow commands (like define, ask, call, for, func) should be placed alone in the string. +

+ +
+
MGL command: chdir 'path'
+

Changes the current directory to path. +

+ + +
+
MGL command: ask $N 'question'
+

Sets N-th script argument to answer which give the user on the question. Usually this show dialog with question where user can enter some text as answer. Here N is digit (0...9) or alpha (a...z). +

+ + +
+
MGL command: define $N smth
+

Sets N-th script argument to smth. Note, that smth is used as is (with `'` symbols if present). Here N is digit (0...9) or alpha (a...z). +

+
+
MGL command: define name smth
+

Create scalar variable name which have the numeric value of smth. Later you can use this variable as usual number. +

+ +
+
MGL command: defchr $N smth
+

Sets N-th script argument to character with value evaluated from smth. Here N is digit (0...9) or alpha (a...z). +

+ +
+
MGL command: defnum $N smth
+

Sets N-th script argument to number with value evaluated from smth. Here N is digit (0...9) or alpha (a...z). +

+ + + +
+
MGL command: call 'funcname' [ARG1 ARG2 ... ARG9]
+

Executes function fname (or script if function is not found). Optional arguments will be passed to functions. See also func. +

+ +
+
MGL command: func 'funcname' [narg=0]
+

Define the function fname and number of required arguments. The arguments will be placed in script parameters $1, $2, ... $9. Note, script execution is stopped at func keyword, similarly to stop command. See also return. +

+ +
+
MGL command: return
+

Return from the function. See also func. +

+ + +
+
MGL command: load 'filename'
+

Load additional MGL command from external module (DLL or .so), located in file filename. This module have to contain array with name mgl_cmd_extra of type mglCommand, which describe provided commands. +

+ + + +
+
MGL command: if val then CMD
+

Executes command CMD only if val is nonzero. +

+
+
MGL command: if val
+

Starts block which will be executed if val is nonzero. +

+
+
MGL command: if dat 'cond'
+

Starts block which will be executed if dat satisfy to cond. +

+ +
+
MGL command: elseif val
+

Starts block which will be executed if previous if or elseif is false and val is nonzero. +

+
+
MGL command: elseif dat 'cond'
+

Starts block which will be executed if previous if or elseif is false and dat satisfy to cond. +

+ +
+
MGL command: else
+

Starts block which will be executed if previous if or elseif is false. +

+ +
+
MGL command: endif
+

Finishes if/elseif/else block. +

+ + +
+
MGL command: for $N v1 v2 [dv=1]
+

Starts loop with $N-th argument changing from v1 to v2 with the step dv. Here N is digit (0...9) or alpha (a...z). +

+
+
MGL command: for $N dat
+

Starts loop with $N-th argument changing for dat values. Here N is digit (0...9) or alpha (a...z). +

+ +
+
MGL command: next
+

Finishes for loop. +

+ + +
+
MGL command: do
+

Starts infinite loop. +

+ +
+
MGL command: while val
+

Continue loop iterations if val is nonzero, or finishes loop otherwise. +

+
+
MGL command: while dat 'cond'
+

Continue loop iterations if dat satisfy to cond, or finishes loop otherwise. +

+ + +
+
MGL command: once val
+

The code between once on and once off will be executed only once. Useful for large data manipulation in programs like UDAV. +

+ +
+
MGL command: stop
+

Terminate execution. +

+ + +
+
MGL command: variant val
+

Set variant of argument(s) separated by `?` symbol to be used in further commands. +

+ + + +
+
MGL command: rkstep eq1;... var1;... [dt=1]
+

Make one step for ordinary differential equation(s) {var1` = eq1, ... } with time-step dt. Here variable(s) `var1`, ... are the ones, defined in MGL script previously. The Runge-Kutta 4-th order method is used for solution. +

+ + + +
+ + + +

1.3 Special comments

+ + +

There are number of special comments for MGL script, which set some global behavior (like, animation, dialog for parameters and so on). All these special comments starts with double sign ##. Let consider them. +

+
+
`##c v1 v2 [dv=1]`
+

Sets the parameter for animation loop relative to variable $0. Here v1 and v2 are initial and final values, dv is the increment. +

+
+
`##a val`
+

Adds the parameter val to the list of animation relative to variable $0. You can use it several times (one parameter per line) or combine it with animation loop ##c. +

+
+
`##d $I kind|label|par1|par2|...`
+

Creates custom dialog for changing plot properties. Each line adds one widget to the dialog. Here $I is id ($0,$1...$9,$a,$b...$z), label is the label of widget, kind is the kind of the widget: +

    +
  • `e` for editor or input line (parameter is initial value) , +
  • `v` for spinner or counter (parameters are "ini|min|max|step|big_step"), +
  • `s` for slider (parameters are "ini|min|max|step"), +
  • `b` for check box (parameter is "ini"; also understand "on"=1), +
  • `c` for choice (parameters are possible choices). +
+

Now, it work in FLTK-based mgllab and mglview only. +

+ +
+
+ + +
+ +
+

+Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

1.4 LaTeX package

+ + +

There is LaTeX package mgltex (was made by Diego Sejas Viscarra) which allow one to make figures directly from MGL script located in LaTeX file. +

+

For using this package you need to specify --shell-escape option for latex/pdflatex or manually run mglconv tool with produced MGL scripts for generation of images. Don`t forgot to run latex/pdflatex second time to insert generated images into the output document. Also you need to run pdflatex third time to update converted from EPS images if you are using vector EPS output (default). +

+

The package may have following options: draft, final — the same as in the graphicx package; on, off — to activate/deactivate the creation of scripts and graphics; comments, nocomments — to make visible/invisible comments contained inside mglcomment environments; jpg, jpeg, png — to export graphics as JPEG/PNG images; eps, epsz — to export to uncompressed/compressed EPS format as primitives; bps, bpsz — to export to uncompressed/compressed EPS format as bitmap (doesn`t work with pdflatex); pdf — to export to 3D PDF; tex — to export to LaTeX/tikz document. +

+

The package defines the following environments: +

+
`mgl`
+

It writes its contents to a general script which has the same name as the LaTeX document, but its extension is .mgl. The code in this environment is compiled and the image produced is included. It takes exactly the same optional arguments as the \includegraphics command, plus an additional argument imgext, which specifies the extension to save the image. +

+

An example of usage of `mgl` environment would be: +

\begin{mglfunc}{prepare2d}
+  new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+  new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+\end{mglfunc}
+
+\begin{figure}[!ht]
+  \centering
+  \begin{mgl}[width=0.85\textwidth,height=7.5cm]
+    fog 0.5
+    call 'prepare2d'
+    subplot 2 2 0 : title 'Surf plot (default)' : rotate 50 60 : light on : box : surf a
+
+    subplot 2 2 1 : title '"\#" style; meshnum 10' : rotate 50 60 : box
+    surf a '#'; meshnum 10
+
+    subplot 2 2 2 : title 'Mesh plot' : rotate 50 60 : box
+    mesh a
+
+    new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+    new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+    new z 50 40 '0.8*cos(pi*(y+1)/2)'
+    subplot 2 2 3 : title 'parametric form' : rotate 50 60 : box
+    surf x y z 'BbwrR'
+  \end{mgl}
+\end{figure}
+
+
+
`mgladdon`
+

It adds its contents to the general script, without producing any image. +

+
`mglcode`
+

Is exactly the same as `mgl`, but it writes its contents verbatim to its own file, whose name is specified as a mandatory argument. +

+
`mglscript`
+

Is exactly the same as `mglcode`, but it doesn`t produce any image, nor accepts optional arguments. It is useful, for example, to create a MGL script, which can later be post processed by another package like "listings". +

+
`mglblock`
+

It writes its contents verbatim to a file, specified as a mandatory argument, and to the LaTeX document, and numerates each line of code. +

+
+
`mglverbatim`
+

Exactly the same as `mglblock`, but it doesn`t write to a file. This environment doesn`t have arguments. +

+
`mglfunc`
+

Is used to define MGL functions. It takes one mandatory argument, which is the name of the function, plus one additional argument, which specifies the number of arguments of the function. The environment needs to contain only the body of the function, since the first and last lines are appended automatically, and the resulting code is written at the end of the general script, after the stop command, which is also written automatically. The warning is produced if 2 or more function with the same name is defined. +

+
`mglcomment`
+

Is used to contain multiline comments. This comments will be visible/invisible in the output document, depending on the use of the package options comments and nocomments (see above), or the \mglcomments and \mglnocomments commands (see bellow). +

+
`mglsetup`
+

If many scripts with the same code are to be written, the repetitive code can be written inside this environment only once, then this code will be used automatically every time the `\mglplot` command is used (see below). It takes one optional argument, which is a name to be associated to the corresponding contents of the environment; this name can be passed to the `\mglplot` command to use the corresponding block of code automatically (see below). +

+
+ +

The package also defines the following commands: +

+
`\mglplot`
+

It takes one mandatory argument, which is MGL instructions separated by the symbol `:` this argument can be more than one line long. It takes the same optional arguments as the `mgl` environment, plus an additional argument setup, which indicates the name associated to a block of code inside a `mglsetup` environment. The code inside the mandatory argument will be appended to the block of code specified, and the resulting code will be written to the general script. +

+

An example of usage of `\mglplot` command would be: +

\begin{mglsetup}
+    box '@{W9}' : axis
+\end{mglsetup}
+\begin{mglsetup}[2d]
+  box : axis
+  grid 'xy' ';k'
+\end{mglsetup}
+\begin{mglsetup}[3d]
+  rotate 50 60
+  box : axis : grid 'xyz' ';k'
+\end{mglsetup}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5]{new a 200 'sin(pi*x)' : plot a '2B'}
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5,setup=2d]{
+    fplot 'sin(pi*x)' '2B' :
+    fplot 'cos(pi*x^2)' '2R'
+  }
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[setup=3d]{fsurf 'sin(pi*x)+cos(pi*y)'}
+\end{figure}
+
+
+
`\mglgraphics`
+

This command takes the same optional arguments as the `mgl` environment, and one mandatory argument, which is the name of a MGL script. This command will compile the corresponding script and include the resulting image. It is useful when you have a script outside the LaTeX document, and you want to include the image, but you don`t want to type the script again. +

+
`\mglinclude`
+

This is like `\mglgraphics` but, instead of creating/including the corresponding image, it writes the contents of the MGL script to the LaTeX document, and numerates the lines. +

+
`\mgldir`
+

This command can be used in the preamble of the document to specify a directory where LaTeX will save the MGL scripts and generate the corresponding images. This directory is also where `\mglgraphics` and `\mglinclude` will look for scripts. +

+
`\mglquality`
+

Adjust the quality of the MGL graphics produced similarly to quality. +

+
`\mgltexon, \mgltexoff`
+

Activate/deactivate the creation of MGL scripts and images. Notice these commands have local behavior in the sense that their effect is from the point they are called on. +

+
`\mglcomment, \mglnocomment`
+

Make visible/invisible the contents of the mglcomment environments. These commands have local effect too. +

+
`\mglTeX`
+

It just pretty prints the name of the package. +

+
+ +

As an additional feature, when an image is not found or cannot be included, instead of issuing an error, mgltex prints a box with the word `MGL image not found` in the LaTeX document. +

+ + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

2 General concepts

+ + +

The set of MathGL features is rather rich - just the number of basic graphics types +is larger than 50. Also there are functions for data handling, plot setup and so on. In spite of it I tried to keep a similar style in function names and in the order of arguments. Mostly it is +used for different drawing functions. +

+

There are six most general (base) concepts: +

    +
  1. Any picture is created in memory first. The internal (memory) representation can be different: bitmap picture (for SetQuality(MGL_DRAW_LMEM) or quality 6) or the list of vector primitives (default). After that the user may decide what he/she want: save to file, display on the screen, run animation, do additional editing and so on. This approach assures a high portability of the program - the source code will produce exactly the same picture in any OS. Another big positive consequence is the ability to create the picture in the console program (using command line, without creating a window)! +
  2. Every plot settings (style of lines, font, color scheme) are specified by a string. It provides convenience for user/programmer - short string with parameters is more comprehensible than a large set of parameters. Also it provides portability - the strings are the same in any OS so that it is not necessary to think about argument types. +
  3. All functions have “simplified” and “advanced” forms. It is done for user`s convenience. One needs to specify only one data array in the “simplified” form in order to see the result. But one may set parametric dependence of coordinates and produce rather complex curves and surfaces in the “advanced” form. In both cases the order of function arguments is the same: first data arrays, second the string with style, and later string with options for additional plot tuning. +
  4. All data arrays for plotting are encapsulated in mglData(A) class. This reduces the number of errors while working with memory and provides a uniform interface for data of different types (mreal, double and so on) or for formula plotting. +
  5. All plots are vector plots. The MathGL library is intended for handling scientific data which have vector nature (lines, faces, matrices and so on). As a result, vector representation is used in all cases! In addition, the vector representation allows one to scale the plot easily - change the canvas size by a factor of 2, and the picture will be proportionally scaled. +
  6. New drawing never clears things drawn already. This, in some sense, unexpected, idea allows to create a lot of “combined” graphics. For example, to make a surface with contour lines one needs to call the function for surface plotting and the function for contour lines plotting (in any order). Thus the special functions for making this “combined” plots (as it is done in Matlab and some other plotting systems) are superfluous. +
+ +

In addition to the general concepts I want to comment on some non-trivial or less commonly used general ideas - plot positioning, axis specification and curvilinear coordinates, styles for lines, text and color scheme. +

+ + + + + + + + + + + + +
+ + + +

2.1 Coordinate axes

+ + +

Two axis representations are used in MathGL. The first one consists of normalizing coordinates of data points in axis range (see Axis settings). If SetCut() is true then the outlier points are omitted, otherwise they are projected to the bounding box (see Cutting). Also, the point will be omitted if it lies inside the box defined by SetCutBox() or if the value of formula CutOff() is nonzero for its coordinates. After that, transformation formulas defined by SetFunc() or SetCoor() are applied to the data point (see Curved coordinates). Finally, the data point is plotted by one of the functions. +

+

The range of x, y, z-axis can be specified by SetRange() or ranges functions. Its origin is specified by origin function. At this you can you can use NAN values for selecting axis origin automatically. +

+

There is 4-th axis c (color axis or colorbar) in addition to the usual axes x, y, z. It sets the range of values for the surface coloring. Its borders are automatically set to values of z-range during the call of ranges function. Also, one can directly set it by call SetRange('c', ...). Use colorbar function for drawing the colorbar. +

+

The form (appearence) of tick labels is controlled by SetTicks() function (see Ticks). Function SetTuneTicks switches on/off tick enhancing by factoring out acommon multiplier (for small coordinate values, like 0.001 to 0.002, or large, like from 1000 to 2000) or common component (for narrow range, like from 0.999 to 1.000). Finally, you may use functions SetTickTempl() for setting templates for tick labels (it supports TeX symbols). Also, there is a possibility to print arbitrary text as tick labels the by help of SetTicksVal() function. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.2 Color styles

+ + +

Base colors are defined by one of symbol `wkrgbcymhRGBCYMHWlenupqLENUPQ`. +

The color types are: `k` - black, `r` - red, `R` - dark red, `g` - green, `G` - dark green, `b` - blue, `B` - dark blue, `c` - cyan, `C` - dark cyan, `m` - magenta, `M` - dark magenta, `y` - yellow, `Y` - dark yellow (gold), `h` - gray, `H` - dark gray, `w` - white, `W` - bright gray, `l` - green-blue, `L` - dark green-blue, `e` - green-yellow, `E` - dark green-yellow, `n` - sky-blue, `N` - dark sky-blue, `u` - blue-violet, `U` - dark blue-violet, `p` - purple, `P` - dark purple, `q` - orange, `Q` - dark orange (brown).

+

+

You can also use “bright” colors. The “bright” color contain 2 symbols in brackets `{cN}`: first one is the usual symbol for color id, the second one is a digit for its brightness. The digit can be in range `1`...`9`. Number `5` corresponds to a normal color, `1` is a very dark version of the color (practically black), and `9` is a very bright version of the color (practically white). For example, the colors can be `{b2}` `{b7}` `{r7}` and so on. +

+

Finally, you can specify RGB or RGBA values of a color using format `{xRRGGBB}` or `{xRRGGBBAA}` correspondingly. For example, `{xFF9966}` give you +melone color. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.3 Line styles

+ + + + + + +

The line style is defined by the string which may contain specifications for color (`wkrgbcymhRGBCYMHWlenupqLENUPQ`), dashing style (`-|;:ji=` or space), width (`123456789`) and marks (`*o+xsd.^v<>` and `#` modifier). If one of the type of information is omitted then default values used with next color from palette (see Palette and colors). Note, that internal color counter will be nullified by any change of palette. This includes even hidden change (for example, by box or axis functions). +By default palette contain following colors: dark gray `H`, blue `b`, green `g`, red `r`, cyan `c`, magenta `m`, yellow `y`, gray `h`, green-blue `l`, sky-blue `n`, orange `q`, green-yellow `e`, blue-violet `u`, purple `p`. + +

Dashing style has the following meaning: space - no line (usable for plotting only marks), `-` - solid line (■■■■■■■■■■■■■■■■), `|` - long dashed line (■■■■■■■■□□□□□□□□), `;` - dashed line (■■■■□□□□■■■■□□□□), `=` - small dashed line (■■□□■■□□■■□□■■□□), `:` - dotted line (■□□□■□□□■□□□■□□□), `j` - dash-dotted line (■■■■■■■□□□□■□□□□), `i` - small dash-dotted line (■■■□□■□□■■■□□■□□), `{dNNNN}` - manual mask style (for v.2.3 and later, like `{df090}` for (■■■■□□□□■□□■□□□□)).

+

+

Marker types are: `o` - circle, `+` - cross, `x` - skew cross, `s` - square, `d` - rhomb (or diamond), `.` - dot (point), `^` - triangle up, `v` - triangle down, `<` - triangle left, `>` - triangle right, `#*` - Y sign, `#+` - squared cross, `#x` - squared skew cross, `#.` - circled dot. If string contain symbol `#` then the solid versions of markers are used. +

+

You can provide user-defined symbols (see addsymbol) to draw it as marker by using `&` style. In particular, `&*`, `&o`, `&+`, `&x`, `&s`, `&d`, `&.`, `&^`, `&v`, `&<`, `&>` will draw user-defined symbol `*o+xsd.^v<>` correspondingly; and +`&#o`, `&#+`, `&#x`, `&#s`, `&#d`, `&#.`, `&#^`, `&#v`, `&#<`, `&#>` will draw user-defined symbols `YOPXSDCTVLR` correspondingly. Note, that wired version of user-defined symbols will be drawn if you set negative marker size (see marksize or size in Command options). +

+

One may specify to draw a special symbol (an arrow) at the beginning and at the end of line. This is done if the specification string contains one of the following symbols: `A` - outer arrow, `V` - inner arrow, `I` - transverse hatches, `K` - arrow with hatches, `T` - triangle, `S` - square, `D` - rhombus, `O` - circle, `X` - skew cross, `_` - nothing (the default). The following rule applies: the first symbol specifies the arrow at the end of line, the second specifies the arrow at the beginning of the line. For example, `r-A` defines a red solid line with usual arrow at the end, `b|AI` defines a blue dash line with an arrow at the end and with hatches at the beginning, `_O` defines a line with the current style and with a circle at the beginning. These styles are applicable during the graphics plotting as well (for example, 1D plotting). +

+
Color and line styles. +
+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.4 Color scheme

+ + + + +

The color scheme is used for determining the color of surfaces, isolines, isosurfaces and so on. The color scheme is defined by the string, which may contain several characters that are color id (see Line styles) or characters `#:|`. Symbol `#` switches to mesh drawing or to a wire plot. Symbol `|` disables color interpolation in color scheme, which can be useful, for example, for sharp colors during matrix plotting. Symbol `:` terminate the color scheme parsing. Following it, the user may put styles for the text, rotation axis for curves/isocontours, and so on. Color scheme may contain up to 32 color values. +

+

The final color is a linear interpolation of color array. The color array is constructed from the string ids (including “bright” colors, see Color styles). The argument is the amplitude normalized in color range (see Axis settings). For example, string containing 4 characters `bcyr` corresponds to a colorbar from blue (lowest value) through cyan (next value) through yellow (next value) to the red (highest value). String `kw` corresponds to a colorbar from black (lowest value) to white (highest value). String `m` corresponds to a simple magenta color. +

+

The special 2-axis color scheme (like in map plot) can be used if it contain symbol `%`. In this case the second direction (alpha channel) is used as second coordinate for colors. At this, up to 4 colors can be specified for corners: {c1,a1}, {c2,a1}, {c1,a2}, {c2,a2}. Here color and alpha ranges are {c1,c2} and {a1,a2} correspondingly. If one specify less than 4 colors then black color is used for corner {c1,a1}. If only 2 colors are specified then the color of their sum is used for corner {c2,a2}. +

+

There are several useful combinations. String `kw` corresponds to the simplest gray color scheme where higher values are brighter. String `wk` presents the inverse gray color scheme where higher value is darker. Strings `kRryw`, `kGgw`, `kBbcw` present the well-known hot, summer and winter color schemes. Strings `BbwrR` and `bBkRr` allow to view bi-color figure on white or black background, where negative values are blue and positive values are red. String `BbcyrR` gives a color scheme similar to the well-known jet color scheme. +

+

For more precise coloring, you can change default (equidistant) position of colors in color scheme. The format is `{CN,pos}`, `{CN,pos}` or `{xRRGGBB,pos}`. The position value pos should be in range [0, 1]. Note, that alternative method for fine tuning of the color scheme is using the formula for coloring (see Curved coordinates). +

+
Most popular color schemes. +
+

When coloring by coordinate (used in map), the final color is determined by the position of the point in 3d space and is calculated from formula c=x*c[1] + y*c[2]. Here, c[1], c[2] are the first two elements of color array; x, y are normalized to axis range coordinates of the point. +

+

Additionally, MathGL can apply mask to face filling at bitmap rendering. The kind of mask is specified by one of symbols `-+=;oOsS~<>jdD*^` in color scheme. Mask can be rotated by arbitrary angle by command mask or by three predefined values +45, -45 and 90 degree by symbols `\/I` correspondingly. Examples of predefined masks are shown on the figure below. +

+
Example of masks for face coloring. +
+

However, you can redefine mask for one symbol by specifying new matrix of size 8*8 as second argument for mask command. For example, the right-down subplot on the figure above is produced by code
+mask '+' 'ff00182424f800':dens a '3+'
+or just use manual mask style (for v.2.3 and later)
+dens a '3{s00ff00182424f800}' +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.5 Font styles

+ + + + +

Text style is specified by the string which may contain: color id characters `wkrgbcymhRGBCYMHW` (see Color styles), and font style (`ribwou`) and/or alignment (`LRC`) specifications. At this, font style and alignment begin after the separator `:`. For example, `r:iCb` sets the bold (`b`) italic (`i`) font text aligned at the center (`C`) and with red color (`r`). Starting from MathGL v.2.3, you can set not single color for whole text, but use color gradient for printed text (see Color scheme). +

+

The font styles are: `r` - roman (or regular) font, `i` - italic style, `b` - bold style. By default roman roman font is used. The align types are: `L` - align left (default), `C` - align center, `R` - align right, `T` - align under, `V` - align center vertical. Additional font effects are: `w` - wired, `o` - over-lined, `u` - underlined. +

+

Also a parsing of the LaTeX-like syntax is provided. There are commands for the font style changing inside the string (for example, use \b for bold font): \a or \overline - over-lined, \b or \textbf - bold, \i or \textit - italic, \r or \textrm - roman (disable bold and italic attributes), \u or \underline - underlined, \w or \wire - wired, \big - bigger size, @ - smaller size. The lower and upper indexes are specified by `_` and `^` symbols. At this the changed font style is applied only on next symbol or symbols in braces {}. The text in braces {} are treated as single symbol that allow one to print the index of index. For example, compare the strings `sin (x^{2^3})` and `sin (x^2^3)`. You may also change text color inside string by command #? or by \color? where `?` is symbolic id of the color (see Color styles). For example, words `blue` and `red` will be colored in the string `#b{blue} and \colorr{red} text`. The most of functions understand the newline symbol `\n` and allows to print multi-line text. Finally, you can use arbitrary (if it was defined in font-face) UTF codes by command \utf0x????. For example, \utf0x3b1 will produce + α symbol. +

+

The most of commands for special TeX or AMSTeX symbols, the commands for font style changing (\textrm, \textbf, \textit, \textsc, \overline, \underline), accents (\hat, \tilde, \dot, \ddot, \acute, \check, \grave, \bar, \breve) and roots (\sqrt, \sqrt3, \sqrt4) are recognized. The full list contain approximately 2000 commands. Note that first space symbol after the command is ignored, but second one is printed as normal symbol (space). For example, the following strings produce the same result \tilde a: `\tilde{a}`; `\tilde a`; `\tilde{}a`. +

+In particular, the Greek letters are recognizable special symbols: α - \alpha, β - \beta, γ - \gamma, δ - \delta, ε - \epsilon, η - \eta, ι - \iota, χ - \chi, κ - \kappa, λ - \lambda, μ - \mu, ν - \nu, o - \o, ω - \omega, ϕ - \phi, π - \pi, ψ - \psi, ρ - \rho, σ - \sigma, θ - \theta, τ - \tau, υ - \upsilon, ξ - \xi, ζ - \zeta, ς - \varsigma, ɛ - \varepsilon, ϑ - \vartheta, φ - \varphi, ϰ - \varkappa; A - \Alpha, B - \Beta, Γ - \Gamma, Δ - \Delta, E - \Epsilon, H - \Eta, I - \Iota, C - \Chi, K - \Kappa, Λ - \Lambda, M - \Mu, N - \Nu, O - \O, Ω - \Omega, Φ - \Phi, Π - \Pi, Ψ - \Psi, R - \Rho, Σ - \Sigma, Θ - \Theta, T - \Tau, Υ - \Upsilon, Ξ - \Xi, Z - \Zeta. + +

The small part of most common special TeX symbols are: ∠ - \angle, ⋅ - \cdot, ♣ - \clubsuit, ✓ - \checkmark, ∪ - \cup, ∩ - \cap, ♢ - \diamondsuit, ◇ - \diamond, ÷ + - \div, +↓ - \downarrow, † - \dag, ‡ - \ddag, ≡ - \equiv, ∃ - \exists, ⌢ - \frown, ♭ - \flat, ≥ - \ge, ≥ - \geq, ≧ - \geqq, ← - \gets, ♡ - \heartsuit, ∞ - \infty, ∫ - \int, \Int, ℑ - \Im, ♢ - \lozenge, ⟨ - \langle, ≤ - \le, ≤ - \leq, ≦ - \leqq, ← - \leftarrow, ∓ - \mp, ∇ - \nabla, ≠ - \ne, ≠ - \neq, ♮ - \natural, ∮ - \oint, ⊙ - \odot, ⊕ - \oplus, ∂ - \partial, ∥ - \parallel, ⊥ -\perp, ± - \pm, ∝ - \propto, ∏ - \prod, ℜ - \Re, → - \rightarrow, ⟩ - \rangle, ♠ - \spadesuit, ~ - \sim, ⌣ - \smile, ⊂ - \subset, ⊃ - \supset, √ - \sqrt or \surd, § - \S, ♯ - \sharp, ∑ - \sum, × - \times, → - \to, ∴ - \therefore, ↑ - \uparrow, ℘ - \wp.

+ +

The font size can be defined explicitly (if size>0) or relatively to a base font size as |size|*FontSize (if size<0). The value size=0 specifies that the string will not be printed. The base font size is measured in internal “MathGL” units. Special functions SetFontSizePT(), SetFontSizeCM(), SetFontSizeIN() (see Font settings) allow one to set it in more “common” variables for a given dpi value of the picture. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.6 Textual formulas

+ + + + +

MathGL have the fast variant of textual formula evaluation +. There are a lot of functions and operators available. The operators are: `+` - addition, `-` - subtraction, `*` - multiplication, `/` - division, `%` - modulo, `^` - integer power. Also there are logical “operators”: `<` - true if x<y, `>` - true if x>y, `=` - true if x=y, `&` - true if x and y both nonzero, `|` - true if x or y nonzero. These logical operators have lowest priority and return 1 if true or 0 if false. +

+

The basic functions are: `sqrt(x)` - square root of x, `pow(x,y)` - power x in y, `ln(x)` - natural logarithm of x, `lg(x)` - decimal logarithm of x, `log(a,x)` - logarithm base a of x, `abs(x)` - absolute value of x, `sign(x)` - sign of x, `mod(x,y)` - x modulo y, `step(x)` - step function, `int(x)` - integer part of x, `rnd` - random number, `random(x)` - random data of size as in x, `hypot(x,y)`=sqrt(x^2+y^2) - hypotenuse, `cmplx(x,y)`=x+i*y - complex number, `pi` - number +π = 3.1415926…, inf=∞ +

+

Functions for complex numbers `real(x)`, `imag(x)`, `abs(x)`, `arg(x)`, `conj(x)`. +

+

Trigonometric functions are: `sin(x)`, `cos(x)`, `tan(x)` (or `tg(x)`). Inverse trigonometric functions are: `asin(x)`, `acos(x)`, `atan(x)`. Hyperbolic functions are: `sinh(x)` (or `sh(x)`), `cosh(x)` (or `ch(x)`), `tanh(x)` (or `th(x)`). Inverse hyperbolic functions are: `asinh(x)`, `acosh(x)`, `atanh(x)`. +

+

There are a set of special functions: `gamma(x)` - Gamma function Γ(x) = ∫0 tx-1 exp(-t) dt, `gamma_inc(x,y)` - incomplete Gamma function Γ(x,y) = ∫y tx-1 exp(-t) dt, `psi(x)` - digamma function ψ(x) = Γ′(x)/Γ(x) for x≠0, `ai(x)` - Airy function Ai(x), `bi(x)` - Airy function Bi(x), `cl(x)` - Clausen function, `li2(x)` (or `dilog(x)`) - dilogarithm Li2(x) = -ℜ∫0xds log(1-s)/s, `sinc(x)` - compute sinc(x) = sin(πx)/(πx) for any value of x, `zeta(x)` - Riemann zeta function ζ(s) = ∑k=1k-s for arbitrary s≠1, `eta(x)` - eta function η(s) = (1 - 21-s)ζ(s) for arbitrary s, `lp(l,x)` - Legendre polynomial Pl(x), (|x|≤1, l≥0), `w0(x)` - principal branch of the Lambert W function, `w1(x)` - principal branch of the Lambert W function. Function W(x) is defined to be solution of the equation: W exp(W) = x.

+ +

The exponent integrals are: `ci(x)` - Cosine integral Ci(x) = ∫0xdt cos(t)/t, `si(x)` - Sine integral Si(x) = ∫0xdt sin(t)/t, `erf(x)` - error function erf(x) = (2/√π) ∫0xdt exp(-t2) , `ei(x)` - exponential integral Ei(x) = -PV(∫-xdt exp(-t)/t) (where PV denotes the principal value of the integral), `e1(x)` - exponential integral E1(x) = ℜ∫1dt exp(-xt)/t, `e2(x)` - exponential integral E2(x) = ℜ∫1∞dt exp(-xt)/t2, `ei3(x)` - exponential integral Ei3(x) = ∫0xdt exp(-t3) for x≥0.

+ +

Bessel functions are: `j(nu,x)` - regular cylindrical Bessel function of fractional order nu, `y(nu,x)` - irregular cylindrical Bessel function of fractional order nu, `i(nu,x)` - regular modified Bessel function of fractional order nu, `k(nu,x)` - irregular modified Bessel function of fractional order nu.

+ +

Elliptic integrals are: `ee(k)` - complete elliptic integral is denoted by E(k) = E(π/2,k), `ek(k)` - complete elliptic integral is denoted by K(k) = F(π/2,k), `e(phi,k)` - elliptic integral E(φ,k) = ∫0φdt √(1 - k2sin2(t)), `f(phi,k)` - elliptic integral F(φ,k) = ∫0φdt 1/√(1 - k2sin2(t))

+ +

Jacobi elliptic functions are: `sn(u,m)`, `cn(u,m)`, `dn(u,m)`, `sc(u,m)`, `sd(u,m)`, `ns(u,m)`, `cs(u,m)`, `cd(u,m)`, `nc(u,m)`, `ds(u,m)`, `dc(u,m)`, `nd(u,m)`. +

+

Note, some of these functions are unavailable if MathGL was compiled without GSL support. +

+

There is no difference between lower or upper case in formulas. If argument value lie outside the range of function definition then function returns NaN. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.7 Command options

+ + +

Command options allow the easy setup of the selected plot by changing global settings only for this plot. Each option start from symbol `;`. Options work so that MathGL remember the current settings, change settings as it being set in the option, execute function and return the original settings back. So, the options are most usable for plotting functions. +

+

The most useful options are xrange, yrange, zrange. They sets the boundaries for data change. This boundaries are used for automatically filled variables. So, these options allow one to change the position of some plots. For example, in command Plot(y,"","xrange 0.1 0.9"); or plot y; xrange 0.1 0.9 the x coordinate will be equidistantly distributed in range 0.1 ... 0.9. See Using options, for sample code and picture. +

+

The full list of options are: + + +

+
MGL option: alpha val
+

Sets alpha value (transparency) of the plot. The value should be in range [0, 1]. See also alphadef. +

+ + +
+
MGL option: xrange val1 val2
+

Sets boundaries of x coordinate change for the plot. See also xrange. +

+ +
+
MGL option: yrange val1 val2
+

Sets boundaries of y coordinate change for the plot. See also yrange. +

+ +
+
MGL option: zrange val1 val2
+

Sets boundaries of z coordinate change for the plot. See also zrange. +

+ + +
+
MGL option: cut val
+

Sets whether to cut or to project the plot points lying outside the bounding box. See also cut. +

+ +
+
MGL option: size val
+

Sets the size of text, marks and arrows. See also font, marksize, arrowsize. +

+ +
+
MGL option: meshnum val
+

Work like meshnum command. +

+ + +
+
MGL option: legend 'txt'
+

Adds string `txt` to internal legend accumulator. The style of described line and mark is taken from arguments of the last 1D plotting command. See also legend. +

+ +
+
MGL option: value val
+

Set the value to be used as additional numeric parameter in plotting command. +

+ + + + +
+ +
+

+Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.8 Interfaces

+ + +

You can use mglParse class for executing MGL scripts from different languages. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 MathGL core

+ + + +

This chapter contains a lot of plotting commands for 1D, 2D and 3D data. It also encapsulates parameters for axes drawing. Moreover an arbitrary coordinate transformation can be used for each axis. Additional information about colors, fonts, formula parsing can be found in General concepts. The full list of symbols used by MathGL for setting up plots can be found in Symbols for styles. +

+ +

Some of MathGL features will appear only in novel versions. To test used MathGL version you can use following function. +

+
MGL command: version 'ver'
+

Return zero if MathGL version is appropriate for required by ver, i.e. if major version is the same and minor version is greater or equal to one in ver. +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: MathGL core   [Contents][Index]

+
+ +

3.1 Create and delete objects

+ + + +

You don`t need to create canvas object in MGL. +

+ +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.2 Graphics setup

+ + + +

Functions and variables in this group influences on overall graphics appearance. So all of them should be placed before any actual plotting function calls. +

+
+
MGL command: reset
+

Restore initial values for all of parameters and clear the image. +

+ +
+
MGL command: setup val flag
+

Sets the value of internal binary flag to val. The list of flags can be found at define.h. The current list of flags are: +

#define MGL_ENABLE_CUT		0x00000004 	///< Flag which determines how points outside bounding box are drown.
+#define MGL_ENABLE_RTEXT 	0x00000008 	///< Use text rotation along axis
+#define MGL_AUTO_FACTOR		0x00000010 	///< Enable autochange PlotFactor
+#define MGL_ENABLE_ALPHA 	0x00000020 	///< Flag that Alpha is used
+#define MGL_ENABLE_LIGHT 	0x00000040 	///< Flag of using lightning
+#define MGL_TICKS_ROTATE 	0x00000080 	///< Allow ticks rotation
+#define MGL_TICKS_SKIP		0x00000100 	///< Allow ticks rotation
+#define MGL_DISABLE_SCALE	0x00000200 	///< Temporary flag for disable scaling (used for axis)
+#define MGL_FINISHED 		0x00000400 	///< Flag that final picture (i.e. mglCanvas::G) is ready
+#define MGL_USE_GMTIME		0x00000800 	///< Use gmtime instead of localtime
+#define MGL_SHOW_POS		0x00001000 	///< Switch to show or not mouse click position
+#define MGL_CLF_ON_UPD		0x00002000 	///< Clear plot before Update()
+#define MGL_NOSUBTICKS		0x00004000 	///< Disable subticks drawing (for bounding box)
+#define MGL_LOCAL_LIGHT		0x00008000 	///< Keep light sources for each inplot
+#define MGL_VECT_FRAME		0x00010000 	///< Use DrwDat to remember all data of frames
+#define MGL_REDUCEACC		0x00020000 	///< Reduce accuracy of points (to reduce size of output files)
+#define MGL_PREFERVC 		0x00040000 	///< Prefer vertex color instead of texture if output format supports
+#define MGL_ONESIDED 		0x00080000 	///< Render only front side of surfaces if output format supports (for debugging)
+#define MGL_NO_ORIGIN 		0x00100000 	///< Don't draw tick labels at axis origin
+#define MGL_GRAY_MODE 		0x00200000 	///< Convert all colors to gray ones
+#define MGL_FULL_CURV 		0x00400000 	///< Disable omitting points in straight-line part(s)
+#define MGL_NO_SCALE_REL 	0x00800000 	///< Disable font scaling in relative inplots
+
+ + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.1 Transparency

+ + + + + +

There are several functions and variables for setup transparency. The general function is alpha which switch on/off the transparency for overall plot. It influence only for graphics which created after alpha call (with one exception, OpenGL). Function alphadef specify the default value of alpha-channel. Finally, function transptype set the kind of transparency. See Transparency and lighting, for sample code and picture. +

+
+
MGL command: alpha [val=on]
+

Sets the transparency on/off and returns previous value of transparency. It is recommended to call this function before any plotting command. Default value is transparency off. +

+ +
+
MGL command: alphadef val
+

Sets default value of alpha channel (transparency) for all plotting functions. Initial value is 0.5. +

+ +
+
MGL command: transptype val
+

Set the type of transparency. Possible values are: +

    +
  • Normal transparency (`0`) - below things is less visible than upper ones. It does not look well in OpenGL mode (mglGraphGL) for several surfaces. +
  • Glass-like transparency (`1`) - below and upper things are commutable and just decrease intensity of light by RGB channel. +
  • Lamp-like transparency (`2`) - below and upper things are commutable and are the source of some additional light. I recommend to set SetAlphaDef(0.3) or less for lamp-like transparency. +
+

See Types of transparency, for sample code and picture.. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.2 Lighting

+ + + + + +

There are several functions for setup lighting. The general function is light which switch on/off the lighting for overall plot. It influence only for graphics which created after light call (with one exception, OpenGL). Generally MathGL support up to 10 independent light sources. But in OpenGL mode only 8 of light sources is used due to OpenGL limitations. The position, color, brightness of each light source can be set separately. By default only one light source is active. It is source number 0 with white color, located at top of the plot. See Lighting sample, for sample code and picture. +

+
+
MGL command: light [val=on]
+

Sets the using of light on/off for overall plot. Function returns previous value of lighting. Default value is lightning off. +

+ +
+
MGL command: light num val
+

Switch on/off n-th light source separately. +

+ +
+
MGL command: light num xdir ydir zdir ['col'='w' br=0.5]
+
MGL command: light num xdir ydir zdir xpos ypos zpos ['col'='w' br=0.5 ap=0]
+

The function adds a light source with identification n in direction d with color c and with brightness bright (which must be in range [0,1]). If position r is specified and isn`t NAN then light source is supposed to be local otherwise light source is supposed to be placed at infinity. +

+ +
+
MGL command: diffuse val
+

Set brightness of diffusive light (only for local light sources). +

+ +
+
MGL command: ambient val
+

Sets the brightness of ambient light. The value should be in range [0,1]. +

+ +
+
MGL command: attachlight val
+

Set to attach light settings to inplot/subplot. Note, OpenGL and some output formats don`t support this feature. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.3 Fog

+ + + +
+
MGL command: fog val [dz=0.25]
+

Function imitate a fog in the plot. Fog start from relative distance dz from view point and its density growths exponentially in depth. So that the fog influence is determined by law ~ 1-exp(-d*z). Here z is normalized to 1 depth of the plot. If value d=0 then the fog is absent. Note, that fog was applied at stage of image creation, not at stage of drawing. See Adding fog, for sample code and picture. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.4 Default sizes

+ + + + + + +

These variables control the default (initial) values for most graphics parameters including sizes of markers, arrows, line width and so on. As any other settings these ones will influence only on plots created after the settings change. +

+
+
MGL command: barwidth val
+

Sets relative width of rectangles in bars, barh, boxplot, candle, ohlc. Default value is 0.7. +

+ +
+
MGL command: marksize val
+

Sets size of marks for 1D plotting. Default value is 1. +

+ +
+
MGL command: arrowsize val
+

Sets size of arrows for 1D plotting, lines and curves (see Primitives). Default value is 1. +

+ +
+
MGL command: meshnum val
+

Sets approximate number of lines in mesh, fall, grid2, and also the number of hachures in vect, dew, and the number of cells in cloud, and the number of markers in plot, tens, step, mark, textmark. By default (=0) it draws all lines/hachures/cells/markers. +

+ +
+
MGL command: facenum val
+

Sets approximate number of visible faces. Can be used for speeding up drawing by cost of lower quality. By default (=0) it draws all of them. +

+ +
+
MGL command: plotid 'id'
+

Sets default name id as filename for saving (in FLTK window for example). +

+ + +
+
MGL command: pendelta val
+

Changes the blur around lines and text (default is 1). For val>1 the text and lines are more sharped. For val<1 the text and lines are more blurred. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.5 Cutting

+ + + +

These variables and functions set the condition when the points are excluded (cutted) from the drawing. Note, that a point with NAN value(s) of coordinate or amplitude will be automatically excluded from the drawing. See Cutting sample, for sample code and picture. +

+
+
MGL command: cut val
+

Flag which determines how points outside bounding box are drawn. If it is true then points are excluded from plot (it is default) otherwise the points are projected to edges of bounding box. +

+ +
+
MGL command: cut x1 y1 z1 x2 y2 z2
+

Lower and upper edge of the box in which never points are drawn. If both edges are the same (the variables are equal) then the cutting box is empty. +

+ +
+
MGL command: cut 'cond'
+

Sets the cutting off condition by formula cond. This condition determine will point be plotted or not. If value of formula is nonzero then point is omitted, otherwise it plotted. Set argument as "" to disable cutting off condition. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.6 Font settings

+ + + + +
+
MGL command: font 'fnt' [val=6]
+

Font style for text and labels (see text). Initial style is `fnt`=`:rC` give Roman font with centering. Parameter val sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels. For more detail, see Font styles. +

+ +
+
MGL command: rotatetext val
+

Sets to use or not text rotation. +

+ +
+
MGL command: scaletext val
+

Sets to scale text in relative inplot (including columnplot, gridplot, stickplot, shearplot) or not. +

+ +
+
MGL command: loadfont ['name'='']
+

Load font typeface from path/name. Empty name will load default font. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.7 Palette and colors

+ + + +
+
MGL command: palette 'colors'
+

Sets the palette as selected colors. Default value is "Hbgrcmyhlnqeup" that corresponds to colors: dark gray `H`, blue `b`, green `g`, red `r`, cyan `c`, magenta `m`, yellow `y`, gray `h`, blue-green `l`, sky-blue `n`, orange `q`, yellow-green `e`, blue-violet `u`, purple `p`. The palette is used mostly in 1D plots (see 1D plotting) for curves which styles are not specified. Internal color counter will be nullified by any change of palette. This includes even hidden change (for example, by box or axis functions). +

+ + + +
+
MGL command: gray [val=on]
+

Sets the gray-scale mode on/off. +

+ + +
+ + + +

3.2.8 Masks

+ + + + +
+
MGL command: mask 'id' 'hex'
+
Команда MGL: mask 'id' hex
+

Sets new bit matrix hex of size 8*8 for mask with given id. This is global setting which influence on any later usage of symbol id. The predefined masks are (see Color scheme): `-` is 000000FF00000000, `+` is 080808FF08080808, `=` is 0000FF00FF000000, `;` is 0000007700000000, `o` is 0000182424180000, `O` is 0000183C3C180000, `s` is 00003C24243C0000, `S` is 00003C3C3C3C0000, `~` is 0000060990600000, `<` is 0060584658600000, `>` is 00061A621A060000, `j` is 0000005F00000000, `d` is 0008142214080000, `D` is 00081C3E1C080000, `*` is 8142241818244281, `^` is 0000001824420000. +

+ +
+
MGL command: mask angle
+

Sets the default rotation angle (in degrees) for masks. Note, you can use symbols `\`, `/`, `I` in color scheme for setting rotation angles as 45, -45 and 90 degrees correspondingly. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.9 Error handling

+ +

All warnings will be displayed automatically in special tool-window or in console. +

+ +
+ +
+

+Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.10 Stop drawing

+ +

You can use stop command or press corresponding toolbutton to stop drawing and script execution. +

+ +
+ + + +

3.3 Axis settings

+ + +

These large set of variables and functions control how the axis and ticks will be drawn. Note that there is 3-step transformation of data coordinates are performed. Firstly, coordinates are projected if Cut=true (see Cutting), after it transformation formulas are applied, and finally the data was normalized in bounding box. Note, that MathGL will produce warning if axis range and transformation formulas are not compatible. +

+ + + + + + + +
+ + + +

3.3.1 Ranges (bounding box)

+ + + + + + + + +
+
MGL command: xrange v1 v2 [add=off]
+
MGL command: yrange v1 v2 [add=off]
+
MGL command: zrange v1 v2 [add=off]
+
MGL command: crange v1 v2 [add=off]
+

Sets or adds the range for `x`-,`y`-,`z`- coordinate or coloring (`c`). If one of values is NAN then it is ignored. See also ranges. +

+ + +
+
MGL command: xrange dat [add=off]
+
MGL command: yrange dat [add=off]
+
MGL command: zrange dat [add=off]
+
MGL command: crange dat [add=off]
+

Sets the range for `x`-,`y`-,`z`- coordinate or coloring (`c`) as minimal and maximal values of data dat. Parameter add=on shows that the new range will be joined to existed one (not replace it). +

+ +
+
MGL command: ranges x1 x2 y1 y2 [z1=0 z2=0]
+

Sets the ranges of coordinates. If minimal and maximal values of the coordinate are the same then they are ignored. Also it sets the range for coloring (analogous to crange z1 z2). This is default color range for 2d plots. Initial ranges are [-1, 1]. +

+ +
+
MGL command: ranges xx yy [zz cc=zz]
+

Sets the ranges of `x`-,`y`-,`z`-,`c`-coordinates and coloring as minimal and maximal values of data xx, yy, zz, cc correspondingly. +

+ + +
+
MGL command: origin x0 y0 [z0=nan]
+

Sets center of axis cross section. If one of values is NAN then MathGL try to select optimal axis position. +

+ +
+
MGL command: zoomaxis x1 x2
+
MGL command: zoomaxis x1 y1 x2 y2
+
MGL command: zoomaxis x1 y1 z1 x2 y2 z2
+
MGL command: zoomaxis x1 y1 z1 c1 x2 y2 z2 c2
+

Additionally extend axis range for any settings made by SetRange or SetRanges functions according the formula min += (max-min)*p1 and max += (max-min)*p1 (or min *= (max/min)^p1 and max *= (max/min)^p1 for log-axis range when inf>max/min>100 or 0<max/min<0.01). Initial ranges are [0, 1]. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam(). +

+ + + +
+ +
+

+Next: , Previous: , Up: Axis settings   [Contents][Index]

+
+ +

3.3.2 Curved coordinates

+ + + +
+
MGL command: axis 'fx' 'fy' 'fz' ['fa'='']
+

Sets transformation formulas for curvilinear coordinate. Each string should contain mathematical expression for real coordinate depending on internal coordinates `x`, `y`, `z` and `a` or `c` for colorbar. For example, the cylindrical coordinates are introduced as SetFunc("x*cos(y)", "x*sin(y)", "z");. For removing of formulas the corresponding parameter should be empty or NULL. Using transformation formulas will slightly slowing the program. Parameter EqA set the similar transformation formula for color scheme. See Textual formulas. +

+ +
+
MGL command: axis how
+

Sets one of the predefined transformation formulas for curvilinear coordinate. Parameter how define the coordinates: +

+
mglCartesian=0
+

Cartesian coordinates (no transformation, {x,y,z}); +

+
mglPolar=1
+

Polar coordinates: {x*cos(y), x*sin(y), z}; +

+
mglSpherical=2
+

Sperical coordinates: {x*sin(y)*cos(z), x*sin(y)*sin(z), x*cos(y)}; +

+
mglParabolic=3
+

Parabolic coordinates: {x*y, (x*x-y*y)/2, z} +

+
mglParaboloidal=4
+

Paraboloidal coordinates: {(x*x-y*y)*cos(z)/2, (x*x-y*y)*sin(z)/2, x*y}; +

+
mglOblate=5
+

Oblate coordinates: {cosh(x)*cos(y)*cos(z), cosh(x)*cos(y)*sin(z), sinh(x)*sin(y)}; +

+
mglProlate=6
+

Prolate coordinates: {sinh(x)*sin(y)*cos(z), sinh(x)*sin(y)*sin(z), cosh(x)*cos(y)}; +

+
mglElliptic=7
+

Elliptic coordinates: {cosh(x)*cos(y), sinh(x)*sin(y), z}; +

+
mglToroidal=8
+

Toroidal coordinates: {sinh(x)*cos(z)/(cosh(x)-cos(y)), sinh(x)*sin(z)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y))}; +

+
mglBispherical=9
+

Bispherical coordinates: {sin(y)*cos(z)/(cosh(x)-cos(y)), sin(y)*sin(z)/(cosh(x)-cos(y)), sinh(x)/(cosh(x)-cos(y))}; +

+
mglBipolar=10
+

Bipolar coordinates: {sinh(x)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y)), z}; +

+
mglLogLog=11
+

Log-log coordinates: {lg(x), lg(y), lg(z)}; +

+
mglLogX=12
+

Log-x coordinates: {lg(x), y, z}; +

+
mglLogY=13
+

Log-y coordinates: {x, lg(y), z}. +

+
+
+ +
+
MGL command: ternary val
+

The function sets to draws Ternary (tern=1), Quaternary (tern=2) plot or projections (tern=4,5,6). +

+

Ternary plot is special plot for 3 dependent coordinates (components) a, b, c so that a+b+c=1. MathGL uses only 2 independent coordinates a=x and b=y since it is enough to plot everything. At this third coordinate z act as another parameter to produce contour lines, surfaces and so on. +

+

Correspondingly, Quaternary plot is plot for 4 dependent coordinates a, b, c and d so that a+b+c+d=1. MathGL uses only 3 independent coordinates a=x, b=y and d=z since it is enough to plot everything. +

+

Projections can be obtained by adding value 4 to tern argument. So, that tern=4 will draw projections in Cartesian coordinates, tern=5 will draw projections in Ternary coordinates, tern=6 will draw projections in Quaternary coordinates. If you add 8 instead of 4 then all text labels will not be printed on projections. +

+

Use Ternary(0) for returning to usual axis. See Ternary axis, for sample code and picture. See Axis projection, for sample code and picture. +

+ + +
+ +
+

+Previous: , Up: Axis settings   [Contents][Index]

+
+ +

3.3.3 Ticks

+ + + + + + + + + +
+
MGL command: adjust ['dir'='xyzc']
+

Set the ticks step, number of sub-ticks and initial ticks position to be the most human readable for the axis along direction(s) dir. Also set SetTuneTicks(true). Usually you don`t need to call this function except the case of returning to default settings. +

+ +
+
MGL command: xtick val [sub=0 org=nan 'fact'='']
+
MGL command: ytick val [sub=0 org=nan 'fact'='']
+
MGL command: ztick val [sub=0 org=nan 'fact'='']
+
MGL command: ctick val [sub=0 org=nan 'fact'='']
+

Set the ticks step d, number of sub-ticks ns (used for positive d) and initial ticks position org for the axis along direction dir (use `c` for colorbar ticks). Variable d set step for axis ticks (if positive) or it`s number on the axis range (if negative). Zero value set automatic ticks. If org value is NAN then axis origin is used. Parameter fact set text which will be printed after tick label (like "\pi" for d=M_PI). +

+ +
+
MGL command: xtick val1 'lbl1' [val2 'lbl2' ...]
+
MGL command: ytick val1 'lbl1' [val2 'lbl2' ...]
+
MGL command: ztick val1 'lbl1' [val2 'lbl2' ...]
+
MGL command: xtick vdat 'lbls' [add=off]
+
MGL command: ytick vdat 'lbls' [add=off]
+
MGL command: ztick vdat 'lbls' [add=off]
+

Set the manual positions val and its labels lbl for ticks along axis dir. If array val is absent then values equidistantly distributed in x-axis range are used. Labels are separated by `\n` symbol. If only one value is specified in MGL command then the label will be add to the current ones. Use SetTicks() to restore automatic ticks. +

+ + +
+
MGL command: xtick 'templ'
+
MGL command: ytick 'templ'
+
MGL command: ztick 'templ'
+
MGL command: ctick 'templ'
+

Set template templ for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. If templ="" then default template is used (in simplest case it is `%.2g`). If template start with `&` symbol then long integer value will be passed instead of default type double. Setting on template switch off automatic ticks tuning. +

+ +
+
MGL command: ticktime 'dir' [dv=0 'tmpl'='']
+

Sets time labels with step val and template templ for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. The format of template templ is the same as described in http://www.manpagez.com/man/3/strftime/. Most common variants are `%X` for national representation of time, `%x` for national representation of date, `%Y` for year with century. If val=0 and/or templ="" then automatic tick step and/or template will be selected. You can use mgl_get_time() function for obtaining number of second for given date/time string. Note, that MS Visual Studio couldn`t handle date before 1970. +

+ + +
+
MGL command: tuneticks val [pos=1.15]
+

Switch on/off ticks enhancing by factoring common multiplier (for small, like from 0.001 to 0.002, or large, like from 1000 to 2000, coordinate values - enabled if tune&1 is nonzero) or common component (for narrow range, like from 0.999 to 1.000 - enabled if tune&2 is nonzero). Also set the position pos of common multiplier/component on the axis: =0 at minimal axis value, =1 at maximal axis value. Default value is 1.15. +

+ +
+
MGL command: tickshift dx [dy=0 dz=0 dc=0]
+

Set value of additional shift for ticks labels. +

+ + +
+
MGL command: origintick val
+

Enable/disable drawing of ticks labels at axis origin. In C/Fortran you can use mgl_set_flag(gr,val, MGL_NO_ORIGIN);. +

+ +
+
MGL command: ticklen val [stt=1]
+

The relative length of axis ticks. Default value is 0.1. Parameter stt>0 set relative length of subticks which is in sqrt(1+stt) times smaller. +

+ +
+
MGL command: axisstl 'stl' ['tck'='' 'sub'='']
+

The line style of axis (stl), ticks (tck) and subticks (sub). If stl is empty then default style is used (`k` or `w` depending on transparency type). If tck or sub is empty then axis style is used (i.e. stl). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.4 Subplots and rotation

+ + + + + + + + + + + + + + + +

These functions control how and where further plotting will be placed. There is a certain calling order of these functions for the better plot appearance. First one should be subplot, multiplot or inplot for specifying the place. Second one can be title for adding title for the subplot. After it a rotate, shear and aspect. And finally any other plotting functions may be called. Alternatively you can use columnplot, gridplot, stickplot, shearplot or relative inplot for positioning plots in the column (or grid, or stick) one by another without gap between plot axis (bounding boxes). See Subplots, for sample code and picture. +

+
+
MGL command: subplot nx ny m ['stl'='<>_^' dx=0 dy=0]
+

Puts further plotting in a m-th cell of nx*ny grid of the whole frame area. The position of the cell can be shifted from its default position by relative size dx, dy. This function set off any aspects or rotations. So it should be used first for creating the subplot. Extra space will be reserved for axis/colorbar if stl contain: +

    +
  • `L` or `<` - at left side, +
  • `R` or `>` - at right side, +
  • `A` or `^` - at top side, +
  • `U` or `_` - at bottom side, +
  • `#` - reserve none space (use whole region for axis range) - axis and tick labels will be invisible by default. +
+

From the aesthetical point of view it is not recommended to use this function with different matrices in the same frame. Note, colorbar can be invisible (be out of image borders) if you set empty style ``. +

+ +
+
MGL command: multiplot nx ny m dx dy ['style'='<>_^' sx sy]
+

Puts further plotting in a rectangle of dx*dy cells starting from m-th cell of nx*ny grid of the whole frame area. The position of the rectangular area can be shifted from its default position by relative size sx, sy. This function set off any aspects or rotations. So it should be used first for creating subplot. Extra space will be reserved for axis/colorbar if stl contain: +

    +
  • `L` or `<` - at left side, +
  • `R` or `>` - at right side, +
  • `A` or `^` - at top side, +
  • `U` or `_` - at bottom side. +`#` - reserve none space (use whole region for axis range) - axis and tick labels will be invisible by default. +
+
+ +
+
MGL command: inplot x1 x2 y1 y2 [rel=on]
+

Puts further plotting in some region of the whole frame surface. This function allows one to create a plot in arbitrary place of the screen. The position is defined by rectangular coordinates [x1, x2]*[y1, y2]. The coordinates x1, x2, y1, y2 are normalized to interval [0, 1]. If parameter rel=true then the relative position to current subplot (or inplot with rel=false) is used. This function set off any aspects or rotations. So it should be used first for creating subplot. +

+ +
+
MGL command: columnplot num ind [d=0]
+

Puts further plotting in ind-th cell of column with num cells. The position is relative to previous subplot (or inplot with rel=false). Parameter d set extra gap between cells. +

+ +
+
MGL command: gridplot nx ny ind [d=0]
+

Puts further plotting in ind-th cell of nx*ny grid. The position is relative to previous subplot (or inplot with rel=false). Parameter d set extra gap between cells. +

+ +
+
MGL command: stickplot num ind tet phi
+

Puts further plotting in ind-th cell of stick with num cells. At this, stick is rotated on angles tet, phi. The position is relative to previous subplot (or inplot with rel=false). +

+ +
+
MGL command: shearplot num ind sx sy [xd yd]
+

Puts further plotting in ind-th cell of stick with num cells. At this, cell is sheared on values sx, sy. Stick direction is specified be xd and yd. The position is relative to previous subplot (or inplot with rel=false). +

+ + +
+
MGL command: title 'title' ['stl'='' size=-2]
+

Add text title for current subplot/inplot. Parameter stl can contain: +

    +
  • font style (see, Font styles); +
  • `#` for box around the title. +
+

Parameter size set font size. This function set off any aspects or rotations. So it should be used just after creating subplot. +

+ +
+
MGL command: rotate tetx tetz [tety=0]
+

Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TetX, TetZ, TetY. +

+ +
+
MGL command: rotate tet x y z
+

Rotates a further plotting around vector {x, y, z} on angle Tet. +

+ +
+
MGL command: shear sx sy
+

Shears a further plotting on values sx, sy. +

+ +
+
MGL command: aspect ax ay [az=1]
+

Defines aspect ratio for the plot. The viewable axes will be related one to another as the ratio Ax:Ay:Az. For the best effect it should be used after rotate function. If Ax is NAN then function try to select optimal aspect ratio to keep equal ranges for x-y axis. At this, Ay will specify proportionality factor, or set to use automatic one if Ay=NAN. +

+ + +

There are 3 functions View(), Zoom() and Perspective() which transform whole image. I.e. they act as secondary transformation matrix. They were introduced for rotating/zooming the whole plot by mouse. It is not recommended to call them for picture drawing. +

+
+
MGL command: perspective val
+

Add (switch on) the perspective to plot. The parameter a = Depth/(Depth+dz) \in [0,1). By default (a=0) the perspective is off. +

+ +
+
MGL command: view tetx tetz [tety=0]
+

Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TetX, TetZ, TetY. Rotation is done independently on rotate. Attention! this settings can not be overwritten by DefaultPlotParam(). Use Zoom(0,0,1,1) to return default view. +

+ +
+
MGL command: zoom x1 y1 x2 y2
+

The function changes the scale of graphics that correspond to zoom in/out of the picture. After function call the current plot will be cleared and further the picture will contain plotting from its part [x1,x2]*[y1,y2]. Here picture coordinates x1, x2, y1, y2 changes from 0 to 1. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam(). Use Zoom(0,0,1,1) to return default view. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.5 Export picture

+ + + +

Functions in this group save or give access to produced picture. So, usually they should be called after plotting is done. +

+
+
MGL command: setsize w h
+

Sets size of picture in pixels. This function should be called before any other plotting because it completely remove picture contents if clear=true. Function just clear pixels and scale all primitives if clear=false. +

+ +
+
MGL command: setsizescl factor
+

Set factor for width and height in all further calls of setsize. This command is obsolete since v.2.4.2. +

+ +
+
MGL command: quality [val=2]
+

Sets quality of the plot depending on value val: MGL_DRAW_WIRE=0 - no face drawing (fastest), MGL_DRAW_FAST=1 - no color interpolation (fast), MGL_DRAW_NORM=2 - high quality (normal), MGL_DRAW_HIGH=3 - high quality with 3d primitives (arrows and marks); MGL_DRAW_LMEM=0x4 - direct bitmap drawing (low memory usage); MGL_DRAW_DOTS=0x8 - for dots drawing instead of primitives (extremely fast). +

+ + + + + + + + + + +
+ + + +

3.5.1 Export to file

+ + + +

These functions export current view to a graphic file. The filename fname should have appropriate extension. Parameter descr gives the short description of the picture. Just now the transparency is supported in PNG, SVG, OBJ and PRC files. +

+
+
MGL command: write ['fname'='']
+

Exports current frame to a file fname which type is determined by the extension. Parameter descr adds description to file (can be ""). If fname="" then the file `frame####.jpg` is used, where `####` is current frame id and name `frame` is defined by plotid class property. +

+ +
+
MGL command: bbox x1 y1 [x2=-1 y2=-1]
+

Set boundary box for export graphics into 2D file formats. If x2<0 (y2<0) then original image width (height) will be used. If x1<0 or y1<0 or x1>=x2|Width or y1>=y2|Height then cropping will be disabled. +

+ + + + + +
+ +
+

+Next: , Previous: , Up: Export picture   [Contents][Index]

+
+ +

3.5.2 Frames/Animation

+ + +

There are no commands for making animation in MGL. However you can use features of mglconv and mglview utilities. For example, by busing special comments `##a ` or `##c `. +

+ + +
+ + + +

3.5.3 Bitmap in memory

+ + + + +
+ +
+

+Previous: , Up: Export picture   [Contents][Index]

+
+ +

3.5.4 Parallelization

+ + + + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.6 Background

+ + + + + +

These functions change background image. +

+
+
MGL command: clf ['col']
+
MGL command: clf r g b
+

Clear the picture and fill background by specified color. +

+ +
+
MGL command: rasterize
+

Force drawing the plot and use it as background. After it, function clear the list of primitives, like clf. This function is useful if you want save part of plot as bitmap one (for example, large surfaces, isosurfaces or vector fields) and keep some parts as vector one (like annotation, curves, axis and so on). +

+ +
+
MGL command: background 'fname' [alpha=1]
+

Load PNG or JPEG file fname as background for the plot. Parameter alpha manually set transparency of the background. +

+ + + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.7 Primitives

+ + + + + + + + + + + + + + +

These functions draw some simple objects like line, point, sphere, drop, cone and so on. See Using primitives, for sample code and picture. +

+
+
MGL command: ball x y ['col'='r.']
+
MGL command: ball x y z ['col'='r.']
+

Draws a mark (point `.` by default) at position p={x, y, z} with color col. +

+ +
+
MGL command: errbox x y ex ey ['stl'='']
+
MGL command: errbox x y z ex ey ez ['stl'='']
+

Draws a 3d error box at position p={x, y, z} with sizes e={ex, ey, ez} and style stl. Use NAN for component of e to reduce number of drawn elements. +

+ +
+
MGL command: line x1 y1 x2 y2 ['stl'='']
+
MGL command: line x1 y1 z1 x2 y2 z2 ['stl'='']
+

Draws a geodesic line (straight line in Cartesian coordinates) from point p1 to p2 using line style stl. Parameter num define the “quality” of the line. If num=2 then the straight line will be drawn in all coordinate system (independently on transformation formulas (see Curved coordinates). Contrary, for large values (for example, =100) the geodesic line will be drawn in corresponding coordinate system (straight line in Cartesian coordinates, circle in polar coordinates and so on). Line will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: curve x1 y1 dx1 dy1 x2 y2 dx2 dy2 ['stl'='']
+
MGL command: curve x1 y1 z1 dx1 dy1 dz1 x2 y2 z2 dx2 dy2 dz2 ['stl'='']
+

Draws Bezier-like curve from point p1 to p2 using line style stl. At this tangent is codirected with d1, d2 and proportional to its amplitude. Parameter num define the “quality” of the curve. If num=2 then the straight line will be drawn in all coordinate system (independently on transformation formulas, see Curved coordinates). Contrary, for large values (for example, =100) the spline like Bezier curve will be drawn in corresponding coordinate system. Curve will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: face x1 y1 x2 y2 x3 y3 x4 y4 ['stl'='']
+
MGL command: face x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 ['stl'='']
+

Draws the solid quadrangle (face) with vertexes p1, p2, p3, p4 and with color(s) stl. At this colors can be the same for all vertexes or different if all 4 colors are specified for each vertex. Face will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: rect x1 y1 x2 y2 ['stl'='']
+
MGL command: rect x1 y1 z1 x2 y2 z2 ['stl'='']
+

Draws the solid rectangle (face) with vertexes {x1, y1, z1} and {x2, y2, z2} with color stl. At this colors can be the same for all vertexes or separately if all 4 colors are specified for each vertex. Face will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: facex x0 y0 z0 wy wz ['stl'='' d1=0 d2=0]
+
MGL command: facey x0 y0 z0 wx wz ['stl'='' d1=0 d2=0]
+
MGL command: facez x0 y0 z0 wx wy ['stl'='' d1=0 d2=0]
+

Draws the solid rectangle (face) perpendicular to [x,y,z]-axis correspondingly at position {x0, y0, z0} with color stl and with widths wx, wy, wz along corresponding directions. At this colors can be the same for all vertexes or separately if all 4 colors are specified for each vertex. Parameters d1!=0, d2!=0 set additional shift of the last vertex (i.e. to draw quadrangle). Face will be drawn even if it lies out of bounding box. +

+ +
+
MGL command: sphere x0 y0 r ['col'='r']
+
MGL command: sphere x0 y0 z0 r ['col'='r']
+

Draw the sphere with radius r and center at point p={x0, y0, z0} and color stl. +

+ +
+
MGL command: drop x0 y0 dx dy r ['col'='r' sh=1 asp=1]
+
MGL command: drop x0 y0 z0 dx dy dz r ['col'='r' sh=1 asp=1]
+

Draw the drop with radius r at point p elongated in direction d and with color col. Parameter shift set the degree of drop oblongness: `0` is sphere, `1` is maximally oblongness drop. Parameter ap set relative width of the drop (this is analogue of “ellipticity” for the sphere). +

+ +
+
MGL command: cone x1 y1 z1 x2 y2 z2 r1 [r2=-1 'stl'='']
+

Draw tube (or truncated cone if edge=false) between points p1, p2 with radius at the edges r1, r2. If r2<0 then it is supposed that r2=r1. The cone color is defined by string stl. Parameter stl can contain: +

    +
  • `@` for drawing edges; +
  • `#` for wired cones; +
  • `t` for drawing tubes/cylinder instead of cones/prisms; +
  • `4`, `6`, `8` for drawing square, hex- or octo-prism instead of cones. +
+
+ +
+
MGL command: circle x0 y0 r ['col'='r']
+
MGL command: circle x0 y0 z0 r ['col'='r']
+

Draw the circle with radius r and center at point p={x0, y0, z0}. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style `@` is used, black color is used by default); +
  • `#` for wire figure (boundary only); +
  • `@` for filling and boundary. +
+
+ +
+
MGL command: ellipse x1 y1 x2 y2 r ['col'='r']
+
MGL command: ellipse x1 y1 z1 x2 y2 z2 r ['col'='r']
+

Draw the ellipse with radius r and focal points p1, p2. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style `@` is used, black color is used by default); +
  • `#` for wire figure (boundary only); +
  • `@` for filling and boundary. +
+
+ +
+
MGL command: rhomb x1 y1 x2 y2 r ['col'='r']
+
MGL command: rhomb x1 y1 z1 x2 y2 z2 r ['col'='r']
+

Draw the rhombus with width r and edge points p1, p2. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style `@` is used, black color is used by default); +
  • `#` for wire figure (boundary only); +
  • `@` for filling and boundary. +
+
+ +
+
MGL command: arc x0 y0 x1 y1 a ['col'='r']
+
MGL command: arc x0 y0 z0 x1 y1 a ['col'='r']
+
MGL command: arc x0 y0 z0 xa ya za x1 y1 z1 a ['col'='r']
+

Draw the arc around axis pa (default is z-axis pa={0,0,1}) with center at p0 and starting from point p1. Parameter a set the angle of arc in degree. Parameter col may contain color of the arc and arrow style for arc edges. +

+ +
+
MGL command: polygon x0 y0 x1 y1 num ['col'='r']
+
MGL command: polygon x0 y0 z0 x1 y1 z1 num ['col'='r']
+

Draw the polygon with num edges starting from p1. The center of polygon is located in p0. Parameter col may contain +

    +
  • colors for filling and boundary (second one if style `@` is used, black color is used by default); +
  • `#` for wire figure (boundary only); +
  • `@` for filling and boundary. +
+
+ + +
+
MGL command: logo 'fname' [smooth=off]
+

Draw bitmap (logo) along whole axis range, which can be changed by Command options. Bitmap can be loaded from file or specified as RGBA values for pixels. Parameter smooth set to draw bitmap without or with color interpolation. +

+ + +
+
MGL command: symbol x y 'id' ['fnt'='' size=-1]
+
MGL command: symbol x y z 'id' ['fnt'='' size=-1]
+

Draws user-defined symbol with name id at position p with style specifying by fnt. The size of font is set by size parameter (default is -1). The string fnt may contain color specification ended by `:` symbol; styles `a`, `A` to draw at absolute position {x, y} (supposed to be in range [0,1]) of picture (for `A`) or subplot/inplot (for `a`); and style `w` to draw wired symbol. +

+ +
+
MGL command: symbol x y dx dy 'id' ['fnt'=':L' size=-1]
+
MGL command: symbol x y z dx dy dz 'id' ['fnt'=':L' size=-1]
+

The same as previous but symbol will be drawn rotated along direction d. +

+ +
+
MGL command: addsymbol 'id' xdat ydat
+

Add user-defined symbol with name id and contour {xdat, ydat}. You can use NAN values to set break (jump) of contour curve. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.8 Text printing

+ + + + + +

These functions draw the text. There are functions for drawing text in arbitrary place, in arbitrary direction and along arbitrary curve. MathGL can use arbitrary font-faces and parse many TeX commands (for more details see Font styles). All these functions have 2 variant: for printing 8-bit text (char *) and for printing Unicode text (wchar_t *). In first case the conversion into the current locale is used. So sometimes you need to specify it by setlocale() function. The size argument control the size of text: if positive it give the value, if negative it give the value relative to SetFontSize(). The font type (STIX, arial, courier, times and so on) can be selected by function LoadFont(). See Font settings. +

+

The font parameters are described by string. This string may set the text color `wkrgbcymhRGBCYMHW` (see Color styles). Starting from MathGL v.2.3, you can set color gradient for text (see Color scheme). Also, after delimiter symbol `:`, it can contain characters of font type (`rbiwou`) and/or align (`LRCTV`) specification. The font types are: `r` - roman (or regular) font, `i` - italic style, `b` - bold style, `w` - wired style, `o` - over-lined text, `u` - underlined text. By default roman font is used. The align types are: `L` - align left (default), `C` - align center, `R` - align right, `T` - align under, `V` - align center vertical. For example, string `b:iC` correspond to italic font style for centered text which printed by blue color. +

+

If string contains symbols `aA` then text is printed at absolute position {x, y} (supposed to be in range [0,1]) of picture (for `A`) or subplot/inplot (for `a`). If string contains symbol `@` then box around text is drawn. +

+

See Text features, for sample code and picture. +

+
+
MGL command: text x y 'text' ['fnt'='' size=-1]
+
MGL command: text x y z 'text' ['fnt'='' size=-1]
+

Draws the string text at position p with fonts specifying by the criteria fnt. The size of font is set by size parameter (default is -1). +

+ +
+
MGL command: text x y dx dy 'text' ['fnt'=':L' size=-1]
+
MGL command: text x y z dx dy dz 'text' ['fnt'=':L' size=-1]
+

Draws the string text at position p along direction d with specified size. Parameter fnt set text style and text position: under (`T`) or above (`t`) the line. +

+ +
+
MGL command: fgets x y 'fname' [n=0 'fnt'='' size=-1.4]
+
MGL command: fgets x y z 'fname' [n=0 'fnt'='' size=-1.4]
+

Draws unrotated n-th line of file fname at position {x,y,z} with specified size. By default parameters from font command are used. +

+ +
+
MGL command: text ydat 'text' ['fnt'='']
+
MGL command: text xdat ydat 'text' ['fnt'='']
+
MGL command: text xdat ydat zdat 'text' ['fnt'='']
+

The function draws text along the curve between points {x[i], y[i], z[i]} by font style fnt. The string fnt may contain symbols `t` for printing the text under the curve (default), or `T` for printing the text under the curve. The sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. If array x is not specified then its an automatic array is used with values equidistantly distributed in x-axis range (see Ranges (bounding box)). If array z is not specified then z[i] equal to minimal z-axis value is used. String opt contain command options (see Command options). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.9 Axis and Colorbar

+ + + + + + + +

These functions draw the “things for measuring”, like axis with ticks, colorbar with ticks, grid along axis, bounding box and labels for axis. For more information see Axis settings. +

+
+
MGL command: axis ['dir'='xyz' 'stl'='']
+

Draws axes with ticks (see Axis settings). Parameter dir may contain: +

    +
  • `xyz` for drawing axis in corresponding direction; +
  • `XYZ` for drawing axis in corresponding direction but with inverted positions of labels; +
  • `~` or `_` for disabling tick labels; +
  • `U` for disabling rotation of tick labels; +
  • `^` for inverting default axis origin; +
  • `!` for disabling ticks tuning (see tuneticks); +
  • `AKDTVISO` for drawing arrow at the end of axis; +
  • `a` for forced adjusting of axis ticks; +
  • `:` for drawing lines through point (0,0,0); +
  • `f` for printing ticks labels in fixed format; +
  • `E` for using `E` instead of `e` in ticks labels; +
  • `F` for printing ticks labels in LaTeX format; +
  • `+` for printing `+` for positive ticks; +
  • `-` for printing usual `-` in ticks labels; +
  • `0123456789` for precision at printing ticks labels. +
+

Styles of ticks and axis can be overrided by using stl string. Option value set the manual rotation angle for the ticks. See Axis and ticks, for sample code and picture. +

+ +
+
MGL command: colorbar ['sch'='']
+

Draws colorbar. Parameter sch may contain: +

    +
  • color scheme (see Color scheme); +
  • `<>^_` for positioning at left, at right, at top or at bottom correspondingly; +
  • `I` for positioning near bounding (by default, is positioned at edges of subplot); +
  • `A` for using absolute coordinates; +
  • `~` for disabling tick labels. +
  • `!` for disabling ticks tuning (see tuneticks); +
  • `f` for printing ticks labels in fixed format; +
  • `E` for using `E` instead of `e` in ticks labels; +
  • `F` for printing ticks labels in LaTeX format; +
  • `+` for printing `+` for positive ticks; +
  • `-` for printing usual `-` in ticks labels; +
  • `0123456789` for precision at printing ticks labels. +
+

See Colorbars, for sample code and picture. +

+ +
+
MGL command: colorbar vdat ['sch'='']
+

The same as previous but with sharp colors sch (current palette if sch="") for values v. See contd sample, for sample code and picture. +

+ +
+
MGL command: colorbar 'sch' x y [w=1 h=1]
+

The same as first one but at arbitrary position of subplot {x, y} (supposed to be in range [0,1]). Parameters w, h set the relative width and height of the colorbar. +

+ +
+
MGL command: colorbar vdat 'sch' x y [w=1 h=1]
+

The same as previous but with sharp colors sch (current palette if sch="") for values v. See contd sample, for sample code and picture. +

+ +
+
MGL command: grid ['dir'='xyz' 'pen'='B']
+

Draws grid lines perpendicular to direction determined by string parameter dir. If dir contain `!` then grid lines will be drawn at coordinates of subticks also. The step of grid lines is the same as tick step for axis. The style of lines is determined by pen parameter (default value is dark blue solid line `B-`). +

+ +
+
MGL command: box ['stl'='k' ticks=on]
+

Draws bounding box outside the plotting volume with color col. If col contain `@` then filled faces are drawn. At this first color is used for faces (default is light yellow), last one for edges. See Bounding box, for sample code and picture. +

+ +
+
MGL command: xlabel 'text' [pos=1]
+
MGL command: ylabel 'text' [pos=1]
+
MGL command: zlabel 'text' [pos=1]
+
MGL command: tlabel 'text' [pos=1]
+

Prints the label text for axis dir=`x`,`y`,`z`,`t` (here `t` is “ternary” axis t=1-x-y). The position of label is determined by pos parameter. If pos=0 then label is printed at the center of axis. If pos>0 then label is printed at the maximum of axis. If pos<0 then label is printed at the minimum of axis. Option value set additional shifting of the label. See Text printing. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.10 Legend

+ + + + + + + +

These functions draw legend to the graph (useful for 1D plotting). Legend entry is a pair of strings: one for style of the line, another one with description text (with included TeX parsing). The arrays of strings may be used directly or by accumulating first to the internal arrays (by function addlegend) and further plotting it. The position of the legend can be selected automatic or manually (even out of bounding box). Parameters fnt and size specify the font style and size (see Font settings). Option value set the relative width of the line sample and the text indent. If line style string for entry is empty then the corresponding text is printed without indent. Parameter fnt may contain: +

    +
  • font style for legend text; +
  • `A` for positioning in absolute coordinates; +
  • `^` for positioning outside of specified point; +
  • `#` for drawing box around legend; +
  • `-` for arranging legend entries horizontally; +
  • colors for face (1st one), for border (2nd one) and for text (last one). If less than 3 colors are specified then the color for border is black (for 2 and less colors), and the color for face is white (for 1 or none colors). +
+

See Legend sample, for sample code and picture. +

+
+
MGL command: legend [pos=3 'fnt'='#']
+

Draws legend of accumulated legend entries by font fnt with size. Parameter pos sets the position of the legend: `0` is bottom left corner, `1` is bottom right corner, `2` is top left corner, `3` is top right corner (is default). Option value set the space between line samples and text (default is 0.1). +

+ +
+
MGL command: legend x y ['fnt'='#']
+

Draws legend of accumulated legend entries by font fnt with size. Position of legend is determined by parameter x, y which supposed to be normalized to interval [0,1]. Option value set the space between line samples and text (default is 0.1). +

+ +
+
MGL command: addlegend 'text' 'stl'
+

Adds string text to internal legend accumulator. The style of described line and mark is specified in string style (see Line styles). +

+ +
+
MGL command: clearlegend
+

Clears saved legend strings. +

+ +
+
MGL command: legendmarks val
+

Set the number of marks in the legend. By default 1 mark is used. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.11 1D plotting

+ + + + + + + + + + + + + + + + + + + + + + +

These functions perform plotting of 1D data. 1D means that data depended from only 1 parameter like parametric curve {x[i],y[i],z[i]}, i=1...n. By default (if absent) values of x[i] are equidistantly distributed in axis range, and z[i] equal to minimal z-axis value. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. +

+

String pen specifies the color and style of line and marks (see Line styles). By default (pen="") solid line with color from palette is used (see Palette and colors). Symbol `!` set to use new color from palette for each point (not for each curve, as default). String opt contain command options (see Command options). +

+
+
MGL command: plot ydat ['stl'='']
+
MGL command: plot xdat ydat ['stl'='']
+
MGL command: plot xdat ydat zdat ['stl'='']
+

These functions draw continuous lines between points {x[i], y[i], z[i]}. If pen contain `a` then segments between points outside of axis range are drawn too. If pen contain `~` then number of segments is reduce for quasi-straight curves. See also area, step, stem, tube, mark, error, belt, tens, tape, meshnum. See plot sample, for sample code and picture. +

+ +
+
MGL command: radar adat ['stl'='']
+

This functions draws radar chart which is continuous lines between points located on an radial lines (like plot in Polar coordinates). Option value set the additional shift of data (i.e. the data a+value is used instead of a). If value<0 then r=max(0, -min(value). If pen containt `#` symbol then "grid" (radial lines and circle for r) is drawn. If pen contain `a` then segments between points outside of axis range are drawn too. See also plot, meshnum. See radar sample, for sample code and picture. +

+ +
+
MGL command: step ydat ['stl'='']
+
MGL command: step xdat ydat ['stl'='']
+
MGL command: step xdat ydat zdat ['stl'='']
+

These functions draw continuous stairs for points to axis plane. If x.nx>y.nx then x set the edges of bars, rather than its central positions. See also plot, stem, tile, boxs, meshnum. See step sample, for sample code and picture. +

+ +
+
MGL command: tens ydat cdat ['stl'='']
+
MGL command: tens xdat ydat cdat ['stl'='']
+
MGL command: tens xdat ydat zdat cdat ['stl'='']
+

These functions draw continuous lines between points {x[i], y[i], z[i]} with color defined by the special array c[i] (look like tension plot). String pen specifies the color scheme (see Color scheme) and style and/or width of line (see Line styles). If pen contain `a` then segments between points outside of axis range are drawn too. If pen contain `~` then number of segments is reduce for quasi-straight curves. See also plot, mesh, fall, meshnum. See tens sample, for sample code and picture. +

+ +
+
MGL command: tape ydat ['stl'='']
+
MGL command: tape xdat ydat ['stl'='']
+
MGL command: tape xdat ydat zdat ['stl'='']
+

These functions draw tapes of normals for curve between points {x[i], y[i], z[i]}. Initial tape(s) was selected in x-y plane (for `x` in pen) and/or y-z plane (for `x` in pen). The width of tape is proportional to barwidth and can be changed by option value. See also plot, flow, barwidth. See tape sample, for sample code and picture. +

+ +
+
MGL command: area ydat ['stl'='']
+
MGL command: area xdat ydat ['stl'='']
+
MGL command: area xdat ydat zdat ['stl'='']
+

These functions draw continuous lines between points and fills it to axis plane. Also you can use gradient filling if number of specified colors is equal to 2*number of curves. If pen contain `#` then wired plot is drawn. If pen contain `a` then segments between points outside of axis range are drawn too. See also plot, bars, stem, region. See area sample, for sample code and picture. +

+ +
+
MGL command: region ydat1 ydat2 ['stl'='']
+
MGL command: region xdat ydat1 ydat2 ['stl'='']
+
MGL command: region xdat1 ydat1 xdat2 ydat2 ['stl'='']
+
MGL command: region xdat1 ydat1 zdat1 xdat2 ydat2 zdat2 ['stl'='']
+

These functions fill area between 2 curves. Dimensions of arrays y1 and y2 must be equal. Also you can use gradient filling if number of specified colors is equal to 2*number of curves. If for 2D version pen contain symbol `i` then only area with y1<y<y2 will be filled else the area with y2<y<y1 will be filled too. If pen contain `#` then wired plot is drawn. If pen contain `a` then segments between points outside of axis range are drawn too. See also area, bars, stem. See region sample, for sample code and picture. +

+ +
+
MGL command: stem ydat ['stl'='']
+
MGL command: stem xdat ydat ['stl'='']
+
MGL command: stem xdat ydat zdat ['stl'='']
+

These functions draw vertical lines from points to axis plane. See also area, bars, plot, mark. See stem sample, for sample code and picture. +

+ +
+
MGL command: bars ydat ['stl'='']
+
MGL command: bars xdat ydat ['stl'='']
+
MGL command: bars xdat ydat zdat ['stl'='']
+

These functions draw vertical bars from points to axis plane. Parameter pen can contain: +

    +
  • `a` for drawing lines one above another (like summation); +
  • `f` for drawing waterfall chart, which show the cumulative effect of sequential positive or negative values; +
  • `F` for using fixed (minimal) width for all bars; +
  • `<`, `^` or `>` for aligning boxes left, right or centering them at its x-coordinates. +
+

You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. If x.nx>y.nx then x set the edges of bars, rather than its central positions. See also barh, cones, area, stem, chart, barwidth. See bars sample, for sample code and picture. +

+ +
+
MGL command: barh vdat ['stl'='']
+
MGL command: barh ydat vdat ['stl'='']
+

These functions draw horizontal bars from points to axis plane. Parameter pen can contain: +

    +
  • `a` for drawing lines one above another (like summation); +
  • `f` for drawing waterfall chart, which show the cumulative effect of sequential positive or negative values; +
  • `F` for using fixed (minimal) width for all bars; +
  • `<`, `^` or `>` for aligning boxes left, right or centering them at its x-coordinates. +
+

You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. If x.nx>y.nx then x set the edges of bars, rather than its central positions. See also bars, barwidth. See barh sample, for sample code and picture. +

+ +
+
MGL command: cones ydat ['stl'='']
+
MGL command: cones xdat ydat ['stl'='']
+
MGL command: cones xdat ydat zdat ['stl'='']
+

These functions draw cones from points to axis plane. If string contain symbol `a` then cones are drawn one above another (like summation). You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. Parameter pen can contain: +

    +
  • `@` for drawing edges; +
  • `#` for wired cones; +
  • `t` for drawing tubes/cylinders instead of cones/prisms; +
  • `4`, `6`, `8` for drawing square, hex- or octo-prism instead of cones; +
  • `<`, `^` or `>` for aligning boxes left, right or centering them at its x-coordinates. +
+

See also bars, cone, barwidth. See cones sample, for sample code and picture. +

+ + + +
+
MGL command: chart adat ['col'='']
+

The function draws colored stripes (boxes) for data in array a. The number of stripes is equal to the number of rows in a (equal to a.ny). The color of each next stripe is cyclically changed from colors specified in string col or in palette Pal (see Palette and colors). Spaces in colors denote transparent “color” (i.e. corresponding stripe(s) are not drawn). The stripe width is proportional to value of element in a. Chart is plotted only for data with non-negative elements. If string col have symbol `#` then black border lines are drawn. The most nice form the chart have in 3d (after rotation of coordinates) or in cylindrical coordinates (becomes so called Pie chart). See chart sample, for sample code and picture. +

+ +
+
MGL command: boxplot adat ['stl'='']
+
MGL command: boxplot xdat adat ['stl'='']
+

These functions draw boxplot (also known as a box-and-whisker diagram) at points x[i]. This is five-number summaries of data a[i,j] (minimum, lower quartile (Q1), median (Q2), upper quartile (Q3) and maximum) along second (j-th) direction. If pen contain `<`, `^` or `>` then boxes will be aligned left, right or centered at its x-coordinates. See also plot, error, bars, barwidth. See boxplot sample, for sample code and picture. +

+ +
+
MGL command: candle vdat1 ['stl'='']
+
MGL command: candle vdat1 vdat2 ['stl'='']
+
MGL command: candle vdat1 ydat1 ydat2 ['stl'='']
+
MGL command: candle vdat1 vdat2 ydat1 ydat2 ['stl'='']
+
MGL command: candle xdat vdat1 vdat2 ydat1 ydat2 ['stl'='']
+

These functions draw candlestick chart at points x[i]. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. Wire (or white) candle correspond to price growth v1[i]<v2[i], opposite case - solid (or dark) candle. You can give different colors for growth and decrease values if number of specified colors is equal to 2. If pen contain `#` then the wire candle will be used even for 2-color scheme. "Shadows" show the minimal y1 and maximal y2 prices. If v2 is absent then it is determined as v2[i]=v1[i+1]. See also plot, bars, ohlc, barwidth. See candle sample, for sample code and picture. +

+ +
+
MGL command: ohlc odat hdat ldat cdat ['stl'='']
+
MGL command: ohlc xdat odat hdat ldat cdat ['stl'='']
+

These functions draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high h) and minimal(low l) values, as well as horizontal lines before/after vertical line for initial(open o)/final(close c) values of some process (usually price). You can give different colors for up and down values (when closing values higher or not as in previous point) if number of specified colors is equal to 2*number of curves. See also candle, plot, barwidth. See ohlc sample, for sample code and picture. +

+ + +
+
MGL command: error ydat yerr ['stl'='']
+
MGL command: error xdat ydat yerr ['stl'='']
+
MGL command: error xdat ydat xerr yerr ['stl'='']
+

These functions draw error boxes {ex[i], ey[i]} at points {x[i], y[i]}. This can be useful, for example, in experimental points, or to show numeric error or some estimations and so on. If string pen contain symbol `@` than large semitransparent mark is used instead of error box. See also plot, mark. See error sample, for sample code and picture. +

+ +
+
MGL command: mark ydat rdat ['stl'='']
+
MGL command: mark xdat ydat rdat ['stl'='']
+
MGL command: mark xdat ydat zdat rdat ['stl'='']
+

These functions draw marks with size r[i]*marksize at points {x[i], y[i], z[i]}. If you need to draw markers of the same size then you can use plot function with empty line style ` `. For markers with size in axis range use error with style `@`. See also plot, textmark, error, stem, meshnum. See mark sample, for sample code and picture. +

+ +
+
MGL command: textmark ydat 'txt' ['stl'='']
+
MGL command: textmark ydat rdat 'txt' ['stl'='']
+
MGL command: textmark xdat ydat rdat 'txt' ['stl'='']
+
MGL command: textmark xdat ydat zdat rdat 'txt' ['stl'='']
+

These functions draw string txt as marks with size proportional to r[i]*marksize at points {x[i], y[i], z[i]}. By default (if omitted) r[i]=1. See also plot, mark, stem, meshnum. See textmark sample, for sample code and picture. +

+ +
+
MGL command: label ydat 'txt' ['stl'='']
+
MGL command: label xdat ydat 'txt' ['stl'='']
+
MGL command: label xdat ydat zdat 'txt' ['stl'='']
+

These functions draw string txt at points {x[i], y[i], z[i]}. If string txt contain `%x`, `%y`, `%z` or `%n` then it will be replaced by the value of x-,y-,z-coordinate of the point or its index. String fnt may contain: +

    +
  • font style Font styles; +
  • `f` for fixed format of printed numbers; +
  • `E` for using `E` instead of `e`; +
  • `F` for printing in LaTeX format; +
  • `+` for printing `+` for positive numbers; +
  • `-` for printing usual `-`; +
  • `0123456789` for precision at printing numbers. +
+

See also plot, mark, textmark, table. See label sample, for sample code and picture. +

+ +
+
MGL command: table vdat 'txt' ['stl'='#']
+
MGL command: table x y vdat 'txt' ['stl'='#']
+

These functions draw table with values of val and captions from string txt (separated by newline symbol `\n`) at points {x, y} (default at {0,0}) related to current subplot. String fnt may contain: +

    +
  • font style Font styles; +
  • `#` for drawing cell borders; +
  • `|` for limiting table widh by subplot one (equal to option `value 1`); +
  • `=` for equal width of all cells; +
  • `f` for fixed format of printed numbers; +
  • `E` for using `E` instead of `e`; +
  • `F` for printing in LaTeX format; +
  • `+` for printing `+` for positive numbers; +
  • `-` for printing usual `-`; +
  • `0123456789` for precision at printing numbers. +
+

Option value set the width of the table (default is 1). See also plot, label. See table sample, for sample code and picture. +

+ +
+
MGL command: iris dats 'ids' ['stl'='']
+
MGL command: iris dats rngs 'ids' ['stl'='']
+

Draws Iris plots for determining cross-dependences of data arrays dats (see http://en.wikipedia.org/wiki/Iris_flower_data_set). Data rngs of size 2*dats.nx provide manual axis ranges for each column. String ids contain column names, separated by `;` symbol. Option value set the text size for column names. You can add another data set to existing Iris plot by providing the same ranges rngs and empty column names ids. See also plot. See iris sample, for sample code and picture. +

+ +
+
MGL command: tube ydat rdat ['stl'='']
+
MGL command: tube ydat rval ['stl'='']
+
MGL command: tube xdat ydat rdat ['stl'='']
+
MGL command: tube xdat ydat rval ['stl'='']
+
MGL command: tube xdat ydat zdat rdat ['stl'='']
+
MGL command: tube xdat ydat zdat rval ['stl'='']
+

These functions draw the tube with variable radius r[i] along the curve between points {x[i], y[i], z[i]}. Option value set the number of segments at cross-section (default is 25). See also plot. See tube sample, for sample code and picture. +

+ +
+
MGL command: torus rdat zdat ['stl'='']
+

These functions draw surface which is result of curve {r, z} rotation around axis. If string pen contain symbols `x` or `z` then rotation axis will be set to specified direction (default is `y`). If string pen have symbol `#` then wire plot is produced. If string pen have symbol `.` then plot by dots is produced. See also plot, axial. See torus sample, for sample code and picture. +

+ +
+
MGL command: lamerey x0 ydat ['stl'='']
+
MGL command: lamerey x0 'y(x)' ['stl'='']
+

These functions draw Lamerey diagram for mapping x_new = y(x_old) starting from point x0. String stl may contain line style, symbol `v` for drawing arrows, symbol `~` for disabling first segment. Option value set the number of segments to be drawn (default is 20). See also plot, fplot, bifurcation, pmap. See lamerey sample, for sample code and picture. +

+ +
+
MGL command: bifurcation dx ydat ['stl'='']
+
MGL command: bifurcation dx 'y(x)' ['stl'='']
+

These functions draw bifurcation diagram for mapping x_new = y(x_old). Parameter dx set the accuracy along x-direction. String stl set color. Option value set the number of stationary points (default is 1024). See also plot, fplot, lamerey. See bifurcation sample, for sample code and picture. +

+ +
+
MGL command: pmap ydat sdat ['stl'='']
+
MGL command: pmap xdat ydat sdat ['stl'='']
+
MGL command: pmap xdat ydat zdat sdat ['stl'='']
+

These functions draw Poincare map for curve {x, y, z} at surface s=0. Basically, it show intersections of the curve and the surface. String stl set the style of marks. See also plot, mark, lamerey. See pmap sample, for sample code and picture. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.12 2D plotting

+ + + + + + + + + + + + + + + +

These functions perform plotting of 2D data. 2D means that data depend from 2 independent parameters like matrix f(x_i,y_j), i=1...n, j=1...m. By default (if absent) values of x, y are equidistantly distributed in axis range. The plots are drawn for each z slice of the data. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: surf zdat ['sch'='']
+
MGL command: surf xdat ydat zdat ['sch'='']
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]}. If string sch have symbol `#` then grid lines are drawn. If string sch have symbol `.` then plot by dots is produced. See also mesh, dens, belt, tile, boxs, surfc, surfa. See surf sample, for sample code and picture. +

+ +
+
MGL command: mesh zdat ['sch'='']
+
MGL command: mesh xdat ydat zdat ['sch'='']
+

The function draws mesh lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. See also surf, fall, meshnum, cont, tens. See mesh sample, for sample code and picture. +

+ +
+
MGL command: fall zdat ['sch'='']
+
MGL command: fall xdat ydat zdat ['sch'='']
+

The function draws fall lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. This plot can be used for plotting several curves shifted in depth one from another. If sch contain `x` then lines are drawn along x-direction else (by default) lines are drawn along y-direction. See also belt, mesh, tens, meshnum. See fall sample, for sample code and picture. +

+ +
+
MGL command: belt zdat ['sch'='']
+
MGL command: belt xdat ydat zdat ['sch'='']
+

The function draws belts for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. This plot can be used as 3d generalization of plot). If sch contain `x` then belts are drawn along x-direction else (by default) belts are drawn along y-direction. See also fall, surf, beltc, plot, meshnum. See belt sample, for sample code and picture. +

+ +
+
MGL command: boxs zdat ['sch'='']
+
MGL command: boxs xdat ydat zdat ['sch'='']
+

The function draws vertical boxes for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Symbol `@` in sch set to draw filled boxes. See also surf, dens, tile, step. See boxs sample, for sample code and picture. +

+ +
+
MGL command: tile zdat ['sch'='']
+
MGL command: tile xdat ydat zdat ['sch'='']
+
MGL command: tile xdat ydat zdat cdat ['sch'='']
+

The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j] (c=z if c is not provided). If string sch contain style `x` or `y` then tiles will be oriented perpendicular to x- or y-axis. Such plot can be used as 3d generalization of step. See also surf, boxs, step, tiles. See tile sample, for sample code and picture. +

+ +
+
MGL command: dens zdat ['sch'='']
+
MGL command: dens xdat ydat zdat ['sch'='']
+

The function draws density plot for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z equal to minimal z-axis value. If string sch have symbol `#` then grid lines are drawn. If string sch have symbol `.` then plot by dots is produced. See also surf, cont, contf, boxs, tile, dens[xyz]. See dens sample, for sample code and picture. +

+ +
+
MGL command: cont vdat zdat ['sch'='']
+
MGL command: cont vdat xdat ydat zdat ['sch'='']
+

The function draws contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k], or at z equal to minimal z-axis value if sch contain symbol `_`. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. If string sch have symbol `t` or `T` then contour labels v[k] will be drawn below (or above) the contours. See also dens, contf, contd, axial, cont[xyz]. See cont sample, for sample code and picture. +

+ +
+
MGL command: cont zdat ['sch'='']
+
MGL command: cont xdat ydat zdat ['sch'='']
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). If string sch contain symbol `.` then only contours at levels with saddle points will be drawn. +

+ +
+
MGL command: contf vdat zdat ['sch'='']
+
MGL command: contf vdat xdat ydat zdat ['sch'='']
+

The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k], or at z equal to minimal z-axis value if sch contain symbol `_`. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v (must be v.nx>2). See also dens, cont, contd, contf[xyz]. See contf sample, for sample code and picture. +

+ +
+
MGL command: contf zdat ['sch'='']
+
MGL command: contf xdat ydat zdat ['sch'='']
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: contd vdat zdat ['sch'='']
+
MGL command: contd vdat xdat ydat zdat ['sch'='']
+

The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k] (or at z equal to minimal z-axis value if sch contain symbol `_`) with manual colors. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v (must be v.nx>2). String sch sets the contour colors: the color of k-th contour is determined by character sch[k%strlen(sch)]. See also dens, cont, contf. See contd sample, for sample code and picture. +

+ +
+
MGL command: contd zdat ['sch'='']
+
MGL command: contd xdat ydat zdat ['sch'='']
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: contp vdat xdat ydat zdat adat ['sch'='']
+

The function draws contour lines on surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Contours are plotted for a[i,j]=v[k] where v[k] are values of data array v. If string sch have symbol `t` or `T` then contour labels v[k] will be drawn below (or above) the contours. If string sch have symbol `f` then solid contours will be drawn. See also cont, contf, surfc, cont[xyz].

+ +
+
MGL command: contp xdat ydat zdat adat ['sch'='']
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ + +
+
MGL command: contv vdat zdat ['sch'='']
+
MGL command: contv vdat xdat ydat zdat ['sch'='']
+

The function draws vertical cylinder (tube) at contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z=v[k], or at z equal to minimal z-axis value if sch contain symbol `_`. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. See also cont, contf. See contv sample, for sample code and picture. +

+ +
+
MGL command: contv zdat ['sch'='']
+
MGL command: contv xdat ydat zdat ['sch'='']
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: axial vdat zdat ['sch'='']
+
MGL command: axial vdat xdat ydat zdat ['sch'='']
+

The function draws surface which is result of contour plot rotation for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. If string sch have symbol `#` then wire plot is produced. If string sch have symbol `.` then plot by dots is produced. If string contain symbols `x` or `z` then rotation axis will be set to specified direction (default is `y`). See also cont, contf, torus, surf3. See axial sample, for sample code and picture. +

+ +
+
MGL command: axial zdat ['sch'='']
+
MGL command: axial xdat ydat zdat ['sch'='']
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 3). +

+ +
+
MGL command: grid2 zdat ['sch'='']
+
MGL command: grid2 xdat ydat zdat ['sch'='']
+

The function draws grid lines for density plot of surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z equal to minimal z-axis value. See also dens, cont, contf, grid3, meshnum. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.13 3D plotting

+ + + + + + + + + +

These functions perform plotting of 3D data. 3D means that data depend from 3 independent parameters like matrix f(x_i,y_j,z_k), i=1...n, j=1...m, k=1...l. By default (if absent) values of x, y, z are equidistantly distributed in axis range. The minor dimensions of arrays x, y, z, a should be equal x.nx=a.nx && y.nx=a.ny && z.nz=a.nz or x.nx=y.nx=z.nx=a.nx && x.ny=y.ny=z.ny=a.ny && x.nz=y.nz=z.nz=a.nz. Arrays x, y and z can be vectors (not matrices as a). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: surf3 adat val ['sch'='']
+
MGL command: surf3 xdat ydat zdat adat val ['sch'='']
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. If string contain `#` then wire plot is produced. If string sch have symbol `.` then plot by dots is produced. Note, that there is possibility of incorrect plotting due to uncertainty of cross-section defining if there are two or more isosurface intersections inside one cell. See also cloud, dens3, surf3c, surf3a, axial. See surf3 sample, for sample code and picture. +

+ +
+
MGL command: surf3 adat ['sch'='']
+
MGL command: surf3 xdat ydat zdat adat ['sch'='']
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. Here num is equal to parameter value in options opt (default is 3). +

+ +
+
MGL command: cloud adat ['sch'='']
+
MGL command: cloud xdat ydat zdat adat ['sch'='']
+

The function draws cloud plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). This plot is a set of cubes with color and transparency proportional to value of a. The resulting plot is like cloud - low value is transparent but higher ones are not. The number of plotting cells depend on meshnum. If string sch contain symbol `.` then lower quality plot will produced with much low memory usage. If string sch contain symbol `i` then transparency will be inversed, i.e. higher become transparent and lower become not transparent. See also surf3, meshnum. See cloud sample, for sample code and picture. +

+ +
+
MGL command: dens3 adat ['sch'='' sval=-1]
+
MGL command: dens3 xdat ydat zdat adat ['sch'='' sval=-1]
+

The function draws density plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Density is plotted at slice sVal in direction {`x`, `y`, `z`} if sch contain corresponding symbol (by default, `y` direction is used). If string stl have symbol `#` then grid lines are drawn. See also cont3, contf3, dens, grid3. See dens3 sample, for sample code and picture. +

+ +
+
MGL command: cont3 vdat adat ['sch'='' sval=-1]
+
MGL command: cont3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+

The function draws contour plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Contours are plotted for values specified in array v at slice sVal in direction {`x`, `y`, `z`} if sch contain corresponding symbol (by default, `y` direction is used). If string sch have symbol `#` then grid lines are drawn. If string sch have symbol `t` or `T` then contour labels will be drawn below (or above) the contours. See also dens3, contf3, cont, grid3. See cont3 sample, for sample code and picture. +

+ +
+
MGL command: cont3 adat ['sch'='' sval=-1]
+
MGL command: cont3 xdat ydat zdat adat ['sch'='' sval=-1]
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: contf3 vdat adat ['sch'='' sval=-1]
+
MGL command: contf3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+

The function draws solid (or filled) contour plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Contours are plotted for values specified in array v at slice sVal in direction {`x`, `y`, `z`} if sch contain corresponding symbol (by default, `y` direction is used). If string sch have symbol `#` then grid lines are drawn. See also dens3, cont3, contf, grid3. See contf3 sample, for sample code and picture. +

+ +
+
MGL command: contf3 adat ['sch'='' sval=-1]
+
MGL command: contf3 xdat ydat zdat adat ['sch'='' sval=-1]
+

The same as previous with vector v of num-th elements equidistantly distributed in color range. Here num is equal to parameter value in options opt (default is 7). +

+ +
+
MGL command: grid3 adat ['sch'='' sval=-1]
+
MGL command: grid3 xdat ydat zdat adat ['sch'='' sval=-1]
+

The function draws grid for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Grid is plotted at slice sVal in direction {`x`, `y`, `z`} if sch contain corresponding symbol (by default, `y` direction is used). See also cont3, contf3, dens3, grid2, meshnum. +

+ +
+
MGL command: beam tr g1 g2 adat rval ['sch'='' flag=0 num=3]
+

Draws the isosurface for 3d array a at constant values of a=val. This is special kind of plot for a specified in accompanied coordinates along curve tr with orts g1, g2 and with transverse scale r. Variable flag is bitwise: `0x1` - draw in accompanied (not laboratory) coordinates; `0x2` - draw projection to \rho-z plane; `0x4` - draw normalized in each slice field. The x-size of data arrays tr, g1, g2 must be nx>2. The y-size of data arrays tr, g1, g2 and z-size of the data array a must be equal. See also surf3. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.14 Dual plotting

+ + + + + + + + + +

These plotting functions draw two matrix simultaneously. There are 5 generally different types of data representations: surface or isosurface colored by other data (SurfC, Surf3C), surface or isosurface transpared by other data (SurfA, Surf3A), tiles with variable size (TileS), mapping diagram (Map), STFA diagram (STFA). By default (if absent) values of x, y, z are equidistantly distributed in axis range. The minor dimensions of arrays x, y, z, c should be equal. Arrays x, y (and z for Surf3C, Surf3A) can be vectors (not matrices as c). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: surfc zdat cdat ['sch'='']
+
MGL command: surfc xdat ydat zdat cdat ['sch'='']
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. If string sch have symbol `#` then grid lines are drawn. If string sch have symbol `.` then plot by dots is produced. All dimensions of arrays z and c must be equal. Surface is plotted for each z slice of the data. See also surf, surfa, surfca, beltc, surf3c. See surfc sample, for sample code and picture. +

+ + +
+
MGL command: beltc zdat cdat ['sch'='']
+
MGL command: beltc xdat ydat zdat cdat ['sch'='']
+

The function draws belts for surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. This plot can be used as 3d generalization of plot). If sch contain `x` then belts are drawn along x-direction else (by default) belts are drawn along y-direction. See also belt, surfc, meshnum.

+ + + +
+
MGL command: surf3c adat cdat val ['sch'='']
+
MGL command: surf3c xdat ydat zdat adat cdat val ['sch'='']
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as surf3 function but the color of isosurface depends on values of array c. If string sch contain `#` then wire plot is produced. If string sch have symbol `.` then plot by dots is produced. See also surf3, surfc, surf3a, surf3ca. See surf3c sample, for sample code and picture. +

+ +
+
MGL command: surf3c adat cdat ['sch'='']
+
MGL command: surf3c xdat ydat zdat adat cdat ['sch'='']
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. Here num is equal to parameter value in options opt (default is 3). +

+ + +
+
MGL command: surfa zdat cdat ['sch'='']
+
MGL command: surfa xdat ydat zdat cdat ['sch'='']
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and transparent it by matrix c[i,j]. If string sch have symbol `#` then grid lines are drawn. If string sch have symbol `.` then plot by dots is produced. All dimensions of arrays z and c must be equal. Surface is plotted for each z slice of the data. See also surf, surfc, surfca, surf3a. See surfa sample, for sample code and picture. +

+ +
+
MGL command: surf3a adat cdat val ['sch'='']
+
MGL command: surf3a xdat ydat zdat adat cdat val ['sch'='']
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as surf3 function but the transparency of isosurface depends on values of array c. If string sch contain `#` then wire plot is produced. If string sch have symbol `.` then plot by dots is produced. See also surf3, surfc, surf3a, surf3ca. See surf3a sample, for sample code and picture. +

+ +
+
MGL command: surf3a adat cdat ['sch'='']
+
MGL command: surf3a xdat ydat zdat adat cdat ['sch'='']
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. At this array c can be vector with values of transparency and num=c.nx. In opposite case num is equal to parameter value in options opt (default is 3). +

+ + + +
+
MGL command: surfca zdat cdat adat ['sch'='']
+
MGL command: surfca xdat ydat zdat cdat adat ['sch'='']
+

The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]}, color it by matrix c[i,j] and transparent it by matrix a[i,j]. If string sch have symbol `#` then grid lines are drawn. If string sch have symbol `.` then plot by dots is produced. All dimensions of arrays z and c must be equal. Surface is plotted for each z slice of the data. Note, you can use map-like coloring if use `%` in color scheme. See also surf, surfc, surfa, surf3ca. See surfca sample, for sample code and picture. +

+ +
+
MGL command: surf3ca adat cdat bdat val ['sch'='']
+
MGL command: surf3ca xdat ydat zdat adat cdat bdat val ['sch'='']
+

The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as surf3 function but the color and the transparency of isosurface depends on values of array c and b correspondingly. If string sch contain `#` then wire plot is produced. If string sch have symbol `.` then plot by dots is produced. Note, you can use map-like coloring if use `%` in color scheme. See also surf3, surfca, surf3c, surf3a. See surf3ca sample, for sample code and picture. +

+ +
+
MGL command: surf3ca adat cdat bdat ['sch'='']
+
MGL command: surf3ca xdat ydat zdat adat cdat bdat ['sch'='']
+

Draws num-th uniformly distributed in color range isosurfaces for 3d data. Here parameter num is equal to parameter value in options opt (default is 3). +

+ +
+
MGL command: tiles zdat rdat ['sch'='']
+
MGL command: tiles xdat ydat zdat rdat ['sch'='']
+
MGL command: tiles xdat ydat zdat rdat cdat ['sch'='']
+

The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. It is mostly the same as tile but the size of tiles is determined by r array. If string sch contain style `x` or `y` then tiles will be oriented perpendicular to x- or y-axis. This is some kind of “transparency” useful for exporting to EPS files. Tiles is plotted for each z slice of the data. See also surfa, tile. See tiles sample, for sample code and picture. +

+ +
+
MGL command: map udat vdat ['sch'='']
+
MGL command: map xdat ydat udat vdat ['sch'='']
+

The function draws mapping plot for matrices {ax, ay } which parametrically depend on coordinates x, y. The initial position of the cell (point) is marked by color. Height is proportional to Jacobian(ax,ay). This plot is like Arnold diagram ??? If string sch contain symbol `.` then the color ball at matrix knots are drawn otherwise face is drawn. See Mapping visualization, for sample code and picture. +

+ +
+
MGL command: stfa re im dn ['sch'='']
+
MGL command: stfa xdat ydat re im dn ['sch'='']
+

Draws spectrogram of complex array re+i*im for Fourier size of dn points at plane z equal to minimal z-axis value. For example in 1D case, result is density plot of data res[i,j]=|\sum_d^dn exp(I*j*d)*(re[i*dn+d]+I*im[i*dn+d])|/dn with size {int(nx/dn), dn, ny}. At this array re, im parametrically depend on coordinates x, y. The size of re and im must be the same. The minor dimensions of arrays x, y, re should be equal. Arrays x, y can be vectors (not matrix as re). See stfa sample, for sample code and picture. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.15 Vector fields

+ + + + + + + + +

These functions perform plotting of 2D and 3D vector fields. There are 5 generally different types of vector fields representations: simple vector field (Vect), vectors along the curve (Traj), vector field by dew-drops (Dew), flow threads (Flow, FlowP), flow pipes (Pipe). By default (if absent) values of x, y, z are equidistantly distributed in axis range. The minor dimensions of arrays x, y, z, ax should be equal. The size of ax, ay and az must be equal. Arrays x, y, z can be vectors (not matrices as ax). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options). +

+
+
MGL command: traj xdat ydat udat vdat ['sch'='']
+
MGL command: traj xdat ydat zdat udat vdat wdat ['sch'='']
+

The function draws vectors {ax, ay, az} along a curve {x, y, z}. The length of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. String pen specifies the color (see Line styles). By default (pen="") color from palette is used (see Palette and colors). Option value set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if value=0). The minor sizes of all arrays must be equal and large 2. The plots are drawn for each row if one of the data is the matrix. See also vect. See traj sample, for sample code and picture. +

+ +
+
MGL command: vect udat vdat ['sch'='']
+
MGL command: vect xdat ydat udat vdat ['sch'='']
+

The function draws plane vector field plot for the field {ax, ay} depending parametrically on coordinates x, y at level z equal to minimal z-axis value. The length and color of arrows are proportional to \sqrt{ax^2+ay^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols: +

    +
  • `f` for drawing arrows with fixed lengths, +
  • `>`, `<` for drawing arrows to or from the cell point (default is centering), +
  • `.` for drawing hachures with dots instead of arrows, +
  • `=` for enabling color gradient along arrows. +
+

See also flow, dew. See vect sample, for sample code and picture. +

+ +
+
MGL command: vect udat vdat wdat ['sch'='']
+
MGL command: vect xdat ydat zdat udat vdat wdat ['sch'='']
+

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the length and color of arrows is proportional to \sqrt{ax^2+ay^2+az^2}. +

+ +
+
MGL command: vect3 udat vdat wdat ['sch'='' sval]
+
MGL command: vect3 xdat ydat zdat udat vdat wdat ['sch'='' sval]
+

The function draws 3D vector field plot for the field {ax, ay, az} depending parametrically on coordinates x, y, z. Vector field is drawn at slice sVal in direction {`x`, `y`, `z`} if sch contain corresponding symbol (by default, `y` direction is used). The length and color of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols: +

    +
  • `f` for drawing arrows with fixed lengths, +
  • `>`, `<` for drawing arrows to or from the cell point (default is centering), +
  • `.` for drawing hachures with dots instead of arrows, +
  • `=` for enabling color gradient along arrows. +
+

See also vect, flow, dew. See vect3 sample, for sample code and picture. +

+ +
+
MGL command: dew udat vdat ['sch'='']
+
MGL command: dew xdat ydat udat vdat ['sch'='']
+

The function draws dew-drops for plane vector field {ax, ay} depending parametrically on coordinates x, y at level z equal to minimal z-axis value. Note that this is very expensive plot in memory usage and creation time! The color of drops is proportional to \sqrt{ax^2+ay^2}. The number of drops depend on meshnum. See also vect. See dew sample, for sample code and picture. +

+ +
+
MGL command: flow udat vdat ['sch'='']
+
MGL command: flow xdat ydat udat vdat ['sch'='']
+

The function draws flow threads for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z equal to minimal z-axis value. Option value set the approximate number of threads (default is 5), or accuracy for stationary points (if style `.` is used) . String sch may contain: +

    +
  • color scheme - up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); +
  • `#` for starting threads from edges only; +
  • `.` for drawing separatrices only (flow threads to/from stationary points). +
  • `*` for starting threads from a 2D array of points inside the data; +
  • `v` for drawing arrows on the threads; +
  • `x`, `z` for drawing tapes of normals in x-y and y-z planes correspondingly. +
+

See also pipe, vect, tape, flow3, barwidth. See flow sample, for sample code and picture. +

+ +
+
MGL command: flow udat vdat wdat ['sch'='']
+
MGL command: flow xdat ydat zdat udat vdat wdat ['sch'='']
+

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}. +

+ +
+
MGL command: flow x0 y0 udat vdat ['sch'='']
+
MGL command: flow x0 y0 xdat ydat udat vdat ['sch'='']
+

The same as first one (flow) but draws single flow thread starting from point p0={x0,y0,z0}. +

+ +
+
MGL command: flow x0 y0 z0 udat vdat wdat ['sch'='']
+
MGL command: flow x0 y0 z0 xdat ydat zdat udat vdat wdat ['sch'='']
+

This is 3D version of the previous functions. +

+ +
+
MGL command: flow3 udat vdat wdat ['sch'='']
+
MGL command: flow3 xdat ydat zdat udat vdat ['sch'='']
+

The function draws flow threads for the 3D vector field {ax, ay, az} parametrically depending on coordinates x, y, z. Flow threads starts from given plane. Option value set the approximate number of threads (default is 5). String sch may contain: +

    +
  • color scheme - up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); +
  • `x`, `z` for normal of starting plane (default is y-direction); +
  • `v` for drawing arrows on the threads; +
  • `t` for drawing tapes of normals in x-y and y-z planes. +
+

See also flow, pipe, vect. See flow3 sample, for sample code and picture. +

+ + +
+
MGL command: grad pdat ['sch'='']
+
MGL command: grad xdat ydat pdat ['sch'='']
+
MGL command: grad xdat ydat zdat pdat ['sch'='']
+

The function draws gradient lines for scalar field phi[i,j] (or phi[i,j,k] in 3d case) specified parametrically {x[i,j,k], y[i,j,k], z[i,j,k]}. Number of lines is proportional to value option (default is 5). See also dens, cont, flow. +

+ +
+
MGL command: pipe udat vdat ['sch'='' r0=0.05]
+
MGL command: pipe xdat ydat udat vdat ['sch'='' r0=0.05]
+

The function draws flow pipes for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z equal to minimal z-axis value. Number of pipes is proportional to value option (default is 5). If `#` symbol is specified then pipes start only from edges of axis range. The color of lines is proportional to \sqrt{ax^2+ay^2}. Warm color corresponds to normal flow (like attractor). Cold one corresponds to inverse flow (like source). Parameter r0 set the base pipe radius. If r0<0 or symbol `i` is specified then pipe radius is inverse proportional to amplitude. The vector field is plotted for each z slice of ax, ay. See also flow, vect. See pipe sample, for sample code and picture. +

+ +
+
MGL command: pipe udat vdat wdat ['sch'='' r0=0.05]
+
MGL command: pipe xdat ydat zdat udat vdat wdat ['sch'='' r0=0.05]
+

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.16 Other plotting

+ + + + + + + + + + + + +

These functions perform miscellaneous plotting. There is unstructured data points plots (Dots), surface reconstruction (Crust), surfaces on the triangular or quadrangular mesh (TriPlot, TriCont, QuadPlot), textual formula plotting (Plots by formula), data plots at edges (Dens[XYZ], Cont[XYZ], ContF[XYZ]). Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See Color scheme. +

+
+
MGL command: densx dat ['sch'='' sval=nan]
+
MGL command: densy dat ['sch'='' sval=nan]
+
MGL command: densz dat ['sch'='' sval=nan]
+

These plotting functions draw density plot in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. See also ContXYZ, ContFXYZ, dens, Data manipulation. See dens_xyz sample, for sample code and picture. +

+ +
+
MGL command: contx dat ['sch'='' sval=nan]
+
MGL command: conty dat ['sch'='' sval=nan]
+
MGL command: contz dat ['sch'='' sval=nan]
+

These plotting functions draw contour lines in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. Option value set the number of contours. See also ContFXYZ, DensXYZ, cont, Data manipulation. See cont_xyz sample, for sample code and picture. +

+ + +
+
MGL command: contfx dat ['sch'='' sval=nan]
+
MGL command: contfy dat ['sch'='' sval=nan]
+
MGL command: contfz dat ['sch'='' sval=nan]
+

These plotting functions draw solid contours in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. Option value set the number of contours. See also ContFXYZ, DensXYZ, cont, Data manipulation. See contf_xyz sample, for sample code and picture. +

+ + +
+
MGL command: fplot 'y(x)' ['pen'='']
+

Draws command function `y(x)` at plane z equal to minimal z-axis value, where `x` variable is changed in xrange. You do not need to create the data arrays to plot it. Option value set initial number of points. See also plot. +

+ +
+
MGL command: fplot 'x(t)' 'y(t)' 'z(t)' ['pen'='']
+

Draws command parametrical curve {`x(t)`, `y(t)`, `z(t)`} where `t` variable is changed in range [0, 1]. You do not need to create the data arrays to plot it. Option value set number of points. See also plot. +

+ +
+
MGL command: fsurf 'z(x,y)' ['sch'='']
+

Draws command surface for function `z(x,y)` where `x`, `y` variable are changed in xrange, yrange. You do not need to create the data arrays to plot it. Option value set number of points. See also surf. +

+ +
+
MGL command: fsurf 'x(u,v)' 'y(u,v)' 'z(u,v)' ['sch'='']
+

Draws command parametrical surface {`x(u,v)`, `y(u,v)`, `z(u,v)`} where `u`, `v` variable are changed in range [0, 1]. You do not need to create the data arrays to plot it. Option value set number of points. See also surf. +

+ +
+
MGL command: triplot idat xdat ydat ['sch'='']
+
MGL command: triplot idat xdat ydat zdat ['sch'='']
+
MGL command: triplot idat xdat ydat zdat cdat ['sch'='']
+

The function draws the surface of triangles. Triangle vertexes are set by indexes id of data points {x[i], y[i], z[i]}. String sch sets the color scheme. If string contain `#` then wire plot is produced. First dimensions of id must be 3 or greater. Arrays x, y, z must have equal sizes. Parameter c set the colors of triangles (if id.ny=c.nx) or colors of vertexes (if x.nx=c.nx). See also dots, crust, quadplot, triangulation. See triplot sample, for sample code and picture. +

+ +
+
MGL command: tricont vdat idat xdat ydat zdat cdat ['sch'='']
+
MGL command: tricont vdat idat xdat ydat zdat ['sch'='']
+
MGL command: tricont idat xdat ydat zdat ['sch'='']
+

The function draws contour lines for surface of triangles at z=v[k] (or at z equal to minimal z-axis value if sch contain symbol `_`). Triangle vertexes are set by indexes id of data points {x[i], y[i], z[i]}. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. If v is absent then arrays of option value elements equidistantly distributed in color range is used. String sch sets the color scheme. Array c (if specified) is used for contour coloring. First dimensions of id must be 3 or greater. Arrays x, y, z must have equal sizes. Parameter c set the colors of triangles (if id.ny=c.nx) or colors of vertexes (if x.nx=c.nx). See also triplot, cont, triangulation. +

+ +
+
MGL command: quadplot idat xdat ydat ['sch'='']
+
MGL command: quadplot idat xdat ydat zdat ['sch'='']
+
MGL command: quadplot idat xdat ydat zdat cdat ['sch'='']
+

The function draws the surface of quadrangles. Quadrangles vertexes are set by indexes id of data points {x[i], y[i], z[i]}. String sch sets the color scheme. If string contain `#` then wire plot is produced. First dimensions of id must be 4 or greater. Arrays x, y, z must have equal sizes. Parameter c set the colors of quadrangles (if id.ny=c.nx) or colors of vertexes (if x.nx=c.nx). See also triplot. See triplot sample, for sample code and picture. +

+ +
+
MGL command: dots xdat ydat zdat ['sch'='']
+
MGL command: dots xdat ydat zdat adat ['sch'='']
+

The function draws the arbitrary placed points {x[i], y[i], z[i]}. String sch sets the color scheme and kind of marks. If arrays c, a are specified then they define colors and transparencies of dots. You can use tens plot with style ` .` to draw non-transparent dots with specified colors. Arrays x, y, z, a must have equal sizes. See also crust, tens, mark, plot. See dots sample, for sample code and picture. +

+ +
+
MGL command: crust xdat ydat zdat ['sch'='']
+

The function reconstruct and draws the surface for arbitrary placed points {x[i], y[i], z[i]}. String sch sets the color scheme. If string contain `#` then wire plot is produced. Arrays x, y, z must have equal sizes. See also dots, triplot.

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.17 Nonlinear fitting

+ + + + + + + + +

These functions fit data to formula. Fitting goal is to find formula parameters for the best fit the data points, i.e. to minimize the sum \sum_i (f(x_i, y_i, z_i) - a_i)^2/s_i^2. At this, approximation function `f` can depend only on one argument `x` (1D case), on two arguments `x,y` (2D case) and on three arguments `x,y,z` (3D case). The function `f` also may depend on parameters. Normally the list of fitted parameters is specified by var string (like, `abcd`). Usually user should supply initial values for fitted parameters by ini variable. But if he/she don`t supply it then the zeros are used. Parameter print=true switch on printing the found coefficients to Message (see Error handling). +

+

Functions Fit() and FitS() do not draw the obtained data themselves. They fill the data fit by formula `f` with found coefficients and return it. At this, the `x,y,z` coordinates are equidistantly distributed in the axis range. Number of points in fit is defined by option value (default is mglFitPnts=100). Note, that this functions use GSL library and do something only if MathGL was compiled with GSL support. See Nonlinear fitting hints, for sample code and picture. +

+
+
MGL command: fits res adat sdat 'func' 'var' [ini=0]
+
MGL command: fits res xdat adat sdat 'func' 'var' [ini=0]
+
MGL command: fits res xdat ydat adat sdat 'func' 'var' [ini=0]
+
MGL command: fits res xdat ydat zdat adat sdat 'func' 'var' [ini=0]
+

Fit data along x-, y- and z-directions for array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) with weight factor s[i,j,k]. +

+ +
+
MGL command: fit res adat 'func' 'var' [ini=0]
+
MGL command: fit res xdat adat 'func' 'var' [ini=0]
+
MGL command: fit res xdat ydat adat 'func' 'var' [ini=0]
+
MGL command: fit res xdat ydat zdat adat 'func' 'var' [ini=0]
+

Fit data along x-, y- and z-directions for array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) with weight factor 1. +

+ + + +
+
MGL command: putsfit x y ['pre'='' 'fnt'='' size=-1]
+

Print last fitted formula with found coefficients (as numbers) at position p0. The string prefix will be printed before formula. All other parameters are the same as in Text printing. +

+ + + + +
+ +
+

+Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.18 Data manipulation

+ + + + + +
+
MGL command: hist RES xdat adat
+
MGL command: hist RES xdat ydat adat
+
MGL command: hist RES xdat ydat zdat adat
+

These functions make distribution (histogram) of data. They do not draw the obtained data themselves. These functions can be useful if user have data defined for random points (for example, after PIC simulation) and he want to produce a plot which require regular data (defined on grid(s)). The range for grids is always selected as axis range. Arrays x, y, z define the positions (coordinates) of random points. Array a define the data value. Number of points in output array res is defined by option value (default is mglFitPnts=100). +

+ + +
+
MGL command: fill dat 'eq'
+
MGL command: fill dat 'eq' vdat
+
MGL command: fill dat 'eq' vdat wdat
+

Fills the value of array `u` according to the formula in string eq. Formula is an arbitrary expression depending on variables `x`, `y`, `z`, `u`, `v`, `w`. Coordinates `x`, `y`, `z` are supposed to be normalized in axis range. Variable `u` is the original value of the array. Variables `v` and `w` are values of arrays v, w which can be NULL (i.e. can be omitted). +

+ +
+
MGL command: datagrid dat xdat ydat zdat
+

Fills the value of array `u` according to the linear interpolation of triangulated surface, found for arbitrary placed points `x`, `y`, `z`. Interpolation is done at points equidistantly distributed in axis range. NAN value is used for grid points placed outside of triangulated surface. See Making regular data, for sample code and picture. +

+ +
+
MGL command: refill dat xdat vdat [sl=-1]
+
MGL command: refill dat xdat ydat vdat [sl=-1]
+
MGL command: refill dat xdat ydat zdat vdat
+

Fills by interpolated values of array v at the point {x, y, z}={X[i], Y[j], Z[k]} (or {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} if x, y, z are not 1d arrays), where X,Y,Z are equidistantly distributed in axis range and have the same sizes as array dat. If parameter sl is 0 or positive then changes will be applied only for slice sl. +

+ + +
+
MGL command: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Coordinates `x`, `y`, `z` are supposed to be normalized in axis range. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. At this moment, simplified form of function ham is supported - all “mixed” terms (like `x*p`->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like `x*q`->x*d/dy) are allowed. Here variable `u` is used for field amplitude |u|. This allow one solve nonlinear problems - for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)", but only if dependence on variable `i` is linear (i.e. ham = hre+i*him). See PDE solving hints, for sample code and picture. +

+ + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

4 Data processing

+ + +

This chapter describe commands for allocation, resizing, loading and saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Class supports data with dimensions up to 3 (like function of 3 variables - x,y,z). Data arrays are denoted by Small Caps (like DAT) if it can be (re-)created by MGL commands. +

+ + + + + + + + + + + + + + + + + + +
+ + + +

4.1 Public variables

+ + +

MGL don`t support direct access to data arrays. See section Data filling +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.2 Data constructor

+ + + +

There are many functions, which can create data for output (see Data filling, File I/O, Make another data, Global functions). Here I put most useful of them. +

+
+
MGL command: new DAT [nx=1 'eq']
+
MGL command: new DAT nx ny ['eq']
+
MGL command: new DAT nx ny nz ['eq']
+

Default constructor. Allocates the memory for data array and initializes it by zero. If string eq is specified then data will be filled by corresponding formula as in fill. +

+ +
+
MGL command: copy DAT dat2 ['eq'='']
+
MGL command: copy DAT val
+

Copy constructor. Allocates the memory for data array and copy values from other array. At this, if parameter eq or val is specified then the data will be modified by corresponding formula similarly to fill. +

+ +
+
MGL command: copy REDAT IMDAT dat2 ['eq'='']
+

Allocates the memory for data array and copy real and imaginary values from complex array dat2. +

+ +
+
MGL command: copy 'name'
+

Allocates the memory for data array and copy values from other array specified by its name, which can be "invalid" for MGL names (like one read from HDF5 files). +

+ + +
+
MGL command: read DAT 'fname'
+

Reads data from tab-separated text file with auto determining sizes of the data. +

+ +
+
MGL command: delete dat
+
MGL command: delete 'name'
+

Deletes the data array from memory. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.3 Data resizing

+ + + + + + + + + + + + + +
+
MGL command: new DAT [nx=1 ny=1 nz=1]
+

Creates or recreates the array with specified size and fills it by zero. This function does nothing if one of parameters mx, my, mz is zero or negative. +

+ +
+
MGL command: rearrange dat mx [my=0 mz=0]
+

Rearrange dimensions without changing data array so that resulting sizes should be mx*my*mz < nx*ny*nz. If some of parameter my or mz are zero then it will be selected to optimal fill of data array. For example, if my=0 then it will be change to my=nx*ny*nz/mx and mz=1. +

+ +
+
MGL command: transpose dat ['dim'='yxz']
+

Transposes (shift order of) dimensions of the data. New order of dimensions is specified in string dim. This function can be useful also after reading of one-dimensional data. +

+ +
+
MGL command: extend dat n1 [n2=0]
+

Increase the dimensions of the data by inserting new (|n1|+1)-th slices after (for n1>0) or before (for n1<0) of existed one. It is possible to insert 2 dimensions simultaneously for 1d data by using parameter n2. Data to new slices is copy from existed one. For example, for n1>0 new array will be +a_ij^new = a_i^old where j=0...n1. Correspondingly, for n1<0 new array will be a_ij^new = a_j^old where i=0...|n1|. +

+ +
+
MGL command: squeeze dat rx [ry=1 rz=1 sm=off]
+

Reduces the data size by excluding data elements which indexes are not divisible by rx, ry, rz correspondingly. Parameter smooth set to use smoothing +(i.e. out[i]=\sum_{j=i,i+r} a[j]/r) or not (i.e. out[i]=a[j*r]). +

+ +
+
MGL command: crop dat n1 n2 'dir'
+

Cuts off edges of the data i<n1 and i>n2 if n2>0 or i>n[xyz]-n2 if n2<=0 along direction dir. +

+ +
+
MGL command: crop dat 'how'
+

Cuts off far edge of the data to be more optimal for fast Fourier transform. The resulting size will be the closest value of 2^n*3^m*5^l to the original one. The string how may contain: `x`, `y`, `z` for directions, and `2`, `3`, `5` for using corresponding bases. +

+ +
+
MGL command: insert dat 'dir' [pos=off num=0]
+

Insert num slices along dir-direction at position pos and fill it by zeros. +

+ +
+
MGL command: delete dat 'dir' [pos=off num=0]
+

Delete num slices along dir-direction at position pos. +

+ +
+
MGL command: delete dat
+
MGL command: delete 'name'
+

Deletes the whole data array. +

+ +
+
MGL command: sort dat idx [idy=-1]
+

Sort data rows (or slices in 3D case) by values of specified column idx (or cell {idx,idy} for 3D case). Note, this function is not thread safe! +

+ +
+
MGL command: clean dat idx
+

Delete rows which values are equal to next row for given column idx. +

+ +
+
MGL command: join dat vdat [v2dat ...]
+

Join data cells from vdat to dat. At this, function increase dat sizes according following: z-size for data arrays arrays with equal x-,y-sizes; or y-size for data arrays with equal x-sizes; or x-size otherwise. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.4 Data filling

+ + + + + + + + +
+
MGL command: list DAT v1 ...
+

Creates new variable with name dat and fills it by numeric values of command arguments v1 .... Command can create one-dimensional and two-dimensional arrays with arbitrary values. For creating 2d array the user should use delimiter `|` which means that the following values lie in next row. Array sizes are [maximal of row sizes * number of rows]. For example, command list 1 | 2 3 creates the array [1 0; 2 3]. Note, that the maximal number of arguments is 1000. +

+
+
MGL command: list DAT d1 ...
+

Creates new variable with name dat and fills it by data values of arrays of command arguments d1 .... Command can create two-dimensional or three-dimensional (if arrays in arguments are 2d arrays) arrays with arbitrary values. Minor dimensions of all arrays in arguments should be equal to dimensions of first array d1. In the opposite case the argument will be ignored. Note, that the maximal number of arguments is 1000. +

+ + +
+
MGL command: var DAT num v1 [v2=nan]
+

Creates new variable with name dat for one-dimensional array of size num. Array elements are equidistantly distributed in range [v1, v2]. If v2=nan then v2=v1 is used. +

+ +
+
MGL command: fill dat v1 v2 ['dir'='x']
+

Equidistantly fills the data values to range [v1, v2] in direction dir={`x`,`y`,`z`}. +

+ +
+
MGL command: fill dat 'eq' [vdat wdat]
+

Fills the value of array according to the formula in string eq. Formula is an arbitrary expression depending on variables `x`, `y`, `z`, `u`, `v`, `w`. Coordinates `x`, `y`, `z` are supposed to be normalized in axis range of canvas gr (in difference from Modify functions). Variable `u` is the original value of the array. Variables `v` and `w` are values of vdat, wdat which can be NULL (i.e. can be omitted). +

+ +
+
MGL command: modify dat 'eq' [dim=0]
+
MGL command: modify dat 'eq' vdat [wdat]
+

The same as previous ones but coordinates `x`, `y`, `z` are supposed to be normalized in range [0,1]. If dim>0 is specified then modification will be fulfilled only for slices >=dim. +

+ +
+
MGL command: fillsample dat 'how'
+

Fills data by `x` or `k` samples for Hankel (`h`) or Fourier (`f`) transform. +

+ + +
+
MGL command: datagrid dat xdat ydat zdat
+

Fills the value of array according to the linear interpolation of triangulated surface assuming x-,y-coordinates equidistantly distributed in axis range (or in range [x1,x2]*[y1,y2]). Triangulated surface is found for arbitrary placed points `x`, `y`, `z`. NAN value is used for grid points placed outside of triangulated surface. See Making regular data, for sample code and picture. +

+ + +
+
MGL command: put dat val [i=all j=all k=all]
+

Sets value(s) of array a[i, j, k] = val. Negative indexes i, j, k=-1 set the value val to whole range in corresponding direction(s). For example, Put(val,-1,0,-1); sets a[i,0,j]=val for i=0...(nx-1), j=0...(nz-1). +

+ +
+
MGL command: put dat vdat [i=all j=all k=all]
+

Copies value(s) from array v to the range of original array. Negative indexes i, j, k=-1 set the range in corresponding direction(s). At this minor dimensions of array v should be large than corresponding dimensions of this array. For example, Put(v,-1,0,-1); sets a[i,0,j]=v.ny>nz ? v[i,j] : v[i], where i=0...(nx-1), j=0...(nz-1) and condition v.nx>=nx is true. +

+ +
+
MGL command: refill dat xdat vdat [sl=-1]
+
MGL command: refill dat xdat ydat vdat [sl=-1]
+
MGL command: refill dat xdat ydat zdat vdat
+

Fills by interpolated values of array v at the point {x, y, z}={X[i], Y[j], Z[k]} (or {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} if x, y, z are not 1d arrays), where X,Y,Z are equidistantly distributed in range [x1,x2]*[y1,y2]*[z1,z2] and have the same sizes as this array. If parameter sl is 0 or positive then changes will be applied only for slice sl. +

+ +
+
MGL command: gspline dat xdat vdat [sl=-1]
+

Fills by global cubic spline values of array v at the point x=X[i], where X are equidistantly distributed in range [x1,x2] and have the same sizes as this array. If parameter sl is 0 or positive then changes will be applied only for slice sl. +

+ +
+
MGL command: idset dat 'ids'
+

Sets the symbol ids for data columns. The string should contain one symbol `a`...`z` per column. These ids are used in column. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.5 File I/O

+ + + + + + + + + + + +
+
MGL command: read DAT 'fname'
+
MGL command: read REDAT IMDAT 'fname'
+

Reads data from tab-separated text file with auto determining sizes of the data. Double newline means the beginning of new z-slice. +

+ +
+
MGL command: read DAT 'fname' mx [my=1 mz=1]
+
MGL command: read REDAT IMDAT 'fname' mx [my=1 mz=1]
+

Reads data from text file with specified data sizes. This function does nothing if one of parameters mx, my or mz is zero or negative. +

+ +
+
MGL command: readmat DAT 'fname' [dim=2]
+

Read data from text file with size specified at beginning of the file by first dim numbers. At this, variable dim set data dimensions. +

+ +
+
MGL command: readall DAT 'templ' v1 v2 [dv=1 slice=off]
+

Join data arrays from several text files. The file names are determined by function call sprintf(fname,templ,val);, where val changes from from to to with step step. The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true. +

+ +
+
MGL command: readall DAT 'templ' [slice=off]
+

Join data arrays from several text files which filenames satisfied the template templ (for example, templ="t_*.dat"). The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true. +

+ +
+
MGL command: scanfile DAT 'fname' 'templ'
+

Read file fname line-by-line and scan each line for numbers according the template templ. The numbers denoted as `%g` in the template. See Saving and scanning file, for sample code and picture. +

+ +
+
MGL command: save dat 'fname'
+

Saves the whole data array (for ns=-1) or only ns-th slice to the text file fname. +

+ +
+
MGL command: save 'str' 'fname' ['mode'='a']
+

Saves the string str to the text file fname. For parameter mode=`a` will append string to the file (default); for mode=`w` will overwrite the file. See Saving and scanning file, for sample code and picture. +

+ + +
+
MGL command: readhdf DAT 'fname' 'dname'
+

Reads data array named dname from HDF5 or HDF4 file. This function does nothing if HDF5|HDF4 was disabled during library compilation. +

+ +
+
MGL command: savehdf dat 'fname' 'dname' [rewrite=off]
+

Saves data array named dname to HDF5 file. This function does nothing if HDF5 was disabled during library compilation. +

+ +
+
MGL command: datas 'fname'
+

Put data names from HDF5 file fname into buf as `\t` separated fields. In MGL version the list of data names will be printed as message. This function does nothing if HDF5 was disabled during library compilation. +

+ +
+
MGL command: openhdf 'fname'
+

Reads all data array from HDF5 file fname and create MGL variables with names of data names in HDF file. Complex variables will be created if data name starts with `!`. +

+ + + +
+
MGL command: import DAT 'fname' 'sch' [v1=0 v2=1]
+

Reads data from bitmap file (now support only PNG format). The RGB values of bitmap pixels are transformed to mreal values in range [v1, v2] using color scheme scheme (see Color scheme). +

+ +
+
MGL command: export dat 'fname' 'sch' [v1=0 v2=0]
+

Saves data matrix (or ns-th slice for 3d data) to bitmap file (now support only PNG format). The data values are transformed from range [v1, v2] to RGB pixels of bitmap using color scheme scheme (see Color scheme). If v1>=v2 then the values of v1, v2 are automatically determined as minimal and maximal value of the data array. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.6 Make another data

+ + + + + + + + + + + + + + + + + +
+
MGL command: subdata RES dat xx [yy=all zz=all]
+

Extracts sub-array data from the original data array keeping fixed positive index. For example SubData(-1,2) extracts 3d row (indexes are zero based), SubData(4,-1) extracts 5th column, SubData(-1,-1,3) extracts 4th slice and so on. If argument(s) are non-integer then linear interpolation between slices is used. In MGL version this command usually is used as inline one dat(xx,yy,zz). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: subdata RES dat xdat [ydat zdat]
+

Extracts sub-array data from the original data array for indexes specified by arrays xx, yy, zz (indirect access). This function work like previous one for 1D arguments or numbers, and resulting array dimensions are equal dimensions of 1D arrays for corresponding direction. For 2D and 3D arrays in arguments, the resulting array have the same dimensions as input arrays. The dimensions of all argument must be the same (or to be scalar 1*1*1) if they are 2D or 3D arrays. In MGL version this command usually is used as inline one dat(xx,yy,zz). Function return NULL or create empty data if data cannot be created for given arguments. In C function some of xx, yy, zz can be NULL. +

+ +
+
MGL command: column RES dat 'eq'
+

Get column (or slice) of the data filled by formula eq on column ids. For example, Column("n*w^2/exp(t)");. The column ids must be defined first by idset function or read from files. In MGL version this command usually is used as inline one dat('eq'). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: resize RES dat mx [my=1 mz=1]
+

Resizes the data to new size mx, my, mz from box (part) [x1,x2] x [y1,y2] x [z1,z2] of original array. Initially x,y,z coordinates are supposed to be in [0,1]. If one of sizes mx, my or mz is 0 then initial size is used. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: evaluate RES dat idat [norm=on]
+
MGL command: evaluate RES dat idat jdat [norm=on]
+
MGL command: evaluate RES dat idat jdat kdat [norm=on]
+

Gets array which values is result of interpolation of original array for coordinates from other arrays. All dimensions must be the same for data idat, jdat, kdat. Coordinates from idat, jdat, kdat are supposed to be normalized in range [0,1] (if norm=true) or in ranges [0,nx], [0,ny], [0,nz] correspondingly. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: section RES dat ids ['dir'='y' val=nan]
+
MGL command: section RES dat id ['dir'='y' val=nan]
+

Gets array which is id-th section (range of slices separated by value val) of original array dat. For id<0 the reverse order is used (i.e. -1 give last section). If several ids are provided then output array will be result of sequential joining of sections. +

+ + +
+
MGL command: solve RES dat val 'dir' [norm=on]
+
MGL command: solve RES dat val 'dir' idat [norm=on]
+

Gets array which values is indexes (roots) along given direction dir, where interpolated values of data dat are equal to val. Output data will have the sizes of dat in directions transverse to dir. If data idat is provided then its values are used as starting points. This allows to find several branches by consequentive calls. Indexes are supposed to be normalized in range [0,1] (if norm=true) or in ranges [0,nx], [0,ny], [0,nz] correspondingly. Function return NULL or create empty data if data cannot be created for given arguments. See Solve sample, for sample code and picture. +

+ +
+
MGL command: roots RES 'func' ini ['var'='x']
+
MGL command: roots RES 'func' ini ['var'='x']
+

Find roots of equation `func`=0 for variable var with initial guess ini. Secant method is used for root finding. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: roots RES 'funcs' 'vars' ini
+

Find roots of system of equations `funcs`=0 for variables vars with initial guesses ini. Secant method is used for root finding. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: detect RES dat lvl dj [di=0 minlen=0]
+

Get curves {x,y}, separated by NAN values, for local maximal values of array dat as function of x-coordinate. Noises below lvl amplitude are ignored. Parameter dj (in range [0,ny]) set the "attraction" y-distance of points to the curve. Similarly, di continue curve in x-direction through gaps smaller than di points. Curves with minimal length smaller than minlen will be ignored. +

+ +
+
MGL command: hist RES dat num v1 v2 [nsub=0]
+
MGL command: hist RES dat wdat num v1 v2 [nsub=0]
+

Creates n-th points distribution of the data values in range [v1, v2]. Array w specifies weights of the data elements (by default is 1). Parameter nsub define the number of additional interpolated points (for smoothness of histogram). Function return NULL or create empty data if data cannot be created for given arguments. See also Data manipulation +

+ +
+
MGL command: momentum RES dat 'how' ['dir'='z']
+

Gets momentum (1d-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as +res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij +if dir=`z` and so on. Coordinates `x`, `y`, `z` are data indexes normalized in range [0,1]. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: sum RES dat 'dir'
+

Gets array which is the result of summation in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: max RES dat 'dir'
+

Gets array which is the maximal data values in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: min RES dat 'dir'
+

Gets array which is the maximal data values in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: combine RES adat bdat
+

Returns direct multiplication of arrays (like, res[i,j] = this[i]*a[j] and so on). Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: trace RES dat
+

Gets array of diagonal elements a[i,i] (for 2D case) or a[i,i,i] (for 3D case) where i=0...nx-1. Function return copy of itself for 1D case. Data array must have dimensions ny,nz >= nx or ny,nz = 1. Function return NULL or create empty data if data cannot be created for given arguments. +

+ +
+
MGL command: correl RES adat bdat 'dir'
+

Find correlation between data a (or this in C++) and b along directions dir. Fourier transform is used to find the correlation. So, you may want to use functions swap or norm before plotting it. Function return NULL or create empty data if data cannot be created for given arguments. +

+ + +
+
MGL command: pulse RES dat 'dir'
+

Find pulse properties along direction dir: pulse maximum (in column 0) and its position (in column 1), pulse width near maximum (in column 3) and by half height (in column 2), energy in first pulse (in column 4). NAN values are used for widths if maximum is located near the edges. Note, that there is uncertainty for complex data. Usually one should use square of absolute value (i.e. |dat[i]|^2) for them. So, MathGL don`t provide this function for complex data arrays. However, C function will work even in this case but use absolute value (i.e. |dat[i]|). Function return NULL or create empty data if data cannot be created for given arguments. See also max, min, momentum, sum. See Pulse properties, for sample code and picture. +

+ + + +
+ + + +

4.7 Data changing

+ + + + + + + + + + + + + + + + + +

These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain `x`, `y` or `z` characters for 1-st, 2-nd and 3-d dimension correspondingly. +

+
+
MGL command: cumsum dat 'dir'
+

Cumulative summation of the data in given direction or directions. +

+ +
+
MGL command: integrate dat 'dir'
+

Integrates (like cumulative summation) the data in given direction or directions. +

+ +
+
MGL command: diff dat 'dir'
+

Differentiates the data in given direction or directions. +

+ +
+
MGL command: diff dat xdat ydat [zdat]
+

Differentiates the data specified parametrically in direction x with y, z=constant. Parametrical differentiation uses the formula (for 2D case): da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j) where a_i=da/di, a_j=da/dj denotes usual differentiation along 1st and 2nd dimensions. The similar formula is used for 3D case. Note, that you may change the order of arguments - for example, if you have 2D data a(i,j) which depend on coordinates {x(i,j), y(i,j)} then usual derivative along `x` will be Diff(x,y); and usual derivative along `y` will be Diff(y,x);. +

+ +
+
MGL command: diff2 dat 'dir'
+

Double-differentiates (like Laplace operator) the data in given direction. +

+ +
+
MGL command: sinfft dat 'dir'
+

Do Sine transform of the data in given direction or directions. The Sine transform is \sum a_j \sin(k j) (see http://en.wikipedia.org/wiki/Discrete_sine_transform#DST-I). +

+ +
+
MGL command: cosfft dat 'dir'
+

Do Cosine transform of the data in given direction or directions. The Cosine transform is \sum a_j \cos(k j) (see http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-I). +

+ + +
+
MGL command: hankel dat 'dir'
+

Do Hankel transform of the data in given direction or directions. The Hankel transform is \sum a_j J_0(k j) (see http://en.wikipedia.org/wiki/Hankel_transform). +

+ +
+
MGL command: wavelet dat 'dir' k
+

Apply wavelet transform of the data in given direction or directions. Parameter dir set the kind of wavelet transform: +`d` for daubechies, `D` for centered daubechies, `h` for haar, `H` for centered haar, `b` for bspline, `B` for centered bspline. If string dir contain symbol `i` then inverse wavelet transform is applied. Parameter k set the size of wavelet transform. +

+ +
+
MGL command: swap dat 'dir'
+

Swaps the left and right part of the data in given direction (useful for Fourier spectrum). +

+ +
+
MGL command: roll dat 'dir' num
+

Rolls the data along direction dir. Resulting array will be out[i] = ini[(i+num)%nx] if dir='x'. +

+ +
+
MGL command: mirror dat 'dir'
+

Mirror the left-to-right part of the data in given direction. Looks like change the value index i->n-i. Note, that the similar effect in graphics you can reach by using options (see Command options), for example, surf dat; xrange 1 -1. +

+ +
+
MGL command: sew dat ['dir'='xyz' da=2*pi]
+

Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction. +

+ +
+
MGL command: smooth data ['dir'='xyz']
+

Smooths the data on specified direction or directions. String dirs specifies the dimensions which will be smoothed. It may contain characters: +

    +
  • `xyz` for smoothing along x-,y-,z-directions correspondingly, +
  • `0` does nothing, +
  • `3` for linear averaging over 3 points, +
  • `5` for linear averaging over 5 points, +
  • `d1`...`d9` for linear averaging over (2*N+1)-th points. +
+

By default quadratic averaging over 5 points is used. +

+ +
+
MGL command: envelop dat ['dir'='x']
+

Find envelop for data values along direction dir. +

+ +
+
MGL command: diffract dat 'how' q
+

Calculates one step of diffraction by finite-difference method with parameter q=\delta t/\delta x^2 using method with 3-d order of accuracy. Parameter how may contain: +

    +
  • `xyz` for calculations along x-,y-,z-directions correspondingly; +
  • `r` for using axial symmetric Laplace operator for x-direction; +
  • `0` for zero boundary conditions; +
  • `1` for constant boundary conditions; +
  • `2` for linear boundary conditions; +
  • `3` for parabolic boundary conditions; +
  • `4` for exponential boundary conditions; +
  • `5` for gaussian boundary conditions. +
+
+ +
+
MGL command: norm dat v1 v2 [sym=off dim=0]
+

Normalizes the data to range [v1,v2]. If flag sym=true then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. Modification will be applied only for slices >=dim. +

+ +
+
MGL command: normsl dat v1 v2 ['dir'='z' keep=on sym=off]
+

Normalizes data slice-by-slice along direction dir the data in slices to range [v1,v2]. If flag sym=true then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. If keep is set then maximal value of k-th slice will be limited by +\sqrt{\sum a_ij(k)/\sum a_ij(0)}. +

+ +
+
MGL command: limit dat val
+

Limits the data values to be inside the range [-val,val], keeping the original sign of the value (phase for complex numbers). This is equivalent to operation a[i] *= abs(a[i])<val?1.:val/abs(a[i]);. +

+ +
+
MGL command: coil dat v1 v2 [sep=on]
+

Project the periodical data to range [v1,v2] (like mod() function). Separate branches by NAN if sep=true. +

+ + +
+
MGL command: dilate dat [val=1 step=1]
+

Return dilated by step cells array of 0 or 1 for data values larger val.

+ +
+
MGL command: erode dat [val=1 step=1]
+

Return eroded by step cells array of 0 or 1 for data values larger val.

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.8 Interpolation

+ + +

MGL scripts can use spline interpolation by evaluate or refill commands. Also you can use resize for obtaining a data array with new sizes. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.9 Data information

+ + +

There are a set of functions for obtaining data properties in MGL language. However most of them can be found using "suffixes". Suffix can get some numerical value of the data array (like its size, maximal or minimal value, the sum of elements and so on) as number. Later it can be used as usual number in command arguments. The suffixes start from point `.` right after (without spaces) variable name or its sub-array. For example, a.nx give the x-size of data a, b(1).max give maximal value of second row of variable b, (c(:,0)^2).sum give the sum of squares of elements in the first column of c and so on. +

+ + +
+
MGL command: info dat
+

Gets or prints to file fp or as message (in MGL) information about the data (sizes, maximum/minimum, momentums and so on). +

+ +
+
MGL command: info 'txt'
+

Prints string txt as message. +

+ +
+
MGL command: info val
+

Prints value of number val as message. +

+ +
+
MGL command: print dat
+
MGL command: print 'txt'
+
MGL command: print val
+

The same as info but immediately print to stdout. +

+ +
+
MGL command: echo dat
+

Prints all values of the data array dat as message. +

+ +
+
MGL command: progress val max
+

Display progress of something as filled horizontal bar with relative length val/max. Note, it work now only in console and in FLTK-based applications, including mgllab and mglview. +

+ + + + + +
+
MGL suffix: (dat) .nx
+
MGL suffix: (dat) .ny
+
MGL suffix: (dat) .nz
+

Gets the x-, y-, z-size of the data. +

+ + + + +
+
MGL suffix: (dat) .max
+

Gets maximal value of the data. +

+ + +
+
MGL suffix: (dat) .min
+

Gets minimal value of the data. +

+ + +
+
MGL suffix: (dat) .mx
+
MGL suffix: (dat) .my
+
MGL suffix: (dat) .mz
+

Gets approximated (interpolated) position of maximum to variables x, y, z and returns the maximal value. +

+ + +
+
MGL suffix: (dat) .mxf
+
MGL suffix: (dat) .myf
+
MGL suffix: (dat) .mzf
+
MGL suffix: (dat) .mxl
+
MGL suffix: (dat) .myl
+
MGL suffix: (dat) .mzl
+

Get first starting from give position (or last one if from<0) maximum along direction dir, and save its orthogonal coordinates in p1, p2. +

+ + + +
+
MGL suffix: (dat) .sum
+
MGL suffix: (dat) .ax
+
MGL suffix: (dat) .ay
+
MGL suffix: (dat) .az
+
MGL suffix: (dat) .aa
+
MGL suffix: (dat) .wx
+
MGL suffix: (dat) .wy
+
MGL suffix: (dat) .wz
+
MGL suffix: (dat) .wa
+
MGL suffix: (dat) .sx
+
MGL suffix: (dat) .sy
+
MGL suffix: (dat) .sz
+
MGL suffix: (dat) .sa
+
MGL suffix: (dat) .kx
+
MGL suffix: (dat) .ky
+
MGL suffix: (dat) .kz
+
MGL suffix: (dat) .ka
+

Gets zero-momentum (energy, I=\sum dat_i) and write first momentum (median, a = \sum \xi_i dat_i/I), second momentum (width, w^2 = \sum (\xi_i-a)^2 dat_i/I), third momentum (skewness, s = \sum (\xi_i-a)^3 dat_i/ I w^3) and fourth momentum (kurtosis, k = \sum (\xi_i-a)^4 dat_i / 3 I w^4) to variables. Here \xi is corresponding coordinate if dir is `'x'`, `'y'` or `'z'`. Otherwise median is a = \sum dat_i/N, width is w^2 = \sum (dat_i-a)^2/N and so on. +

+ +
+
MGL suffix: (dat) .fst
+

Find position (after specified in i, j, k) of first nonzero value of formula cond. Function return the data value at found position. +

+ +
+
MGL suffix: (dat) .lst
+

Find position (before specified in i, j, k) of last nonzero value of formula cond. Function return the data value at found position. +

+ + +
+
MGL suffix: (dat) .a
+

Give first (for .a, i.e. dat->a[0]). +

+ + + +
+ + + +

4.10 Operators

+ + +
+
MGL command: copy DAT dat2 ['eq'='']
+

Copies data from other variable. +

+ +
+
MGL command: copy dat val
+

Set all data values equal to val. +

+ +
+
MGL command: multo dat dat2
+
MGL command: multo dat val
+

Multiplies data element by the other one or by value. +

+ +
+
MGL command: divto dat dat2
+
MGL command: divto dat val
+

Divides each data element by the other one or by value. +

+ +
+
MGL command: addto dat dat2
+
MGL command: addto dat val
+

Adds to each data element the other one or the value. +

+ +
+
MGL command: subto dat dat2
+
MGL command: subto dat val
+

Subtracts from each data element the other one or the value. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.11 Global functions

+ + + +
+
MGL command: transform DAT 'type' real imag
+

Does integral transformation of complex data real, imag on specified direction. The order of transformations is specified in string type: first character for x-dimension, second one for y-dimension, third one for z-dimension. The possible character are: `f` is forward Fourier transformation, `i` is inverse Fourier transformation, `s` is Sine transform, `c` is Cosine transform, `h` is Hankel transform, `n` or ` ` is no transformation. +

+ +
+
MGL command: transforma DAT 'type' ampl phase
+

The same as previous but with specified amplitude ampl and phase phase of complex numbers. +

+ +
+
MGL command: fourier reDat imDat 'dir'
+
MGL command: fourier complexDat 'dir'
+

Does Fourier transform of complex data re+i*im in directions dir. Result is placed back into re and im data arrays. If dir contain `i` then inverse Fourier is used. +

+ +
+
MGL command: stfad RES real imag dn ['dir'='x']
+

Short time Fourier transformation for real and imaginary parts. Output is amplitude of partial Fourier of length dn. For example if dir=`x`, result will have size {int(nx/dn), dn, ny} and it will contain res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn. +

+ +
+
MGL command: triangulate dat xdat ydat
+

Do Delone triangulation for 2d points and return result suitable for triplot and tricont. See Making regular data, for sample code and picture. +

+ + +
+
MGL command: tridmat RES ADAT BDAT CDAT DDAT 'how'
+

Get array as solution of tridiagonal system of equations A[i]*x[i-1]+B[i]*x[i]+C[i]*x[i+1]=D[i]. String how may contain: +

    +
  • `xyz` for solving along x-,y-,z-directions correspondingly; +
  • `h` for solving along hexagonal direction at x-y plain (require square matrix); +
  • `c` for using periodical boundary conditions; +
  • `d` for for diffraction/diffuse calculation (i.e. for using -A[i]*D[i-1]+(2-B[i])*D[i]-C[i]*D[i+1] at right part instead of D[i]). +
+

Data dimensions of arrays A, B, C should be equal. Also their dimensions need to be equal to all or to minor dimension(s) of array D. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters Min, Max set the bounding box for the solution. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. At this moment, simplified form of function ham is supported - all “mixed” terms (like `x*p`->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like `x*q`->x*d/dy) are allowed. Here variable `u` is used for field amplitude |u|. This allow one solve nonlinear problems - for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)". See also apde, qo2d, qo3d. See PDE solving hints, for sample code and picture. +

+ +
+
MGL command: apde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters Min, Max set the bounding box for the solution. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. The advanced and rather slow algorithm is used for taking into account both spatial dispersion and inhomogeneities of media [see A.A. Balakin, E.D. Gospodchikov, A.G. Shalashov, JETP letters v.104, p.690-695 (2016)]. Variable `u` is used for field amplitude |u|. This allow one solve nonlinear problems - for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)". See also pde. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: ray RES 'ham' x0 y0 z0 p0 q0 v0 [dt=0.1 tmax=10]
+

Solves GO ray equation like dr/dt = d ham/dp, dp/dt = -d ham/dr. This is Hamiltonian equations for particle trajectory in 3D case. Here ham is Hamiltonian which may depend on coordinates `x`, `y`, `z`, momentums `p`=px, `q`=py, `v`=pz and time `t`: ham = H(x,y,z,p,q,v,t). The starting point (at t=0) is defined by variables r0, p0. Parameters dt and tmax specify the integration step and maximal time for ray tracing. Result is array of {x,y,z,p,q,v,t} with dimensions {7 * int(tmax/dt+1) }. +

+ +
+
MGL command: ode RES 'df' 'var' ini [dt=0.1 tmax=10]
+

Solves ODE equations dx/dt = df(x). The functions df can be specified as string of `;`-separated textual formulas (argument var set the character ids of variables x[i]) or as callback function, which fill dx array for give x`s. Parameters ini, dt, tmax set initial values, time step and maximal time of the calculation. Function stop execution if NAN or INF values appears. Result is data array with dimensions {n * Nt}, where Nt <= int(tmax/dt+1) +

+ +
+
MGL command: qo2d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy]
+

Solves equation du/dt = i*k0*ham(p,q,x,y,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators (see mglPDE() for details). Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters ray set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by ray function. Note, that the reference ray must be smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If xx and yy are non-zero then Cartesian coordinates for each point will be written into them. See also pde, qo3d. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: qo3d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy zz]
+

Solves equation du/dt = i*k0*ham(p,q,v,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy, v=-i/k0*d/dz are pseudo-differential operators (see mglPDE() for details). Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters ray set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by ray function. Note, that the reference ray must be smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If xx and yy and zz are non-zero then Cartesian coordinates for each point will be written into them. See also pde, qo2d. See PDE solving hints, for sample code and picture. +

+ + +
+
MGL command: jacobian RES xdat ydat [zdat]
+

Computes the Jacobian for transformation {i,j,k} to {x,y,z} where initial coordinates {i,j,k} are data indexes normalized in range [0,1]. The Jacobian is determined by formula det||dr_\alpha/d\xi_\beta|| where r={x,y,z} and \xi={i,j,k}. All dimensions must be the same for all data arrays. Data must be 3D if all 3 arrays {x,y,z} are specified or 2D if only 2 arrays {x,y} are specified. +

+ +
+
MGL command: triangulation RES xdat ydat
+

Computes triangulation for arbitrary placed points with coordinates {x,y} (i.e. finds triangles which connect points). MathGL use s-hull code for triangulation. The sizes of 1st dimension must be equal for all arrays x.nx=y.nx. Resulting array can be used in triplot or tricont functions for visualization of reconstructed surface. See Making regular data, for sample code and picture. +

+ + + +
+
MGL command: ifs2d RES dat num [skip=20]
+

Computes num points {x[i]=res[0,i], y[i]=res[1,i]} for fractal using iterated function system. Matrix dat is used for generation according the formulas +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[4,i];
+y[i+1] = dat[2,i]*x[i] + dat[3,i]*y[i] + dat[5,i];
+

Value dat[6,i] is used as weight factor for i-th row of matrix dat. At this first skip iterations will be omitted. Data array dat must have x-size greater or equal to 7. See also ifs3d, flame2d. See ifs2d sample, for sample code and picture. +

+ +
+
MGL command: ifs3d RES dat num [skip=20]
+

Computes num points {x[i]=res[0,i], y[i]=res[1,i], z[i]=res[2,i]} for fractal using iterated function system. Matrix dat is used for generation according the formulas +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[2,i]*z[i] + dat[9,i];
+y[i+1] = dat[3,i]*x[i] + dat[4,i]*y[i] + dat[5,i]*z[i] + dat[10,i];
+z[i+1] = dat[6,i]*x[i] + dat[7,i]*y[i] + dat[8,i]*z[i] + dat[11,i];
+

Value dat[12,i] is used as weight factor for i-th row of matrix dat. At this first skip iterations will be omitted. Data array dat must have x-size greater or equal to 13. See also ifs2d. See ifs3d sample, for sample code and picture. +

+ +
+
MGL command: ifsfile RES 'fname' 'name' num [skip=20]
+

Reads parameters of IFS fractal named name from file fname and computes num points for this fractal. At this first skip iterations will be omitted. See also ifs2d, ifs3d. +

+

IFS file may contain several records. Each record contain the name of fractal (`binary` in the example below) and the body of fractal, which is enclosed in curly braces {}. Symbol `;` start the comment. If the name of fractal contain `(3D)` or `(3d)` then the 3d IFS fractal is specified. The sample below contain two fractals: `binary` - usual 2d fractal, and `3dfern (3D)` - 3d fractal. See also ifs2d, ifs3d. +

+
 binary
+ { ; comment allowed here
+  ; and here
+  .5  .0 .0 .5 -2.563477 -0.000003 .333333   ; also comment allowed here
+  .5  .0 .0 .5  2.436544 -0.000003 .333333
+  .0 -.5 .5 .0  4.873085  7.563492 .333333
+  }
+
+ 3dfern (3D) {
+   .00  .00 0 .0 .18 .0 0  0.0 0.00 0 0.0 0 .01
+   .85  .00 0 .0 .85 .1 0 -0.1 0.85 0 1.6 0 .85
+   .20 -.20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  -.20  .20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  }
+
+ +
+
MGL command: flame2d RES dat func num [skip=20]
+

Computes num points {x[i]=res[0,i], y[i]=res[1,i]} for "flame" fractal using iterated function system. Array func define "flame" function identificator (func[0,i,j]), its weight (func[0,i,j]) and arguments (func[2 ... 5,i,j]). Matrix dat set linear transformation of coordinates before applying the function. The resulting coordinates are +

xx = dat[0,i]*x[j] + dat[1,j]*y[i] + dat[4,j];
+yy = dat[2,i]*x[j] + dat[3,j]*y[i] + dat[5,j];
+x[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_x(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+y[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_y(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+

The possible function ids are: mglFlame2d_linear=0, mglFlame2d_sinusoidal, mglFlame2d_spherical, mglFlame2d_swirl, mglFlame2d_horseshoe, + mglFlame2d_polar, mglFlame2d_handkerchief,mglFlame2d_heart, mglFlame2d_disc, mglFlame2d_spiral, + mglFlame2d_hyperbolic, mglFlame2d_diamond, mglFlame2d_ex, mglFlame2d_julia, mglFlame2d_bent, + mglFlame2d_waves, mglFlame2d_fisheye, mglFlame2d_popcorn, mglFlame2d_exponential, mglFlame2d_power, + mglFlame2d_cosine, mglFlame2d_rings, mglFlame2d_fan, mglFlame2d_blob, mglFlame2d_pdj, + mglFlame2d_fan2, mglFlame2d_rings2, mglFlame2d_eyefish, mglFlame2d_bubble, mglFlame2d_cylinder, + mglFlame2d_perspective, mglFlame2d_noise, mglFlame2d_juliaN, mglFlame2d_juliaScope, mglFlame2d_blur, + mglFlame2d_gaussian, mglFlame2d_radialBlur, mglFlame2d_pie, mglFlame2d_ngon, mglFlame2d_curl, + mglFlame2d_rectangles, mglFlame2d_arch, mglFlame2d_tangent, mglFlame2d_square, mglFlame2d_blade, + mglFlame2d_secant, mglFlame2d_rays, mglFlame2d_twintrian, mglFlame2d_cross, mglFlame2d_disc2, + mglFlame2d_supershape, mglFlame2d_flower, mglFlame2d_conic, mglFlame2d_parabola, mglFlame2d_bent2, + mglFlame2d_bipolar, mglFlame2d_boarders, mglFlame2d_butterfly, mglFlame2d_cell, mglFlame2d_cpow, + mglFlame2d_curve, mglFlame2d_edisc, mglFlame2d_elliptic, mglFlame2d_escher, mglFlame2d_foci, + mglFlame2d_lazySusan, mglFlame2d_loonie, mglFlame2d_preBlur, mglFlame2d_modulus, mglFlame2d_oscope, + mglFlame2d_polar2, mglFlame2d_popcorn2, mglFlame2d_scry, mglFlame2d_separation, mglFlame2d_split, + mglFlame2d_splits, mglFlame2d_stripes, mglFlame2d_wedge, mglFlame2d_wedgeJulia, mglFlame2d_wedgeSph, + mglFlame2d_whorl, mglFlame2d_waves2, mglFlame2d_exp, mglFlame2d_log, mglFlame2d_sin, + mglFlame2d_cos, mglFlame2d_tan, mglFlame2d_sec, mglFlame2d_csc, mglFlame2d_cot, + mglFlame2d_sinh, mglFlame2d_cosh, mglFlame2d_tanh, mglFlame2d_sech, mglFlame2d_csch, + mglFlame2d_coth, mglFlame2d_auger, mglFlame2d_flux. +Value dat[6,i] is used as weight factor for i-th row of matrix dat. At this first skip iterations will be omitted. Sizes of data arrays must be: dat.nx>=7, func.nx>=2 and func.nz=dat.ny. See also ifs2d, ifs3d. See flame2d sample, for sample code and picture. +

+ + + +
+ + + +

4.12 Evaluate expression

+ + +

You can use arbitrary formulas of existed data arrays or constants as any argument of data processing or data plotting commands. There are only 2 limitations: formula shouldn`t contain spaces (to be recognized as single argument), and formula cannot be used as argument which will be (re)created by MGL command. +

+ + +
+ + + +

4.13 Special data classes

+ + + +

MGL use these special classes automatically. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

5 MathGL examples

+ + +

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. +

+ + + + + + + + + + +
+ +
+

+Next: , Up: Examples   [Contents][Index]

+
+ +

5.1 Basic usage

+ + +

MGL script can be used by several manners. Each has positive and negative sides: +

    +
  • Using UDAV. + +

    Positive sides are possibilities to view the plot at once and to modify it, rotate, zoom or switch on transparency or lighting by hands or by mouse. Negative side is the needness of the X-terminal.

    +
  • Using command line tools. + +

    Positive aspects are: batch processing of similar data set, for example, a set of resulting data files for different calculation parameters), running from the console program, including the cluster calculation), fast and automated drawing, saving pictures for further analysis, or demonstration). Negative sides are: the usage of the external program for picture viewing. Also, the data plotting is non-visual. So, you have to imagine the picture, view angles, lighting and so on) before the plotting. I recommend to use graphical window for determining the optimal parameters of plotting on the base of some typical data set. And later use these parameters for batch processing in console program. +

    +

    In this case you can use the program: mglconv or mglview for viewing. +

    +
  • Using C/C++/... code. + +

    You can easily execute MGL script within C/C++/Fortan code. This can be useful for fast data plotting, for example, in web applications, where textual string (MGL script) may contain all necessary information for plot. The basic C++ code may look as following +

    const char *mgl_script; // script itself, can be of type const wchar_t*
    +mglGraph gr;
    +mglParse pr;
    +pr.Execute(&gr, mgl_script);
    +
+ +

The simplest script is +

box         # draw bounding box
+axis        # draw axis
+fplot 'x^3' # draw some function
+
+

Just type it in UDAV and press F5. Also you can save it in text file `test.mgl` and type in the console mglconv test.mgl what produce file `test.mgl.png` with resulting picture. +

+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.2 Advanced usage

+ + +

Now I show several non-obvious features of MGL: several subplots in a single picture, curvilinear coordinates, text printing and so on. Generally you may miss this section at first reading, but I don`t recommend it. +

+ + + + + + + + + + + + + +
+ + + +

5.2.1 Subplots

+ + +

Let me demonstrate possibilities of plot positioning and rotation. MathGL has a set of functions: subplot, inplot, title, aspect and rotate and so on (see Subplots and rotation). The order of their calling is strictly determined. First, one changes the position of plot in image area (functions subplot, inplot and multiplot). Secondly, you can add the title of plot by title function. After that one may rotate the plot (command rotate). Finally, one may change aspects of axes (command aspect). The following code illustrates the aforesaid it: +

subplot 2 2 0
+box:text -1 1.1 'Just box' ':L'
+inplot 0.2 0.5 0.7 1 off
+box:text 0 1.2 'InPlot example'
+
+subplot 2 2 1:title 'Rotate only'
+rotate 50 60:box
+
+subplot 2 2 2:title 'Rotate and Aspect'
+rotate 50 60:aspect 1 1 2:box
+
+subplot 2 2 3:title 'Shear'
+box 'c':shear 0.2 0.1:box
+

Here I used function Puts for printing the text in arbitrary position of picture (see Text printing). Text coordinates and size are connected with axes. However, text coordinates may be everywhere, including the outside the bounding box. I`ll show its features later in Text features. +

+

Note that several commands can be placed in a string if they are separated by `:` symbol. +

+
Example of several subplots on the single picture. +
+

More complicated sample show how to use most of positioning functions: +

subplot 3 2 0:title 'StickPlot'
+stickplot 3 0 20 30:box 'r':text 0 0 0 '0' 'r'
+stickplot 3 1 20 30:box 'g':text 0 0 0 '1' 'g'
+stickplot 3 2 20 30:box 'b':text 0 0 0 '2' 'b'
+
+subplot 3 2 3 '':title 'ColumnPlot'
+columnplot 3 0:box 'r':text 0 0 '0' 'r'
+columnplot 3 1:box 'g':text 0 0 '1' 'g'
+columnplot 3 2:box 'b':text 0 0 '2' 'b'
+
+subplot 3 2 4 '':title 'GridPlot'
+gridplot 2 2 0:box 'r':text 0 0 '0' 'r'
+gridplot 2 2 1:box 'g':text 0 0 '1' 'g'
+gridplot 2 2 2:box 'b':text 0 0 '2' 'b'
+gridplot 2 2 3:box 'm':text 0 0 '3' 'm'
+
+subplot 3 2 5 '':title 'InPlot':box
+inplot 0.4 1 0.6 1 on:box 'r'
+
+multiplot 3 2 1 2 1 '':title 'MultiPlot and ShearPlot':box
+shearplot 3 0 0.2 0.1:box 'r':text 0 0 '0' 'r'
+shearplot 3 1 0.2 0.1:box 'g':text 0 0 '1' 'g'
+shearplot 3 2 0.2 0.1:box 'b':text 0 0 '2' 'b'
+
+
Example for most of positioning functions. +
+ +
+ + + +

5.2.2 Axis and ticks

+ + +

MathGL library can draw not only the bounding box but also the axes, grids, labels and so on. The ranges of axes and their origin (the point of intersection) are determined by functions SetRange(), SetRanges(), SetOrigin() (see Ranges (bounding box)). Ticks on axis are specified by function SetTicks, SetTicksVal, SetTicksTime (see Ticks). But usually +

+

Command axis draws axes. Its textual string shows in which directions the axis or axes will be drawn (by default "xyz", function draws axes in all directions). Command grid draws grid perpendicularly to specified directions. Example of axes and grid drawing is: +

subplot 2 2 0:title 'Axis origin, Grid'
+origin 0 0:axis:grid:fplot 'x^3'
+
+subplot 2 2 1:title '2 axis'
+ranges -1 1 -1 1:origin -1 -1:axis
+ylabel 'axis_1':fplot 'sin(pi*x)' 'r2'
+ranges 0 1 0 1:origin 1 1:axis
+ylabel 'axis_2':fplot 'cos(pi*x)'
+
+subplot 2 2 3:title 'More axis'
+origin nan nan:xrange -1 1:axis
+xlabel 'x' 0:ylabel 'y_1' 0:fplot 'x^2' 'k'
+yrange -1 1:origin -1.3 -1:axis 'y' 'r'
+ylabel '#r{y_2}' 0.2:fplot 'x^3' 'r'
+
+subplot 2 2 2:title '4 segments, inverted axis':origin 0 0:
+inplot 0.5 1 0.5 1 on:ranges 0 10 0 2:axis
+fplot 'sqrt(x/2)':xlabel 'W' 1:ylabel 'U' 1
+inplot 0 0.5 0.5 1 on:ranges 1 0 0 2:axis 'x'
+fplot 'sqrt(x)+x^3':xlabel '\tau' 1
+inplot 0.5 1 0 0.5 on:ranges 0 10 4 0:axis 'y'
+fplot 'x/4':ylabel 'L' -1
+inplot 0 0.5 0 0.5 on:ranges 1 0 4 0:fplot '4*x^2'
+
+

Note, that MathGL can draw not only single axis (which is default). But also several axis on the plot (see right plots). The idea is that the change of settings does not influence on the already drawn graphics. So, for 2-axes I setup the first axis and draw everything concerning it. Then I setup the second axis and draw things for the second axis. Generally, the similar idea allows one to draw rather complicated plot of 4 axis with different ranges (see bottom left plot). +

+

At this inverted axis can be created by 2 methods. First one is used in this sample - just specify minimal axis value to be large than maximal one. This method work well for 2D axis, but can wrongly place labels in 3D case. Second method is more general and work in 3D case too - just use aspect function with negative arguments. For example, following code will produce exactly the same result for 2D case, but 2nd variant will look better in 3D. +

# variant 1
+ranges 0 10 4 0:axis
+
+# variant 2
+ranges 0 10 0 4:aspect 1 -1:axis
+
+
Example of axis. +
+

Another MathGL feature is fine ticks tunning. By default (if it is not changed by SetTicks function), MathGL try to adjust ticks positioning, so that they looks most human readable. At this, MathGL try to extract common factor for too large or too small axis ranges, as well as for too narrow ranges. Last one is non-common notation and can be disabled by SetTuneTicks function. +

+

Also, one can specify its own ticks with arbitrary labels by help of SetTicksVal function. Or one can set ticks in time format. In last case MathGL will try to select optimal format for labels with automatic switching between years, months/days, hours/minutes/seconds or microseconds. However, you can specify its own time representation using formats described in http://www.manpagez.com/man/3/strftime/. Most common variants are `%X` for national representation of time, `%x` for national representation of date, `%Y` for year with century. +

+

The sample code, demonstrated ticks feature is +

subplot 3 3 0:title 'Usual axis'
+axis
+
+subplot 3 3 1:title 'Too big/small range'
+ranges -1000 1000 0 0.001:axis
+
+subplot 3 3 2:title 'LaTeX-like labels'
+axis 'F!'
+
+subplot 3 3 3:title 'Too narrow range'
+ranges 100 100.1 10 10.01:axis
+
+subplot 3 3 4:title 'No tuning, manual "+"'
+axis '+!'
+# for version <2.3 you can use
+#tuneticks off:axis
+
+subplot 3 3 5:title 'Template for ticks'
+xtick 'xxx:%g':ytick 'y:%g'
+axis
+
+xtick '':ytick '' # switch it off for other plots
+
+subplot 3 3 6:title 'No tuning, higher precision'
+axis '!4'
+
+subplot 3 3 7:title 'Manual ticks'
+ranges -pi pi 0 2
+xtick pi 3 '\pi'
+xtick 0.886 'x^*' on # note this will disable subticks drawing
+# or you can use
+#xtick -pi '\pi' -pi/2 '-\pi/2' 0 '0' 0.886 'x^*' pi/2 '\pi/2' pi 'pi'
+# or you can use
+#list v -pi -pi/2 0 0.886 pi/2 pi:xtick v '-\pi\n-\pi/2\n{}0\n{}x^*\n\pi/2\n\pi'
+axis:grid:fplot '2*cos(x^2)^2' 'r2'
+
+subplot 3 3 8:title 'Time ticks'
+xrange 0 3e5:ticktime 'x':axis
+
+
Features of axis ticks. +
+

The last sample I want to show in this subsection is Log-axis. From MathGL`s point of view, the log-axis is particular case of general curvilinear coordinates. So, we need first define new coordinates (see also Curvilinear coordinates) by help of SetFunc or SetCoor functions. At this one should wary about proper axis range. So the code looks as following: +

subplot 2 2 0 '<_':title 'Semi-log axis'
+ranges 0.01 100 -1 1:axis 'lg(x)' '' ''
+axis:grid 'xy' 'g':fplot 'sin(1/x)'
+xlabel 'x' 0:ylabel 'y = sin 1/x' 0
+
+subplot 2 2 1 '<_':title 'Log-log axis'
+ranges 0.01 100 0.1 100:axis 'lg(x)' 'lg(y)' ''
+axis:grid '!' 'h=':grid:fplot 'sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = \sqrt{1+x^2}' 0
+
+subplot 2 2 2 '<_':title 'Minus-log axis'
+ranges -100 -0.01 -100 -0.1:axis '-lg(-x)' '-lg(-y)' ''
+axis:fplot '-sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = -\sqrt{1+x^2}' 0
+
+subplot 2 2 3 '<_':title 'Log-ticks'
+ranges 0.01 100 0 100:axis 'sqrt(x)' '' ''
+axis:fplot 'x'
+xlabel 'x' 1:ylabel 'y = x' 0
+
+
Features of axis ticks. +
+

You can see that MathGL automatically switch to log-ticks as we define log-axis formula (in difference from v.1.*). Moreover, it switch to log-ticks for any formula if axis range will be large enough (see right bottom plot). Another interesting feature is that you not necessary define usual log-axis (i.e. when coordinates are positive), but you can define “minus-log” axis when coordinate is negative (see left bottom plot). +

+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.3 Curvilinear coordinates

+ + +

As I noted in previous subsection, MathGL support curvilinear coordinates. In difference from other plotting programs and libraries, MathGL uses textual formulas for connection of the old (data) and new (output) coordinates. This allows one to plot in arbitrary coordinates. The following code plots the line y=0, z=0 in Cartesian, polar, parabolic and spiral coordinates: +

origin -1 1 -1
+subplot 2 2 0:title 'Cartesian':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' '':
+subplot 2 2 1:title 'Cylindrical':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+axis '2*y*x' 'y*y - x*x' ''
+subplot 2 2 2:title 'Parabolic':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' 'x+z'
+subplot 2 2 3:title 'Spiral':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+
Example of curvilinear coordinates +
+ + +
+ + + +

5.2.4 Colorbars

+ + +

MathGL handle colorbar as special kind of axis. So, most of functions for axis and ticks setup will work for colorbar too. Colorbars can be in log-scale, and generally as arbitrary function scale; common factor of colorbar labels can be separated; and so on. +

+

But of course, there are differences - colorbars usually located out of bounding box. At this, colorbars can be at subplot boundaries (by default), or at bounding box (if symbol `I` is specified). Colorbars can handle sharp colors. And they can be located at arbitrary position too. The sample code, which demonstrate colorbar features is: +

call 'prepare2d'
+new v 9 'x'
+
+subplot 2 2 0:title 'Colorbar out of box':box
+colorbar '<':colorbar '>':colorbar '_':colorbar '^'
+
+subplot 2 2 1:title 'Colorbar near box':box
+colorbar '<I':colorbar '>I':colorbar '_I':colorbar '^I'
+
+subplot 2 2 2:title 'manual colors':box:contd v a
+colorbar v '<':colorbar v '>':colorbar v '_':colorbar v '^'
+
+subplot 2 2 3:title '':text -0.5 1.55 'Color positions' ':C' -2
+
+colorbar 'bwr>' 0.25 0:text -0.9 1.2 'Default'
+colorbar 'b{w,0.3}r>' 0.5 0:text -0.1 1.2 'Manual'
+
+crange 0.01 1e3
+colorbar '>' 0.75 0:text 0.65 1.2 'Normal scale'
+colorbar '>':text 1.35 1.2 'Log scale'
+
+
Example of colorbars +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.5 Bounding box

+ + +

Box around the plot is rather useful thing because it allows one to: see the plot boundaries, and better estimate points position since box contain another set of ticks. MathGL provide special function for drawing such box - box function. By default, it draw black or white box with ticks (color depend on transparency type, see Types of transparency). However, you can change the color of box, or add drawing of rectangles at rear faces of box. Also you can disable ticks drawing, but I don`t know why anybody will want it. The sample code, which demonstrate box features is: +

subplot 2 2 0:title 'Box (default)':rotate 50 60:box
+
+subplot 2 2 1:title 'colored':rotate 50 60:box 'r'
+
+subplot 2 2 2:title 'with faces':rotate 50 60:box '@'
+
+subplot 2 2 3:title 'both':rotate 50 60:box '@cm'
+
+
Example of Box() +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.6 Ternary axis

+ + +

There are another unusual axis types which are supported by MathGL. These are ternary and quaternary axis. Ternary axis is special axis of 3 coordinates a, b, c which satisfy relation a+b+c=1. Correspondingly, quaternary axis is special axis of 4 coordinates a, b, c, d which satisfy relation a+b+c+d=1. +

+

Generally speaking, only 2 of coordinates (3 for quaternary) are independent. So, MathGL just introduce some special transformation formulas which treat a as `x`, b as `y` (and c as `z` for quaternary). As result, all plotting functions (curves, surfaces, contours and so on) work as usual, but in new axis. You should use ternary function for switching to ternary/quaternary coordinates. The sample code is: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':copy ry (1-rx)*rnd
+light on
+
+subplot 2 2 0:title 'Ordinary axis 3D':rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':zlabel 'Z'
+
+subplot 2 2 1:title 'Ternary axis (x+y+t=1)':ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y 'r2':plot rx ry 'q^ ':cont a:line 0.5 0 0 0.75 'g2'
+xlabel 'B':ylabel 'C':tlabel 'A'
+
+subplot 2 2 2:title 'Quaternary axis 3D':rotate 50 60:ternary 2
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'D'
+
+subplot 2 2 3:title 'Ternary axis 3D':rotate 50 60:ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'Z'
+
+
Ternary and Quaternary axis +
+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.7 Text features

+ + +

MathGL prints text by vector font. There are functions for manual specifying of text position (like Puts) and for its automatic selection (like Label, Legend and so on). MathGL prints text always in specified position even if it lies outside the bounding box. The default size of font is specified by functions SetFontSize* (see Font settings). However, the actual size of output string depends on subplot size (depends on functions SubPlot, InPlot). The switching of the font style (italic, bold, wire and so on) can be done for the whole string (by function parameter) or inside the string. By default MathGL parses TeX-like commands for symbols and indexes (see Font styles). +

+

Text can be printed as usual one (from left to right), along some direction (rotated text), or along a curve. Text can be printed on several lines, divided by new line symbol `\n`. +

+

Example of MathGL font drawing is: +

call 'prepare1d'
+
+subplot 2 2 0 ''
+text 0 1 'Text can be in ASCII and in Unicode'
+text 0 0.6 'It can be \wire{wire}, \big{big} or #r{colored}'
+text 0 0.2 'One can change style in string: \b{bold}, \i{italic, \b{both}}'
+text 0 -0.2 'Easy to \a{overline} or \u{underline}'
+text 0 -0.6 'Easy to change indexes ^{up} _{down} @{center}'
+text 0 -1 'It parse TeX: \int \alpha \cdot \
+\sqrt3{sin(\pi x)^2 + \gamma_{i_k}} dx'
+
+subplot 2 2 1 ''
+ text 0 0.5 '\sqrt{\frac{\alpha^{\gamma^2}+\overset 1{\big\infty}}{\sqrt3{2+b}}}' '@' -2
+text 0 -0.5 'Text can be printed\n{}on several lines'
+
+subplot 2 2 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn under a curve' 'Tr'
+
+subplot 2 2 3 '':line -1 -1 1 -1 'rA':text 0 -1 1 -1 'Horizontal'
+line -1 -1 1 1 'rA':text 0 0 1 1 'At angle' '@'
+line -1 -1 -1 1 'rA':text -1 0 -1 1 'Vertical'
+
+
Example of text printing +
+

You can change font faces by loading font files by function loadfont. Note, that this is long-run procedure. Font faces can be downloaded from MathGL website or from here. The sample code is: +

define d 0.25
+loadfont 'STIX':text 0 1.1 'default font (STIX)'
+loadfont 'adventor':text 0 1.1-d 'adventor font'
+loadfont 'bonum':text 0 1.1-2*d 'bonum font'
+loadfont 'chorus':text 0 1.1-3*d 'chorus font'
+loadfont 'cursor':text 0 1.1-4*d 'cursor font'
+loadfont 'heros':text 0 1.1-5*d 'heros font'
+loadfont 'heroscn':text 0 1.1-6*d 'heroscn font'
+loadfont 'pagella':text 0 1.1-7*d 'pagella font'
+loadfont 'schola':text 0 1.1-8*d 'schola font'
+loadfont 'termes':text 0 1.1-9*d 'termes font'
+
+
Example of font faces +
+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.8 Legend sample

+ + +

Legend is one of standard ways to show plot annotations. Basically you need to connect the plot style (line style, marker and color) with some text. In MathGL, you can do it by 2 methods: manually using addlegend function; or use `legend` option (see Command options), which will use last plot style. In both cases, legend entries will be added into internal accumulator, which later used for legend drawing itself. clearlegend function allow you to remove all saved legend entries. +

+

There are 2 features. If plot style is empty then text will be printed without indent. If you want to plot the text with indent but without plot sample then you need to use space ` ` as plot style. Such style ` ` will draw a plot sample (line with marker(s)) which is invisible line (i.e. nothing) and print the text with indent as usual one. +

+

Command legend draw legend on the plot. The position of the legend can be selected automatic or manually. You can change the size and style of text labels, as well as setup the plot sample. The sample code demonstrating legend features is: +

addlegend 'sin(\pi {x^2})' 'b'
+addlegend 'sin(\pi x)' 'g*'
+addlegend 'sin(\pi \sqrt{x})' 'rd'
+addlegend 'jsut text' ' '
+addlegend 'no indent for this' ''
+
+subplot 2 2 0 '':title 'Legend (default)':box
+legend
+
+text 0.75 0.65 'Absolute position' 'A'
+legend 3 'A#'
+
+subplot 2 2 2 '':title 'coloring':box
+legend 0 'r#':legend 1 'Wb#':legend 2 'ygr#'
+
+subplot 2 2 3 '':title 'manual position':box
+legend 0.5 1:text 0.5 0.55 'at x=0.5, y=1' 'a'
+legend 1 '#-':text 0.75 0.25 'Horizontal legend' 'a'
+
+
Example of legend +
+ +
+ +
+

+Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.9 Cutting sample

+ + +

The last common thing which I want to show in this section is how one can cut off points from plot. There are 4 mechanism for that. +

    +
  • You can set one of coordinate to NAN value. All points with NAN values will be omitted. + +
  • You can enable cutting at edges by SetCut function. As result all points out of bounding box will be omitted. + +
  • You can set cutting box by SetCutBox function. All points inside this box will be omitted. + +
  • You can define cutting formula by SetCutOff function. All points for which the value of formula is nonzero will be omitted. Note, that this is the slowest variant. +
+ +

Below I place the code which demonstrate last 3 possibilities: +

call 'prepare2d'
+call 'prepare3d'
+
+subplot 2 2 0:title 'Cut on (default)':rotate 50 60
+light on:box:surf a; zrange -1 0.5
+
+subplot 2 2 1:title 'Cut off':rotate 50 60
+box:surf a; zrange -1 0.5; cut off
+
+subplot 2 2 2:title 'Cut in box':rotate 50 60:box:alpha on
+cut 0 -1 -1 1 0 1.1:surf3 c
+cut 0 0 0 0 0 0	# restore back
+
+subplot 2 2 3:title 'Cut by formula':rotate 50 60:box
+cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)':surf3 c
+
+
Example of point cutting +
+ + + +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.3 Data handling

+ + +

Class mglData contains all functions for the data handling in MathGL (see Data processing). There are several matters why I use class mglData but not a single array: it does not depend on type of data (mreal or double), sizes of data arrays are kept with data, memory working is simpler and safer. +

+ + + + + + +
+ +
+

+Next: , Up: Data handling   [Contents][Index]

+
+ +

5.3.1 Array creation

+ + +

One can put numbers into the data instance by several ways. Let us do it for square function: +

    +
  • one can create array by list command +
    list a 0 0.04 0.16 0.36 0.64 1
    +
    +
  • another way is to copy from “inline” array +
    copy a [0,0.04,0.16,0.36,0.64,1]
    +
    +
  • next way is to fill the data by textual formula with the help of modify function +
    new a 6
    +modify a 'x^2'
    +
    +
  • or one may fill the array in some interval and modify it later +
    new a 6
    +fill a 0 1
    +modify a 'u^2'
    +
    +
  • or fill the array using current axis range +
    new a 6
    +fill a '(x+1)^2/4'
    +

    or use single line +

    new a 6 '(x+1)^2/4'
    +
    +
  • finally it can be loaded from file +
    new s 6 '(x+1)^2/4'
    +save s 'sqr.dat'    # create file first
    +read a 'sqr.dat'    # load it
    +
    +
  • at this one can read only part of data +
    new s 6 '(x+1)^2/4'
    +save s 'sqr.dat'    # create file first
    +read a 'sqr.dat' 5  # load it
    +
+ +

Creation of 2d- and 3d-arrays is mostly the same. One can use direct data filling by list command +

list a 11 12 13 | 21 22 23 | 31 32 33
+

or by inline arrays +

copy a [[11,12,13],[21,22,23],[31,32,33]]
+

Also data can be filled by formula +

new z 30 40 'sin(pi*x)*cos(pi*y)'
+

or loaded from a file. +

+ +
+ +
+

+Previous: , Up: Data handling   [Contents][Index]

+
+ +

5.3.2 Change data

+ + +

MathGL has functions for data processing: differentiating, integrating, smoothing and so on (for more detail, see Data processing). Let us consider some examples. The simplest ones are integration and differentiation. The direction in which operation will be performed is specified by textual string, which may contain symbols `x`, `y` or `z`. For example, the call of diff 'x' will differentiate data along `x` direction; the call of integrate 'xy' perform the double integration of data along `x` and `y` directions; the call of diff2 'xyz' will apply 3d Laplace operator to data and so on. Example of this operations on 2d array a=x*y is presented in code: +

ranges 0 1 0 1 0 1:new a 30 40 'x*y'
+subplot 2 2 0:title 'a(x,y)':rotate 60 40
+surf a:box
+
+subplot 2 2 1:title 'da/dx':rotate 60 40
+diff a 'x':surf a:box
+
+subplot 2 2 2:title '\int da/dx dxdy':rotate 60 40
+integrate a 'xy':surf a:box
+
+subplot 2 2 3:title '\int {d^2}a/dxdy dx':rotate 60 40
+diff2 a 'y':surf a:box
+
+
Example of data differentiation and integration +
+

Data smoothing (command smooth) is more interesting and important. This function has single argument which define type of smoothing and its direction. Now 3 methods are supported: `3` - linear averaging by 3 points, `5` - linear averaging by 5 points, and default one - quadratic averaging by 5 points. +

+

MathGL also have some amazing functions which is not so important for data processing as useful for data plotting. There are functions for finding envelope (useful for plotting rapidly oscillating data), for data sewing (useful to removing jumps on the phase), for data resizing (interpolation). Let me demonstrate it: +

subplot 2 2 0 '':title 'Envelop sample'
+new d1 1000 'exp(-8*x^2)*sin(10*pi*x)'
+axis:plot d1 'b'
+envelop d1 'x'
+plot d1 'r'
+
+subplot 2 2 1 '':title 'Smooth sample':ranges 0 1 0 1
+new y0 30 '0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd'
+copy y1 y0:smooth y1 'x3':plot y1 'r';legend '"3" style'
+copy y2 y0:smooth y2 'x5':plot y2 'g';legend '"5" style'
+copy y3 y0:smooth y3 'x':plot y3 'b';legend 'default'
+plot y0 '{m7}:s';legend 'none':legend:box
+
+subplot 2 2 2:title 'Sew sample':rotate 50 60:light on:alpha on
+new d2 100 100 'mod((y^2-(1-x)^2)/2,0.1)'
+box:surf d2 'b'
+sew d2 'xy' 0.1
+surf d2 'r'
+
+subplot 2 2 3:title 'Resize sample (interpolation)'
+new x0 10 'rnd':new v0 10 'rnd'
+resize x1 x0 100:resize v1 v0 100
+plot x0 v0 'b+ ':plot x1 v1 'r-':label x0 v0 '%n'
+
+
Example of data smoothing +
+

Finally one can create new data arrays on base of the existing one: extract slice, row or column of data (subdata), summarize along a direction(s) (sum), find distribution of data elements (hist) and so on. +

+

Another interesting feature of MathGL is interpolation and root-finding. There are several functions for linear and cubic spline interpolation (see Interpolation). Also there is a function evaluate which do interpolation of data array for values of each data element of index data. It look as indirect access to the data elements. +

+

This function have inverse function solve which find array of indexes at which data array is equal to given value (i.e. work as root finding). But solve function have the issue - usually multidimensional data (2d and 3d ones) have an infinite number of indexes which give some value. This is contour lines for 2d data, or isosurface(s) for 3d data. So, solve function will return index only in given direction, assuming that other index(es) are the same as equidistant index(es) of original data. Let me demonstrate this on the following sample. +

+
zrange 0 1
+new x 20 30 '(x+2)/3*cos(pi*y)'
+new y 20 30 '(x+2)/3*sin(pi*y)'
+new z 20 30 'exp(-6*x^2-2*sin(pi*y)^2)'
+
+subplot 2 1 0:title 'Cartesian space':rotate 30 -40
+axis 'xyzU':box
+xlabel 'x':ylabel 'y'origin 1 1:grid 'xy'
+mesh x y z
+
+# section along 'x' direction
+solve u x 0.5 'x'
+var v u.nx 0 1
+evaluate yy y u v
+evaluate xx x u v
+evaluate zz z u v
+plot xx yy zz 'k2o'
+
+# 1st section along 'y' direction
+solve u1 x -0.5 'y'
+var v1 u1.nx 0 1
+evaluate yy y v1 u1
+evaluate xx x v1 u1
+evaluate zz z v1 u1
+plot xx yy zz 'b2^'
+
+# 2nd section along 'y' direction
+solve u2 x -0.5 'y' u1
+evaluate yy y v1 u2
+evaluate xx x v1 u2
+evaluate zz z v1 u2
+plot xx yy zz 'r2v'
+
+subplot 2 1 1:title 'Accompanied space'
+ranges 0 1 0 1:origin 0 0
+axis:box:xlabel 'i':ylabel 'j':grid2 z 'h'
+
+plot u v 'k2o':line 0.4 0.5 0.8 0.5 'kA'
+plot v1 u1 'b2^':line 0.5 0.15 0.5 0.3 'bA'
+plot v1 u2 'r2v':line 0.5 0.7 0.5 0.85 'rA'
+
+
Example of data interpolation and root finding +
+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.4 Data plotting

+ + +

Let me now show how to plot the data. Next section will give much more examples for all plotting functions. Here I just show some basics. MathGL generally has 2 types of plotting functions. Simple variant requires a single data array for plotting, other data (coordinates) are considered uniformly distributed in axis range. Second variant requires data arrays for all coordinates. It allows one to plot rather complex multivalent curves and surfaces (in case of parametric dependencies). Usually each function have one textual argument for plot style and accept options (see Command options). +

+

Note, that the call of drawing function adds something to picture but does not clear the previous plots (as it does in Matlab). Another difference from Matlab is that all setup (like transparency, lightning, axis borders and so on) must be specified before plotting functions. +

+

Let start for plots for 1D data. Term “1D data” means that data depend on single index (parameter) like curve in parametric form {x(i),y(i),z(i)}, i=1...n. The textual argument allow you specify styles of line and marks (see Line styles). If this parameter is empty '' then solid line with color from palette is used (see Palette and colors). +

+

Below I shall show the features of 1D plotting on base of plot function. Let us start from sinus plot: +

new y0 50 'sin(pi*x)'
+subplot 2 2 0
+plot y0:box
+

Style of line is not specified in plot function. So MathGL uses the solid line with first color of palette (this is blue). Next subplot shows array y1 with 2 rows: +

subplot 2 2 1
+new y1 50 2
+fill y1 'cos(pi*(x+y/4))*2/(y+3)'
+plot y1:box
+

As previously I did not specify the style of lines. As a result, MathGL again uses solid line with next colors in palette (there are green and red). Now let us plot a circle on the same subplot. The circle is parametric curve x=cos(\pi t), y=sin(\pi t). I will set the color of the circle (dark yellow, `Y`) and put marks `+` at point position: +

new x 50 'cos(pi*x)'
+plot x y0 'Y+'
+

Note that solid line is used because I did not specify the type of line. The same picture can be achieved by plot and subdata functions. Let us draw ellipse by orange dash line: +

plot y1(:,0) y1(:,1) 'q|'
+
+

Drawing in 3D space is mostly the same. Let us draw spiral with default line style. Now its color is 4-th color from palette (this is cyan): +

subplot 2 2 2:rotate 60 40
+new z 50 'x'
+plot x y0 z:box
+

Functions plot and subdata make 3D curve plot but for single array. Use it to put circle marks on the previous plot: +

new y2 10 3 'cos(pi*(x+y/2))'
+modify y2 '2*x-1' 2
+plot y2(:,0) y2(:,1) y2(:,2) 'bo '
+

Note that line style is empty ` ` here. Usage of other 1D plotting functions looks similar: +

subplot 2 2 3:rotate 60 40
+bars x y0 z 'r':box
+
+

Surfaces surf and other 2D plots (see 2D plotting) are drown the same simpler as 1D one. The difference is that the string parameter specifies not the line style but the color scheme of the plot (see Color scheme). Here I draw attention on 4 most interesting color schemes. There is gray scheme where color is changed from black to white (string `kw`) or from white to black (string `wk`). Another scheme is useful for accentuation of negative (by blue color) and positive (by red color) regions on plot (string `"BbwrR"`). Last one is the popular “jet” scheme (string `"BbcyrR"`). +

+

Now I shall show the example of a surface drawing. At first let us switch lightning on +

light on
+

and draw the surface, considering coordinates x,y to be uniformly distributed in axis range +

new a0 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+subplot 2 2 0:rotate 60 40
+surf a0:box
+

Color scheme was not specified. So previous color scheme is used. In this case it is default color scheme (“jet”) for the first plot. Next example is a sphere. The sphere is parametrically specified surface: +

new x 50 40 '0.8*sin(pi*x)*cos(pi*y/2)'
+new y 50 40 '0.8*cos(pi*x)*cos(pi*y/2)'
+new z 50 40 '0.8*sin(pi*y/2)'
+subplot 2 2 1:rotate 60 40
+surf x y z 'BbwrR':box
+

I set color scheme to "BbwrR" that corresponds to red top and blue bottom of the sphere. +

+

Surfaces will be plotted for each of slice of the data if nz>1. Next example draws surfaces for data arrays with nz=3: +

new a1 50 40 3
+modify a1 '0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))'
+modify a1 '0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*sin(3*pi*(x*y))' 1
+modify a1 '0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))' 2
+subplot 2 2 2:rotate 60 40
+alpha on
+surf a1:box
+

Note, that it may entail a confusion. However, if one will use density plot then the picture will look better: +

subplot 2 2 3:rotate 60 40
+dens a1:box
+
+

Drawing of other 2D plots is analogous. The only peculiarity is the usage of flag `#`. By default this flag switches on the drawing of a grid on plot (grid or mesh for plots in plain or in volume). However, for isosurfaces (including surfaces of rotation axial) this flag switches the face drawing off and figure becomes wired. +

+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.5 Hints

+ + +

In this section I`ve included some small hints and advices for the improving of the quality of plots and for the demonstration of some non-trivial features of MathGL library. In contrast to previous examples I showed mostly the idea but not the whole drawing function. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

5.5.1 “Compound” graphics

+ + +

As I noted above, MathGL functions (except the special one, like Clf()) do not erase the previous plotting but just add the new one. It allows one to draw “compound” plots easily. For example, popular Matlab command surfc can be emulated in MathGL by 2 calls: +

  Surf(a);
+  Cont(a, "_");     // draw contours at bottom
+

Here a is 2-dimensional data for the plotting, -1 is the value of z-coordinate at which the contour should be plotted (at the bottom in this example). Analogously, one can draw density plot instead of contour lines and so on. +

+

Another nice plot is contour lines plotted directly on the surface: +

  Light(true);       // switch on light for the surface
+  Surf(a, "BbcyrR"); // select 'jet' colormap for the surface
+  Cont(a, "y");      // and yellow color for contours
+

The possible difficulties arise in black&white case, when the color of the surface can be close to the color of a contour line. In that case I may suggest the following code: +

  Light(true);   // switch on light for the surface
+  Surf(a, "kw"); // select 'gray' colormap for the surface
+  CAxis(-1,0);   // first draw for darker surface colors
+  Cont(a, "w");  // white contours
+  CAxis(0,1);    // now draw for brighter surface colors
+  Cont(a, "k");  // black contours
+  CAxis(-1,1);   // return color range to original state
+

The idea is to divide the color range on 2 parts (dark and bright) and to select the contrasting color for contour lines for each of part. +

+

Similarly, one can plot flow thread over density plot of vector field amplitude (this is another amusing plot from Matlab) and so on. The list of compound graphics can be prolonged but I hope that the general idea is clear. +

+

Just for illustration I put here following sample code: +

call 'prepare2v'
+call 'prepare3d'
+new v 10:fill v -0.5 1:copy d sqrt(a^2+b^2)
+subplot 2 2 0:title 'Surf + Cont':rotate 50 60:light on:box
+surf a:cont a 'y'
+
+subplot 2 2 1 '':title 'Flow + Dens':light off:box
+flow a b 'br':dens d
+
+subplot 2 2 2:title 'Mesh + Cont':rotate 50 60:box
+mesh a:cont a '_'
+
+subplot 2 2 3:title 'Surf3 + ContF3':rotate 50 60:light on
+box:contf3 v c 'z' 0:contf3 v c 'x':contf3 v c
+cut 0 -1 -1 1 0 1.1
+contf3 v c 'z' c.nz-1:surf3 c -0.5
+
+
Example of “combined” plots +
+ +
+ + + +

5.5.2 Transparency and lighting

+ + +

Here I want to show how transparency and lighting both and separately change the look of a surface. So, there is code and picture for that: +

call 'prepare2d'
+subplot 2 2 0:title 'default':rotate 50 60:box
+surf a
+
+subplot 2 2 1:title 'light on':rotate 50 60:box
+light on:surf a
+
+subplot 2 2 3:title 'light on; alpha on':rotate 50 60:box
+alpha on:surf a
+
+subplot 2 2 2:title 'alpha on':rotate 50 60:box
+light off:surf a
+
+
Example of transparency and lightings +
+ +
+ + + +

5.5.3 Types of transparency

+ + +

MathGL library has advanced features for setting and handling the surface transparency. The simplest way to add transparency is the using of command alpha. As a result, all further surfaces (and isosurfaces, density plots and so on) become transparent. However, their look can be additionally improved. +

+

The value of transparency can be different from surface to surface. To do it just use SetAlphaDef before the drawing of the surface, or use option alpha (see Command options). If its value is close to 0 then the surface becomes more and more transparent. Contrary, if its value is close to 1 then the surface becomes practically non-transparent. +

+

Also you can change the way how the light goes through overlapped surfaces. The function SetTranspType defines it. By default the usual transparency is used (`0`) - surfaces below is less visible than the upper ones. A “glass-like” transparency (`1`) has a different look - each surface just decreases the background light (the surfaces are commutable in this case). +

+

A “neon-like” transparency (`2`) has more interesting look. In this case a surface is the light source (like a lamp on the dark background) and just adds some intensity to the color. At this, the library sets automatically the black color for the background and changes the default line color to white. +

+

As example I shall show several plots for different types of transparency. The code is the same except the values of SetTranspType function: +

call 'prepare2d'
+alpha on:light on
+transptype 0:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Example of SetTranspType(0). +
Example of SetTranspType(1). +
Example of SetTranspType(2). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.4 Axis projection

+ + +

You can easily make 3D plot and draw its x-,y-,z-projections (like in CAD) by using ternary function with arguments: 4 for Cartesian, 5 for Ternary and 6 for Quaternary coordinates. The sample code is: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample':ternary 4:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+
Example of axis projections +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.5 Adding fog

+ + +

MathGL can add a fog to the image. Its switching on is rather simple - just use fog function. There is the only feature - fog is applied for whole image. Not to particular subplot. The sample code is: +

call 'prepare2d'
+title 'Fog sample':rotate 50 60:light on
+fog 1
+box:surf a:cont a 'y'
+
+
Example of Fog(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.6 Lighting sample

+ + +

In contrast to the most of other programs, MathGL supports several (up to 10) light sources. Moreover, the color each of them can be different: white (this is usual), yellow, red, cyan, green and so on. The use of several light sources may be interesting for the highlighting of some peculiarities of the plot or just to make an amusing picture. Note, each light source can be switched on/off individually. The sample code is: +

call 'prepare2d'
+title 'Several light sources':rotate 50 60:light on
+light 1 0 1 0 'c':light 2 1 0 0 'y':light 3 0 -1 0 'm'
+box:surf a 'h'
+
+
Example of several light sources. +
+

Additionally, you can use local light sources and set to use diffuse reflection instead of specular one (by default) or both kinds. Note, I use attachlight command to keep light settings relative to subplot. +

light on: attachlight on
+call 'prepare2d'
+subplot 2 2 0:title 'Default':rotate 50 60:box:surf a
+line -1 -0.7 1.7 -1 -0.7 0.7 'BA'
+
+subplot 2 2 1:title 'Local':rotate 50 60
+light 0 1 0 1 -2 -1 -1
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 2:title 'no diffuse':rotate 50 60
+diffuse 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 3:title 'diffusive only':rotate 50 60
+diffuse 0.5:light 0 1 0 1 -2 -1 -1 'w' 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+
Example of different types of lighting. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.7 Using primitives

+ + +

MathGL provide a set of functions for drawing primitives (see Primitives). Primitives are low level object, which used by most of plotting functions. Picture below demonstrate some of commonly used primitives. +

subplot 2 2 0 '':title 'Line, Curve, Rhomb, Ellipse' '' -1.5
+line -1 -1 -0.5 1 'qAI'
+curve -0.6 -1 1 1 0 1 1 1 'rA'
+ball 0 -0.5 '*':ball 1 -0.1 '*'
+rhomb 0 0.4 1 0.9 0.2 'b#'
+rhomb 0 0 1 0.4 0.2 'cg@'
+ellipse 0 -0.5 1 -0.1 0.2 'u#'
+ellipse 0 -1 1 -0.6 0.2 'm@'
+
+light on
+subplot 2 2 1:title 'Face[xyz]':rotate 50 60:box
+facex 1 0 -1 1 1 'r':facey -1 -1 -1 1 1 'g':facez 1 -1 -1 -1 1 'b'
+face -1 -1 1 -1 1 1 1 -1 0 1 1 1 'bmgr'
+
+subplot 2 2 3 '':title 'Cone'
+cone -0.7 -0.3 0 -0.7 0.7 0.5 0.2 0.1 'b':text -0.7 -0.7 'no edges\n(default)'
+cone 0 -0.3 0 0 0.7 0.5 0.2 0.1 'g@':text 0 -0.7 'with edges\n('\@' style)'
+cone 0.7 -0.3 0 0.7 0.7 0.5 0.2 0.1 'ry':text 0.7 -0.7 '"arrow" with\n{}gradient'
+
+subplot 2 2 2 '':title 'Sphere and Drop'
+line -0.9 0 1 0.9 0 1
+text -0.9 -0.7 'sh=0':drop -0.9 0 0 1 0.5 'r' 0:ball -0.9 0 1 'k'
+text -0.3 -0.7 'sh=0.33':drop -0.3 0 0 1 0.5 'r' 0.33:ball -0.3 0 1 'k'
+text 0.3 -0.7 'sh=0.67':drop 0.3 0 0 1 0.5 'r' 0.67:ball 0.3 0 1 'k'
+text 0.9 -0.7 'sh=1':drop 0.9 0 0 1 0.5 'r' 1:ball 0.9 0 1 'k'
+
+
Primitives in MathGL. +
+

Generally, you can create arbitrary new kind of plot using primitives. For example, MathGL don`t provide any special functions for drawing molecules. However, you can do it using only one type of primitives drop. The sample code is: +

alpha on:light on
+subplot 2 2 0 '':title 'Methane, CH_4':rotate 60 120
+sphere 0 0 0 0.25 'k':drop 0 0 0 0 0 1 0.35 'h' 1 2:sphere 0 0 0.7 0.25 'g'
+drop 0 0 0 -0.94 0 -0.33 0.35 'h' 1 2:sphere -0.66 0 -0.23 0.25 'g'
+drop 0 0 0 0.47 0.82 -0.33 0.35 'h' 1 2:sphere 0.33 0.57 -0.23 0.25 'g'
+drop 0 0 0 0.47 -0.82 -0.33 0.35 'h' 1 2:sphere 0.33 -0.57 -0.23 0.25 'g'
+
+subplot 2 2 1 '':title 'Water, H{_2}O':rotate 60 100
+sphere 0 0 0 0.25 'r':drop 0 0 0 0.3 0.5 0 0.3 'm' 1 2:sphere 0.3 0.5 0 0.25 'g'
+drop 0 0 0 0.3 -0.5 0 0.3 'm' 1 2:sphere 0.3 -0.5 0 0.25 'g'
+
+subplot 2 2 2 '':title 'Oxygen, O_2':rotate 60 120
+drop 0 0.5 0 0 -0.3 0 0.3 'm' 1 2:sphere 0 0.5 0 0.25 'r'
+drop 0 -0.5 0 0 0.3 0 0.3 'm' 1 2:sphere 0 -0.5 0 0.25 'r'
+
+subplot 2 2 3 '':title 'Ammonia, NH_3':rotate 60 120
+sphere 0 0 0 0.25 'b':drop 0 0 0 0.33 0.57 0 0.32 'n' 1 2
+sphere 0.33 0.57 0 0.25 'g':drop 0 0 0 0.33 -0.57 0 0.32 'n' 1 2
+sphere 0.33 -0.57 0 0.25 'g':drop 0 0 0 -0.65 0 0 0.32 'n' 1 2
+sphere -0.65 0 0 0.25 'g'
+
+
Example of molecules drawing. +
+

Moreover, some of special plots can be more easily produced by primitives rather than by specialized function. For example, Venn diagram can be produced by Error plot: +

list x -0.3 0 0.3:list y 0.3 -0.3 0.3:list e 0.7 0.7 0.7
+title 'Venn-like diagram':alpha on
+error x y e e '!rgb@#o'
+

You see that you have to specify and fill 3 data arrays. The same picture can be produced by just 3 calls of circle function: +

title 'Venn-like diagram':alpha on
+circle -0.3 0.3 0.7 'rr@'
+circle 0 -0.3 0.7 'gg@'
+circle 0.3 0.3 0.7 'bb@'
+

Of course, the first variant is more suitable if you need to plot a lot of circles. But for few ones the usage of primitives looks easy. +

+
Example of Venn diagram. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.8 STFA sample

+ + +

Short-time Fourier Analysis (stfa) is one of informative method for analyzing long rapidly oscillating 1D data arrays. It is used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. +

+

MathGL can find and draw STFA result. Just to show this feature I give following sample. Initial data arrays is 1D arrays with step-like frequency. Exactly this you can see at bottom on the STFA plot. The sample code is: +

new a 2000:new b 2000
+fill a 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)'
+
+subplot 1 2 0 '<_':title 'Initial signal'
+plot a:axis:xlabel '\i t'
+
+subplot 1 2 1 '<_':title 'STFA plot'
+stfa a b 64:axis:ylabel '\omega' 0:xlabel '\i t'
+
+
Example of STFA(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.9 Mapping visualization

+ + +

Sometime ago I worked with mapping and have a question about its visualization. Let me remember you that mapping is some transformation rule for one set of number to another one. The 1d mapping is just an ordinary function - it takes a number and transforms it to another one. The 2d mapping (which I used) is a pair of functions which take 2 numbers and transform them to another 2 ones. Except general plots (like surfc, surfa) there is a special plot - Arnold diagram. It shows the area which is the result of mapping of some initial area (usually square). +

+

I tried to make such plot in map. It shows the set of points or set of faces, which final position is the result of mapping. At this, the color gives information about their initial position and the height describes Jacobian value of the transformation. Unfortunately, it looks good only for the simplest mapping but for the real multivalent quasi-chaotic mapping it produces a confusion. So, use it if you like :). +

+

The sample code for mapping visualization is: +

new a 50 40 'x':new b 50 40 'y':zrange -2 2:text 0 0 '\to'
+subplot 2 1 0:text 0 1.1 '\{x, y\}' '' -2:box
+map a b 'brgk'
+
+subplot 2 1 1:box
+text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2
+fill a '(x^3+y^3)/2':fill b '(x-y)/2':map a b 'brgk'
+
+
Example of Map(). +
+ +
+ + + +

5.5.10 Data interpolation

+ + +

There are many functions to get interpolated values of a data array. Basically all of them can be divided by 3 categories: +

    +
  1. functions which return single value at given point (see Interpolation and mglGSpline() in Global functions); +
  2. functions subdata and evaluate for indirect access to data elements; +
  3. functions refill, gspline and datagrid which fill regular (rectangular) data array by interpolated values. +
+ +

The usage of first category is rather straightforward and don`t need any special comments. +

+

There is difference in indirect access functions. Function subdata use use step-like interpolation to handle correctly single nan values in the data array. Contrary, function evaluate use local spline interpolation, which give smoother output but spread nan values. So, subdata should be used for specific data elements (for example, for given column), and evaluate should be used for distributed elements (i.e. consider data array as some field). Following sample illustrates this difference: +

subplot 1 1 0 '':title 'SubData vs Evaluate'
+new in 9 'x^3/1.1':plot in 'ko ':box
+new arg 99 '4*x+4'
+evaluate e in arg off:plot e 'b.'; legend 'Evaluate'
+subdata s in arg:plot s 'r.';legend 'SubData'
+legend 2
+
+
Example of indirect data access. +
+

Example of datagrid usage is done in Making regular data. Here I want to show the peculiarities of refill and gspline functions. Both functions require argument(s) which provide coordinates of the data values, and return rectangular data array which equidistantly distributed in axis range. So, in opposite to evaluate function, refill and gspline can interpolate non-equidistantly distributed data. At this both functions refill and gspline provide continuity of 2nd derivatives along coordinate(s). However, refill is slower but give better (from human point of view) result than global spline gspline due to more advanced algorithm. Following sample illustrates this difference: +

new x 10 '0.5+rnd':cumsum x 'x':norm x -1 1
+copy y sin(pi*x)/1.5
+subplot 2 2 0 '<_':title 'Refill sample'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:refill r x y:plot r 'r'
+
+subplot 2 2 1 '<_':title 'Global spline'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:gspline r x y:plot r 'r'
+
+new y 10 '0.5+rnd':cumsum y 'x':norm y -1 1
+copy xx x:extend xx 10
+copy yy y:extend yy 10:transpose yy
+copy z sin(pi*xx*yy)/1.5
+alpha on:light on
+subplot 2 2 2:title '2d regular':rotate 40 60
+box:axis:mesh xx yy z 'k'
+new rr 100 100:refill rr x y z:surf rr
+
+new xx 10 10 '(x+1)/2*cos(y*pi/2-1)'
+new yy 10 10 '(x+1)/2*sin(y*pi/2-1)'
+copy z sin(pi*xx*yy)/1.5
+subplot 2 2 3:title '2d non-regular':rotate 40 60
+box:axis:plot xx yy z 'ko '
+new rr 100 100:refill rr xx yy z:surf rr
+
+
Example of non-equidistant data interpolation. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.11 Making regular data

+ + +

Sometimes, one have only unregular data, like as data on triangular grids, or experimental results and so on. Such kind of data cannot be used as simple as regular data (like matrices). Only few functions, like dots, can handle unregular data as is. +

+

However, one can use built in triangulation functions for interpolating unregular data points to a regular data grids. There are 2 ways. First way, one can use triangulation function to obtain list of vertexes for triangles. Later this list can be used in functions like triplot or tricont. Second way consist in usage of datagrid function, which fill regular data grid by interpolated values, assuming that coordinates of the data grid is equidistantly distributed in axis range. Note, you can use options (see Command options) to change default axis range as well as in other plotting functions. +

new x 100 '2*rnd-1':new y 100 '2*rnd-1':copy z x^2-y^2
+# first way - plot triangular surface for points
+triangulate d x y
+title 'Triangulation'
+rotate 50 60:box:light on
+triplot d x y z:triplot d x y z '#k'
+# second way - make regular data and plot it
+new g 30 30:datagrid g x y z:mesh g 'm'
+
+
Example of triangulation. +
+ +
+ + + +

5.5.12 Making histogram

+ + +

Using the hist function(s) for making regular distributions is one of useful fast methods to process and plot irregular data. Hist can be used to find some momentum of set of points by specifying weight function. It is possible to create not only 1D distributions but also 2D and 3D ones. Below I place the simplest sample code which demonstrate hist usage: +

new x 10000 '2*rnd-1':new y 10000 '2*rnd-1':copy z exp(-6*(x^2+y^2))
+hist xx x z:norm xx 0 1:hist yy y z:norm yy 0 1
+multiplot 3 3 3 2 2 '':ranges -1 1 -1 1 0 1:box:dots x y z 'wyrRk'
+multiplot 3 3 0 2 1 '':ranges -1 1 0 1:box:bars xx
+multiplot 3 3 5 1 2 '':ranges 0 1 -1 1:box:barh yy
+subplot 3 3 2:text 0.5 0.5 'Hist and\n{}MultiPlot\n{}sample' 'a' -3
+
+
Example of Hist(). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.13 Nonlinear fitting hints

+ + +

Nonlinear fitting is rather simple. All that you need is the data to fit, the approximation formula and the list of coefficients to fit (better with its initial guess values). Let me demonstrate it on the following simple example. First, let us use sin function with some random noise: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+

and plot it to see that data we will fit +

title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+
+

The next step is the fitting itself. For that let me specify an initial values ini for coefficients `abc` and do the fitting for approximation formula `a+b*sin(c*x)` +

list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+

Now display it +

plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r'
+text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+

NOTE! the fitting results may have strong dependence on initial values for coefficients due to algorithm features. The problem is that in general case there are several local "optimums" for coefficients and the program returns only first found one! There are no guaranties that it will be the best. Try for example to set ini[3] = {0, 0, 0} in the code above. +

+

The full sample code for nonlinear fitting is: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r'
+text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+
Example of nonlinear fitting. +
+ +
+ + + +

5.5.14 PDE solving hints

+ + +

Solving of Partial Differential Equations (PDE, including beam tracing) and ray tracing (or finding particle trajectory) are more or less common task. So, MathGL have several functions for that. There are ray for ray tracing, pde for PDE solving, qo2d for beam tracing in 2D case (see Global functions). Note, that these functions take “Hamiltonian” or equations as string values. And I don`t plan now to allow one to use user-defined functions. There are 2 reasons: the complexity of corresponding interface; and the basic nature of used methods which are good for samples but may not good for serious scientific calculations. +

+

The ray tracing can be done by ray function. Really ray tracing equation is Hamiltonian equation for 3D space. So, the function can be also used for finding a particle trajectory (i.e. solve Hamiltonian ODE) for 1D, 2D or 3D cases. The function have a set of arguments. First of all, it is Hamiltonian which defined the media (or the equation) you are planning to use. The Hamiltonian is defined by string which may depend on coordinates `x`, `y`, `z`, time `t` (for particle dynamics) and momentums `p`=p_x, `q`=p_y, `v`=p_z. Next, you have to define the initial conditions for coordinates and momentums at `t`=0 and set the integrations step (default is 0.1) and its duration (default is 10). The Runge-Kutta method of 4-th order is used for integration. +

  const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+  mglData r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+

This example calculate the reflection from linear layer (media with Hamiltonian `p^2+q^2-x-1`=p_x^2+p_y^2-x-1). This is parabolic curve. The resulting array have 7 columns which contain data for {x,y,z,p,q,v,t}. +

+

The solution of PDE is a bit more complicated. As previous you have to specify the equation as pseudo-differential operator \hat H(x, \nabla) which is called sometime as “Hamiltonian” (for example, in beam tracing). As previously, it is defined by string which may depend on coordinates `x`, `y`, `z` (but not time!), momentums `p`=(d/dx)/i k_0, `q`=(d/dy)/i k_0 and field amplitude `u`=|u|. The evolutionary coordinate is `z` in all cases. So that, the equation look like du/dz = ik_0 H(x,y,\hat p, \hat q, |u|)[u]. Dependence on field amplitude `u`=|u| allows one to solve nonlinear problems too. For example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". Also you may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)" or ham = "p^2 + i1*x*(x>0)". +

+

Next step is specifying the initial conditions at `z` equal to minimal z-axis value. The function need 2 arrays for real and for imaginary part. Note, that coordinates x,y,z are supposed to be in specified axis range. So, the data arrays should have corresponding scales. Finally, you may set the integration step and parameter k0=k_0. Also keep in mind, that internally the 2 times large box is used (for suppressing numerical reflection from boundaries) and the equation should well defined even in this extended range. +

+

Final comment is concerning the possible form of pseudo-differential operator H. At this moment, simplified form of operator H is supported - all “mixed” terms (like `x*p`->x*d/dx) are excluded. For example, in 2D case this operator is effectively H = f(p,z) + g(x,z,u). However commutable combinations (like `x*q`->x*d/dy) are allowed for 3D case. +

+

So, for example let solve the equation for beam deflected from linear layer and absorbed later. The operator will have the form `"p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)"` that correspond to equation 1/ik_0 * du/dz + d^2 u/dx^2 + d^2 u/dy^2 + x * u + i (x+z)/2 * u = 0. This is typical equation for Electron Cyclotron (EC) absorption in magnetized plasmas. For initial conditions let me select the beam with plane phase front exp(-48*(x+0.7)^2). The corresponding code looks like this: +

new re 128 'exp(-48*(x+0.7)^2)':new im 128
+pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30
+transpose a
+subplot 1 1 0 '<_':title 'PDE solver'
+axis:xlabel '\i x':ylabel '\i z'
+crange 0 1:dens a 'wyrRk'
+fplot '-x' 'k|'
+text 0 0.95 'Equation: ik_0\partial_zu + \Delta u + x\cdot u +\
+ i \frac{x+z}{2}\cdot u = 0\n{}absorption: (x+z)/2 for x+z>0'
+
+
Example of PDE solving. +
+

The next example is example of beam tracing. Beam tracing equation is special kind of PDE equation written in coordinates accompanied to a ray. Generally this is the same parameters and limitation as for PDE solving but the coordinates are defined by the ray and by parameter of grid width w in direction transverse the ray. So, you don`t need to specify the range of coordinates. BUT there is limitation. The accompanied coordinates are well defined only for smooth enough rays, i.e. then the ray curvature K (which is defined as 1/K^2 = (|r''|^2 |r'|^2 - (r'', r'')^2)/|r'|^6) is much large then the grid width: K>>w. So, you may receive incorrect results if this condition will be broken. +

+

You may use following code for obtaining the same solution as in previous example: +

define $1 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)'
+subplot 1 1 0 '<_':title 'Beam and ray tracing'
+ray r $1 -0.7 -1 0 0 0.5 0 0.02 2:plot r(0) r(1) 'k'
+axis:xlabel '\i x':ylabel '\i z'
+new re 128 'exp(-48*x^2)':new im 128
+new xx 1:new yy 1
+qo2d a $1 re im r 1 30 xx yy
+crange 0 1:dens xx yy a 'wyrRk':fplot '-x' 'k|'
+text 0 0.85 'absorption: (x+y)/2 for x+y>0'
+text 0.7 -0.05 'central ray'
+
+
Example of beam tracing. +
+

Note, the pde is fast enough and suitable for many cases routine. However, there is situations then media have both together: strong spatial dispersion and spatial inhomogeneity. In this, case the pde will produce incorrect result and you need to use advanced PDE solver apde. For example, a wave beam, propagated in plasma, described by Hamiltonian exp(-x^2-p^2), will have different solution for using of simplification and advanced PDE solver: +

ranges -1 1 0 2 0 2
+new ar 256 'exp(-2*(x+0.0)^2)':new ai 256
+
+apde res1 'exp(-x^2-p^2)' ar ai 0.01:transpose res1
+subplot 1 2 0 '_':title 'Advanced PDE solver'
+ranges 0 2 -1 1:crange res1
+dens res1:box                                                                     
+axis:xlabel '\i z':ylabel '\i x'                                                  
+text -0.5 0.2 'i\partial_z\i u = exp(-\i x^2+\partial_x^2)[\i u]' 'y'             
+                                                                                  
+pde res2 'exp(-x^2-p^2)' ar ai 0.01
+subplot 1 2 1 '_':title 'Simplified PDE solver'                                   
+dens res2:box                                                                     
+axis:xlabel '\i z':ylabel '\i x'                                                  
+text -0.5 0.2 'i\partial_z\i u \approx\ exp(-\i x^2)\i u+exp(\partial_x^2)[\i u]' 'y'
+
+
Comparison of simplified and advanced PDE solvers. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.15 Drawing phase plain

+ + +

Here I want say a few words of plotting phase plains. Phase plain is name for system of coordinates x, x', i.e. a variable and its time derivative. Plot in phase plain is very useful for qualitative analysis of an ODE, because such plot is rude (it topologically the same for a range of ODE parameters). Most often the phase plain {x, x'} is used (due to its simplicity), that allows to analyze up to the 2nd order ODE (i.e. x''+f(x,x')=0). +

+

The simplest way to draw phase plain in MathGL is using flow function(s), which automatically select several points and draw flow threads. If the ODE have an integral of motion (like Hamiltonian H(x,x')=const for dissipation-free case) then you can use cont function for plotting isolines (contours). In fact. isolines are the same as flow threads, but without arrows on it. Finally, you can directly solve ODE using ode function and plot its numerical solution. +

+

Let demonstrate this for ODE equation x''-x+3*x^2=0. This is nonlinear oscillator with square nonlinearity. It has integral H=y^2+2*x^3-x^2=Const. Also it have 2 typical stationary points: saddle at {x=0, y=0} and center at {x=1/3, y=0}. Motion at vicinity of center is just simple oscillations, and is stable to small variation of parameters. In opposite, motion around saddle point is non-stable to small variation of parameters, and is very slow. So, calculation around saddle points are more difficult, but more important. Saddle points are responsible for solitons, stochasticity and so on. +

+

So, let draw this phase plain by 3 different methods. First, draw isolines for H=y^2+2*x^3-x^2=Const - this is simplest for ODE without dissipation. Next, draw flow threads - this is straightforward way, but the automatic choice of starting points is not always optimal. Finally, use ode to check the above plots. At this we need to run ode in both direction of time (in future and in the past) to draw whole plain. Alternatively, one can put starting points far from (or at the bounding box as done in flow) the plot, but this is a more complicated. The sample code is: +

subplot 2 2 0 '<_':title 'Cont':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new f 100 100 'y^2+2*x^3-x^2-0.5':cont f
+
+subplot 2 2 1 '<_':title 'Flow':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new fx 100 100 'x-3*x^2'
+new fy 100 100 'y'
+flow fy fx 'v';value 7
+
+subplot 2 2 2 '<_':title 'ODE':box
+axis:xlabel 'x':ylabel '\dot{x}'
+for $x -1 1 0.1
+  ode r 'y;x-3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+  ode r '-y;-x+3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+next
+
+
Example of ODE solving and phase plain drawing. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.16 Pulse properties

+ + +

There is common task in optics to determine properties of wave pulses or wave beams. MathGL provide special function pulse which return the pulse properties (maximal value, center of mass, width and so on). Its usage is rather simple. Here I just illustrate it on the example of Gaussian pulse, where all parameters are obvious. +

subplot 1 1 0 '<_':title 'Pulse sample'
+# first prepare pulse itself
+new a 100 'exp(-6*x^2)'
+
+# get pulse parameters
+pulse b a 'x'
+
+# positions and widths are normalized on the number of points. So, set proper axis scale.
+ranges 0 a.nx-1 0 1
+axis:plot a # draw pulse and axis
+
+# now visualize found pulse properties
+define m a.max # maximal amplitude
+# approximate position of maximum
+line b(1) 0 b(1) m 'r='
+# width at half-maximum (so called FWHM)
+line b(1)-b(3)/2 0  b(1)-b(3)/2 m 'm|'
+line b(1)+b(3)/2 0  b(1)+b(3)/2 m 'm|'
+line 0 0.5*m a.nx-1 0.5*m 'h'
+# parabolic approximation near maximum
+new x 100 'x'
+plot b(0)*(1-((x-b(1))/b(2))^2) 'g'
+
+
Example of determining of pulse properties. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.17 Using MGL parser

+ + +

MGL scripts can contain loops, conditions and user-defined functions. Below I show very simple example of its usage: +

title 'MGL parser sample'
+call 'sample'
+stop
+
+func 'sample'
+new dat 100 'sin(2*pi*(x+1))'
+plot dat; xrange 0 1
+box:axis:xlabel 'x':ylabel 'y'
+for $0 -1 1 0.1
+if $0<0
+line 0 0 -1 $0 'r'
+else
+line 0 0 -1 $0 'r'
+endif
+next
+
+
Example of MGL script parsing. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.18 Using options

+ + +

Command options allow the easy setup of the selected plot by changing global settings only for this plot. Often, options are used for specifying the range of automatic variables (coordinates). However, options allows easily change plot transparency, numbers of line or faces to be drawn, or add legend entries. The sample function for options usage is: +

new a 31 41 '-pi*x*exp(-(y+1)^2-4*x^2)'
+alpha on:light on
+subplot 2 2 0:title 'Options for coordinates':rotate 40 60:box
+surf a 'r';yrange 0 1
+surf a 'b';yrange 0 -1
+
+subplot 2 2 1:title 'Option "meshnum"':rotate 40 60:box
+mesh a 'r'; yrange 0 1
+mesh a 'b';yrange 0 -1; meshnum 5
+
+subplot 2 2 2:title 'Option "alpha"':rotate 40 60:box
+surf a 'r';yrange 0 1; alpha 0.7
+surf a 'b';yrange 0 -1; alpha 0.3
+
+subplot 2 2 3 '<_':title 'Option "legend"'
+fplot 'x^3' 'r'; legend 'y = x^3'
+fplot 'cos(pi*x)' 'b'; legend 'y = cos \pi x'
+box:axis:legend 2
+
+
Example of options usage. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.19 “Templates”

+ + +

As I have noted before, the change of settings will influence only for the further plotting commands. This allows one to create “template” function which will contain settings and primitive drawing for often used plots. Correspondingly one may call this template-function for drawing simplification. +

+

For example, let one has a set of points (experimental or numerical) and wants to compare it with theoretical law (for example, with exponent law \exp(-x/2), x \in [0, 20]). The template-function for this task is: +

void template(mglGraph *gr)
+{
+  mglData  law(100);      // create the law
+  law.Modify("exp(-10*x)");
+  gr->SetRanges(0,20, 0.0001,1);
+  gr->SetFunc(0,"lg(y)",0);
+  gr->Plot(law,"r2");
+  gr->Puts(mglPoint(10,0.2),"Theoretical law: e^x","r:L");
+  gr->Label('x',"x val."); gr->Label('y',"y val.");
+  gr->Axis(); gr->Grid("xy","g;"); gr->Box();
+}
+

At this, one will only write a few lines for data drawing: +

  template(gr);     // apply settings and default drawing from template
+  mglData dat("fname.dat"); // load the data
+  // and draw it (suppose that data file have 2 columns)
+  gr->Plot(dat.SubData(0),dat.SubData(1),"bx ");
+

A template-function can also contain settings for font, transparency, lightning, color scheme and so on. +

+

I understand that this is obvious thing for any professional programmer, but I several times receive suggestion about “templates” ... So, I decide to point out it here. +

+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.20 Stereo image

+ + +

One can easily create stereo image in MathGL. Stereo image can be produced by making two subplots with slightly different rotation angles. The corresponding code looks like this: +

call 'prepare2d'
+light on
+subplot 2 1 0:rotate 50 60+1:box:surf a
+subplot 2 1 1:rotate 50 60-1:box:surf a
+
+
Example of stereo image. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.21 Reduce memory usage

+ + +

By default MathGL save all primitives in memory, rearrange it and only later draw them on bitmaps. Usually, this speed up drawing, but may require a lot of memory for plots which contain a lot of faces (like cloud, dew). You can use quality function for setting to use direct drawing on bitmap and bypassing keeping any primitives in memory. This function also allow you to decrease the quality of the resulting image but increase the speed of the drawing. +

+

The code for lower memory usage looks like this: +

quality 6  # firstly, set to draw directly on bitmap
+for $1 0 1000
+  sphere 2*rnd-1 2*rnd-1 0.05
+next
+
+ +
+ + + +

5.5.22 Scanning file

+ + +

MathGL have possibilities to write textual information into file with variable values by help of save command. This is rather useful for generating an ini-files or preparing human-readable textual files. For example, lets create some textual file +

subplot 1 1 0 '<_':title 'Save and scanfile sample'
+list a 1 -1 0
+save 'This is test: 0 -> ',a(0),' q' 'test.txt' 'w'
+save 'This is test: 1 -> ',a(1),' q' 'test.txt'
+save 'This is test: 2 -> ',a(2),' q' 'test.txt'
+

It contents look like +

This is test: 0 -> 1 q
+This is test: 1 -> -1 q
+This is test: 2 -> 0 q
+

Note, that I use option `w` at first call of save to overwrite the contents of the file. +

+

Let assume now that you want to read this values (i.e. [[0,1],[1,-1],[2,0]]) from the file. You can use scanfile for that. The desired values was written using template `This is test: %g -> %g q`. So, just use +

scanfile a 'test.txt' 'This is test: %g -> %g'
+

and plot it to for assurance +

ranges a(0) a(1):axis:plot a(0) a(1) 'o'
+
+

Note, I keep only the leading part of template (i.e. `This is test: %g -> %g` instead of `This is test: %g -> %g q`), because there is no important for us information after the second number in the line. +

+ +
+ +
+

+Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.23 Mixing bitmap and vector output

+ + +

Sometimes output plots contain surfaces with a lot of points, and some vector primitives (like axis, text, curves, etc.). Using vector output formats (like EPS or SVG) will produce huge files with possible loss of smoothed lighting. Contrary, the bitmap output may cause the roughness of text and curves. Hopefully, MathGL have a possibility to combine bitmap output for surfaces and vector one for other primitives in the same EPS file, by using rasterize command. +

+

The idea is to prepare part of picture with surfaces or other "heavy" plots and produce the background image from them by help of rasterize command. Next, we draw everything to be saved in vector form (text, curves, axis and etc.). Note, that you need to clear primitives (use clf command) after rasterize if you want to disable duplication of surfaces in output files (like EPS). Note, that some of output formats (like 3D ones, and TeX) don`t support the background bitmap, and use clf for them will cause the loss of part of picture. +

+

The sample code is: +

# first draw everything to be in bitmap output
+fsurf 'x^2+y^2' '#';value 10
+
+rasterize   # set above plots as bitmap background
+clf         # clear primitives, to exclude them from file
+
+# now draw everything to be in vector output
+axis:box
+
+# and save file
+write 'fname.eps'
+
+ + +
+ +
+

+Previous: , Up: Examples   [Contents][Index]

+
+ +

5.6 FAQ

+ + +
+
The plot does not appear
+

Check that points of the plot are located inside the bounding box and resize the bounding box using ranges function. Check that the data have correct dimensions for selected type of plot. Sometimes the light reflection from flat surfaces (like, dens) can look as if the plot were absent. +

+
+
I can not find some special kind of plot.
+

Most “new” types of plots can be created by using the existing drawing functions. For example, the surface of curve rotation can be created by a special function torus, or as a parametrically specified surface by surf. See also, Hints. If you can not find a specific type of plot, please e-mail me and this plot will appear in the next version of MathGL library. +

+
+
How can I print in Russian/Spanish/Arabic/Japanese, and so on?
+

The standard way is to use Unicode encoding for the text output. But the MathGL library also has interface for 8-bit (char *) strings with internal conversion to Unicode. This conversion depends on the current locale OS. +

+
+
How can I exclude a point or a region of plot from the drawing?
+

There are 3 general ways. First, the point with nan value as one of the coordinates (including color/alpha range) will never be plotted. Second, special functions define the condition when the points should be omitted (see Cutting). Last, you may change the transparency of a part of the plot by the help of functions surfa, surf3a (see Dual plotting). In last case the transparency is switched on smoothly. +

+
+
How many people write this library?
+

Most of the library was written by one person. This is a result of nearly a year of work (mostly in the evening and on holidays): I spent half a year to write the kernel and half a year to a year on extending, improving the library and writing documentation. This process continues now :). The build system (cmake files) was written mostly by D.Kulagin, and the export to PRC/PDF was written mostly by M.Vidassov. +

+
+
How can I display a bitmap on the figure?
+

You can import data by command import and display it by dens function. For example, for black-and-white bitmap you can use the code: import bmp 'fname.png' 'wk':dens bmp 'wk'. +

+ +
+
How can I create 3D in PDF?
+

Just use command write fname.pdf, which create PDF file if enable-pdf=ON at MathGL configure. +

+
+
How can I create TeX figure?
+

Just use command write fname.tex, which create LaTeX files with figure itself `fname.tex`, with MathGL colors `mglcolors.tex` and main file `mglmain.tex`. Last one can be used for viewing image by command like pdflatex mglmain.tex. +

+ +
+
How I can change the font family?
+

First, you should download new font files from here or from here. Next, you should load the font files into by the following command: loadfont 'fontname'. Here fontname is the base font name like `STIX`. Use loadfont '' to start using the default font. +

+
+
How can I draw tick out of a bounding box?
+

Just set a negative value in ticklen. For example, use ticklen -0.1. +

+
+
How can I prevent text rotation?
+

Just use rotatetext off. Also you can use axis style `U` for disable only tick labels rotation. +

+
+
How can I draw equal axis range even for rectangular image?
+

Just use aspect nan nan for each subplot, or at the beginning of the drawing. +

+
+
How I can set transparent background?
+

Just use code like clf 'r{A5}' or prepare PNG file and set it as background image by call background 'fname.png'. +

+
+
How I can reduce "white" edges around bounding box?
+

The simplest way is to use subplot style. However, you should be careful if you plan to add colorbar or rotate plot - part of plot can be invisible if you will use non-default subplot style. +

+
+
Can I combine bitmap and vector output in EPS?
+

Yes. Sometimes you may have huge surface and a small set of curves and/or text on the plot. You can use function rasterize just after making surface plot. This will put all plot to bitmap background. At this later plotting will be in vector format. For example, you can do something like following: +

surf x y z
+rasterize # make surface as bitmap
+axis
+write 'fname.eps'
+
+
+
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 All samples

+ + +

This chapter contain alphabetical list of MGL and C++ samples for most of MathGL graphics and features. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: All samples   [Contents][Index]

+
+ +

6.1 Functions for initialization

+ + +

This section contain functions for input data for most of further samples. +

+

MGL code: +

+func 'prepare1d'
+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
+new x1 50 'x'
+new x2 50 '0.05-0.03*cos(pi*x)'
+new y1 50 '0.5-0.3*cos(pi*x)'
+new y2 50 '-0.3*sin(pi*x)'
+return
+
+func 'prepare2d'
+new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3d'
+new c 61 50 40 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 61 50 40 '1-2*tanh((x+y)*(x+y))'
+return
+
+func 'prepare2v'
+new a 20 30 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 20 30 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3v'
+define $1 pow(x*x+y*y+(z-0.3)*(z-0.3)+0.03,1.5)
+define $2 pow(x*x+y*y+(z+0.3)*(z+0.3)+0.03,1.5)
+new ex 10 10 10 '0.2*x/$1-0.2*x/$2'
+new ey 10 10 10 '0.2*y/$1-0.2*y/$2'
+new ez 10 10 10 '0.2*(z-0.3)/$1-0.2*(z+0.3)/$2'
+return
+
+ + +
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.2 Sample `3wave`

+ + +

Example of complex ode on basis of 3-wave decay. +

+

MGL code: +

define t 50
+ode !r '-b*f;a*conj(f);a*conj(b)-0.1*f' 'abf' [1,1e-3,0] 0.1 t
+ranges 0 t 0 r.max
+plot r(0) 'b';legend 'a'
+plot r(1) 'g';legend 'b'
+plot r(2) 'r';legend 'f'
+axis:box:legend
+
+
Sample 3wave +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.3 Sample `alpha`

+ + +

Example of light and alpha (transparency). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'default':rotate 50 60:box
+surf a
+subplot 2 2 1:title 'light on':rotate 50 60:box
+light on:surf a
+subplot 2 2 3:title 'light on; alpha on':rotate 50 60:box
+alpha on:surf a
+subplot 2 2 2:title 'alpha on':rotate 50 60:box
+light off:surf a
+
+
Sample alpha +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.4 Sample `apde`

+ + +

Comparison of advanced PDE solver (apde) and ordinary one (pde). +

+

MGL code: +

ranges -1 1 0 2 0 2
+new ar 256 'exp(-2*(x+0.0)^2)'
+new ai 256
+
+apde res1 'exp(-x^2-p^2)' ar ai 0.01:transpose res1
+pde res2 'exp(-x^2-p^2)' ar ai 0.01
+
+subplot 1 2 0 '_':title 'Advanced PDE solver'
+ranges 0 2 -1 1:crange res1
+dens res1:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u = exp(-\i x^2+\partial_x^2)[\i u]' 'y'
+
+subplot 1 2 1 '_':title 'Simplified PDE solver'
+dens res2:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u \approx\ exp(-\i x^2)\i u+exp(\partial_x^2)[\i u]' 'y'
+
+
Sample apde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.5 Sample `area`

+ + +

Function area fill the area between curve and axis plane. It support gradient filling if 2 colors per curve is specified. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0
+subplot 2 2 0 '':title 'Area plot (default)':box:area y
+subplot 2 2 1 '':title '2 colors':box:area y 'cbgGyr'
+subplot 2 2 2 '':title '"!" style':box:area y '!'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 3:title '3d variant':rotate 50 60:box
+area xc yc z 'r'
+area xc -yc z 'b#'
+
+
Sample area +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.6 Sample `aspect`

+ + +

Example of subplot, inplot, rotate, aspect, shear. +

+

MGL code: +

subplot 2 2 0:box:text -1 1.1 'Just box' ':L'
+inplot 0.2 0.5 0.7 1 off:box:text 0 1.2 'InPlot example'
+subplot 2 2 1:title 'Rotate only':rotate 50 60:box
+subplot 2 2 2:title 'Rotate and Aspect':rotate 50 60:aspect 1 1 2:box
+subplot 2 2 3:title 'Shear':box 'c':shear 0.2 0.1:box
+
+
Sample aspect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.7 Sample `axial`

+ + +

Function axial draw surfaces of rotation for contour lines. You can draw wire surfaces (`#` style) or ones rotated in other directions (`x`, `z` styles). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Axial plot (default)':light on:alpha on:rotate 50 60:box:axial a
+subplot 2 2 1:title '"x" style;"." style':light on:rotate 50 60:box:axial a 'x.'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:axial a 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:axial a '#'
+
+
Sample axial +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.8 Sample `axis`

+ + +

Different forms of axis position. +

+

MGL code: +

subplot 2 2 0:title 'Axis origin, Grid':origin 0 0:axis:grid:fplot 'x^3'
+subplot 2 2 1:title '2 axis':ranges -1 1 -1 1:origin -1 -1:axis:ylabel 'axis_1':fplot 'sin(pi*x)' 'r2'
+ranges 0 1 0 1:origin 1 1:axis:ylabel 'axis_2':fplot 'cos(pi*x)'
+subplot 2 2 3:title 'More axis':origin nan nan:xrange -1 1:axis:xlabel 'x' 0:ylabel 'y_1' 0:fplot 'x^2' 'k'
+yrange -1 1:origin -1.3 -1:axis 'y' 'r':ylabel '#r{y_2}' 0.2:fplot 'x^3' 'r'
+
+subplot 2 2 2:title '4 segments, inverted axis':origin 0 0:
+inplot 0.5 1 0.5 1 on:ranges 0 10 0 2:axis
+fplot 'sqrt(x/2)':xlabel 'W' 1:ylabel 'U' 1
+inplot 0 0.5 0.5 1 on:ranges 1 0 0 2:axis 'x':fplot 'sqrt(x)+x^3':xlabel '\tau' 1
+inplot 0.5 1 0 0.5 on:ranges 0 10 4 0:axis 'y':fplot 'x/4':ylabel 'L' -1
+inplot 0 0.5 0 0.5 on:ranges 1 0 4 0:fplot '4*x^2'
+
+
Sample axis +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.9 Sample `barh`

+ + +

Function barh is the similar to bars but draw horizontal bars. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 2 2 0 '':title 'Barh plot (default)':box:barh ys
+subplot 2 2 1 '':title '2 colors':box:barh ys 'cbgGyr'
+ranges -3 3 -1 1:subplot 2 2 2 '':title '"a" style':box:barh ys 'a'
+subplot 2 2 3 '': title '"f" style':box:barh ys 'f'
+
+
Sample barh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.10 Sample `bars`

+ + +

Function bars draw vertical bars. It have a lot of options: bar-above-bar (`a` style), fall like (`f` style), 2 colors for positive and negative values, wired bars (`#` style), 3D variant. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 3 2 0 '':title 'Bars plot (default)':box:bars ys
+subplot 3 2 1 '':title '2 colors':box:bars ys 'cbgGyr'
+subplot 3 2 4 '':title '"\#" style':box:bars ys '#'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:bars xc yc z 'r'
+ranges -1 1 -3 3:subplot 3 2 2 '':title '"a" style':box:bars ys 'a'
+subplot 3 2 3 '':title '"f" style':box:bars ys 'f'
+
+
Sample bars +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.11 Sample `belt`

+ + +

Function belt draw surface by belts. You can use `x` style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Belt plot':rotate 50 60:box:belt a
+
+
Sample belt +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.12 Sample `bifurcation`

+ + +

Function bifurcation draw Bifurcation diagram for multiple stationary points of the map (like logistic map). +

+

MGL code: +

subplot 1 1 0 '<_':title 'Bifurcation sample'
+ranges 0 4 0 1:axis
+bifurcation 0.005 'x*y*(1-y)' 'r'
+
+
Sample bifurcation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.13 Sample `box`

+ + +

Different styles of bounding box. +

+

MGL code: +

subplot 2 2 0:title 'Box (default)':rotate 50 60:box
+subplot 2 2 1:title 'colored':rotate 50 60:box 'r'
+subplot 2 2 2:title 'with faces':rotate 50 60:box '@'
+subplot 2 2 3:title 'both':rotate 50 60:box '@cm'
+
+
Sample box +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.14 Sample `boxplot`

+ + +

Function boxplot draw box-and-whisker diagram. +

+

MGL code: +

new a 10 7 '(2*rnd-1)^3/2'
+subplot 1 1 0 '':title 'Boxplot plot':box:boxplot a
+
+
Sample boxplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.15 Sample `boxs`

+ + +

Function boxs draw surface by boxes. You can use `#` for drawing wire plot. +

+

MGL code: +

call 'prepare2d'
+origin 0 0 0
+subplot 2 2 0:title 'Boxs plot (default)':rotate 40 60:light on:box:boxs a
+subplot 2 2 1:title '"\@" style':rotate 50 60:box:boxs a '@'
+subplot 2 2 2:title '"\#" style':rotate 50 60:box:boxs a '#'
+subplot 2 2 3:title 'compare with Tile':rotate 50 60:box:tile a
+
+
Sample boxs +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.16 Sample `candle`

+ + +

Function candle draw candlestick chart. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. +

+

MGL code: +

new y 30 'sin(pi*x/2)^2'
+subplot 1 1 0 '':title 'Candle plot (default)'
+yrange 0 1:box
+candle y y/2 (y+1)/2
+
+
Sample candle +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.17 Sample `chart`

+ + +

Function chart draw colored boxes with width proportional to data values. Use ` ` for empty box. It produce well known pie chart if drawn in polar coordinates. +

+

MGL code: +

new ch 7 2 'rnd+0.1':light on
+subplot 2 2 0:title 'Chart plot (default)':rotate 50 60:box:chart ch
+subplot 2 2 1:title '"\#" style':rotate 50 60:box:chart ch '#'
+subplot 2 2 2:title 'Pie chart; " " color':rotate 50 60:
+axis '(y+1)/2*cos(pi*x)' '(y+1)/2*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+subplot 2 2 3:title 'Ring chart; " " color':rotate 50 60:
+axis '(y+2)/3*cos(pi*x)' '(y+2)/3*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+
+
Sample chart +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.18 Sample `cloud`

+ + +

Function cloud draw cloud-like object which is less transparent for higher data values. Similar plot can be created using many (about 10...20 - surf3a a a;value 10) isosurfaces surf3a. +

+

MGL code: +

call 'prepare3d'
+subplot 2 2 0:title 'Cloud plot':rotate 50 60:alpha on:box:cloud c 'wyrRk'
+subplot 2 2 1:title '"i" style':rotate 50 60:box:cloud c 'iwyrRk'
+subplot 2 2 2:title '"." style':rotate 50 60:box:cloud c '.wyrRk'
+subplot 2 2 3:title 'meshnum 10':rotate 50 60:box:cloud c 'wyrRk'; meshnum 10
+
+
Sample cloud +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.19 Sample `colorbar`

+ + +

Example of colorbar position and styles. +

+

MGL code: +

call 'prepare2d'
+new v 9 'x'
+subplot 2 2 0:title 'Colorbar out of box':box
+colorbar '<':colorbar '>':colorbar '_':colorbar '^'
+subplot 2 2 1:title 'Colorbar near box':box
+colorbar '<I':colorbar '>I':colorbar '_I':colorbar '^I'
+subplot 2 2 2:title 'manual colors':box:contd v a
+colorbar v '<':colorbar v '>':colorbar v '_':colorbar v '^'
+subplot 2 2 3:title '':text -0.5 1.55 'Color positions' ':C' -2
+colorbar 'bwr>' 0.25 0:text -0.9 1.2 'Default'
+colorbar 'b{w,0.3}r>' 0.5 0:text -0.1 1.2 'Manual'
+crange 0.01 1e3
+colorbar '>' 0.75 0:text 0.65 1.2 'Normal scale':colorbar '>':text 1.35 1.2 'Log scale'
+
+
Sample colorbar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.20 Sample `combined`

+ + +

Example of several plots in the same axis. +

+

MGL code: +

call 'prepare2v'
+call 'prepare3d'
+new v 10:fill v -0.5 1:copy d sqrt(a^2+b^2)
+subplot 2 2 0:title 'Surf + Cont':rotate 50 60:light on:box:surf a:cont a 'y'
+subplot 2 2 1 '':title 'Flow + Dens':light off:box:flow a b 'br':dens d
+subplot 2 2 2:title 'Mesh + Cont':rotate 50 60:box:mesh a:cont a '_'
+subplot 2 2 3:title 'Surf3 + ContF3':rotate 50 60:light on
+box:contf3 v c 'z' 0:contf3 v c 'x':contf3 v c
+cut 0 -1 -1 1 0 1.1
+contf3 v c 'z' c.nz-1:surf3 c -0.5
+
+
Sample combined +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.21 Sample `cones`

+ + +

Function cones is similar to bars but draw cones. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+light on:origin 0 0 0
+subplot 3 2 0:title 'Cones plot':rotate 50 60:box:cones ys
+subplot 3 2 1:title '2 colors':rotate 50 60:box:cones ys 'cbgGyr'
+subplot 3 2 2:title '"\#" style':rotate 50 60:box:cones ys '#'
+subplot 3 2 3:title '"a" style':rotate 50 60:zrange -2 2:box:cones ys 'a'
+subplot 3 2 4:title '"t" style':rotate 50 60:box:cones ys 't'
+subplot 3 2 5:title '"4" style':rotate 50 60:box:cones ys '4'
+
+
Sample cones +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.22 Sample `cont`

+ + +

Function cont draw contour lines for surface. You can select automatic (default) or manual levels for contours, print contour labels, draw it on the surface (default) or at plane (as Dens). +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'Cont plot (default)':rotate 50 60:box:cont a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:cont v a
+subplot 2 2 2:title '"\_" and "." styles':rotate 50 60:box:cont a '_':cont a '_.2k'
+subplot 2 2 3 '':title '"t" style':box:cont a 't'
+
+
Sample cont +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.23 Sample `cont3`

+ + +

Function contf3 draw ordinary contour lines but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box
+cont3 c 'x':cont3 c:cont3 c 'z'
+
+
Sample cont3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.24 Sample `cont_xyz`

+ + +

Functions contz, conty, contx draw contour lines on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Cont[XYZ] sample':rotate 50 60:box
+contx {sum c 'x'} '' -1:conty {sum c 'y'} '' 1:contz {sum c 'z'} '' -1
+
+
Sample cont_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.25 Sample `contd`

+ + +

Function contd is similar to contf but with manual contour colors. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContD plot (default)':rotate 50 60:box:contd a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contd v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contd a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contd a1
+
+
Sample contd +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.26 Sample `contf`

+ + +

Function contf draw filled contours. You can select automatic (default) or manual levels for contours. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContF plot (default)':rotate 50 60:box:contf a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contf v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contf a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contf a1
+
+
Sample contf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.27 Sample `contf3`

+ + +

Function contf3 draw ordinary filled contours but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box:light on
+contf3 c 'x':contf3 c:contf3 c 'z'
+cont3 c 'xk':cont3 c 'k':cont3 c 'zk'
+
+
Sample contf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.28 Sample `contf_xyz`

+ + +

Functions contfz, contfy, contfx, draw filled contours on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'ContF[XYZ] sample':rotate 50 60:box
+contfx {sum c 'x'} '' -1:contfy {sum c 'y'} '' 1:contfz {sum c 'z'} '' -1
+
+
Sample contf_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.29 Sample `contv`

+ + +

Function contv draw vertical cylinders (belts) at contour lines. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'ContV plot (default)':rotate 50 60:box:contv a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contv v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contv a '_'
+subplot 2 2 3:title 'ContV and ContF':rotate 50 60:light on:box
+contv a:contf a:cont a 'k'
+
+
Sample contv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.30 Sample `correl`

+ + +

Test of correlation function (correl). +

+

MGL code: +

new a 100 'exp(-10*x^2)'
+new b 100 'exp(-10*(x+0.5)^2)'
+yrange 0 1
+subplot 1 2 0 '_':title 'Input fields'
+plot a:plot b:box:axis
+correl r a b 'x'
+norm r 0 1:swap r 'x' # make it human readable
+subplot 1 2 1 '_':title 'Correlation of a and b'
+plot r 'r':axis:box
+line 0.5 0 0.5 1 'B|'
+
+
Sample correl +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.31 Sample `curvcoor`

+ + +

Some common curvilinear coordinates. +

+

MGL code: +

origin -1 1 -1
+subplot 2 2 0:title 'Cartesian':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' '':subplot 2 2 1:title 'Cylindrical':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis '2*y*x' 'y*y - x*x' '':subplot 2 2 2:title 'Parabolic':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' 'x+z':subplot 2 2 3:title 'Spiral':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+
Sample curvcoor +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.32 Sample `cut`

+ + +

Example of point cutting (cut. +

+

MGL code: +

call 'prepare2d'
+call 'prepare3d'
+subplot 2 2 0:title 'Cut on (default)':rotate 50 60:light on:box:surf a; zrange -1 0.5
+subplot 2 2 1:title 'Cut off':rotate 50 60:box:surf a; zrange -1 0.5; cut off
+subplot 2 2 2:title 'Cut in box':rotate 50 60:box:alpha on
+cut 0 -1 -1 1 0 1.1:surf3 c
+cut 0 0 0 0 0 0	# restore back
+subplot 2 2 3:title 'Cut by formula':rotate 50 60:box
+cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)':surf3 c
+
+
Sample cut +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.33 Sample `dat_diff`

+ + +

Example of diff and integrate. +

+

MGL code: +

ranges 0 1 0 1 0 1:new a 30 40 'x*y'
+subplot 2 2 0:title 'a(x,y)':rotate 60 40:surf a:box
+subplot 2 2 1:title 'da/dx':rotate 60 40:diff a 'x':surf a:box
+subplot 2 2 2:title '\int da/dx dxdy':rotate 60 40:integrate a 'xy':surf a:box
+subplot 2 2 3:title '\int {d^2}a/dxdy dx':rotate 60 40:diff2 a 'y':surf a:box
+
+
Sample dat_diff +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.34 Sample `dat_extra`

+ + +

Example of envelop, sew, smooth and resize. +

+

MGL code: +

subplot 2 2 0 '':title 'Envelop sample':new d1 1000 'exp(-8*x^2)*sin(10*pi*x)'
+axis:plot d1 'b':envelop d1 'x':plot d1 'r'
+subplot 2 2 1 '':title 'Smooth sample':ranges 0 1 0 1
+new y0 30 '0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd'
+copy y1 y0:smooth y1 'x3':plot y1 'r';legend '"3" style'
+copy y2 y0:smooth y2 'x5':plot y2 'g';legend '"5" style'
+copy y3 y0:smooth y3 'x':plot y3 'b';legend 'default'
+plot y0 '{m7}:s';legend 'none'
+legend:box
+subplot 2 2 2:title 'Sew sample':rotate 50 60:light on:alpha on
+new d2 100 100 'mod((y^2-(1-x)^2)/2,0.1)'
+box:surf d2 'b':sew d2 'xy' 0.1:surf d2 'r'
+subplot 2 2 3:title 'Resize sample (interpolation)'
+new x0 10 'rnd':new v0 10 'rnd'
+resize x1 x0 100:resize v1 v0 100
+plot x0 v0 'b+ ':plot x1 v1 'r-':label x0 v0 '%n'
+
+
Sample dat_extra +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.35 Sample `data1`

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:diff b 'x':subplot 5 3 0:call 'splot'
+copy b a:diff2 b 'x':subplot 5 3 1:call 'splot'
+copy b a:cumsum b 'x':subplot 5 3 2:call 'splot'
+copy b a:integrate b 'x':subplot 5 3 3:call 'splot'
+mirror b 'x':subplot 5 3 4:call 'splot'
+copy b a:diff b 'y':subplot 5 3 5:call 'splot'
+copy b a:diff2 b 'y':subplot 5 3 6:call 'splot'
+copy b a:cumsum b 'y':subplot 5 3 7:call 'splot'
+copy b a:integrate b 'y':subplot 5 3 8:call 'splot'
+mirror b 'y':subplot 5 3 9:call 'splot'
+copy b a:diff b 'z':subplot 5 3 10:call 'splot'
+copy b a:diff2 b 'z':subplot 5 3 11:call 'splot'
+copy b a:cumsum b 'z':subplot 5 3 12:call 'splot'
+copy b a:integrate b 'z':subplot 5 3 13:call 'splot'
+mirror b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box:surf3 b
+return
+
+
Sample data1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.36 Sample `data2`

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:sinfft b 'x':subplot 5 3 0:call 'splot'
+copy b a:cosfft b 'x':subplot 5 3 1:call 'splot'
+copy b a:hankel b 'x':subplot 5 3 2:call 'splot'
+copy b a:swap b 'x':subplot 5 3 3:call 'splot'
+copy b a:smooth b 'x':subplot 5 3 4:call 'splot'
+copy b a:sinfft b 'y':subplot 5 3 5:call 'splot'
+copy b a:cosfft b 'y':subplot 5 3 6:call 'splot'
+copy b a:hankel b 'y':subplot 5 3 7:call 'splot'
+copy b a:swap b 'y':subplot 5 3 8:call 'splot'
+copy b a:smooth b 'y':subplot 5 3 9:call 'splot'
+copy b a:sinfft b 'z':subplot 5 3 10:call 'splot'
+copy b a:cosfft b 'z':subplot 5 3 11:call 'splot'
+copy b a:hankel b 'z':subplot 5 3 12:call 'splot'
+copy b a:swap b 'z':subplot 5 3 13:call 'splot'
+copy b a:smooth b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box
+surf3 b 0.5:surf3 b -0.5
+return
+
+
Sample data2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.37 Sample `dens`

+ + +

Function dens draw density plot (also known as color-map) for surface. +

+

MGL code: +

call 'prepare2d'
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0 '':title 'Dens plot (default)':box:dens a
+subplot 2 2 1:title '3d variant':rotate 50 60:box:dens a
+subplot 2 2 2 '':title '"\#" style; meshnum 10':box:dens a '#'; meshnum 10
+subplot 2 2 3:title 'several slices':rotate 50 60:box:dens a1
+
+
Sample dens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.38 Sample `dens3`

+ + +

Function dens3 draw ordinary density plots but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Dens3 sample':rotate 50 60:alpha on:alphadef 0.7
+origin 0 0 0:box:axis '_xyz'
+dens3 c 'x':dens3 c ':y':dens3 c 'z'
+
+
Sample dens3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.39 Sample `dens_xyz`

+ + +

Functions densz, densy, densx draw density plot on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Dens[XYZ] sample':rotate 50 60:box
+densx {sum c 'x'} '' -1:densy {sum c 'y'} '' 1:densz {sum c 'z'} '' -1
+
+
Sample dens_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.40 Sample `detect`

+ + +

Example of curve detect. +

+

MGL code: +

subplot 1 1 0 '':title 'Detect sample'
+new a 200 100 'exp(-30*(y-0.5*sin(pi*x))^2-rnd/10)+exp(-30*(y+0.5*sin(pi*x))^2-rnd/10)+exp(-30*(x+y)^2-rnd/10)'
+ranges 0 a.nx 0 a.ny:box
+alpha on:crange a:dens a
+
+detect r a 0.1 5
+plot r(0) r(1) '.'
+
+
Sample detect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.41 Sample `dew`

+ + +

Function dew is similar to vect but use drops instead of arrows. +

+

MGL code: +

call 'prepare2v'
+subplot 1 1 0 '':title 'Dew plot':light on:box:dew a b
+
+
Sample dew +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.42 Sample `diffract`

+ + + + +

MGL code: +

define n 32	#number of points
+define m 20 # number of iterations
+define dt 0.01 # time step
+new res n m+1
+ranges -1 1 0 m*dt 0 1
+
+#tridmat periodic variant
+new !a n 'i',dt*(n/2)^2/2
+copy !b !(1-2*a)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xdc'
+put res u all $i+1
+next
+subplot 2 2 0 '<_':title 'Tridmat, periodic b.c.'
+axis:box:dens res
+
+#fourier variant
+new k n:fillsample k 'xk'
+copy !e !exp(-i1*dt*k^2)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+fourier u 'x'
+multo u e
+fourier u 'ix'
+put res u all $i+1
+next
+subplot 2 2 1 '<_':title 'Fourier method'
+axis:box:dens res
+
+#tridmat zero variant
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xd'
+put res u all $i+1
+next
+subplot 2 2 2 '<_':title 'Tridmat, zero b.c.'
+axis:box:dens res
+
+#diffract exp variant
+new !u n 'exp(-6*x^2)'
+define q dt*(n/2)^2/8 # need q<0.4 !!!
+put res u all 0
+for $i 0 m
+for $j 1 8	# due to smaller dt
+diffract u 'xe' q
+next
+put res u all $i+1
+next
+subplot 2 2 3 '<_':title 'Diffract, exp b.c.'
+axis:box:dens res
+
+
Sample diffract +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.43 Sample `dilate`

+ + +

Example of dilate and erode. +

+

MGL code: +

subplot 2 2 0:title 'Dilate&Erode 1D sample'
+new y 11:put y 1 5
+ranges 0 10 0 1:axis:box
+plot y 'b*'
+dilate y 0.5 2
+plot y 'rs'
+erode y 0.5 1
+plot y 'g#o'
+
+subplot 2 2 1:title 'Dilate&Erode 2D sample':rotate 40 60
+ranges 0 10 0 10 0 3
+axis:box
+new z 11 11:put z 3 5 5
+boxs z 'b':boxs z 'k#'
+dilate z 1 2
+boxs z 'r':boxs z 'k#'
+erode z 1 1
+boxs 2*z 'g':boxs 2*z 'k#'
+
+subplot 2 2 2
+text 0.5 0.7 'initial' 'ba';size -2
+text 0.5 0.5 'dilate=2' 'ra';size -2
+text 0.5 0.3 'erode=1' 'ga';size -2
+
+subplot 2 2 3:title 'Dilate&Erode 3D sample'
+rotate 60 50:light on:alpha on
+ranges 0 10 0 10 0 10:crange 0 3
+axis:box
+new a 11 11 11:put a 3 5 5 5
+surf3a a a 1.5 'b'
+dilate a 1 2
+surf3a a a 0.5 'r'
+erode a 1 1
+surf3a 2*a 2*a 1 'g'
+
+
Sample dilate +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.44 Sample `dots`

+ + +

Function dots is another way to draw irregular points. Dots use color scheme for coloring (see Color scheme). +

+

MGL code: +

new t 2000 'pi*(rnd-0.5)':new f 2000 '2*pi*rnd'
+copy x 0.9*cos(t)*cos(f):copy y 0.9*cos(t)*sin(f):copy z 0.6*sin(t):copy c cos(2*t)
+subplot 2 2 0:title 'Dots sample':rotate 50 60
+box:dots x y z
+alpha on
+subplot 2 2 1:title 'add transparency':rotate 50 60
+box:dots x y z c
+subplot 2 2 2:title 'add colorings':rotate 50 60
+box:dots x y z x c
+subplot 2 2 3:title 'Only coloring':rotate 50 60
+box:tens x y z x ' .'
+
+
Sample dots +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.45 Sample `earth`

+ + +

Example of Earth map by using import. +

+

MGL code: +

import dat 'Equirectangular-projection.jpg' 'BbGYw' -1 1
+subplot 1 1 0 '<>':title 'Earth in 3D':rotate 40 60
+copy phi dat 'pi*x':copy tet dat 'pi*y/2'
+copy x cos(tet)*cos(phi)
+copy y cos(tet)*sin(phi)
+copy z sin(tet)
+
+light on
+surfc x y z dat 'BbGYw'
+contp [-0.51,-0.51] x y z dat 'y'
+
+
Sample earth +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.46 Sample `error`

+ + +

Function error draw error boxes around the points. You can draw default boxes or semi-transparent symbol (like marker, see Line styles). Also you can set individual color for each box. See also error2 sample. +

+

MGL code: +

call 'prepare1d'
+new y 50 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2)'
+new x0 10 'x + 0.1*rnd-0.05':new ex 10 '0.1':new ey 10 '0.2'
+new y0 10 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2) + 0.2*rnd-0.1'
+subplot 2 2 0 '':title 'Error plot (default)':box:plot y:error x0 y0 ex ey 'k'
+subplot 2 2 1 '':title '"!" style; no e_x':box:plot y:error x0 y0 ey 'o!rgb'
+subplot 2 2 2 '':title '"\@" style':alpha on:box:plot y:error x0 y0 ex ey '@'; alpha 0.5
+subplot 2 2 3:title '3d variant':rotate 50 60:axis
+for $1 0 9
+	errbox 2*rnd-1 2*rnd-1 2*rnd-1 0.2 0.2 0.2 'bo'
+next
+
+
Sample error +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.47 Sample `error2`

+ + +

Example of error kinds. +

+

MGL code: +

new x0 10 'rnd':new ex 10 '0.1'
+new y0 10 'rnd':new ey 10 '0.1'
+ranges 0 1 0 1
+subplot 4 3 0 '':box:error x0 y0 ex ey '#+@'
+subplot 4 3 1 '':box:error x0 y0 ex ey '#x@'
+subplot 4 3 2 '':box:error x0 y0 ex ey '#s@'; alpha 0.5
+subplot 4 3 3 '':box:error x0 y0 ex ey 's@'
+subplot 4 3 4 '':box:error x0 y0 ex ey 'd@'
+subplot 4 3 5 '':box:error x0 y0 ex ey '#d@'; alpha 0.5
+subplot 4 3 6 '':box:error x0 y0 ex ey '+@'
+subplot 4 3 7 '':box:error x0 y0 ex ey 'x@'
+subplot 4 3 8 '':box:error x0 y0 ex ey 'o@'
+subplot 4 3 9 '':box:error x0 y0 ex ey '#o@'; alpha 0.5
+subplot 4 3 10 '':box:error x0 y0 ex ey '#.@'
+subplot 4 3 11 '':box:error x0 y0 ex ey; alpha 0.5
+
+
Sample error2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.48 Sample `export`

+ + +

Example of data export and import. +

+

MGL code: +

new a 100 100 'x^2*y':new b 100 100
+export a 'test_data.png' 'BbcyrR' -1 1
+import b 'test_data.png' 'BbcyrR' -1 1
+subplot 2 1 0 '':title 'initial':box:dens a
+subplot 2 1 1 '':title 'imported':box:dens b
+
+
Sample export +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.49 Sample `fall`

+ + +

Function fall draw waterfall surface. You can use meshnum for changing number of lines to be drawn. Also you can use `x` style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Fall plot':rotate 50 60:box:fall a
+
+
Sample fall +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.50 Sample `fexport`

+ + +

Example of write to different file formats. +

+

MGL code: +

subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+write 'fexport.jpg':#write 'fexport.png'
+write 'fexport.bmp':write 'fexport.tga'
+write 'fexport.eps':write 'fexport.svg'
+write 'fexport.gif':write 'fexport.xyz'
+write 'fexport.stl':write 'fexport.off'
+write 'fexport.tex':write 'fexport.obj'
+write 'fexport.prc':write 'fexport.json'
+write 'fexport.mgld'
+
+
Sample fexport +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.51 Sample `fit`

+ + +

Example of nonlinear fit. +

+

MGL code: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r':text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+
Sample fit +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.52 Sample `flame2d`

+ + +

Function flame2d generate points for flame fractals in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+new B 2 3 A.ny '0.3'
+put B 3 0 0 -1
+put B 3 0 1 -1
+put B 3 0 2 -1
+flame2d fx fy A B 1000000
+subplot 1 1 0 '<_':title 'Flame2d sample'
+ranges fx fy:box:axis
+plot fx fy 'r#o ';size 0.05
+
+
Sample flame2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.53 Sample `flow`

+ + +

Function flow is another standard way to visualize vector fields - it draw lines (threads) which is tangent to local vector field direction. MathGL draw threads from edges of bounding box and from central slices. Sometimes it is not most appropriate variant - you may want to use flowp to specify manual position of threads. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Flow plot (default)':box:flow a b
+subplot 2 2 1 '':title '"v" style':box:flow a b 'v'
+subplot 2 2 2 '':title '"#" and "." styles':box:flow a b '#':flow a b '.2k'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:flow ex ey ez
+
+
Sample flow +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.54 Sample `flow3`

+ + +

Function flow3 draw flow threads, which start from given plane. +

+

MGL code: +

call 'prepare3v'
+subplot 2 2 0:title 'Flow3 plot (default)':rotate 50 60:box
+flow3 ex ey ez
+subplot 2 2 1:title '"v" style, from boundary':rotate 50 60:box
+flow3 ex ey ez 'v' 0
+subplot 2 2 2:title '"t" style':rotate 50 60:box
+flow3 ex ey ez 't' 0
+subplot 2 2 3:title 'from \i z planes':rotate 50 60:box
+flow3 ex ey ez 'z' 0
+flow3 ex ey ez 'z' 9
+
+
Sample flow3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.55 Sample `fog`

+ + +

Example of fog. +

+

MGL code: +

call 'prepare2d'
+title 'Fog sample':rotate 50 60:light on:fog 1
+box:surf a:cont a 'y'
+
+
Sample fog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.56 Sample `fonts`

+ + +

Example of font typefaces. +

+

MGL code: +

define d 0.25
+loadfont 'STIX':text 0 1.1 'default font (STIX)'
+loadfont 'adventor':text 0 1.1-d 'adventor font'
+loadfont 'bonum':text 0 1.1-2*d 'bonum font'
+loadfont 'chorus':text 0 1.1-3*d 'chorus font'
+loadfont 'cursor':text 0 1.1-4*d 'cursor font'
+loadfont 'heros':text 0 1.1-5*d 'heros font'
+loadfont 'heroscn':text 0 1.1-6*d 'heroscn font'
+loadfont 'pagella':text 0 1.1-7*d 'pagella font'
+loadfont 'schola':text 0 1.1-8*d 'schola font'
+loadfont 'termes':text 0 1.1-9*d 'termes font'
+loadfont ''
+
+
Sample fonts +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.57 Sample `grad`

+ + +

Function grad draw gradient lines for matrix. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Grad plot':box:grad a:dens a '{u8}w{q8}'
+
+
Sample grad +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.58 Sample `hist`

+ + +

Example of hist (histogram). +

+

MGL code: +

new x 10000 '2*rnd-1':new y 10000 '2*rnd-1':copy z exp(-6*(x^2+y^2))
+hist xx x z:norm xx 0 1:hist yy y z:norm yy 0 1
+multiplot 3 3 3 2 2 '':ranges -1 1 -1 1 0 1:box:dots x y z 'wyrRk'
+multiplot 3 3 0 2 1 '':ranges -1 1 0 1:box:bars xx
+multiplot 3 3 5 1 2 '':ranges 0 1 -1 1:box:barh yy
+subplot 3 3 2:text 0.5 0.5 'Hist and\n{}MultiPlot\n{}sample' 'a' -3
+
+
Sample hist +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.59 Sample `ifs2d`

+ + +

Function ifs2d generate points for fractals using iterated function system in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+ifs2d fx fy A 100000
+subplot 1 1 0 '<_':title 'IFS 2d sample'
+ranges fx fy:axis
+plot fx fy 'r#o ';size 0.05
+
+
Sample ifs2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.60 Sample `ifs3d`

+ + +

Function ifs3d generate points for fractals using iterated function system in 3d case. +

+

MGL code: +

list A [0,0,0,0,.18,0,0,0,0,0,0,0,.01] [.85,0,0,0,.85,.1,0,-0.1,0.85,0,1.6,0,.85]\
+	[.2,-.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07] [-.2,.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07]
+ifs3d f A 100000
+title 'IFS 3d sample':rotate 50 60
+ranges f(0) f(1) f(2):axis:box
+dots f(0) f(1) f(2) 'G#o';size 0.05
+
+
Sample ifs3d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.61 Sample `indirect`

+ + +

Comparison of subdata vs evaluate/ +

+

MGL code: +

subplot 1 1 0 '':title 'SubData vs Evaluate'
+new in 9 'x^3/1.1':plot in 'ko ':box
+new arg 99 '4*x+4'
+evaluate e in arg off:plot e 'b.'; legend 'Evaluate'
+subdata s in arg:plot s 'r.';legend 'SubData'
+legend 2
+
+
Sample indirect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.62 Sample `inplot`

+ + +

Example of inplot, multiplot, columnplot, gridplot, shearplot, stickplot. +

+

MGL code: +

subplot 3 2 0:title 'StickPlot'
+stickplot 3 0 20 30:box 'r':text 0 0 0 '0' 'r'
+stickplot 3 1 20 30:box 'g':text 0 0 0 '1' 'g'
+stickplot 3 2 20 30:box 'b':text 0 9 0 '2' 'b'
+subplot 3 2 3 '':title 'ColumnPlot'
+columnplot 3 0:box 'r':text 0 0 '0' 'r'
+columnplot 3 1:box 'g':text 0 0 '1' 'g'
+columnplot 3 2:box 'b':text 0 0 '2' 'b'
+subplot 3 2 4 '':title 'GridPlot'
+gridplot 2 2 0:box 'r':text 0 0 '0' 'r'
+gridplot 2 2 1:box 'g':text 0 0 '1' 'g'
+gridplot 2 2 2:box 'b':text 0 0 '2' 'b'
+gridplot 2 2 3:box 'm':text 0 0 '3' 'm'
+subplot 3 2 5 '':title 'InPlot':box
+inplot 0.4 1 0.6 1 on:box 'r'
+multiplot 3 2 1 2 1 '':title 'MultiPlot and ShearPlot':box
+shearplot 3 0 0.2 0.1:box 'r':text 0 0 '0' 'r'
+shearplot 3 1 0.2 0.1:box 'g':text 0 0 '1' 'g'
+shearplot 3 2 0.2 0.1:box 'b':text 0 0 '2' 'b'
+
+
Sample inplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.63 Sample `iris`

+ + +

Function iris draw Iris plot for columns of data array. +

+

MGL code: +

read a 'iris.dat'
+crop a 0 4 'x':rearrange a a.nx 50
+subplot 1 1 0 '':title 'Iris plot'
+iris a 'sepal\n length;sepal\n width;petal\n length;petal\n width' '. ';value -1.5;size -2
+
+
Sample iris +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.64 Sample `label`

+ + +

Function label print text at data points. The string may contain `%x`, `%y`, `%z` for x-, y-, z-coordinates of points, `%n` for point index. +

+

MGL code: +

new ys 10 '0.2*rnd-0.8*sin(pi*x)'
+subplot 1 1 0 '':title 'Label plot':box:plot ys ' *':label ys 'y=%y'
+
+
Sample label +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.65 Sample `lamerey`

+ + +

Function lamerey draw Lamerey diagram. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Lamerey sample'
+axis:xlabel '\i x':ylabel '\bar{\i x} = 2 \i{x}'
+fplot 'x' 'k='
+fplot '2*x' 'b'
+lamerey 0.00097 '2*x' 'rv~';size 2
+lamerey -0.00097 '2*x' 'rv~';size 2
+
+
Sample lamerey +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.66 Sample `legend`

+ + +

Example of legend styles. +

+

MGL code: +

addlegend 'sin(\pi {x^2})' 'b':addlegend 'sin(\pi x)' 'g*'
+addlegend 'sin(\pi \sqrt{x})' 'rd':addlegend 'jsut text' ' ':addlegend 'no indent for this' ''
+subplot 2 2 0 '':title 'Legend (default)':box:legend
+legend 1 0.5 '^':text 0.49 0.88 'Style "\^"' 'A:L'
+legend 3 'A#':text 0.75 0.65 'Absolute position' 'A'
+subplot 2 2 2 '':title 'coloring':box:legend 0 'r#':legend 1 'Wb#':legend 2 'ygr#'
+subplot 2 2 3 '':title 'manual position':box
+legend 0.5 1:text 0.5 0.5 'at x=0.5, y=1' 'a'
+legend 1 '#-':text 0.75 0.25 'Horizontal legend' 'a'
+
+
Sample legend +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.67 Sample `light`

+ + +

Example of light with different types. +

+

MGL code: +

light on:attachlight on
+call 'prepare2d'
+subplot 2 2 0:title 'Default':rotate 50 60:box:surf a
+line -1 -0.7 1.7 -1 -0.7 0.7 'BA'
+
+subplot 2 2 1:title 'Local':rotate 50 60
+light 0 1 0 1 -2 -1 -1
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 2:title 'no diffuse':rotate 50 60
+diffuse 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 3:title 'diffusive only':rotate 50 60
+diffuse 0.5:light 0 1 0 1 -2 -1 -1 'w' 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+
Sample light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.68 Sample `loglog`

+ + +

Example of log- and log-log- axis labels. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Semi-log axis':ranges 0.01 100 -1 1:axis 'lg(x)' '' ''
+axis:grid 'xy' 'g':fplot 'sin(1/x)':xlabel 'x' 0:ylabel 'y = sin 1/x' 0
+subplot 2 2 1 '<_':title 'Log-log axis':ranges 0.01 100 0.1 100:axis 'lg(x)' 'lg(y)' ''
+axis:grid '!' 'h=':grid:fplot 'sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = \sqrt{1+x^2}' 0
+subplot 2 2 2 '<_':title 'Minus-log axis':ranges -100 -0.01 -100 -0.1:axis '-lg(-x)' '-lg(-y)' ''
+axis:fplot '-sqrt(1+x^2)':xlabel 'x' 0:ylabel 'y = -\sqrt{1+x^2}' 0
+subplot 2 2 3 '<_':title 'Log-ticks':ranges 0.01 100 0 100:axis 'sqrt(x)' '' ''
+axis:fplot 'x':xlabel 'x' 1:ylabel 'y = x' 0
+
+
Sample loglog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.69 Sample `map`

+ + +

Example of map. +

+

MGL code: +

new a 50 40 'x':new b 50 40 'y':zrange -2 2:text 0 0 '\to'
+subplot 2 1 0:text 0 1.1 '\{x, y\}' '' -2:box:map a b 'brgk'
+subplot 2 1 1:text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2
+box:fill a '(x^3+y^3)/2':fill b '(x-y)/2':map a b 'brgk'
+
+
Sample map +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.70 Sample `mark`

+ + +

Example of mark. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Mark plot (default)':box:mark y y1 's'
+
+
Sample mark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.71 Sample `mask`

+ + +

Example of mask kinds. +

+

MGL code: +

new a 10 10 'x'
+subplot 5 4 0 '':title '"-" mask':dens a '3-'
+subplot 5 4 1 '':title '"+" mask':dens a '3+'
+subplot 5 4 2 '':title '"=" mask':dens a '3='
+subplot 5 4 3 '':title '";" mask':dens a '3;'
+subplot 5 4 4 '':title '";I" mask':dens a '3;I'
+subplot 5 4 5 '':title '"o" mask':dens a '3o'
+subplot 5 4 6 '':title '"O" mask':dens a '3O'
+subplot 5 4 7 '':title '"s" mask':dens a '3s'
+subplot 5 4 8 '':title '"S" mask':dens a '3S'
+subplot 5 4 9 '':title '";/" mask':dens a '3;/'
+subplot 5 4 10 '':title '"~" mask':dens a '3~'
+subplot 5 4 11 '':title '"<" mask':dens a '3<'
+subplot 5 4 12 '':title '">" mask':dens a '3>'
+subplot 5 4 13 '':title '"j" mask':dens a '3j'
+subplot 5 4 14 '':title '"-;\" mask':dens a '3;\ '
+subplot 5 4 15 '':title '"d" mask':dens a '3d'
+subplot 5 4 16 '':title '"D" mask':dens a '3D'
+subplot 5 4 17 '':title '"*" mask':dens a '3*'
+subplot 5 4 18 '':title '"^" mask':dens a '3^'
+subplot 5 4 19 '':title 'manual mask'
+mask '+' 'ff00182424f800':dens a '3+'
+
+
Sample mask +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.72 Sample `mesh`

+ + +

Function mesh draw wired surface. You can use meshnum for changing number of lines to be drawn. +

+

MGL code: +

call 'prepare2d'
+title 'Mesh plot':rotate 50 60:box:mesh a
+
+
Sample mesh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.73 Sample `mirror`

+ + +

Example of using options. +

+

MGL code: +

new a 31 41 '-pi*x*exp(-(y+1)^2-4*x^2)'
+subplot 2 2 0:title 'Options for coordinates':alpha on:light on:rotate 40 60:box
+surf a 'r';yrange 0 1:surf a 'b';yrange 0 -1
+subplot 2 2 1:title 'Option "meshnum"':rotate 40 60:box
+mesh a 'r'; yrange 0 1:mesh a 'b';yrange 0 -1; meshnum 5
+subplot 2 2 2:title 'Option "alpha"':rotate 40 60:box
+surf a 'r';yrange 0 1; alpha 0.7:surf a 'b';yrange 0 -1; alpha 0.3
+subplot 2 2 3 '<_':title 'Option "legend"'
+fplot 'x^3' 'r'; legend 'y = x^3':fplot 'cos(pi*x)' 'b'; legend 'y = cos \pi x'
+box:axis:legend 2
+
+
Sample mirror +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.74 Sample `molecule`

+ + +

Example of drawing molecules. +

+

MGL code: +

alpha on:light on
+subplot 2 2 0 '':title 'Methane, CH_4':rotate 60 120
+sphere 0 0 0 0.25 'k':drop 0 0 0 0 0 1 0.35 'h' 1 2:sphere 0 0 0.7 0.25 'g'
+drop 0 0 0 -0.94 0 -0.33 0.35 'h' 1 2:sphere -0.66 0 -0.23 0.25 'g'
+drop 0 0 0 0.47 0.82 -0.33 0.35 'h' 1 2:sphere 0.33 0.57 -0.23 0.25 'g'
+drop 0 0 0 0.47 -0.82 -0.33 0.35 'h' 1 2:sphere 0.33 -0.57 -0.23 0.25 'g'
+subplot 2 2 1 '':title 'Water, H{_2}O':rotate 60 100
+sphere 0 0 0 0.25 'r':drop 0 0 0 0.3 0.5 0 0.3 'm' 1 2:sphere 0.3 0.5 0 0.25 'g'
+drop 0 0 0 0.3 -0.5 0 0.3 'm' 1 2:sphere 0.3 -0.5 0 0.25 'g'
+subplot 2 2 2 '':title 'Oxygen, O_2':rotate 60 120
+drop 0 0.5 0 0 -0.3 0 0.3 'm' 1 2:sphere 0 0.5 0 0.25 'r'
+drop 0 -0.5 0 0 0.3 0 0.3 'm' 1 2:sphere 0 -0.5 0 0.25 'r'
+subplot 2 2 3 '':title 'Ammonia, NH_3':rotate 60 120
+sphere 0 0 0 0.25 'b':drop 0 0 0 0.33 0.57 0 0.32 'n' 1 2
+sphere 0.33 0.57 0 0.25 'g':drop 0 0 0 0.33 -0.57 0 0.32 'n' 1 2
+sphere 0.33 -0.57 0 0.25 'g':drop 0 0 0 -0.65 0 0 0.32 'n' 1 2
+sphere -0.65 0 0 0.25 'g'
+
+
Sample molecule +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.75 Sample `ode`

+ + +

Example of phase plain created by ode solving, contour lines (cont) and flow threads. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Cont':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new f 100 100 'y^2+2*x^3-x^2-0.5':cont f
+
+subplot 2 2 1 '<_':title 'Flow':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new fx 100 100 'x-3*x^2'
+new fy 100 100 'y'
+flow fy fx 'v';value 7
+
+subplot 2 2 2 '<_':title 'ODE':box
+axis:xlabel 'x':ylabel '\dot{x}'
+for $x -1 1 0.1
+  ode r 'y;x-3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+  ode r '-y;-x+3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+next
+
+
Sample ode +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.76 Sample `ohlc`

+ + +

Function ohlc draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high) and minimal(low) values, as well as horizontal lines before/after vertical line for initial(open)/final(close) values of some process. +

+

MGL code: +

new o 10 '0.5*sin(pi*x)'
+new c 10 '0.5*sin(pi*(x+2/9))'
+new l 10 '0.3*rnd-0.8'
+new h 10 '0.3*rnd+0.5'
+subplot 1 1 0 '':title 'OHLC plot':box:ohlc o h l c
+
+
Sample ohlc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.77 Sample `param1`

+ + +

Example of parametric plots for 1D data. +

+

MGL code: +

new x 100 'sin(pi*x)'
+new y 100 'cos(pi*x)'
+new z 100 'sin(2*pi*x)'
+new c 100 'cos(2*pi*x)'
+
+subplot 4 3 0:rotate 40 60:box:plot x y z
+subplot 4 3 1:rotate 40 60:box:area x y z
+subplot 4 3 2:rotate 40 60:box:tens x y z c
+subplot 4 3 3:rotate 40 60:box:bars x y z
+subplot 4 3 4:rotate 40 60:box:stem x y z
+subplot 4 3 5:rotate 40 60:box:textmark x y z c*2 '\alpha'
+subplot 4 3 6:rotate 40 60:box:tube x y z c/10
+subplot 4 3 7:rotate 40 60:box:mark x y z c 's'
+subplot 4 3 8:box:error x y z/10 c/10
+subplot 4 3 9:rotate 40 60:box:step x y z
+subplot 4 3 10:rotate 40 60:box:torus x z 'z';light on
+subplot 4 3 11:rotate 40 60:box:label x y z '%z'
+
+
Sample param1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.78 Sample `param2`

+ + +

Example of parametric plots for 2D data. +

+

MGL code: +

new x 100 100 'sin(pi*(x+y)/2)*cos(pi*y/2)'
+new y 100 100 'cos(pi*(x+y)/2)*cos(pi*y/2)'
+new z 100 100 'sin(pi*y/2)'
+new c 100 100 'cos(pi*x)'
+
+subplot 4 4 0:rotate 40 60:box:surf x y z
+subplot 4 4 1:rotate 40 60:box:surfc x y z c
+subplot 4 4 2:rotate 40 60:box:surfa x y z c;alpha 1
+subplot 4 4 3:rotate 40 60:box:mesh x y z;meshnum 10
+subplot 4 4 4:rotate 40 60:box:tile x y z;meshnum 10
+subplot 4 4 5:rotate 40 60:box:tiles x y z c;meshnum 10
+subplot 4 4 6:rotate 40 60:box:axial x y z;alpha 0.5;light on
+subplot 4 4 7:rotate 40 60:box:cont x y z
+subplot 4 4 8:rotate 40 60:box:contf x y z;light on:contv x y z;light on
+subplot 4 4 9:rotate 40 60:box:belt x y z 'x';meshnum 10;light on
+subplot 4 4 10:rotate 40 60:box:dens x y z;alpha 0.5
+subplot 4 4 11:rotate 40 60:box
+fall x y z 'g';meshnum 10:fall x y z 'rx';meshnum 10
+subplot 4 4 12:rotate 40 60:box:belt x y z '';meshnum 10;light on
+subplot 4 4 13:rotate 40 60:box:boxs x y z '';meshnum 10;light on
+subplot 4 4 14:rotate 40 60:box:boxs x y z '#';meshnum 10;light on
+subplot 4 4 15:rotate 40 60:box:boxs x y z '@';meshnum 10;light on
+
+
Sample param2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.79 Sample `param3`

+ + +

Example of parametric plots for 3D data. +

+

MGL code: +

new x 50 50 50 '(x+2)/3*sin(pi*y/2)'
+new y 50 50 50 '(x+2)/3*cos(pi*y/2)'
+new z 50 50 50 'z'
+new c 50 50 50 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 50 50 50 '1-2*tanh(2*(x+y)^2)'
+
+alpha on:light on
+subplot 4 3 0:rotate 40 60:box:surf3 x y z c
+subplot 4 3 1:rotate 40 60:box:surf3c x y z c d
+subplot 4 3 2:rotate 40 60:box:surf3a x y z c d
+subplot 4 3 3:rotate 40 60:box:cloud x y z c
+subplot 4 3 4:rotate 40 60:box:cont3 x y z c:cont3 x y z c 'x':cont3 x y z c 'z'
+subplot 4 3 5:rotate 40 60:box:contf3 x y z c:contf3 x y z c 'x':contf3 x y z c 'z'
+subplot 4 3 6:rotate 40 60:box:dens3 x y z c:dens3 x y z c 'x':dens3 x y z c 'z'
+subplot 4 3 7:rotate 40 60:box:dots x y z c;meshnum 15
+subplot 4 3 8:rotate 40 60:box:densx c '' 0:densy c '' 0:densz c '' 0
+subplot 4 3 9:rotate 40 60:box:contx c '' 0:conty c '' 0:contz c '' 0
+subplot 4 3 10:rotate 40 60:box:contfx c '' 0:contfy c '' 0:contfz c '' 0
+
+
Sample param3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.80 Sample `paramv`

+ + +

Example of parametric plots for vector fields. +

+

MGL code: +

new x 20 20 20 '(x+2)/3*sin(pi*y/2)'
+new y 20 20 20 '(x+2)/3*cos(pi*y/2)'
+new z 20 20 20 'z+x'
+new ex 20 20 20 'x'
+new ey 20 20 20 'x^2+y'
+new ez 20 20 20 'y^2+z'
+
+new x1 50 50 '(x+2)/3*sin(pi*y/2)'
+new y1 50 50 '(x+2)/3*cos(pi*y/2)'
+new e1 50 50 'x'
+new e2 50 50 'x^2+y'
+
+subplot 3 3 0:rotate 40 60:box:vect x1 y1 e1 e2
+subplot 3 3 1:rotate 40 60:box:flow x1 y1 e1 e2
+subplot 3 3 2:rotate 40 60:box:pipe x1 y1 e1 e2
+subplot 3 3 3:rotate 40 60:box:dew x1 y1 e1 e2
+subplot 3 3 4:rotate 40 60:box:vect x y z ex ey ez
+subplot 3 3 5:rotate 40 60:box
+vect3 x y z ex ey ez:vect3 x y z ex ey ez 'x':vect3 x y z ex ey ez 'z'
+grid3 x y z z '{r9}':grid3 x y z z '{g9}x':grid3 x y z z '{b9}z'
+subplot 3 3 6:rotate 40 60:box:flow x y z ex ey ez
+subplot 3 3 7:rotate 40 60:box:pipe x y z ex ey ez
+
+
Sample paramv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.81 Sample `parser`

+ + +

Basic MGL script. +

+

MGL code: +

title 'MGL parser sample'
+# call function
+call 'sample'
+
+# ordinary for-loop
+for $0 -1 1 0.1
+if $0<0:line 0 0 1 $0 'r':else:line 0 0 1 $0 'g':endif
+next
+
+# if-elseif-else
+for $i -1 1 0.5
+if $i<0
+text 1.1 $i '$i' 'b'
+elseif $i>0
+text 1.1 $i '$i' 'r'
+else
+text 1.1 $i '$i'
+endif
+next
+
+# ordinary do-while
+do
+defnum $i $i-0.2
+line 0 0 $i 1 'b'
+while $i>0
+
+# do-next-break
+do
+defnum $i $i-0.2
+if $i<-1 then break
+line 0 0 $i 1 'm'
+next
+
+# for-while-continue
+for $i -5 10
+text $i/5 1.1 'a'+($i+5)
+if $i<0
+text $i/5-0.06 1.1 '--' 'b'
+elseif mod($i,2)=0
+text $i/5-0.06 1.1 '~' 'r'
+else
+# NOTE: 'continue' bypass the 'while'!
+continue
+endif
+# NOTE: 'while' limit the actual number of iterations
+while $i<5
+
+# nested loops
+for $i 0 1 0.1
+for $j 0 1 0.1
+ball $i $j
+if $j>0.5 then continue
+ball $i $j 'b+'
+next
+next
+
+func 'sample'
+new dat 100 'sin(2*pi*(i/99+1))'
+plot dat;xrange -1 0
+box:axis
+xlabel 'x':ylabel 'y'
+return
+
+
Sample parser +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.82 Sample `pde`

+ + +

Example of pde solver. +

+

MGL code: +

new re 128 'exp(-48*(x+0.7)^2)':new im 128
+pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30
+transpose a
+subplot 1 1 0 '<_':title 'PDE solver'
+axis:xlabel '\i x':ylabel '\i z'
+crange 0 1:dens a 'wyrRk'
+fplot '-x' 'k|'
+text 0 0.95 'Equation: ik_0\partial_zu + \Delta u + x\cdot u + i \frac{x+z}{2}\cdot u = 0\n{}absorption: (x+z)/2 for x+z>0'
+
+
Sample pde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.83 Sample `pendelta`

+ + +

Example of pendelta for lines and glyphs smoothing. +

+

MGL code: +

quality 6
+list a 0.25 0.5 1 2 4
+for $0 0 4
+pendelta a($0)
+define $1 0.5*$0-1
+line -1 $1 1 $1 'r'
+text 0 $1 'delta=',a($0)
+next
+
+
Sample pendelta +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.84 Sample `pipe`

+ + +

Function pipe is similar to flow but draw pipes (tubes) which radius is proportional to the amplitude of vector field. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Pipe plot (default)':light on:box:pipe a b
+subplot 2 2 1 '':title '"i" style':box:pipe a b 'i'
+subplot 2 2 2 '':title 'from edges only':box:pipe a b '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:pipe ex ey ez '' 0.1
+
+
Sample pipe +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.85 Sample `plot`

+ + +

Function plot is most standard way to visualize 1D data array. By default, Plot use colors from palette. However, you can specify manual color/palette, and even set to use new color for each points by using `!` style. Another feature is ` ` style which draw only markers without line between points. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Plot plot (default)':box:plot y
+subplot 2 2 2 '':title ''!' style; 'rgb' palette':box:plot y 'o!rgb'
+subplot 2 2 3 '':title 'just markers':box:plot y ' +'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:plot xc yc z 'rs'
+
+
Sample plot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.86 Sample `pmap`

+ + +

Function pmap draw Poincare map - show intersections of the curve and the surface. +

+

MGL code: +

subplot 1 1 0 '<_^':title 'Poincare map sample'
+ode r 'cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)' 'xyz' [0.1,0,0] 0.1 100
+rotate 40 60:copy x r(0):copy y r(1):copy z r(2)
+ranges x y z
+axis:plot x y z 'b'
+xlabel '\i x' 0:ylabel '\i y' 0:zlabel '\i z'
+pmap x y z z 'b#o'
+fsurf '0'
+
+
Sample pmap +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.87 Sample `primitives`

+ + +

Example of primitives: line, curve, rhomb, ellipse, face, sphere, drop, cone. +

+

MGL code: +

subplot 2 2 0 '':title 'Line, Curve, Rhomb, Ellipse' '' -1.5
+line -1 -1 -0.5 1 'qAI'
+curve -0.6 -1 1 1 0 1 1 1 'rA'
+ball 0 -0.5 '*':ball 1 -0.1 '*'
+rhomb 0 0.4 1 0.9 0.2 'b#'
+rhomb 0 0 1 0.4 0.2 'cg@'
+ellipse 0 -0.5 1 -0.1 0.2 'u#'
+ellipse 0 -1 1 -0.6 0.2 'm@'
+
+subplot 2 3 1 '':title 'Arc, Polygon, Symbol';size -1.2
+arc -0.6 0 -0.6 0.3 180 '2kA':ball -0.6 0
+polygon 0 0 0 0.4 6 'r'
+new x 50 'cos(3*pi*x)':new y 50 'sin(pi*x)'
+addsymbol 'a' x y
+symbol 0.7 0 'a'
+
+light on
+subplot 2 3 3 '<^>' 0 -0.2:title 'Face[xyz]';size -1.5:rotate 50 60:box
+facex 1 0 -1 1 1 'r':facey -1 -1 -1 1 1 'g':facez 1 -1 -1 -1 1 'b'
+face -1 -1 1 -1 1 1 1 -1 0 1 1 1 'bmgr'
+
+subplot 2 3 5 '':title 'Cone';size -1.5
+cone -0.7 -0.3 0 -0.7 0.7 0.5 0.2 0.1 'b':text -0.7 -0.7 'no edges\n(default)';size -1.5
+cone 0 -0.3 0 0 0.7 0.5 0.2 0.1 'g@':text 0 -0.7 'with edges\n("\@" style)';size -1.5
+cone 0.7 -0.3 0 0.7 0.7 0.5 0.2 0 'Ggb':text 0.7 -0.7 '"arrow" with\n{}gradient';size -1.5
+subplot 2 2 2 '':title 'Sphere and Drop'
+line -0.9 0 1 0.9 0 1
+text -0.9 0.4 'sh=0':drop -0.9 0 0 1 0.5 'r' 0:ball -0.9 0 1 'k'
+text -0.3 0.6 'sh=0.33':drop -0.3 0 0 1 0.5 'r' 0.33:ball -0.3 0 1 'k'
+text 0.3 0.8 'sh=0.67':drop 0.3 0 0 1 0.5 'r' 0.67:ball 0.3 0 1 'k'
+text 0.9 1. 'sh=1':drop 0.9 0 0 1 0.5 'r' 1:ball 0.9 0 1 'k'
+
+text -0.9 -1.1 'asp=0.33':drop -0.9 -0.7 0 1 0.5 'b' 0 0.33
+text -0.3 -1.1 'asp=0.67':drop -0.3 -0.7 0 1 0.5 'b' 0 0.67
+text 0.3 -1.1 'asp=1':drop 0.3 -0.7 0 1 0.5 'b' 0 1
+text 0.9 -1.1 'asp=1.5':drop 0.9 -0.7 0 1 0.5 'b' 0 1.5
+
+
Sample primitives +
+
+ + + +

6.88 Sample `projection`

+ + +

Example of plot projection (ternary=4). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample':ternary 4:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+
Sample projection +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.89 Sample `projection5`

+ + +

Example of plot projection in ternary coordinates (ternary=5). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample (ternary)':ternary 5:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+
Sample projection5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.90 Sample `pulse`

+ + +

Example of pulse parameter determining. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Pulse sample'
+new a 100 'exp(-6*x^2)':ranges 0 a.nx-1 0 1
+axis:plot a
+
+pulse b a 'x'
+
+define m a.max
+
+line b(1) 0 b(1) m 'r='
+line b(1)-b(3)/2 0  b(1)-b(3)/2 m 'm|'
+line b(1)+b(3)/2 0  b(1)+b(3)/2 m 'm|'
+line 0 0.5*m a.nx-1 0.5*m 'h'
+new x 100 'x'
+plot b(0)*(1-((x-b(1))/b(2))^2) 'g'
+
+
Sample pulse +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.91 Sample `qo2d`

+ + +

Example of PDE solving by quasioptical approach qo2d. +

+

MGL code: +

define $1 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)'
+subplot 1 1 0 '<_':title 'Beam and ray tracing'
+ray r $1 -0.7 -1 0 0 0.5 0 0.02 2:plot r(0) r(1) 'k'
+axis:xlabel '\i x':ylabel '\i z'
+new re 128 'exp(-48*x^2)':new im 128
+new xx 1:new yy 1
+qo2d a $1 re im r 1 30 xx yy
+crange 0 1:dens xx yy a 'wyrRk':fplot '-x' 'k|'
+text 0 0.85 'absorption: (x+y)/2 for x+y>0'
+text 0.7 -0.05 'central ray'
+
+
Sample qo2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.92 Sample `quality0`

+ + +

Show all kind of primitives in quality=0. +

+

MGL code: +

quality 0
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.93 Sample `quality1`

+ + +

Show all kind of primitives in quality=1. +

+

MGL code: +

quality 1
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.94 Sample `quality2`

+ + +

Show all kind of primitives in quality=2. +

+

MGL code: +

quality 2
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.95 Sample `quality4`

+ + +

Show all kind of primitives in quality=4. +

+

MGL code: +

quality 4
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality4 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.96 Sample `quality5`

+ + +

Show all kind of primitives in quality=5. +

+

MGL code: +

quality 5
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.97 Sample `quality6`

+ + +

Show all kind of primitives in quality=6. +

+

MGL code: +

quality 6
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality6 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.98 Sample `quality8`

+ + +

Show all kind of primitives in quality=8. +

+

MGL code: +

quality 8
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality8 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.99 Sample `radar`

+ + +

The radar plot is variant of plot, which make plot in polar coordinates and draw radial rays in point directions. If you just need a plot in polar coordinates then I recommend to use Curvilinear coordinates or plot in parametric form with x=r*cos(fi); y=r*sin(fi);. +

+

MGL code: +

new yr 10 3 '0.4*sin(pi*(x+1.5+y/2)+0.1*rnd)'
+subplot 1 1 0 '':title 'Radar plot (with grid, "\#")':radar yr '#'
+
+
Sample radar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.100 Sample `refill`

+ + +

Example of refill and gspline. +

+

MGL code: +

new x 10 '0.5+rnd':cumsum x 'x':norm x -1 1
+copy y sin(pi*x)/1.5
+subplot 2 2 0 '<_':title 'Refill sample'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:refill r x y:plot r 'r'
+
+subplot 2 2 1 '<_':title 'Global spline'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:gspline r x y:plot r 'r'
+
+new y 10 '0.5+rnd':cumsum y 'x':norm y -1 1
+copy xx x:extend xx 10
+copy yy y:extend yy 10:transpose yy
+copy z sin(pi*xx*yy)/1.5
+alpha on:light on
+subplot 2 2 2:title '2d regular':rotate 40 60
+box:axis:mesh xx yy z 'k'
+new rr 100 100:refill rr x y z:surf rr
+
+new xx 10 10 '(x+1)/2*cos(y*pi/2-1)':new yy 10 10 '(x+1)/2*sin(y*pi/2-1)'
+copy z sin(pi*xx*yy)/1.5
+subplot 2 2 3:title '2d non-regular':rotate 40 60
+box:axis:plot xx yy z 'ko '
+new rr 100 100:refill rr xx yy z:surf rr
+
+
Sample refill +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.101 Sample `region`

+ + +

Function region fill the area between 2 curves. It support gradient filling if 2 colors per curve is specified. Also it can fill only the region y1<y<y2 if style `i` is used. +

+

MGL code: +

call 'prepare1d'
+copy y1 y(:,1):copy y2 y(:,2)
+subplot 2 2 0 '':title 'Region plot (default)':box:region y1 y2:plot y1 'k2':plot y2 'k2'
+subplot 2 2 1 '':title '2 colors':box:region y1 y2 'yr':plot y1 'k2':plot y2 'k2'
+subplot 2 2 2 '':title '"i" style':box:region y1 y2 'ir':plot y1 'k2':plot y2 'k2'
+subplot 2 2 3 '^_':title '3d variant':rotate 40 60:box
+new x1 100 'sin(pi*x)':new y1 100 'cos(pi*x)':new z 100 'x'
+new x2 100 'sin(pi*x+pi/3)':new y2 100 'cos(pi*x+pi/3)'
+plot x1 y1 z 'r2':plot x2 y2 z 'b2'
+region x1 y1 z x2 y2 z 'cmy!'
+
+
Sample region +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.102 Sample `scanfile`

+ + +

Example of scanfile for reading `named` data. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Save and scanfile sample'
+list a 1 -1 0
+save 'This is test: 0 -> ',a(0),' q' 'test.txt' 'w'
+save 'This is test: 1 -> ',a(1),' q' 'test.txt'
+save 'This is test: 2 -> ',a(2),' q' 'test.txt'
+
+scanfile a 'test.txt' 'This is test: %g -> %g'
+ranges a(0) a(1):axis:plot a(0) a(1) 'o'
+
+
Sample scanfile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.103 Sample `schemes`

+ + +

Example of popular color schemes. +

+

MGL code: +

new x 100 100 'x':new y 100 100 'y'
+call 'sch' 0 'kw'
+call 'sch' 1 '%gbrw'
+call 'sch' 2 'kHCcw'
+call 'sch' 3 'kBbcw'
+call 'sch' 4 'kRryw'
+call 'sch' 5 'kGgew'
+call 'sch' 6 'BbwrR'
+call 'sch' 7 'BbwgG'
+call 'sch' 8 'GgwmM'
+call 'sch' 9 'UuwqR'
+call 'sch' 10 'QqwcC'
+call 'sch' 11 'CcwyY'
+call 'sch' 12 'bcwyr'
+call 'sch' 13 'bwr'
+call 'sch' 14 'wUrqy'
+call 'sch' 15 'UbcyqR'
+call 'sch' 16 'BbcyrR'
+call 'sch' 17 'bgr'
+call 'sch' 18 'BbcyrR|'
+call 'sch' 19 'b{g,0.3}r'
+stop
+func 'sch' 2
+subplot 2 10 $1 '<>_^' 0.2 0:surfa x y $2
+text 0.07+0.5*mod($1,2) 0.92-0.1*int($1/2) $2 'A'
+return
+
+
Sample schemes +
+
+ + + +

6.104 Sample `section`

+ + +

Example of section to separate data and join it back. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Section&Join sample'
+axis:box:line -1 0 1 0 'h:'
+# first lets demonstrate 'join'
+new aa 11 'x^2':new a1 3 '-x':new a2 15 'x^3'
+join aa a1:join aa a2
+# add x-coordinate
+new xx aa.nx 'x':join aa xx
+plot aa(:,1) aa(:,0) '2y'
+# now select 1-st (id=0) section between zeros
+section b1 aa 0 'x' 0
+plot b1(:,1) b1(:,0) 'bo'
+# next, select 3-d (id=2) section between zeros
+section b3 aa 2 'x' 0
+plot b3(:,1) b3(:,0) 'gs'
+# finally, select 2-nd (id=-2) section from the end
+section b4 aa -2 'x' 0
+plot b4(:,1) b4(:,0) 'r#o'
+
+
Sample section +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.105 Sample `several_light`

+ + +

Example of using several light sources. +

+

MGL code: +

call 'prepare2d'
+title 'Several light sources':rotate 50 60:light on
+light 1 0 1 0 'c':light 2 1 0 0 'y':light 3 0 -1 0 'm'
+box:surf a 'h'
+
+
Sample several_light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.106 Sample `solve`

+ + +

Example of solve for root finding. +

+

MGL code: +

zrange 0 1
+new x 20 30 '(x+2)/3*cos(pi*y)'
+new y 20 30 '(x+2)/3*sin(pi*y)'
+new z 20 30 'exp(-6*x^2-2*sin(pi*y)^2)'
+
+subplot 2 1 0:title 'Cartesian space':rotate 30 -40
+axis 'xyzU':box
+xlabel 'x':ylabel 'y'
+origin 1 1:grid 'xy'
+mesh x y z
+
+# section along 'x' direction
+solve u x 0.5 'x'
+var v u.nx 0 1
+evaluate yy y u v
+evaluate xx x u v
+evaluate zz z u v
+plot xx yy zz 'k2o'
+
+# 1st section along 'y' direction
+solve u1 x -0.5 'y'
+var v1 u1.nx 0 1
+evaluate yy y v1 u1
+evaluate xx x v1 u1
+evaluate zz z v1 u1
+plot xx yy zz 'b2^'
+
+# 2nd section along 'y' direction
+solve u2 x -0.5 'y' u1
+evaluate yy y v1 u2
+evaluate xx x v1 u2
+evaluate zz z v1 u2
+plot xx yy zz 'r2v'
+
+subplot 2 1 1:title 'Accompanied space'
+ranges 0 1 0 1:origin 0 0
+axis:box:xlabel 'i':ylabel 'j':grid2 z 'h'
+
+plot u v 'k2o':line 0.4 0.5 0.8 0.5 'kA'
+plot v1 u1 'b2^':line 0.5 0.15 0.5 0.3 'bA'
+plot v1 u2 'r2v':line 0.5 0.7 0.5 0.85 'rA'
+
+
Sample solve +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.107 Sample `stem`

+ + +

Function stem draw vertical bars. It is most attractive if markers are drawn too. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Stem plot (default)':box:stem y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:stem xc yc z 'rx'
+subplot 2 2 2 '':title '"!" style':box:stem y 'o!rgb'
+
+
Sample stem +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.108 Sample `step`

+ + +

Function step plot data as stairs. At this stairs can be centered if sizes are differ by 1. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Step plot (default)':box:step y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:step xc yc z 'r'
+subplot 2 2 2 '':title '"!" style':box:step y 's!rgb'
+
+
Sample step +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.109 Sample `stereo`

+ + +

Example of stereo image of surf. +

+

MGL code: +

call 'prepare2d'
+light on
+subplot 2 1 0:rotate 50 60+1:box:surf a
+subplot 2 1 1:rotate 50 60-1:box:surf a
+
+
Sample stereo +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.110 Sample `stfa`

+ + +

Example of stfa. +

+

MGL code: +

new a 2000:new b 2000
+fill a 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)'
+subplot 1 2 0 '<_':title 'Initial signal':plot a:axis:xlabel '\i t'
+subplot 1 2 1 '<_':title 'STFA plot':stfa a b 64:axis:ylabel '\omega' 0:xlabel '\i t'
+
+
Sample stfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.111 Sample `style`

+ + +

Example of colors and styles for plots. +

+

MGL code: +

+
+
Sample style +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.112 Sample `surf`

+ + +

Function surf is most standard way to visualize 2D data array. Surf use color scheme for coloring (see Color scheme). You can use `#` style for drawing black meshes on the surface. +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Surf plot (default)':rotate 50 60:light on:box:surf a
+subplot 2 2 1:title '"\#" style; meshnum 10':rotate 50 60:box:surf a '#'; meshnum 10
+subplot 2 2 2:title '"." style':rotate 50 60:box:surf a '.'
+new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+new z 50 40 '0.8*cos(pi*(y+1)/2)'
+subplot 2 2 3:title 'parametric form':rotate 50 60:box:surf x y z 'BbwrR'
+
+
Sample surf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.113 Sample `surf3`

+ + +

Function surf3 is one of most suitable (for my opinion) functions to visualize 3D data. It draw the isosurface(s) - surface(s) of constant amplitude (3D analogue of contour lines). You can draw wired isosurfaces if specify `#` style. +

+

MGL code: +

call 'prepare3d'
+light on:alpha on
+subplot 2 2 0:title 'Surf3 plot (default)'
+rotate 50 60:box:surf3 c
+subplot 2 2 1:title '"\#" style'
+rotate 50 60:box:surf3 c '#'
+subplot 2 2 2:title '"." style'
+rotate 50 60:box:surf3 c '.'
+
+
Sample surf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.114 Sample `surf3a`

+ + +

Function surf3c is similar to surf3 but its transparency is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3A plot':rotate 50 60:light on:alpha on:box:surf3a c d
+
+
Sample surf3a +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.115 Sample `surf3c`

+ + +

Function surf3c is similar to surf3 but its coloring is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3C plot':rotate 50 60:light on:alpha on:box:surf3c c d
+
+
Sample surf3c +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.116 Sample `surf3ca`

+ + +

Function surf3c is similar to surf3 but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3CA plot':rotate 50 60:light on:alpha on:box:surf3ca c d c
+
+
Sample surf3ca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.117 Sample `surfa`

+ + +

Function surfa is similar to surf but its transparency is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfA plot':rotate 50 60:light on:alpha on:box:surfa a b
+
+
Sample surfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.118 Sample `surfc`

+ + +

Function surfc is similar to surf but its coloring is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfC plot':rotate 50 60:light on:box:surfc a b
+
+
Sample surfc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.119 Sample `surfca`

+ + +

Function surfca is similar to surf but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare2d'
+title 'SurfCA plot':rotate 50 60:light on:alpha on:box:surfca a b a
+
+
Sample surfca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.120 Sample `table`

+ + +

Function table draw table with data values. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+subplot 2 2 0:title 'Table sample':box
+table ys 'y_1\n{}y_2\n{}y_3'
+
+subplot 2 2 1:title 'no borders, colored'
+table ys 'y_1\n{}y_2\n{}y_3' 'r|'
+
+subplot 2 2 2:title 'no font decrease'
+table ys 'y_1\n{}y_2\n{}y_3' '#'
+
+subplot 2 2 3:title 'manual width and position':box
+table 0.5 0.95 ys 'y_1\n{}y_2\n{}y_3' '#';value 0.7
+
+
Sample table +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.121 Sample `tape`

+ + +

Function tape draw tapes which rotate around the curve as transverse orts of accompanied coordinates. +

+

MGL code: +

call 'prepare1d'
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x'
+subplot 2 2 0 '':title 'Tape plot (default)':box:tape y:plot y 'k'
+subplot 2 2 1:title '3d variant, 2 colors':rotate 50 60:light on
+box:plot xc yc z 'k':tape xc yc z 'rg'
+subplot 2 2 2:title '3d variant, x only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'xr':tape xc yc z 'xr#'
+subplot 2 2 3:title '3d variant, z only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'zg':tape xc yc z 'zg#'
+
+
Sample tape +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.122 Sample `tens`

+ + +

Function tens is variant of plot with smooth coloring along the curves. At this, color is determined as for surfaces (see Color scheme). +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Tens plot (default)':box:tens y(:,0) y(:,1)
+subplot 2 2 2 '':title '" " style':box:tens y(:,0) y(:,1) 'o '
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:tens xc yc z z 's'
+
+
Sample tens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.123 Sample `ternary`

+ + +

Example of ternary coordinates. +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+subplot 2 2 0:title 'Ordinary axis 3D':rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':zlabel 'Z'
+
+subplot 2 2 1:title 'Ternary axis (x+y+t=1)':ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y 'r2':plot rx ry 'q^ ':cont a:line 0.5 0 0 0.75 'g2'
+xlabel 'B':ylabel 'C':tlabel 'A'
+
+subplot 2 2 2:title 'Quaternary axis 3D':rotate 50 60:ternary 2
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'D'
+
+subplot 2 2 3:title 'Ternary axis 3D':rotate 50 60:ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'Z'
+
+
Sample ternary +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.124 Sample `text`

+ + +

Example of text possibilities. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 ''
+text 0 1 'Text can be in ASCII and in Unicode'
+text 0 0.6 'It can be \wire{wire}, \big{big} or #r{colored}'
+text 0 0.2 'One can change style in string: \b{bold}, \i{italic, \b{both}}'
+text 0 -0.2 'Easy to \a{overline} or \u{underline}'
+text 0 -0.6 'Easy to change indexes ^{up} _{down} @{center}'
+text 0 -1 'It parse TeX: \int \alpha \cdot \
+\sqrt3{sin(\pi x)^2 + \gamma_{i_k}} dx'
+subplot 2 2 1 ''
+ text 0 0.5 '\sqrt{\frac{\alpha^{\gamma^2}+\overset 1{\big\infty}}{\sqrt3{2+b}}}' '@' -2
+text 0 -0.1 'More text position: \frac{a}{b}, \dfrac{a}{b}, [\stack{a}{bbb}], [\stackl{a}{bbb}], [\stackr{a}{bbb}], \sup{a}{sup}, \sub{a}{sub}'text 0 -0.5 'Text can be printed\n{}on several lines'
+text 0 -0.9 'or with color gradient' 'BbcyrR'
+subplot 2 2 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn above a curve' 'Tr'
+subplot 2 2 3 '':line -1 -1 1 -1 'rA':text 0 -1 1 -1 'Horizontal'
+line -1 -1 1 1 'rA':text 0 0 1 1 'At angle' '@'
+line -1 -1 -1 1 'rA':text -1 0 -1 1 'Vertical'
+
+
Sample text +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.125 Sample `text2`

+ + +

Example of text along curve. +

+

MGL code: +

call 'prepare1d'
+subplot 1 3 0 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn under a curve' 'Tr'
+subplot 1 3 1 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:C'
+text y 'Another string drawn under a curve' 'Tr:C'
+subplot 1 3 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:R'
+text y 'Another string drawn under a curve' 'Tr:R'
+
+
Sample text2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.126 Sample `textmark`

+ + +

Function textmark is similar to mark but draw text instead of markers. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'TextMark plot (default)':box:textmark y y1 '\gamma' 'r'
+
+
Sample textmark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.127 Sample `ticks`

+ + +

Example of axis ticks. +

+

MGL code: +

subplot 3 3 0:title 'Usual axis with ":" style'
+axis ':'
+
+subplot 3 3 1:title 'Too big/small range'
+ranges -1000 1000 0 0.001:axis
+
+subplot 3 3 2:title 'LaTeX-like labels'
+axis 'F!'
+
+subplot 3 3 3:title 'Too narrow range'
+ranges 100 100.1 10 10.01:axis
+
+subplot 3 3 4:title 'No tuning, manual "+"'
+axis '+!'
+# for version <2.3 you can use
+#tuneticks off:axis
+
+subplot 3 3 5:title 'Template for ticks'
+xtick 'xxx:%g':ytick 'y:%g'
+axis
+
+xtick '':ytick '' # switch it off for other plots
+
+subplot 3 3 6:title 'No tuning, higher precision'
+axis '!4'
+
+subplot 3 3 7:title 'Manual ticks'
+ranges -pi pi 0 2
+xtick pi 3 '\pi'
+xtick 0.886 'x^*' on # note this will disable subticks drawing
+# or you can use
+#xtick -pi '\pi' -pi/2 '-\pi/2' 0 '0' 0.886 'x^*' pi/2 '\pi/2' pi 'pi'
+list v 0 0.5 1 2:ytick v '0
+0.5
+1
+2'
+axis:grid:fplot '2*cos(x^2)^2' 'r2'
+
+subplot 3 3 8:title 'Time ticks'
+xrange 0 3e5:ticktime 'x':axis
+
+
Sample ticks +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.128 Sample `tile`

+ + +

Function tile draw surface by tiles. +

+

MGL code: +

call 'prepare2d'
+title 'Tile plot':rotate 50 60:box:tile a
+
+
Sample tile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.129 Sample `tiles`

+ + +

Function tiles is similar to tile but tile sizes is determined by another data. This allows one to simulate transparency of the plot. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Tiles plot':box:tiles a b
+
+
Sample tiles +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.130 Sample `torus`

+ + +

Function torus draw surface of the curve rotation. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0:title 'Torus plot (default)':light on:rotate 50 60:box:torus y1 y2
+subplot 2 2 1:title '"x" style':light on:rotate 50 60:box:torus y1 y2 'x'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:torus y1 y2 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:torus y1 y2 '#'
+
+
Sample torus +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.131 Sample `traj`

+ + +

Function traj is 1D analogue of vect. It draw vectors from specified points. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Traj plot':box:plot x1 y:traj x1 y y1 y2
+
+
Sample traj +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.132 Sample `triangulation`

+ + +

Example of use triangulate for arbitrary placed points. +

+

MGL code: +

new x 100 '2*rnd-1':new y 100 '2*rnd-1':copy z x^2-y^2
+new g 30 30:triangulate d x y
+title 'Triangulation'
+rotate 50 60:box:light on
+triplot d x y z:triplot d x y z '#k'
+datagrid g x y z:mesh g 'm'
+
+
Sample triangulation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.133 Sample `triplot`

+ + +

Functions triplot and quadplot draw set of triangles (or quadrangles, correspondingly) for irregular data arrays. Note, that you have to provide not only vertexes, but also the indexes of triangles or quadrangles. I.e. perform triangulation by some other library. See also triangulate. +

+

MGL code: +

list q 0 1 2 3 | 4 5 6 7 | 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7
+list xq -1 1 -1 1 -1 1 -1 1
+list yq -1 -1 1 1 -1 -1 1 1
+list zq -1 -1 -1 -1 1 1 1 1
+light on
+subplot 2 2 0:title 'QuadPlot sample':rotate 50 60
+quadplot q xq yq zq 'yr'
+quadplot q xq yq zq '#k'
+subplot 2 2 2:title 'QuadPlot coloring':rotate 50 60
+quadplot q xq yq zq yq 'yr'
+quadplot q xq yq zq '#k'
+list t 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0
+list yt -1 -1 1 0
+list zt -1 -1 -1 1
+subplot 2 2 1:title 'TriPlot sample':rotate 50 60
+triplot t xt yt zt 'b'
+triplot t xt yt zt '#k'
+subplot 2 2 3:title 'TriPlot coloring':rotate 50 60
+triplot t xt yt zt yt 'cb'
+triplot t xt yt zt '#k'
+tricont t xt yt zt 'B'
+
+
Sample triplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.134 Sample `tube`

+ + +

Function tube draw tube with variable radius. +

+

MGL code: +

call 'prepare1d'
+light on
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x':divto y1 20
+subplot 2 2 0 '':title 'Tube plot (default)':box:tube y 0.05
+subplot 2 2 1 '':title 'variable radius':box:tube y y1
+subplot 2 2 2 '':title '"\#" style':box:tube y 0.05 '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:tube xc yc z y2 'r'
+
+
Sample tube +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.135 Sample `type0`

+ + +

Example of ordinary transparency (transptype=0). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 0:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Sample type0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.136 Sample `type1`

+ + +

Example of glass-like transparency (transptype=1). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 1:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Sample type1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.137 Sample `type2`

+ + +

Example of lamp-like transparency (transptype=2). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 2:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Sample type2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.138 Sample `vect`

+ + +

Function vect is most standard way to visualize vector fields - it draw a lot of arrows or hachures for each data cell. It have a lot of options which can be seen on the figure (and in the sample code), and use color scheme for coloring (see Color scheme). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 3 2 0 '':title 'Vect plot (default)':box:vect a b
+subplot 3 2 1 '':title '"." style; "=" style':box:vect a b '.='
+subplot 3 2 2 '':title '"f" style':box:vect a b 'f'
+subplot 3 2 3 '':title '">" style':box:vect a b '>'
+subplot 3 2 4 '':title '"<" style':box:vect a b '<'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:vect ex ey ez
+
+
Sample vect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.139 Sample `vect3`

+ + +

Function vect3 draw ordinary vector field plot but at slices of 3D data. +

+

MGL code: +

call 'prepare3v'
+subplot 2 1 0:title 'Vect3 sample':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'x':vect3 ex ey ez:vect3 ex ey ez 'z'
+subplot 2 1 1:title '"f" style':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'fx':vect3 ex ey ez 'f':vect3 ex ey ez 'fz'
+grid3 ex 'Wx':grid3 ex 'W':grid3 ex 'Wz'
+
+
Sample vect3 +
+
+ +
+

+Previous: , Up: All samples   [Contents][Index]

+
+ +

6.140 Sample `venn`

+ + +

Example of venn-like diagram. +

+

MGL code: +

list x -0.3 0 0.3:list y 0.3 -0.3 0.3:list e 0.7 0.7 0.7
+subplot 1 1 0:title 'Venn-like diagram'
+transptype 1:alpha on:error x y e e '!rgb@#o';alpha 0.1
+
+
Sample venn +
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix A Symbols and hot-keys

+ + +

This appendix contain the full list of symbols (characters) used by MathGL for setting up plot. Also it contain sections for full list of hot-keys supported by mglview tool and by UDAV program. +

+ + + + + + + +
+ + + +

A.1 Symbols for styles

+ + +

Below is full list of all characters (symbols) which MathGL use for setting up the plot. +

+
+
`space ' '`
+

empty line style (see Line styles); +

+

empty color in chart. +

+
+
`!`
+

set to use new color from palette for each point (not for each curve, as default) in 1D plotting; +

+

set to disable ticks tuning in axis and colorbar; +

+

set to draw grid lines at subticks coordinates too; +

+

define complex variable/expression in MGL script if placed at beginning. +

+
+
`#`
+

set to use solid marks (see Line styles) or solid error boxes; +

+

set to draw wired plot for axial, surf3, surf3a, surf3c, triplot, quadplot, area, region, bars, barh, tube, tape, cone, boxs and draw boundary only for circle, ellipse, rhomb; +

+

set to draw also mesh lines for surf, surfc, surfa, dens, densx, densy, densz, dens3, or boundary for chart, facex, facey, facez, rect; +

+

set to draw boundary and box for legend, title, or grid lines for table; +

+

set to draw grid for radar; +

+

set to start flow threads and pipes from edges only for flow, pipe; +

+

set to use whole are for axis range in subplot, inplot; +

+

change text color inside a string (see Font styles); +

+

start comment in MGL scripts or in Command options. +

+
+
`$`
+

denote parameter of MGL scripts. +

+
+
`%`
+

set color scheme along 2 coordinates Color scheme; +

+

operation in Textual formulas. +

+
+
`&`
+
+

set to pass long integer number in tick template xtick, ytick, ztick, ctick; +

+

specifier of drawing user-defined symbols as mark (see Line styles); +

+

operation in Textual formulas. +

+
+
```
+

denote string in MGL scripts or in Command options. +

+
+
`*`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to start flow threads from 2d array inside data (see flow); +

+

operation in Textual formulas. +

+
+
`+`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

set to print `+` for positive numbers in axis, label, table; +

+

operation of increasing last character value in MGL strings; +

+

operation in Textual formulas. +

+
+
`,`
+

separator for color positions (see Color styles) or items in a list +

+

concatenation of MGL string with another string or numerical value. +

+
+
`-`
+

solid line style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

place entries horizontally in legend; +

+

set to use usual `-` for negative numbers in axis, label, table; +

+

operation in Textual formulas. +

+
+
`.`
+

one of marks (see Line styles) or kind of error boxes; +

+

set to draw hachures instead of arrows for vect, vect3; +

+

set to use dots instead of faces for cloud, torus, axial, surf3, surf3a, surf3c, surf, surfa, surfc, dens, map; +

+

delimiter of fractional parts for numbers. +

+
+
`/`
+

operation in Textual formulas. +

+
+
`:`
+

line dashing style (see Line styles); +

+

stop color scheme parsing (see Color scheme); +

+

range operation in MGL scripts; +

+

style for axis; +

+

separator of commands in MGL scripts. +

+
+
`;`
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

start of an option in MGL scripts or in Command options; +

+

separator of equations in ode; +

+

separator of labels in iris. +

+
+
`<`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align left in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+ +
+
`>`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align right in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
`=`
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to use equidistant columns for table; +

+

set to use color gradient for vect, vect3; +

+

operation in Textual formulas. +

+
+
`@`
+

set to draw box around text for text and similar functions; +

+

set to draw boundary and fill it for circle, ellipse, rhomb; +

+

set to fill faces for box; +

+

set to draw large semitransparent mark instead of error box for error; +

+

set to draw edges for cone; +

+

set to draw filled boxes for boxs; +

+

reduce text size inside a string (see Font styles); +

+

operation in Textual formulas. +

+
+
`^`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set outer position for legend; +

+

inverse default position for axis; +

+

switch to upper index inside a string (see Font styles); +

+

align center in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
`_`
+

empty arrow style (see Line styles); +

+

disable drawing of tick labels for axis; +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set to draw contours at bottom for cont, contf, contd, contv, tricont; +

+

switch to lower index inside a string (see Font styles). +

+
+
`[]`
+

contain symbols excluded from color scheme parsing (see Color scheme); +

+

operation of getting n-th character from MGL string. +

+
+
`{}`
+

contain extended specification of color (see Color styles), dashing (see Line styles) or mask (see Color scheme); +

+

denote special operation in MGL scripts; +

+

denote `meta-symbol` for LaTeX like string parsing (see Font styles). +

+
+
`|`
+

line dashing style (see Line styles); +

+

set to use sharp color scheme (see Color scheme); +

+

set to limit width by subplot width for table; +

+

delimiter in list command; +

+

operation in Textual formulas. +

+
+
`\`
+

string continuation symbol on next line for MGL scripts. +

+
+
`~`
+

disable drawing of tick labels for axis and colorbar; +

+

disable first segment in lamerey; +

+

reduce number of segments in plot and tens; +

+

one of mask for face filling (see Color scheme). +

+
+
`0,1,2,3,4,5,6,7,8,9`
+

line width (see Line styles); +

+

brightness of a color (see Color styles); +

+

precision of numbers in axis, label, table; +

+

kind of smoothing (for digits 1,3,5) in smooth; +

+

digits for a value. +

+
+
`4,6,8`
+

set to draw square, hex- or octo-pyramids instead of cones in cone, cones. +

+
+
`A,B,C,D,E,F,a,b,c,d,e,f`
+

can be hex-digit for color specification if placed inside {} (see Color styles). +

+
+
`A`
+

arrow style (see Line styles); +

+

set to use absolute position in whole picture for text, colorbar, legend. +

+
+
`a`
+

set to use absolute position in subplot for text; +

+

style of plot, radar, tens, area, region to draw segments between points outside of axis range; +

+

style of bars, barh, cones. +

+
+
`B`
+

dark blue color (see Color styles). +

+
+
`b`
+

blue color (see Color styles); +

+

bold font face if placed after `:` (see Font styles). +

+
+
`C`
+

dark cyan color (see Color styles); +

+

align text to center if placed after `:` (see Font styles). +

+
+
`c`
+

cyan color (see Color styles); +

+

name of color axis; +

+

cosine transform for transform. +

+
+
`D`
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`d`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-dash description if placed inside {} (see Line styles). +

+
+
`E`
+

dark green-yellow color (see Color styles). +

+
+
`e`
+

green-yellow color (see Color styles). +

+
+
`F`
+
+

set fixed bar widths in bars, barh; +

+

set LaTeX-like format for numbers in axis, label, table. +

+
+
`f`
+

style of bars, barh; +

+

style of vect, vect3; +

+

set fixed format for numbers in axis, label, table; +

+

Fourier transform for transform. +

+
+
`G`
+

dark green color (see Color styles). +

+
+
`g`
+

green color (see Color styles). +

+
+
`H`
+

dark gray color (see Color styles). +

+
+
`h`
+

gray color (see Color styles); +

+

Hankel transform for transform. +

+
+
`I`
+

arrow style (see Line styles); +

+

set colorbar position near boundary. +

+
+
`i`
+

line dashing style (see Line styles); +

+

italic font face if placed after `:` (see Font styles). +

+

set to use inverse values for cloud, pipe, dew; +

+

set to fill only area with y1<y<y2 for region; +

+

inverse Fourier transform for transform, transforma, fourier. +

+
+
`j`
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`K`
+

arrow style (see Line styles). +

+
+
`k`
+

black color (see Color styles). +

+
+
`L`
+

dark green-blue color (see Color styles); +

+

align text to left if placed after `:` (see Font styles). +

+
+
`l`
+

green-blue color (see Color styles). +

+
+
`M`
+

dark magenta color (see Color styles). +

+
+
`m`
+

magenta color (see Color styles). +

+
+
`N`
+

dark sky-blue color (see Color styles). +

+
+
`n`
+

sky-blue color (see Color styles). +

+
+
`O`
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`o`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

over-line text if placed after `:` (see Font styles). +

+
+
`P`
+

dark purple color (see Color styles). +

+
+
`p`
+

purple color (see Color styles). +

+
+
`Q`
+

dark orange or brown color (see Color styles). +

+
+
`q`
+

orange color (see Color styles). +

+
+
`R`
+

dark red color (see Color styles); +

+

align text to right if placed after `:` (see Font styles). +

+
+
`r`
+

red color (see Color styles). +

+
+
`S`
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`s`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-mask description if placed inside {} (see Color scheme); +

+

sine transform for transform. +

+
+
`t`
+

draw tubes instead of cones in cone, cones; +

+
+
`T`
+

arrow style (see Line styles); +

+

place text under the curve for text, cont, cont3. +

+
+
`t`
+

set to draw text labels for cont, cont3; +

+

name of t-axis (one of ternary axis); +

+

variable in Textual formulas, which usually is varied in range [0,1]. +

+
+
`U`
+

dark blue-violet color (see Color styles); +

+

disable rotation of tick labels for axis. +

+
+
`u`
+

blue-violet color (see Color styles); +

+

under-line text if placed after `:` (see Font styles); +

+

name of u-axis (one of ternary axis); +

+

variable in Textual formulas, which usually denote array itself. +

+
+
`V`
+

arrow style (see Line styles); +

+

place text centering on vertical direction for text. +

+
+
`v`
+

one of marks (see Line styles); +

+

set to draw vectors on flow threads for flow and on segments for lamerey. +

+
+
`W`
+

bright gray color (see Color styles). +

+
+
`w`
+

white color (see Color styles); +

+

wired text if placed after `:` (see Font styles); +

+

name of w-axis (one of ternary axis); +

+
+
`X`
+

arrow style (see Line styles). +

+
+
`x`
+
+

name of x-axis or x-direction or 1st dimension of a data array; +

+

start hex-color description if placed inside {} (see Color styles); +

+

one of marks (see Line styles) or kind of error boxes; +

+

tiles orientation perpendicular to x-axis in tile, tiles; +

+

style of tape. +

+
+
`Y`
+

dark yellow or gold color (see Color styles). +

+
+
`y`
+

yellow color (see Color styles); +

+

name of y-axis or y-direction or 2nd dimension of a data array; +

+

tiles orientation perpendicular to y-axis in tile, tiles. +

+
+
`z`
+
+

name of z-axis or z-direction or 3d dimension of a data array; +

+

style of tape. +

+
+
+ + + +
+ + + +

A.2 Hot-keys for mglview

+ + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-POpen printer dialog and print graphics.
Ctrl-WClose window.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop drawing and script execution.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Shift-GCopy graphics to clipboard.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + +
+ + + +

A.3 Hot-keys for UDAV

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-NCreate new window with empty script. Note, all scripts share variables. So, second window can be used to see some additional information of existed variables.
Ctrl-OOpen and execute/show script or data from file. You may switch off automatic exection in UDAV properties
Ctrl-SSave script to a file.
Ctrl-POpen printer dialog and print graphics.
Ctrl-ZUndo changes in script editor.
Ctrl-Shift-ZRedo changes in script editor.
Ctrl-XCut selected text into clipboard.
Ctrl-CCopy selected text into clipboard.
Ctrl-VPaste selected text from clipboard.
Ctrl-ASelect all text in editor.
Ctrl-FShow dialog for text finding.
F3Find next occurrence of the text.
Win-C or Meta-CShow dialog for new command and put it into the script.
Win-F or Meta-FInsert last fitted formula with found coefficients.
Win-S or Meta-SShow dialog for styles and put it into the script. Styles define the plot view (color scheme, marks, dashing and so on).
Win-O or Meta-OShow dialog for options and put it into the script. Options are used for additional setup the plot.
Win-N or Meta-NReplace selected expression by its numerical value.
Win-P or Meta-PSelect file and insert its file name into the script.
Win-G or Meta-GShow dialog for plot setup and put resulting code into the script. This dialog setup axis, labels, lighting and other general things.
Ctrl-Shift-OLoad data from file. Data will be deleted only at exit but UDAV will not ask to save it.
Ctrl-Shift-SSave data to a file.
Ctrl-Shift-CCopy range of numbers to clipboard.
Ctrl-Shift-VPaste range of numbers from clipboard.
Ctrl-Shift-NRecreate the data with new sizes and fill it by zeros.
Ctrl-Shift-RResize (interpolate) the data to specified sizes.
Ctrl-Shift-TTransform data along dimension(s).
Ctrl-Shift-MMake another data.
Ctrl-Shift-HFind histogram of data.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-GSwitch on/off grid of absolute coordinates.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop script execution and drawing.
F8Show/hide tool window with list of hidden plots.
F9Restore status for `once` command and reload data.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-WOpen dialog with slideshow options.
Ctrl-Shift-GCopy graphics to clipboard.
F1Show help on MGL commands
F2Show/hide tool window with messages and information.
F4Show/hide calculator which evaluate and help to type textual formulas. Textual formulas may contain data variables too.
Meta-Shift-Up, Meta-Shift-DownChange view angle \theta.
Meta-Shift-Left, Meta-Shift-RightChange view angle \phi.
Alt-Minus, Alt-EqualZoom in/out whole image.
Alt-Up, Alt-Down, Alt-Right, Alt-LeftShift whole image.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix B GNU Free Documentation License

+
Version 1.2, November 2002 +
+ +
+
Copyright © 2000,2001,2002 Free Software Foundation, Inc.
+51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+ +
    +
  1. PREAMBLE + +

    The purpose of this License is to make a manual, textbook, or other +functional and useful document free in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. +

    +

    This License is a kind of “copyleft”, which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. +

    +

    We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. +

    +
  2. APPLICABILITY AND DEFINITIONS + +

    This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The “Document”, below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as “you”. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. +

    +

    A “Modified Version” of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. +

    +

    A “Secondary Section” is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document`s overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. +

    +

    The “Invariant Sections” are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. +

    +

    The “Cover Texts” are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. +

    +

    A “Transparent” copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not “Transparent” is called “Opaque”. +

    +

    Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input +format, SGML or XML using a publicly available +DTD, and standard-conforming simple HTML, +PostScript or PDF designed for human modification. Examples +of transparent image formats include PNG, XCF and +JPG. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, SGML or +XML for which the DTD and/or processing tools are +not generally available, and the machine-generated HTML, +PostScript or PDF produced by some word processors for +output purposes only. +

    +

    The “Title Page” means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, “Title Page” means +the text near the most prominent appearance of the work`s title, +preceding the beginning of the body of the text. +

    +

    A section “Entitled XYZ” means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as “Acknowledgements”, +“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” +of such a section when you modify the Document means that it remains a +section “Entitled XYZ” according to this definition. +

    +

    The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. +

    +
  3. VERBATIM COPYING + +

    You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. +

    +

    You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +

    +
  4. COPYING IN QUANTITY + +

    If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document`s license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. +

    +

    If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. +

    +

    If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. +

    +

    It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. +

    +
  5. MODIFICATIONS + +

    You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: +

    +
      +
    1. Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +
    2. List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +
    3. State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +
    4. Preserve all the copyright notices of the Document. + +
    5. Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +
    6. Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +
    7. Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document`s license notice. + +
    8. Include an unaltered copy of this License. + +
    9. Preserve the section Entitled “History”, Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled “History” in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +
    10. Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the “History” section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +
    11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +
    12. Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +
    13. Delete any section Entitled “Endorsements”. Such a section +may not be included in the Modified Version. + +
    14. Do not retitle any existing section to be Entitled “Endorsements” or +to conflict in title with any Invariant Section. + +
    15. Preserve any Warranty Disclaimers. +
    + +

    If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version`s license notice. +These titles must be distinct from any other section titles. +

    +

    You may add a section Entitled “Endorsements”, provided it contains +nothing but endorsements of your Modified Version by various +parties—for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. +

    +

    You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. +

    +

    The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +

    +
  6. COMBINING DOCUMENTS + +

    You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. +

    +

    The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. +

    +

    In the combination, you must combine any sections Entitled “History” +in the various original documents, forming one section Entitled +“History”; likewise combine any sections Entitled “Acknowledgements”, +and any sections Entitled “Dedications”. You must delete all +sections Entitled “Endorsements.” +

    +
  7. COLLECTIONS OF DOCUMENTS + +

    You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. +

    +

    You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. +

    +
  8. AGGREGATION WITH INDEPENDENT WORKS + +

    A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an “aggregate” if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation`s users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. +

    +

    If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document`s Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. +

    +
  9. TRANSLATION + +

    Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. +

    +

    If a section in the Document is Entitled “Acknowledgements”, +“Dedications”, or “History”, the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. +

    +
  10. TERMINATION + +

    You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. +

    +
  11. FUTURE REVISIONS OF THIS LICENSE + +

    The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. +

    +

    Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License “or any later version” applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +

+ + +

ADDENDUM: How to use this License for your documents

+ +

To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: +

+
+
  Copyright (C)  year  your name.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.2
+  or any later version published by the Free Software Foundation;
+  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+  Texts.  A copy of the license is included in the section entitled ``GNU
+  Free Documentation License''.
+
+ +

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the “with…Texts.” line with this: +

+
+
    with the Invariant Sections being list their titles, with
+    the Front-Cover Texts being list, and with the Back-Cover Texts
+    being list.
+
+ +

If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. +

+

If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. +

+ + +
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

Index

+ +
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

A
AddLegend: Legend
Adjust: Ticks
alpha: Command options
Alpha: Transparency
alphadef: Command options
AlphaDef: Transparency
Ambient: Lighting
Area: 1D plotting
Arrows: Line styles
ArrowSize: Default sizes
ask: Program flow commands
Aspect: Subplots and rotation
AutoCorrel: Make another data
Axial: 2D plotting
Axis: Curved coordinates
Axis: Axis and Colorbar
AxisStl: Ticks

B
Ball: Primitives
Barh: 1D plotting
Bars: 1D plotting
BarWidth: Default sizes
Beam: 3D plotting
Belt: 2D plotting
Box: Axis and Colorbar
BoxPlot: 1D plotting
Boxs: 2D plotting

C
call: Program flow commands
Candle: 1D plotting
Chart: 1D plotting
chdir: Program flow commands
Clean: Data resizing
ClearLegend: Legend
Clf: Background
Cloud: 3D plotting
Color scheme: Color scheme
Colorbar: Axis and Colorbar
Column: Make another data
ColumnPlot: Subplots and rotation
Combine: Make another data
Cone: Primitives
Cones: 1D plotting
Cont: 2D plotting
Cont3: 3D plotting
ContD: 2D plotting
ContF: 2D plotting
ContF3: 3D plotting
ContFXYZ: Other plotting
ContXYZ: Other plotting
Correl: Make another data
CosFFT: Data changing
CRange: Ranges (bounding box)
Create: Data resizing
Crop: Data resizing
Crust: Other plotting
CTick: Ticks
CumSum: Data changing
Curve: Primitives
cut: Command options
Cut: Cutting

D
DataGrid: Data manipulation
defchr: Program flow commands
define: Program flow commands
defnum: Program flow commands
Delete: Data resizing
Dens: 2D plotting
Dens3: 3D plotting
DensXYZ: Other plotting
Dew: Vector fields
Diff: Data changing
Diff2: Data changing
do: Program flow commands
Dots: Other plotting
Drop: Primitives

E
else: Program flow commands
elseif: Program flow commands
endif: Program flow commands
Envelop: Data changing
Error: 1D plotting
Evaluate: Make another data
Export: File I/O
Extend: Data resizing

F
Face: Primitives
FaceX: Primitives
FaceY: Primitives
FaceZ: Primitives
Fall: 2D plotting
fgets: Text printing
Fill: Data manipulation
Fill: Data filling
Fit: Nonlinear fitting
Fit2: Nonlinear fitting
Fit3: Nonlinear fitting
FitS: Nonlinear fitting
Flow: Vector fields
FlowP: Vector fields
Fog: Fog
Font: Font settings
Font styles: Font styles
fontsize: Command options
for: Program flow commands
FPlot: Other plotting
FSurf: Other plotting
func: Program flow commands

G
GetNx: Data information
GetNy: Data information
GetNz: Data information
Glyph: Primitives
Grad: 2D plotting
Grid: Axis and Colorbar
Grid: 2D plotting
Grid3: 3D plotting

H
Hankel: Data changing
Hist: Data manipulation
Hist: Make another data

I
if: Program flow commands
Import: File I/O
InPlot: Subplots and rotation
Insert: Data resizing
Integral: Data changing

J
Join: Data resizing

L
Label: Text printing
Label: Axis and Colorbar
Label: 1D plotting
legend: Command options
Legend: Legend
Light: Lighting
Line: Primitives
Line style: Line styles
List: Data filling
load: Program flow commands
LoadBackground: Background

M
Map: Dual plotting
Mark: 1D plotting
Mark style: Line styles
MarkSize: Default sizes
MathGL setup: Graphics setup
Max: Make another data
Maximal: Data information
Mesh: 2D plotting
meshnum: Command options
MeshNum: Default sizes
mglData: Data constructor
mglFitPnts: Nonlinear fitting
mglGraph: MathGL core
Min: Make another data
Minimal: Data information
Mirror: Data changing
Modify: Data filling
Momentum: Make another data
Momentum: Data information
MultiPlot: Subplots and rotation

N
next: Program flow commands
Norm: Data changing
NormSl: Data changing

O
once: Program flow commands
Origin: Ranges (bounding box)

P
Palette: Palette and colors
Perspective: Subplots and rotation
Pipe: Vector fields
Plot: 1D plotting
Pop: Subplots and rotation
PrintInfo: Data information
Push: Subplots and rotation
PutsFit: Nonlinear fitting

Q
QuadPlot: Other plotting

R
Radar: 1D plotting
Ranges: Ranges (bounding box)
Rasterize: Background
Read: File I/O
ReadAll: File I/O
ReadHDF: File I/O
ReadMat: File I/O
ReadRange: File I/O
Rearrange: Data resizing
Refill: Data filling
Region: 1D plotting
Resize: Make another data
return: Program flow commands
rkstep: Program flow commands
Roll: Data changing
Roots: Make another data
Rotate: Subplots and rotation
RotateN: Subplots and rotation
RotateText: Font settings

S
Save: File I/O
SaveHDF: File I/O
Set: Data filling
SetLegendBox: Legend
SetLegendMarks: Legend
SetMask: Masks
SetMaskAngle: Masks
SetSize: Export picture
Sew: Data changing
SinFFT: Data changing
Smooth: Data changing
Sort: Data resizing
Sphere: Primitives
Squeeze: Data resizing
Stem: 1D plotting
Step: 1D plotting
STFA: Dual plotting
StickPlot: Subplots and rotation
stop: Program flow commands
SubData: Make another data
SubPlot: Subplots and rotation
Sum: Make another data
Surf: 2D plotting
Surf3: 3D plotting
Surf3A: Dual plotting
Surf3C: Dual plotting
SurfA: Dual plotting
SurfC: Dual plotting
Swap: Data changing

T
Tape: 1D plotting
Tens: 1D plotting
Text: Text printing
TextMark: 1D plotting
Textual formulas: Textual formulas
TickLen: Ticks
Tile: 2D plotting
TileS: Dual plotting
Title: Subplots and rotation
Torus: 1D plotting
Trace: Make another data
Traj: Vector fields
Transpose: Data resizing
TranspType: Transparency
TriCont: Other plotting
TriPlot: Other plotting
Tube: 1D plotting

V
value: Command options
Var: Data filling
variant: Program flow commands
Vect: Vector fields
View: Subplots and rotation

W
while: Program flow commands
Write: Export to file

X
xrange: Command options
XRange: Ranges (bounding box)
XTick: Ticks

Y
yrange: Command options
YRange: Ranges (bounding box)
YTick: Ticks

Z
zrange: Command options
ZRange: Ranges (bounding box)
ZTick: Ticks

+
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +
+ +
+ + + + + diff --git a/website/mgl_ru.html b/website/mgl_ru.html new file mode 100644 index 0000000..757de0b --- /dev/null +++ b/website/mgl_ru.html @@ -0,0 +1,12613 @@ + + + + + + +Язык MGL для версии 2.4.2 + + + + + + + + + + + + + + + + +

Язык MGL для версии 2.4.2

+ + + + + +

Table of Contents

+ +
+ + +
+ + + +
+

+Next: , Up: (dir)   [Contents][Index]

+
+ +

Язык MGL

+ +

Это документация для языка MGL (версии 2.4.2). Пожалуйста сообщайте о любых ошибках в этом руководстве на mathgl.abalakin@gmail.org. Дополнительную информацию о MGL и MathGL можно найти на домашней странице проекта http://mathgl.sourceforge.net/. +

+

Copyright © 2008-2012 Alexey A. Balakin. +

+
+

Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 +or any later version published by the Free Software Foundation; +with no Invariant Sections, no Front-Cover Texts, and no Back-Cover +Texts. A copy of the license is included in the section entitled “GNU +Free Documentation License.” +

+ + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ + +

1 Скрипты MGL

+ + +

MathGL имеет встроенный скриптовый язык MGL для обработки и отображения данных. Скрипты MGL могут быть выполнены независимо (с помощью программ UDAV, mglconv, mglview и др. +

+ + + + + + + + + +
+ + + +

1.1 Основы MGL

+ + +

Язык MGL достаточно простой. Каждая строка - отдельная команда. Первое слово - имя команды, а все остальные ее аргументы. Команда может иметь до 1000 аргументов (по крайней мере сейчас). Слова разделяются одно от другого пробелом или символом табуляции. Различий между верхним и нижним индексом нет, т.е. переменные a и A идентичны. Символ `#` начинает комментарий - все символы после него игнорируются до конца строки. Исключением является случай, когда `#` входит в строку. Опции команды указываются после символа `;` (see Command options). Символ `:` начинает новую команду (подобно переводу строки) если он расположен не внутри скобок или строки. +

+

Если строка содержит ссылки на внешние параметры (`$0`, `$1` ... `$9`) или макроопределения (`$a`, `$b` ... `$z`), то текущие значения параметров/макроопределений подставляются в строку вместо ссылки до выполнением команды. Это позволяет использовать один и тот же скрипт при различных входных параметрах командной строки или вводить макроопределения по ходу исполнения команд скрипта. +

+

Аргументы команды могут быть строками, переменными или числами. +

    +
  • Строка - произвольный набор символов между метками `'`. Длинные строки могут быть соединены из нескольких линий файла символом `\`. Т.е. строки файла `'a +'\<br>' b'` дадут строку `'a + b'` (здесь `<br>` - перевод строки). MGL поддерживает несколько операций над строками: +
      +
    • Соединение строк и чисел, используя `,` без пробелов (например, `'max(u)=',u.max,' a.u.'` или `'u=',!(1+i2)` для комплексных чисел); +
    • Получение n-го символа строки, используя `[]` (например, `'abc'[1]` даст 'b'); +
    • Инкремент последнего символа строки, используя `+` (например, `'abc'+3` даст 'abf'). +
    + +
  • Обычно переменная имеет имя, состоящее из букв и чисел (должно начинаться с буквы и не быть длиннее 64 символов). Если выражение или переменная начинается с символа `!`, то будут использованы комплексные значения. Например, код new x 100 'x':copy !b !exp(1i*x) создаст массив действительных чисел x и массив комплексных чисел b, который будет равен exp(I*x), где I^2=-1. +В качестве переменной можно использовать также и временные массивы, включающие в себя: +
      +
    • срезы (“подмассивы”) массивов данных (подобно команде subdata). Например, a(1) или a(1,:) или a(1,:,:) - вторая строка массива a, a(:,2) или a(:,2,:) - третий столбец, a(:,:,0) - первый срез и т.д. Также можно выделить часть массива с m-го по n-ый элемент a(m:n,:,:) или просто a(m:n). + +
    • произвольные комбинации столбцов данных (например, a('n*w^2/exp(t)')), если столбцы данных были именованы командой idset или в файле данных (в строке начинающейся с ##). + +
    • произвольное выражение из существующих переменных и констант. Например, `sqrt(dat(:,5)+1)` даст временный массив данных с элементами равными tmp[i,j] = sqrt(dat[i,5,j]+1). При этом символ ``` возвращает транспонированный массив: ``sqrt(dat(:,5)+1)` и `sqrt(`dat(:,5)+1)` оба дадут временный массив данных с элементами равными tmp[i,j] = sqrt(dat[j,5,i]+1). + +
    • массивы с элементами заданными в квадратных скобках [], разделенные `,`. При этом внутри выражения не должно быть пробелов! Например, `[1,2,3]` даст временный массив из 3 элементов {1, 2, 3}; `[[11,12],[21,22]]` даст матрицу 2*2 и т.д. Элементами такой конструкции могут быть и массивы если их размерности одинаковые, например `[v1,v2,...,vn]`. + +
    • результат команд построения новых данных (see Make another data), если они заключены в фигурные скобки {}. Например, `{sum dat 'x'}` даст временный массив, который есть результат суммирования dat вдоль `x`. Это такой же массив как и tmp, полученный командой `sum tmp dat 'x'`. При этом можно использовать вложенные конструкции, например `{sum {max dat 'z'} 'x'}`. +
    +

    Временные массивы не могут стоять в качестве первого аргумента команд, создающих массивы (например, `new`, `read`, `hist` и т.д.). +

    +
  • К скалярным переменным, кроме собственно чисел, относятся: специальные переменные nan=#QNAN, inf=бесконечность, rnd=случайное число, pi=3.1415926..., on=1, off=0, all=-1, :=-1, переменные с суффиксами (see Data information), переменные определенные командой define, значения времени (в формате "hh-mm-ss_DD.MM.YYYY", "hh-mm-ss" или "DD.MM.YYYY") . Также массивы размером 1x1x1 считаются скалярами (например, `pi/dat.nx`). +
+

Перед первым использованием все переменные должны быть определены с помощью команд, создающих массивы (new, var, list, copy, read, hist, sum и др., см. Data constructor, Data filling и Make another data). +

+

Команды могут иметь несколько наборов аргументов (например, plot ydat и plot xdat ydat). Все аргументы команды для выбранного набора должны быть указаны, однако часть из них могут иметь значения по умолчанию. Такие аргументы в описании команд будут помещены в квадратные скобки [], например plot ydat ['stl'='' zval=nan]. При этом запись [arg1 arg2 arg3 ...] подразумевает [arg1 [arg2 [arg3 ...]]], т.е. опускать можно только аргументы с конца, если вы согласны с их значениями по умолчанию. Например, plot ydat '' 1 или plot ydat '' правильно, а plot ydat 1 не правильно (аргумент 'stl' пропущен). +

+

Можно предоставить несколько вариантов аргументов комманд при использовании символа `?` для их разделения. Конкретный вариант аргумента, используемый при выполнении команды, задается значением команды variant. При этом будет использован последний вариант, если задано слишком большое значение. По умолчанию используется первый вариант (т.е. как при variant 0). Например в следующем коде будет сначала нарисован график синим цветом (первый аргумент `b`), а затем красным пунктиром - после variant 1 будет использован второй аргумент `r|`: +

fplot 'x' 'b'?'r'
+variant 1
+fplot 'x^3' 'b'?'r|'
+
+ +
+ +
+

+Next: , Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

1.2 Управление ходом выполнения

+ + +

Ниже собраны команды, управляющие порядком выполнения других команд (условия, циклы, подпрограммы), (пере-)определяют аргументы скрипта и пр. Прочие команды могут быть найдены в главах MathGL core и Data processing. Отмечу, что некоторые из команд (например, define, ask, call, for, func) должны быть расположены на отдельной строке. +

+ +
+
Команда MGL: chdir 'path'
+

Переходит в папку path. +

+ + +
+
Команда MGL: ask $N 'question'
+

Задает N-ый аргумент скрипта равным ответу пользователя на вопрос question. Обычно команда показывает диалог с вопросом и полем ввода текста ответа. Здесь N это цифра (0...9) или буква (a...z). +

+ + +
+
Команда MGL: define $N smth
+

Задает N-ый аргумент скрипта равным smth. Отмечу, что smth используется как есть (с символами `'` если присутствуют). Выполняется только подстановка других макроопределений $0...$9, $a...$z. Здесь N это цифра (0...9) или буква (a...z). +

+
+
Команда MGL: define name smth
+

Определяет константу (скаляр) с именем name и числовым значением smth. Позднее она может быть использована как обычное число. +

+ +
+
Команда MGL: defchr $N smth
+

Задает N-ый аргумент скрипта равным символу с UTF кодом smth. Здесь N это цифра (0...9) или буква (a...z). +

+ +
+
Команда MGL: defnum $N smth
+

Задает N-ый аргумент скрипта равным числовому значению smth. Здесь N это цифра (0...9) или буква (a...z). +

+ + + +
+
Команда MGL: call 'fname' [ARG1 ARG2 ... ARG9]
+

Переходит к выполнению (вызывает) подпрограммы fname (или внешнего скрипта, если функция не была найдена). Опциональные аргументы передаются в подпрограмму. См. также func. +

+ + +
+
Команда MGL: func 'fname' [narg=0]
+

Определяет подпрограмму с именем fname и задает число требуемых аргументов. Аргументы будут помещены в параметры скрипта $1, $2, ... $9. Отмечу, что выполнение основной программы будет остановлено при встрече func - действует аналогично комманде stop. См. также return. +

+
+ +
+
Команда MGL: return
+

Возвращается из подпрограммы. См. также func. +

+ + +
+
Команда MGL: load 'filename'
+

Загружает дополнительные команды MGL из внешней динамической библиотеки filename. Данная библиотека должна содержать массив с именем mgl_cmd_extra типа mglCommand, который содержит описание новых комманд. +

+ + + +
+
Команда MGL: if val then CMD
+

Выполняет команду CMD только если val не ноль. +

+
+
Команда MGL: if val
+

Начинает блок команд, выполняемый если val не ноль. +

+
+
Команда MGL: if dat 'cond'
+

Начинает блок команд, выполняемый если каждый элемент dat удовлетворяет условию cond. +

+ +
+
Команда MGL: elseif dat 'cond'
+

Начинает блок команд, выполняемый если предыдущий if или elseif не был выполнен и каждый элемент dat удовлетворяет условию cond. +

+
+
Команда MGL: elseif val
+

Начинает блок команд, выполняемый если предыдущий if или elseif не был выполнен и val не ноль. +

+ +
+
Команда MGL: else
+

Начинает блок команд, выполняемый если предыдущий if или elseif не был выполнен. +

+ +
+
Команда MGL: endif
+

Заканчивает определение блока if/elseif/else. +

+ + +
+
Команда MGL: for $N v1 v2 [dv=1]
+

Начинает блок команд, выполняемый в цикле с $N-ым аргументом изменяющимся от v1 до v2 с шагом dv. Здесь N это цифра (0...9) или буква (a...z). +

+
+
Команда MGL: for $N dat
+

Начинает блок команд, выполняемый в цикле с $N-ым аргументом пробегающим значения массива dat. Здесь N это цифра (0...9) или буква (a...z). +

+ +
+
Команда MGL: next
+

Заканчивает блок цикла for. +

+ + +
+
Команда MGL: do
+

Начинает бесконечный цикл. +

+ +
+
Команда MGL: while val
+

Переходит к следующей итерации цикла если val не ноль, в противном случае заканчивает цикл. +

+
+
Команда MGL: while dat 'cond'
+

Переходит к следующей итерации цикла если dat удовлетворяет условию cond, в противном случае заканчивает цикл. +

+ + +
+
Команда MGL: once val
+

Определяет код (между once on и once off) который будет выполнен только один раз. Полезно для работы с большими данными в программах типа UDAV. +

+ +
+
Команда MGL: stop
+

Останавливает выполнение скрипта. +

+ + +
+
Команда MGL: variant val
+

Задает вариант аргумента(ов), разделенных символом `?`, для всех последующих комманд. +

+ + +
+
Команда MGL: rkstep eq1;... var1;... [dt=1]
+

Выполняет один шаг решения системы обыкновенных дифференциальных уравнений {var1` = eq1, ... } с временным шагом dt. Здесь переменные `var1`, ... - переменные, определенные в MGL скрипте ранее. При решении используется метод Рунге-Кутта 4-го порядка. +

+ + + + +
+ + + +

1.3 Специальные комментарии

+ + +

There are number of special comments for MGL script, which set some global behavior (like, animation, dialog for parameters and so on). All these special comments starts with double sign ##. Let consider them. +

+
+
`##c v1 v2 [dv=1]`
+

Sets the parameter for animation loop relative to variable $0. Here v1 and v2 are initial and final values, dv is the increment. +

+
+
`##a val`
+

Adds the parameter val to the list of animation relative to variable $0. You can use it several times (one parameter per line) or combine it with animation loop ##c. +

+
+
`##d $I kind|label|par1|par2|...`
+

Creates custom dialog for changing plot properties. Each line adds one widget to the dialog. Here $I is id ($0,$1...$9,$a,$b...$z), label is the label of widget, kind is the kind of the widget: +

    +
  • `e` for editor or input line (parameter is initial value) , +
  • `v` for spinner or counter (parameters are "ini|min|max|step|big_step"), +
  • `s` for slider (parameters are "ini|min|max|step"), +
  • `b` for check box (parameter is "ini"; also understand "on"=1), +
  • `c` for choice (parameters are possible choices). +
+

Now, it work in FLTK-based mgllab and mglview only. +

+ +
+
+ + +
+ +
+

+Previous: , Up: MGL scripts   [Contents][Index]

+
+ +

1.4 LaTeX package

+ + +

There is LaTeX package mgltex (was made by Diego Sejas Viscarra) which allow one to make figures directly from MGL script located in LaTeX file. +

+

For using this package you need to specify --shell-escape option for latex/pdflatex or manually run mglconv tool with produced MGL scripts for generation of images. Don`t forgot to run latex/pdflatex second time to insert generated images into the output document. Also you need to run pdflatex third time to update converted from EPS images if you are using vector EPS output (default). +

+

The package may have following options: draft, final — the same as in the graphicx package; on, off — to activate/deactivate the creation of scripts and graphics; comments, nocomments — to make visible/invisible comments contained inside mglcomment environments; jpg, jpeg, png — to export graphics as JPEG/PNG images; eps, epsz — to export to uncompressed/compressed EPS format as primitives; bps, bpsz — to export to uncompressed/compressed EPS format as bitmap (doesn`t work with pdflatex); pdf — to export to 3D PDF; tex — to export to LaTeX/tikz document. +

+

The package defines the following environments: +

+
`mgl`
+

It writes its contents to a general script which has the same name as the LaTeX document, but its extension is .mgl. The code in this environment is compiled and the image produced is included. It takes exactly the same optional arguments as the \includegraphics command, plus an additional argument imgext, which specifies the extension to save the image. +

+

An example of usage of `mgl` environment would be: +

\begin{mglfunc}{prepare2d}
+  new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+  new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+\end{mglfunc}
+
+\begin{figure}[!ht]
+  \centering
+  \begin{mgl}[width=0.85\textwidth,height=7.5cm]
+    fog 0.5
+    call 'prepare2d'
+    subplot 2 2 0 : title 'Surf plot (default)' : rotate 50 60 : light on : box : surf a
+
+    subplot 2 2 1 : title '"\#" style; meshnum 10' : rotate 50 60 : box
+    surf a '#'; meshnum 10
+
+    subplot 2 2 2 : title 'Mesh plot' : rotate 50 60 : box
+    mesh a
+
+    new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+    new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+    new z 50 40 '0.8*cos(pi*(y+1)/2)'
+    subplot 2 2 3 : title 'parametric form' : rotate 50 60 : box
+    surf x y z 'BbwrR'
+  \end{mgl}
+\end{figure}
+
+
+
`mgladdon`
+

It adds its contents to the general script, without producing any image. +

+
`mglcode`
+

Is exactly the same as `mgl`, but it writes its contents verbatim to its own file, whose name is specified as a mandatory argument. +

+
`mglscript`
+

Is exactly the same as `mglcode`, but it doesn`t produce any image, nor accepts optional arguments. It is useful, for example, to create a MGL script, which can later be post processed by another package like "listings". +

+
`mglblock`
+

It writes its contents verbatim to a file, specified as a mandatory argument, and to the LaTeX document, and numerates each line of code. +

+
+
`mglverbatim`
+

Exactly the same as `mglblock`, but it doesn`t write to a file. This environment doesn`t have arguments. +

+
`mglfunc`
+

Is used to define MGL functions. It takes one mandatory argument, which is the name of the function, plus one additional argument, which specifies the number of arguments of the function. The environment needs to contain only the body of the function, since the first and last lines are appended automatically, and the resulting code is written at the end of the general script, after the stop command, which is also written automatically. The warning is produced if 2 or more function with the same name is defined. +

+
`mglcomment`
+

Is used to contain multiline comments. This comments will be visible/invisible in the output document, depending on the use of the package options comments and nocomments (see above), or the \mglcomments and \mglnocomments commands (see bellow). +

+
`mglsetup`
+

If many scripts with the same code are to be written, the repetitive code can be written inside this environment only once, then this code will be used automatically every time the `\mglplot` command is used (see below). It takes one optional argument, which is a name to be associated to the corresponding contents of the environment; this name can be passed to the `\mglplot` command to use the corresponding block of code automatically (see below). +

+
+ +

The package also defines the following commands: +

+
`\mglplot`
+

It takes one mandatory argument, which is MGL instructions separated by the symbol `:` this argument can be more than one line long. It takes the same optional arguments as the `mgl` environment, plus an additional argument setup, which indicates the name associated to a block of code inside a `mglsetup` environment. The code inside the mandatory argument will be appended to the block of code specified, and the resulting code will be written to the general script. +

+

An example of usage of `\mglplot` command would be: +

\begin{mglsetup}
+    box '@{W9}' : axis
+\end{mglsetup}
+\begin{mglsetup}[2d]
+  box : axis
+  grid 'xy' ';k'
+\end{mglsetup}
+\begin{mglsetup}[3d]
+  rotate 50 60
+  box : axis : grid 'xyz' ';k'
+\end{mglsetup}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5]{new a 200 'sin(pi*x)' : plot a '2B'}
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[scale=0.5,setup=2d]{
+    fplot 'sin(pi*x)' '2B' :
+    fplot 'cos(pi*x^2)' '2R'
+  }
+\end{figure}
+\begin{figure}[!ht]
+  \centering
+  \mglplot[setup=3d]{fsurf 'sin(pi*x)+cos(pi*y)'}
+\end{figure}
+
+
+
`\mglgraphics`
+

This command takes the same optional arguments as the `mgl` environment, and one mandatory argument, which is the name of a MGL script. This command will compile the corresponding script and include the resulting image. It is useful when you have a script outside the LaTeX document, and you want to include the image, but you don`t want to type the script again. +

+
`\mglinclude`
+

This is like `\mglgraphics` but, instead of creating/including the corresponding image, it writes the contents of the MGL script to the LaTeX document, and numerates the lines. +

+
`\mgldir`
+

This command can be used in the preamble of the document to specify a directory where LaTeX will save the MGL scripts and generate the corresponding images. This directory is also where `\mglgraphics` and `\mglinclude` will look for scripts. +

+
`\mglquality`
+

Adjust the quality of the MGL graphics produced similarly to quality. +

+
`\mgltexon, \mgltexoff`
+

Activate/deactivate the creation of MGL scripts and images. Notice these commands have local behavior in the sense that their effect is from the point they are called on. +

+
`\mglcomment, \mglnocomment`
+

Make visible/invisible the contents of the mglcomment environments. These commands have local effect too. +

+
`\mglTeX`
+

It just pretty prints the name of the package. +

+
+ +

As an additional feature, when an image is not found or cannot be included, instead of issuing an error, mgltex prints a box with the word `MGL image not found` in the LaTeX document. +

+ + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

2 Основные принципы

+ + +

Возможности библиотеки MathGL довольно богаты - число только основных типов графиков превышает 50 видов. Кроме того, есть функции для обработки данных, настройки вида графика и пр. и пр. Тем не менее, я старался придерживаться единого стиля в порядке аргументов функций и способе их “настройки”. В основном все ниже сказанное относится к функциям рисования различных графиков. +

+

Всего основных концепций (базисных идей) шесть: +

    +
  1. Все рисунки создаются в памяти. Это могут быть как растровые картинки (для SetQuality(MGL_DRAW_LMEM) или quality 6), так и векторные списки примитивов (по умолчанию). Дальнейшая судьба рисунков определяется пользователем: можно сохранить в файл, вывести на экран, создать анимацию/кино, дополнительно отредактировать и т.д. Такой подход обеспечивает высокую переносимость библиотеки - один и тот же программный код создаст в точности одинаковый рисунок на любой операционной системе. Кроме того, при таком подходе рисунки можно создавать непосредственно в консольной программе - графическое окно не нужно! +
  2. Все настройки графиков (стиль линий, цветовые схемы поверхностей, стиль и цвет текста) задаются строками. Это обеспечивает: удобство для пользователя - короткую строку легче читать и здесь тяжелее ошибиться, чем в большом списке параметров; переносимость - строки выглядят одинаково на всех платформах и не надо заботиться о типе и числе аргументов. +
  3. Все функции имеют “упрощенный” и “продвинутый” варианты. Сделано опять из-за удобства. В “упрощенном” варианте для построения графика нужны только один-два массив(а) данных, которые автоматически равнораспределяются в заданном диапазоне осей координат. В “продвинутой” версии можно не только указать явно диапазон построения графика, но и задать его параметрически. Последнее позволяет легко строить довольно сложные кривые и поверхности. В обоих вариантах функций порядок аргументов стандартен: сначала идут массивы данных, потом необязательный строковый параметр стиля графика, а далее строка опций для более точной настройки графика. +
  4. Все данные передаются через экземпляры класса mglData(A). Такой подход позволяет избежать ошибок при работе с памятью и единообразно передавать данные разных типов (float, double, данные из файла, заполненных пользователем и пр.) в функции рисования. +
  5. Все элементы рисунков векторные. Изначально библиотека MathGL была ориентированна на работу с научными данными, которые по своей природе векторные (линии, грани, матрицы и т.д.). Поэтому векторность используется во всех рисунках! Причем иногда даже в ущерб производительности (например, при выводе шрифтов). Помимо всего прочего, векторность позволяет легко масштабировать рисунок - измените размер картинки в 2 раза, и рисунок пропорционально растянется. +
  6. Новые графики не удаляют уже нарисованное. Этот, в чем-то неожиданный, подход позволяет создавать огромное количество “комбинированных” графиков. Например, поверхность с наложенными линиями уровня строится двумя последовательными вызовами функций рисования поверхности и линий уровня (в любом порядке). И совершенно не надо писать специальную функцию (как в Matlab и некоторых других программах) для рисования этого графика. +
+ +

Кроме основных концепций я хотел бы остановиться на нескольких, как оказалось, нетривиальных моментах - способе указания положения графика, осей координат и строковых параметров линий, поверхностей, текста. +

+ + + + + + + + + + + + +
+ + + +

2.1 Оси координат

+ + +

Представление системы координат в MathGL состоит из двух частей. Вначале координаты нормируются в диапазон изменения осей координат (see Axis settings). Если флаг SetCut() установлен, то точки вне интервала отбрасываются, в противном случае, они проецируются на ограничивающий параллелепипед (см. Cutting). Кроме того, отбрасываются точки внутри границ, определенных переменными CutMinxCutMax и точки, для которых значение функции CutOff() не равно нулю. После этого формулы перехода в криволинейную систему координат SetFunc()применяются к каждой точке. Наконец, точка данных отображается с помощью одной из графических функций. +

+

Диапазон изменения x, y, z-координат задается функциями SetRange() или ranges. Точка пересечения осей координат задается функцией SetOrigin(). При этом можно использовать NAN значения для автоматического выбора положения оси. +

+

Кроме привычных осей x, y, z есть еще одна ось - цветовая шкала - ось c. Она используется при окрашивании поверхностей и задает границы изменения функции при окрашивании. Ее границы автоматически устанавливаются равными диапазону z-оси при вызове ranges. Возможно и ручное изменение границ цветового интервала посредством вызова SetRange('c', ...). Используйте colorbar для отображения цветовой шкалы. +

+

Вид меток по осям определяется функцией SetTicks() (see Ticks). Функция SetTuneTicks включает/выключает выделение общего множителя (большого или малого факторов в диапазоне) для меток осей координат. Наконец, если стандартный вид меток не устраивает пользователя, то их шаблон можно задать явно (можно использовать и ТеХ символы), воспользовавшись функцией SetTickTempl(). Кроме того, в качестве меток можно вывести произвольный текст использовав функцию SetTicksVal(). +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.2 Цвета

+ + +

Base colors are defined by one of symbol `wkrgbcymhRGBCYMHWlenupqLENUPQ`. +

Символы цвета: `k` - черный, `r` - красный, `R` - темно красный, `g` - зеленый, `G` - темно зеленый, `b` - синий, `B` - темно синий, `c` - голубой, `C` - темно голубой, `m` - пурпурный, `M` - темно пурпурный, `y` - желтый, `Y` - темно желтый (золотой), `h` - серый, `H` - темно серый, `w` - белый, `W` - светло серый, `l` - сине-зеленый, `L` - темно сине-зеленый, `e` - желто-зеленый, `E` - темно желто-зеленый, `n` - небесно-синий, `N` - темно небесно-синий, `u` - сине-фиолетовый, `U` - темно сине-фиолетовый, `p` - фиолетовый, `P` - темно фиолетовый, `q` - оранжевый, `Q` - темно оранжевый (коричневый).

+

+

В цветовой схеме можно использовать тональные (“подсвеченные”) цвета. Тональный цвет задается двумя символами в фигурных скобках `{cN}`: первый - обычный цвет, второй - его яркость цифрой. Цифра может быть в диапазоне `1`...`9`. При этом `5` соответствует нормальному цвету, `1` - очень темная версия цвета (почти черный), `9` - очень светлая версия цвета (почти белый). Например, цвета могут быть `{b2}` `{b7}` `{r7}` и т.д. +

+

Наконец, можно указать явно RGB или RGBA значения цвета, используя формат `{xRRGGBB}` или `{xRRGGBBAA}` соответственно. Например, `{xFF9966}` даст цвет +дыни. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.3 Стиль линий

+ + + + + + +

Стиль линии задается строкой, которая может содержать символ цвета (`wkrgbcymhRGBCYMHWlenupqLENUPQ`), тип пунктира (`-|;:ji` или пробел), ширину линии (`0123456789`) и тип маркера (`o+xsd.^v` и модификатор `#`). Если пропущен цвет или тип пунктира, то используется значение по умолчанию с последним указанным цветом или значение из палитры (для see 1D plotting). +По умолчанию палитры содержит следующие цвета: темно серый `H`, синий `b`, зеленый `g`, красный `r`, голубой `c`, пурпурный `m`, yellow `y`, серый `h`, сине-зеленый `l`, небесно-синий `n`, оранжевый `q`, желто-зеленый `e`, сине-фиолетовый `u`, фиолетовый `p`. + +

Тип пунктира: пробел - нет линии (для рисования только маркеров), `-` - сплошная линия (■■■■■■■■■■■■■■■■), `|` - длинный пунктир (■■■■■■■■□□□□□□□□), `;` - пунктир (■■■■□□□□■■■■□□□□), `=` - короткий пунктир (■■□□■■□□■■□□■■□□), `:` - точки (■□□□■□□□■□□□■□□□), `j` - пунктир с точками (■■■■■■■□□□□■□□□□), `i` - мелкий пунктир с точками (■■■□□■□□■■■□□■□□), `{dNNNN}` - заданный вручную стиль (для v.2.3 и поздних, например `{df090}` для (■■■■□□□□■□□■□□□□)).

+

+

Типы маркеров: `o` - окружность, `+` - крест, `x` - косой крест, `s` - квадрат, `d` - ромб, `.` - точка, `^` - треугольник вверх, `v` - треугольник вниз, `<` - треугольник влево, `>` - треугольник вправо, `#*` - знак Y, `#+` - крест в квадрате, `#x` - косой крест в квадрате, `#.` - точка в окружности. Если в строке присутствует символ `#`, то используются символы с заполнением. +

+

Вы можете определить собственные символы (см. addsymbol) для рисования маркеров при использовании стиля `&`. В частности, `&*`, `&o`, `&+`, `&x`, `&s`, `&d`, `&.`, `&^`, `&v`, `&<`, `&>` нарисует определенный пользователем символ с именем `*o+xsd.^v<>` соответственно; и +`&#o`, `&#+`, `&#x`, `&#s`, `&#d`, `&#.`, `&#^`, `&#v`, `&#<`, `&#>` нарисует определенный пользователем символ с именем `YOPXSDCTVLR` соответственно. Замечу, что будет нарисован только контур определенного пользователем символа если задан отрицательный размер маркера (см. marksize или опцию size в Command options). +

+

На конце и в начале линии можно выводить специальный символ (стрелку), если в строке указать один из символов: `A` - стрелка наружу, `V` - стрелка внутрь, `I` - поперечная черта, `K` - стрелка с чертой, `T` - треугольник, `S` - квадрат, `D` - ромб, `O` - круг, `X` - косой крест, `_` - нет стрелки (по умолчанию). При этом действует следующее правило: первый символ определяет стрелку на конце линии, второй символ - стрелку в начале линии. Например, `r-A` - красная сплошная линия со стрелкой на конце, `b|AI` - синий пунктир со стрелкой на конце и чертой вначале, `_O` - линия с текущим стилем и кружком вначале. Эти стили действуют и при построении графиков (например, 1D plotting). +

+
Color and line styles. +
+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.4 Цветовая схема

+ + + + +

Цветовая схема используется для определения цвета поверхностей, линий уровня и пр. Цветовая схема задается строкой s, которая содержит символы цвета (see Line styles) или символы `#:|`. Символ `#` переключает рисование поверхности на сетчатое (для трехмерных поверхностей) или включает рисование сетки на поверхности. Символ `|` отключает интерполяцию цвета в цветовой схеме. Это может быть полезно для “резких” цветов, например, при рисовании матриц. Если в строке встречается символ `:`, то он принудительно заканчивает разбор строки для стиля поверхности. После этого символа могут идти описание стиля текста или оси вращения кривой/линий уровня. Цветовая схема может содержать до 32 значений цвета. +

+

При определении цвета по амплитуде (наиболее часто используется) окончательный цвет определяется путем линейной интерполяции массива цветов. Массив цветов формируется из цветов, указанных в строке спецификации. Аргумент - амплитуда, нормированная на диапазон изменения цвета (см. Axis settings). Например, строка из 4 символов `bcyr` соответствует изменению цвета от синего (минимальное значение) через голубой и желтый (промежуточные значения) к красному (максимальное значение). Строка `kw` соответствует изменению цвета от черного (минимальное значение) к белому (максимальное значение). Строка из одного символа (например, `g`) соответствует однотонному цвету (в данному случае зеленому). +

+

Специальная двуосная цветовая схема (как в графике map) задается символом `%`. В ней второе направление (прозрачность) используется как вторая координата для цвета. При этом можно указать до 4 цветов для углов: {c1,a1}, {c2,a1}, {c1,a2}, {c2,a2}. Здесь диапазоны цвета и прозрачности равны {c1,c2} и {a1,a2}. Если указано меньше 4 цветов, то черный используется для угла {c1,a1}. Если задано только 2 цвета, то их сумма используется для угла {c2,a2}. +

+

Есть несколько полезных цветовых схем. Строка `kw` дает обычную серую (черно-белую) схему, когда большие значения светлее. Строка `wk` представляет обратную серую схему, когда большие значения темнее. Строки `kRryw`, `kGgw`, `kBbcw` представляют собой хорошо известные схемы hot, summer и winter. Строки `BbwrR` и `bBkRr` позволяют рисовать двухцветные фигуры на белом или черном фоне, когда отрицательные значения показаны синим цветом, а положительные - красным. Строка `BbcyrR` дает цветовую схему, близкую к хорошо известной схеме jet. +

+

Для более точно раскрашивания поверхностей можно изменить равномерное (по умолчанию) положение цветов в цветовой схеме. Формат следующий: `{CN,pos}`, `{CN,pos}` или `{xRRGGBB,pos}`. Здесь значение pos положения цвета должно быть в диапазоне [0, 1]. Отмечу, что альтернативным механизмом тонкой настройки цветовой схемы может служить использование формул для цветовой координаты (см. Curved coordinates). +

+
Most popular color schemes. +
+

При определении цвета по положению точки в пространстве (используется в map) окончательный цвет определяется по формуле c=x*c[1] + y*c[2]. Здесь c[1], c[2] - первые три цвета в цветовом массиве; x, y - координаты точки, нормированные в диапазон изменения осей координат. +

+ +

Дополнительно, MathGL может наложить маску при закраске граней для создания растрового изображения. Тип маски задается одним из символов `-+=;oOsS~<>jdD*^` в цветовой схеме. Маску можно повернуть на произвольный угол командой mask или на один из улов +45, -45 или 90 градусов, используя символы `\/I` соответственно. Примеры масок по умолчанию показаны на рисунке ниже. +

+
Example of masks for face coloring. +
+

Однако, вы можете задать собственную маску (как матрицу 8*8) для любого из этих символов, используя второй аргумент команды mask. Например, маска на правом нижнем подрисунке получается кодом
+mask '+' 'ff00182424f80000':dens a '3+'
+или использовать явное задание маски (для v.2.3 и более поздних)
+dens a '3{s00ff00182424f800}' +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.5 Стиль текста

+ + + + +

Стиль текста задается строкой, которая может содержать цвет текста `wkrgbcymhRGBCYMHW` (см. Color styles), а также тип шрифта (`ribwou`) и/или выравнивания (`LRC`) после символа `:`. Например, `r:iCb` соответствует жирному (`b`) курсиву (`i`) с выравниванием по центру (`C` красного цвета (`r`). Начиная с MathGL версии 2.3, вы можете использовать не только один цвет для всего текста, но и задать цветовой градиент для выводимой строки (см. Color scheme). +

+

Начертания шрифта: `r` - прямой шрифт, `i` - курсив, `b` - жирный. По умолчанию используется прямой шрифт. Типы выравнивания текста: `L` - по левому краю (по умолчанию), `C` - по центру, `R` - по правому краю, `T` - под текстом, `V` - по центру вертикально. Дополнительные эффекты шрифта: `w` - контурный, `o` - надчеркнутый, `u` - подчеркнутый. +

+

Синтаксический разбор LaTeX-их команд по умолчанию включен. Это команды смены стиля текста (например, \b для жирного текста): \a или \overline - надчеркивание, \b или \textbf - жирный, \i или \textit - курсив, \r или \textrm - прямой (отменяет стили жирного и курсива), \u или \underline - подчеркнутый, \w или \wire - контурный, \big - большего размера, @ - меньшего размера. Нижний и верхний индексы задаются символами `_` и `^`. При этом изменение стиля применяется только к следующему символу или к символам в фигурных скобках {}, которые понимаются как единый блок. Например, сравните строки `sin (x^{2^3})` и `sin (x^2^3)`. Можно также менять цвет текста внутри строки с помощью команд #? или \color?, где `?` - символ цвета (see Line styles). Например, слова `Blue` и `red` будут окрашены в соответствующий цвет в строке `#b{Blue} and \colorr{red} text`. Большинство функций понимает символ новой строки `\n` и позволяет выводить много строчный текст. Наконец, можно использовать символы с произвольным UTF кодом с помощью команды \utf0x????. Например, \utf0x3b1 даст символ +α. +

+

Распознаются также большинство символов TeX и AMSTeX, команды смены стиля текста (\textrm, \textbf, \textit, \textsc, \overline, \underline), акценты (\hat, \tilde, \dot, \ddot, \acute, \check, \grave, \bar, \breve) и корни (\sqrt, \sqrt3, \sqrt4). Полный список содержит около 2000 символов. Отмечу, что первый пробел (пробел, табуляция и пр.) после команды игнорируется, а все остальные пробелы печатаются обычным образом. Например, следующие строки дают одинаковый результат \tilde a: `\tilde{a}`; `\tilde a`; `\tilde{}a`. +

+В частности, распознаются греческие буквы: α - \alpha, β - \beta, γ - \gamma, δ - \delta, ε - \epsilon, η - \eta, ι - \iota, χ - \chi, κ - \kappa, λ - \lambda, μ - \mu, ν - \nu, o - \o, ω - \omega, ϕ - \phi, π - \pi, ψ - \psi, ρ - \rho, σ - \sigma, θ - \theta, τ - \tau, υ - \upsilon, ξ - \xi, ζ - \zeta, ς - \varsigma, ɛ - \varepsilon, ϑ - \vartheta, φ - \varphi, ϰ - \varkappa; A - \Alpha, B - \Beta, Γ - \Gamma, Δ - \Delta, E - \Epsilon, H - \Eta, I - \Iota, C - \Chi, K - \Kappa, Λ - \Lambda, M - \Mu, N - \Nu, O - \O, Ω - \Omega, Φ - \Phi, Π - \Pi, Ψ - \Psi, R - \Rho, Σ - \Sigma, Θ - \Theta, T - \Tau, Υ - \Upsilon, Ξ - \Xi, Z - \Zeta. + +

Еще примеры наиболее общеупотребительных TeX-их символов: ∠ - \angle, ⋅ - \cdot, ♣ - \clubsuit, ✓ - \checkmark, ∪ - \cup, ∩ - \cap, ♢ - \diamondsuit, ◇ - \diamond, ÷ + - \div, +↓ - \downarrow, † - \dag, ‡ - \ddag, ≡ - \equiv, ∃ - \exists, ⌢ - \frown, ♭ - \flat, ≥ - \ge, ≥ - \geq, ≧ - \geqq, ← - \gets, ♡ - \heartsuit, ∞ - \infty, ∫ - \int, \Int, ℑ - \Im, ♢ - \lozenge, ⟨ - \langle, ≤ - \le, ≤ - \leq, ≦ - \leqq, ← - \leftarrow, ∓ - \mp, ∇ - \nabla, ≠ - \ne, ≠ - \neq, ♮ - \natural, ∮ - \oint, ⊙ - \odot, ⊕ - \oplus, ∂ - \partial, ∥ - \parallel, ⊥ -\perp, ± - \pm, ∝ - \propto, ∏ - \prod, ℜ - \Re, → - \rightarrow, ⟩ - \rangle, ♠ - \spadesuit, ~ - \sim, ⌣ - \smile, ⊂ - \subset, ⊃ - \supset, √ - \sqrt or \surd, § - \S, ♯ - \sharp, ∑ - \sum, × - \times, → - \to, ∴ - \therefore, ↑ - \uparrow, ℘ - \wp.

+ +

Размер текста может быть задан явно (если size>0) или относительно базового размера шрифта для рисунка |size|*FontSize при size<0. Значение size=0 указывает, что соответствующая строка выводиться не будет. Базовый размер шрифта измеряется во внутренних единицах. Специальные функции SetFontSizePT(), SetFontSizeCM(), SetFontSizeIN() позволяют задавать его в более “привычных” единицах. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.6 Текстовые формулы

+ + + +

MathGL имеет быстрый парсер текстовых формул +, понимающий большое число функций и операций. Базовые операции: `+` - сложение, `-` - вычитание, `*` - умножение, `/` - деление, `%` - остаток от деления, `^` - возведение в целосичленную степень. Также есть логические операции: `<` - истина если if x<y, `>` - истина если x>y, `=` - истина если x=y, `&` - истина если x и y оба не равны нулю, `|` - истина если x или y не нуль. Логические операции имеют наинизший приоритет и возвращают 1 если истина или 0 если ложно. +

+

Базовые функции: `sqrt(x)` - квадратный корень из x, `pow(x,y)` - x в степени y, `ln(x)` - натуральный логарифм x, `lg(x)` - десятичный логарифм x, `log(a,x)` - логарифм по основанию a от x, `abs(x)` - модуль x, `sign(x)` - знак x, `mod(x,y)` - остаток от деления x на y, `step(x)` - ступенчатая функция, `int(x)` - целая часть x, `rnd` - случайное число, `random(x)` - матрица случайный чисел размером как x, `hypot(x,y)`=sqrt(x^2+y^2) - гипотенуза, `cmplx(x,y)`=x+i*y - комплексное число, `pi` - число +π = 3.1415926…, inf=∞ +

+

Функции для работы с комплексными числами `real(x)`, `imag(x)`, `abs(x)`, `arg(x)`, `conj(x)`. +

+

Тригонометрические функции: `sin(x)`, `cos(x)`, `tan(x)` (или `tg(x)`). Обратные тригонометрические функции: `asin(x)`, `acos(x)`, `atan(x)`. Гиперболические функции: `sinh(x)` (или `sh(x)`), `cosh(x)` (или `ch(x)`), `tanh(x)` (или `th(x)`). Обратные гиперболические функции: `asinh(x)`, `acosh(x)`, `atanh(x)`. +

+

Специальные функции: `gamma(x)` - гамма функция Γ(x) = ∫0 tx-1 exp(-t) dt, `gamma_inc(x,y)` - неполная гамма функция Γ(x,y) = ∫y tx-1 exp(-t) dt, `psi(x)` - дигамма функция ψ(x) = Γ′(x)/Γ(x) для x≠0, `ai(x)` - Эйри функция Ai(x), `bi(x)` - Эйри функция Bi(x), `cl(x)` - функция Клаузена, `li2(x)` (или `dilog(x)`) - дилогарифм Li2(x) = -ℜ∫0xds log(1-s)/s, `sinc(x)` - функция sinc(x) = sin(πx)/(πx) для любых x, `zeta(x)` - зета функция Римана ζ(s) = ∑k=1k-s для s≠1, `eta(x)` - эта функция η(s) = (1 - 21-s)ζ(s) для произвольного s, `lp(l,x)` - полином Лежандра Pl(x), (|x|≤1, l≥0), `w0(x)`, `w1(x)` - функции Ламберта W. Функции W(x) определены как решение уравнения: W exp(W) = x.

+ +

Экспоненциальные интегралы: `ci(x)` - cos-интеграл Ci(x) = ∫0xdt cos(t)/t, `si(x)` - sin-интеграл Si(x) = ∫0xdt sin(t)/t, `erf(x)` - функция ошибки erf(x) = (2/√π) ∫0xdt exp(-t2) , `ei(x)` - интеграл Ei(x) = -PV(∫-xdt exp(-t)/t) (где PV обозначает главное значение), `e1(x)` - интеграл E1(x) = ℜ∫1dt exp(-xt)/t, `e2(x)` - интеграл E2(x) = ℜ∫1∞dt exp(-xt)/t2, `ei3(x)` - интеграл Ei3(x) = ∫0xdt exp(-t3) для x≥0.

+ +

Функции Бесселя: `j(nu,x)` - функция Бесселя первого рода, `y(nu,x)` - функция Бесселя второго рода, `i(nu,x)` - модифицированная функция Бесселя первого рода, `k(nu,x)` - модифицированная функция Бесселя второго рода.

+ +

Эллиптические интегралы: `ee(k)` - полный эллиптический интеграл E(k) = E(π/2,k), `ek(k)` - полный эллиптический интеграл K(k) = F(π/2,k), `e(phi,k)` - эллиптический интеграл E(φ,k) = ∫0φdt √(1 - k2sin2(t)), `f(phi,k)` - эллиптический интеграл F(φ,k) = ∫0φdt 1/√(1 - k2sin2(t))

+ +

Функции Якоби: `sn(u,m)`, `cn(u,m)`, `dn(u,m)`, `sc(u,m)`, `sd(u,m)`, `ns(u,m)`, `cs(u,m)`, `cd(u,m)`, `nc(u,m)`, `ds(u,m)`, `dc(u,m)`, `nd(u,m)`. +

+

Некоторые из функций могут быть недоступны если не была включена поддержка GSL при компиляции библиотеки MathGL. +

+

При разборе формул нет различия между верхним и нижним регистром. Если аргумент лежит вне области определения функции, то возвращается NaN. +

+ +
+ +
+

+Next: , Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.7 Опции команд

+ + +

Опции команд позволяют легко настроить вид отдельного графика не меняя глобальных настроек для все рисунка. Каждая опция отделяется от предыдущей символом `;`. Опции работают так, что запоминают текущие настройки рисунка, применяют собственные настройки, выполняют команду и возвращают глобальные настройки обратно. Поэтому использование опций для команд обработки данных или настройки графика бесполезно. +

+

Наиболее часто используемые опции - xrange, yrange, zrange, устанавливают границы изменения осей координат (и тем самым автоматических массивов). Например, команда Plot(y,"","xrange 0.1 0.9"); или plot y; xrange 0.1 0.9 построит кривую с x-координатой равно распределенной в интервале 0.1 ... 0.9, а не вдоль текущей оси x. См. Using options, для примеров кода и графика. +

+

Полный список опций: + + +

+
Опция MGL: alpha val
+

Задает величину прозрачности поверхности. Значение должно быть в диапазоне [0, 1]. См. также alphadef +

+ + +
+
Опция MGL: xrange val1 val2
+

Задает границы изменения координаты x. См. также xrange +

+ +
+
Опция MGL: yrange val1 val2
+

Задает границы изменения координаты y. См. также yrange +

+ +
+
Опция MGL: zrange val1 val2
+

Задает границы изменения координаты z. См. также zrange +

+ + +
+
Опция MGL: cut val
+

Задает обрезание точек за пределами осей координат. См. также cut. +

+ +
+
Опция MGL: size val
+

Задает размер текста, маркеров и стрелок. См. также font, marksize, arrowsize. +

+ +
+
Опция MGL: meshnum val
+

Задает ориентировочное число линий, стрелок, ячеек и пр. См. также meshnum +

+ + +
+
Опция MGL: legend 'txt'
+

Добавляет строку `txt` во внутренний массив записей легенды. Стиль линии и маркера аргумента последней вызванной команды построения 1D plotting. См. также legend +

+ +
+
MGL option: value val
+

Задает значение, которое будет использовано как дополнительный числовой параметр при построении графика. +

+ + + + +
+ +
+

+Previous: , Up: General concepts   [Contents][Index]

+
+ +

2.8 Интерфейсы

+ + +

Вы можете использовать класс mglParse для выполнения MGL скриптов из других языков программирования. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 Ядро MathGL

+ + + +

Эта глава посвящена описанию множества команд построения графиков для 1D, 2D и 3D массивов данных. Сюда включены также команды настройки графика, вывода текста и примитивов, рисования осей координат и др. Дополнительную информацию о цвете, шрифтах, стилях линий и формулах можно найти в General concepts. +

+ +

Некоторые возможности MathGL доступны только в новых версиях библиотеки. Для проверки текущей версии MathGL можно использовать следующую функцию. +

+
Команда MGL: version 'ver'
+

Возвращает нулевое значение если версия MathGL подходит для требуемой в ver, т.е. если номер основной версии совпадает и "подверсия" больше или равна указанной в ver. +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: MathGL core   [Contents][Index]

+
+ +

3.1 Создание и удаление графического объекта

+ + + +

MGL не требует создания данного типа объектов. +

+ +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.2 Настройка графика

+ + + +

Функции и переменные в этой группе влияют на вид всего рисунка. Соответственно они должны располагаться перед вызовом функций непосредственно рисующих графики. +

+
+
Команда MGL: reset
+

Устанавливает все настройки по умолчанию и очищает рисунок. +

+ +
+
Команда MGL: setup val flag
+

Устанавливает значение бинарного флага flag в val. Список флагов можно найти в define.h. Текущий список флагов: +

#define MGL_ENABLE_CUT		0x00000004 	///< Определяет способ рисования точек вне диапазона осей координат
+#define MGL_ENABLE_RTEXT 	0x00000008 	///< Использовать вращение текста
+#define MGL_AUTO_FACTOR		0x00000010 	///< Разрешить автоматическое масштабирование графика
+#define MGL_ENABLE_ALPHA 	0x00000020 	///< Использовать прозрачность
+#define MGL_ENABLE_LIGHT 	0x00000040 	///< Использовать освещение
+#define MGL_TICKS_ROTATE 	0x00000080 	///< Разрешить вращение меток осей
+#define MGL_TICKS_SKIP		0x00000100 	///< Разрешить пропуск меток осей
+#define MGL_DISABLE_SCALE	0x00000200 	///< Временный флаг, запрещающий изменение размеров
+#define MGL_FINISHED 		0x00000400 	///< Флаг готовности окончательной картинки (т.е. mglCanvas::G)
+#define MGL_USE_GMTIME		0x00000800 	///< Использовать gmtime вместо localtime
+#define MGL_SHOW_POS		0x00001000 	///< Включить показ координат щелчка мыши
+#define MGL_CLF_ON_UPD		0x00002000 	///< Очищать график перед Update()
+#define MGL_NOSUBTICKS		0x00004000 	///< Запретить рисование subticks для bounding box
+#define MGL_LOCAL_LIGHT		0x00008000 	///< Сохранять источники освещения в каждом inplot
+#define MGL_VECT_FRAME		0x00010000 	///< Использовать DrwDat для сохранения всех данных в кадрах
+#define MGL_REDUCEACC		0x00020000 	///< Сокращать точность вывода точек (для уменьшения размера выходных файлов)
+#define MGL_PREFERVC 		0x00040000 	///< Предпочитать цвета вершин вместо текстур если выходной формат поддерживает
+#define MGL_ONESIDED 		0x00080000 	///< Выводить только переднюю сторону поверхностей если выходной формат поддерживает
+#define MGL_NO_ORIGIN 		0x00100000 	///< Не рисовать метки в точке пересечения осей
+#define MGL_GRAY_MODE 		0x00200000 	///< Преобразовать все цвета в оттенки серого
+#define MGL_FULL_CURV 		0x00400000 	///< Запретить пропуск точек на прямолинейных участках
+#define MGL_NO_SCALE_REL 	0x00800000 	///< Запретить изменение размера текста в относительных inplots
+
+ + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.1 Прозрачность

+ + + + + +

Эти функции и переменные настраивают тип и степень прозрачности поверхностей. Главной является функция alpha, которая включает/выключает прозрачность для всего графика. Функция alphadef устанавливает величину alpha-канала по умолчанию. Наконец, функция transptype задает тип прозрачности. См. Transparency and lighting, для примеров кода и графика. +

+
+
Команда MGL: alpha [val=on]
+

Включает/выключает прозрачность и возвращает свое предыдущее состояние. По умолчанию прозрачность выключена. Функция включает прозрачность для всего рисунка. +

+ +
+
Команда MGL: alphadef val
+

Задает значение прозрачности по умолчанию для всех графиков. Значение по умолчанию 0.5. +

+ +
+
Команда MGL: transptype val
+

Задает тип прозрачности. Допустимые значения: +

    +
  • Обычная прозрачность (`0`) - "закрытые" объекты видны меньше чем закрывающие. Этот режим некорректно отображается в OpenGL (mglGraphGL) для нескольких перекрывающихся поверхностей. +
  • "Стеклянная" прозрачность (`1`) - закрытые и закрывающие объекты единообразно ослабляют интенсивность света (по RGB каналам). +
  • "Ламповая" прозрачность (`2`) - закрытые и закрывающие объекты являются источниками дополнительного освещения (рекомендую установить SetAlphaDef(0.3) или меньше в этом случае). +
+

См. Types of transparency, для примеров кода и графика. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.2 Освещение

+ + + + +

Эти функции настраивают освещение графика. Главная функция light включает/выключает освещение графиков построенных после ее вызова (в OpenGL работает сразу для всего рисунка). MathGL поддерживает до 10 независимых источников света. Но в режиме OpenGL можно использовать только первые 8 из них. Положение, цвет, яркость каждого источника света можно задавать по отдельности. По умолчанию включен только первый (с порядковым номером 0) источник света белого цвета, расположенный сверху. См. Lighting sample, для примеров кода и графика. +

+
+
Команда MGL: light [val=on]
+

Включает/выключает освещение графика и возвращает предыдущее состояние. По умолчанию освещение выключено. +

+ +
+
Команда MGL: light num val
+

Включает/выключает n-ый источник света. +

+ +
+
Команда MGL: light num xdir ydir zdir ['col'='w' br=0.5 ap=0]
+
Команда MGL: light num xdir ydir zdir xpos ypos zpos ['col'='w' br=0.5]
+

Добавляет источник света с номером n в положение p с цветом c и яркостью bright, которая должна быть в диапазоне [0,1]. Если указано положение источника r и оно не NAN, то источник считается локальным, иначе источник полагается бесконечно удалённым (для более быстрого рисования). +

+ +
+
Команда MGL: diffuse val
+

Задает яркость диффузного освещения (только для локальных источников света). +

+ +
+
Команда MGL: ambient val
+

Задает яркость рассеянного освещения. Значение должно быть в диапазоне [0,1]. +

+ +
+
Команда MGL: attachlight val
+

Задает привязку настроек освещения к inplot/subplot. Отмечу, что OpenGL и некоторые выходные форматы не поддерживают эту возможность. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.3 Туман

+ + + +
+
Команда MGL: fog val [dz=0.25]
+

Имитирует туман на графике. Туман начинается на относительном расстоянии dz от точки обзора и его плотность растет экспоненциально вглубь по закону ~ 1-exp(-d*z). Здесь z - нормализованная на 1 глубина графика. Если d=0 то туман отсутствует. См. Adding fog, для примеров кода и графика. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.4 Базовые размеры

+ + + + + + +

Эти функции задают величины большинства параметров графика, включая размеры маркеров, стрелок, толщину линий и т.д. Как и любые другие настройки, они подействуют только на графики созданные после изменения настроек. +

+
+
Команда MGL: barwidth val
+

Задает относительный размер прямоугольников в bars, barh, boxplot, candle. Значение по умолчанию 0.7. +

+ +
+
Команда MGL: marksize val
+

Задает размер маркеров для 1D plotting. Значение по умолчанию 1. +

+ +
+
Команда MGL: arrowsize val
+

Задает размер стрелок для 1D plotting, линий и кривых (см. Primitives). Значение по умолчанию 1. +

+ +
+
Команда MGL: meshnum val
+

Задает ориентировочное число линий в mesh, fall, и число стрелок (штрихов) в vect, dew, и число ячеек в cloud, и число маркеров в plot, tens, step, mark, textmark. По умолчанию (=0) рисуются все линии, стрелки, ячейки и т.д. +

+ +
+
Команда MGL: facenum val
+

Задает ориентировочное число видимых граней. Может быть использована для ускорения рисования за счет более грубого рисунка. По умолчанию (=0) рисуются все грани. +

+ +
+
Команда MGL: plotid 'id'
+

Задает имя графика для сохранения в файл (например, в окне FLTK). +

+ + +
+
Команда MGL: pendelta val
+

Изменяет размытие около линий и текста (по умолчанию 1). Для val>1 текст и линии более резкие. Для val<1 текст и линии более размытые. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.5 Обрезание

+ + + +

Эти функции задают условия когда точка будет исключена (вырезана) из рисования. Замечу, что все точки со значением(-ями) NAN по одной из координат или амплитуде автоматически исключаются из рисования. См. Cutting sample, для примеров кода и графика. +

+
+
Команда MGL: cut val
+

Задает обрезание точек за пределами осей координат. Если true то такие точки исключаются из рисования (это по умолчанию) иначе они проецируются на ограничивающий прямоугольник. +

+ +
+
Команда MGL: cut x1 y1 z1 x2 y2 z2
+

Задает границы параллелепипеда внутри которого точки не рисуются. Если границы одинаковы (переменные равны), то параллелепипеда считается пустым. +

+ +
+
Команда MGL: cut 'cond'
+

Задает условие обрезания по формуле cond. Это условие исключает точки из рисования если результат вычисления формулы не равен нулю. Установите аргумент "" для выключения условия обрезания. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.6 Шрифты

+ + + + +
+
Команда MGL: font 'fnt' [val=6]
+

Задает стиль и размер шрифта. Вначале используется `:rC` - прямой шрифт с выравниванием по центру. По умолчанию размер подписей оси координат в 1.4 раза больше. См. также см. Font styles. +

+ +
+
Команда MGL: rotatetext val
+

Включает/выключает вращение меток и подписей осей координат вдоль оси. +

+ +
+
Команда MGL: scaletext val
+

Включает/выключает масштабирование текста в относительных inplot-ах (в том числе columnplot, gridplot, stickplot, shearplot). +

+ +
+
Команда MGL: loadfont ['name'='']
+

Загружает начертание шрифта из файла path/name. Пустая строка загрузит шрифт по умолчанию. +

+ + + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.7 Палитра и цвета

+ + + +
+
Команда MGL: palette 'colors'
+

Задает палитру как последовательность цветов. Значение по умолчанию "Hbgrcmyhlnqeup", что соответствует цветам: темно серый `H`, синий `b`, зелёный `g`, красный `r`, голубой `c`, малиновый `m`, жёлтый `y`, серый `h`, сине-зелёный `l`, небесно-голубой `n`, оранжевый `q`, желто-зелёный `e`, сине-фиолетовый `u`, фиолетовый `p`. Палитра в основном используется в 1D графиках (см. 1D plotting) для кривых с неопределённым стилем линии. Внутренний счетчик цвета будет сброшен при любом изменении палитры, включая скрытые (например, функциями box или axis). +

+ + +
+
Команда MGL: gray [val=on]
+

Включает/выключает вывод графика в оттенках серого. +

+ + +
+ + + +

3.2.8 Маски

+ + + + +
+
Команда MGL: mask 'id' 'hex'
+
Команда MGL: mask 'id' hex
+

Задает новую матрицу hex размером 8*8 для маски с заданным id. Изменения действуют глобально для всех последующих использований данного id. Значения по умолчанию (см. Color scheme): `-` - 000000FF00000000, `+` - 080808FF08080808, `=` - 0000FF00FF000000, `;` - 0000007700000000, `o` - 0000182424180000, `O` - 0000183C3C180000, `s` - 00003C24243C0000, `S` - 00003C3C3C3C0000, `~` - 0000060990600000, `<` - 0060584658600000, `>` - 00061A621A060000, `j` - 0000005F00000000, `d` - 0008142214080000, `D` - 00081C3E1C080000, `*` - 8142241818244281, `^` - 0000001824420000. +

+ +
+
Команда MGL: mask angle
+

Задает угол поворота маски в градусах. Отмечу, что символы `\`, `/`, `I` в цветовой схеме задают угол поворота в 45, -45 и 90 градусов соответственно. +

+ + +
+ +
+

+Next: , Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.9 Обработка ошибок

+ +

Все сообщения будут выведены автоматически в специальном окне или в консоли. +

+ +
+ +
+

+Previous: , Up: Graphics setup   [Contents][Index]

+
+ +

3.2.10 Остановка рисования

+ +

Вы можете использовать команду stop или соответствующую кнопку панели инструментов для остановки рисования и выполнения скрипта. +

+ + +
+ + + +

3.3 Настройки осей координат

+ + +

Эти функции управляет видом и масштабом осей координат. Перед построением для каждой точки выполняются 3 преобразования: сначала определяется возможность рисования точки (см. Cutting), далее применяются формулы перехода к криволинейным координатам и наконец точка отображается. Отмечу, что MathGL выдает предупреждение если масштабы осей координат лежат вне области определения формул преобразования координат. +

+ + + + + + + +
+ + + +

3.3.1 Масштаб осей координат

+ + + + + + + + +
+
Команда MGL: xrange v1 v2 [add=off]
+
Команда MGL: yrange v1 v2 [add=off]
+
Команда MGL: zrange v1 v2 [add=off]
+
Команда MGL: crange v1 v2 [add=off]
+

Задает диапазон изменения `x`-,`y`-,`z`-,`c`-координат. Если одно из значений равно NAN, то оно игнорируется. Параметр add=on указывает добавлять новый диапазон к существующему (не заменять его). См. также ranges. +

+ +
+
Команда MGL: xrange dat [add=off]
+
Команда MGL: yrange dat [add=off]
+
Команда MGL: zrange dat [add=off]
+
Команда MGL: crange dat [add=off]
+

Задает диапазон изменения `x`-,`y`-,`z`-,`c`-координат как минимальное и максимальное значение массива dat. Параметр add=on указывает добавлять новый диапазон к существующему (не заменять его). +

+ +
+
Команда MGL: ranges x1 x2 y1 y2 [z1=0 z2=0]
+

Задает диапазон изменения координат. Если минимальное и максимальное значение координаты равны, то они игнорируются по данному направлению. Также устанавливает размер цветовой шкалы, аналогично команде crange z1 z2. Начальные диапазоны равны [-1, 1]. +

+ +
+
Команда MGL: ranges xx yy [zz cc=zz]
+

Задает диапазон изменения `x`-,`y`-,`z`-,`c`-координат как минимальное и максимальное значение массивов xx, yy, zz, cc соответственно. +

+ + +
+
Команда MGL: origin x0 y0 [z0=nan]
+

Задает центр пересечения осей координат. Если одно из значений равно NAN, то MathGL попытается выбрать оптимальное положение осей координат по этому направлению. +

+ +
+
Команда MGL: zoomaxis x1 x2
+
Команда MGL: zoomaxis x1 y1 x2 y2
+
Команда MGL: zoomaxis x1 y1 z1 x2 y2 z2
+
Команда MGL: zoomaxis x1 y1 z1 c1 x2 y2 z2 c2
+

Дополнительно расширяет диапазон осей координат, задаваемый функциями SetRange или SetRanges, в соответствии с формулами min += (max-min)*p1 и max += (max-min)*p1 (или min *= (max/min)^p1 и max *= (max/min)^p1 для "логарифмических" диапазонов, когда inf>max/min>100 или 0<max/min<0.01). Начальные значения [0, 1]. Внимание! эти настройки не могут быть переписаны никакими другими функциями, включая DefaultPlotParam(). +

+ + + +
+ +
+

+Next: , Previous: , Up: Axis settings   [Contents][Index]

+
+ +

3.3.2 Криволинейные координаты

+ + + +
+
Команда MGL: axis 'fx' 'fy' 'fz' ['fa'='']
+

Задает формулы перехода к криволинейным координатам. Каждая строка является математическим выражением, зависящим от старых координат `x`, `y`, `z` и `a` или `c` для цветовой шкалы. Например, для цилиндрических координат будет SetFunc("x*cos(y)", "x*sin(y)", "z");. Для удаления формул соответствующий параметр должен быть пустым или NULL. Использование формул преобразования слегка замедляет программу. Параметр EqA задает аналогичную формулу для цветовой шкалы. See Textual formulas. +

+ +
+
Команда MGL: axis how
+

Устанавливает одну из предопределенных систем криволинейных координат в зависимости от параметра how: +

+
mglCartesian=0
+

декартова система (нет преобразования координат, {x,y,z}); +

+
mglPolar=1
+

полярные координаты: {x*cos(y),x*sin(y), z}; +

+
mglSpherical=2
+

сферические координаты: {x*sin(y)*cos(z), x*sin(y)*sin(z), x*cos(y)}; +

+
mglParabolic=3
+

параболические координаты: {x*y, (x*x-y*y)/2, z}; +

+
mglParaboloidal=4
+

Paraboloidal coordinates: {(x*x-y*y)*cos(z)/2, (x*x-y*y)*sin(z)/2, x*y}; +

+
mglOblate=5
+

Oblate coordinates: {cosh(x)*cos(y)*cos(z), cosh(x)*cos(y)*sin(z), sinh(x)*sin(y)}; +

+
mglProlate=6
+

Prolate coordinates: {sinh(x)*sin(y)*cos(z), sinh(x)*sin(y)*sin(z), cosh(x)*cos(y)}; +

+
mglElliptic=7
+

эллиптические координаты: {cosh(x)*cos(y), sinh(x)*sin(y), z}; +

+
mglToroidal=8
+

тороидальные координаты: {sinh(x)*cos(z)/(cosh(x)-cos(y)), sinh(x)*sin(z)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y))}; +

+
mglBispherical=9
+

бисферические координаты: {sin(y)*cos(z)/(cosh(x)-cos(y)), sin(y)*sin(z)/(cosh(x)-cos(y)), sinh(x)/(cosh(x)-cos(y))}; +

+
mglBipolar=10
+

биполярные координаты: {sinh(x)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y)), z}; +

+
mglLogLog=11
+

Log-log координаты: {lg(x), lg(y), lg(z)}; +

+
mglLogX=12
+

Log-x координаты: {lg(x), y, z}; +

+
mglLogY=13
+

Log-y координаты: {x, lg(y), z}. +

+
+
+ +
+
Команда MGL: ternary val
+

Задает рисование треугольных (Ternary, tern=1), пирамидальных (Quaternary, tern=2) осей координат и проекций осей координат (tern=4,5,6). +

+

Ternary - специальный тип графика для 3 зависимых координат (компонент) a, b, c таких, что a+b+c=1. MathGL использует только 2 независимые координаты a=x и b=y поскольку их достаточно для построения всех графиков. При этом третья координата z является независимым параметром для построения линий уровня, поверхностей и т.д. +

+

Соответственно Quaternary координаты - 4 зависимые координаты a, b, c и d, такие что a+b+c+d=1. MathGL использует только 2 независимые координаты a=x, b=y и d=z поскольку их достаточно для построения всех графиков. +

+

Проекции строятся если к переменной tern добавить число 4. Так что tern=4 нарисует проекции в декартовых координатах, tern=5 нарисует проекции в треугольных координатах, tern=6 нарисует проекции в пирамидальных координатах. Если добавить 8 вместо 4, то текст не будет выводиться на проекциях. +

+

Используйте Ternary(0) для возвращения к привычным координатам. См. Ternary axis, для примеров кода и графика. См. Axis projection, для примеров кода и графика. +

+ + +
+ +
+

+Previous: , Up: Axis settings   [Contents][Index]

+
+ +

3.3.3 Метки осей

+ + + + + + + + + +
+
Команда MGL: adjust ['dir'='xyzc']
+

Автоматически задает шаг меток осей, число подметок и начальное положение меток для осей координат dir в виде наиболее удобном для человека. Также задает SetTuneTicks(true). Обычно не требуется вызывать эту функцию кроме случая возвращения настроек по умолчанию. +

+ +
+
Команда MGL: xtick val [sub=0 org=nan 'fact'='']
+
Команда MGL: ytick val [sub=0 org=nan 'fact'='']
+
Команда MGL: ztick val [sub=0 org=nan 'fact'='']
+
Команда MGL: ctick val [sub=0 org=nan 'fact'='']
+

Задает шаг меток осей d, число подметок ns и начальное положение меток org для оси вдоль направления dir (используйте `c` для меток colorbar). Переменная d задает шаг меток (если положительна) или их число на оси (если отрицательна). Нулевое значение задает автоматическую расстановку меток. Если org=NAN, то используется значение из переменной Org. Параметр fact задает текст, которые будет напечатан после метки оси (например, "\pi" для d=M_PI). +

+ +
+
Команда MGL: xtick val1 'lbl1' [val2 'lbl2' ...]
+
Команда MGL: ytick val1 'lbl1' [val2 'lbl2' ...]
+
Команда MGL: ztick val1 'lbl1' [val2 'lbl2' ...]
+
Команда MGL: xtick vdat 'lbls' [add=off]
+
Команда MGL: ytick vdat 'lbls' [add=off]
+
Команда MGL: ztick vdat 'lbls' [add=off]
+

Задает явное положение val и подписи lbl для меток вдоль оси dir. Если массив val не указан, то используются значения равно распределённые в диапазоне осей координат. Метки разделяются символом `\n`. Если в команде MGL задано только одно значение, то метка будет добавлена к существующим меткам. Используйте SetTicks() для восстановления автоматических меток. +

+ + +
+
Команда MGL: xtick 'templ'
+
Команда MGL: ytick 'templ'
+
Команда MGL: ztick 'templ'
+
Команда MGL: ctick 'templ'
+

Задает шаблон templ для меток вдоль x-,y-,z-оси или colorbar. Шаблон может содержать и символы TeX. Если templ="", то используется шаблон по умолчанию (в простейшем случае `%.2g`). Если шаблон начинается с символа `&`, то будет использовано целое long вместо типа double. Установка шаблона выключает автоматическое улучшение вида меток. +

+ +
+
Команда MGL: ticktime 'dir' [dv=0 'tmpl'='']
+

Задает метки времени с шагом val и шаблоном templ для меток вдоль x-,y-,z-оси или colorbar. Шаблон может содержать и символы TeX. Формат шаблона templ такой же как http://www.manpagez.com/man/3/strftime/. Наиболее употребительные варианты: `%X` для национального представления времени, `%x` для национального представления даты, `%Y` для года с цифрами столетия. Если val=0 и/или templ="", то используется автоматическая расстановка меток и/или выбор шаблона. Вы можете использовать функцию mgl_get_time() для получения числа секунд с 1970 года до указанной даты/времени. Отмечу, что MS Visual Studio не может обрабатывать даты до 1970. +

+ + +
+
Команда MGL: tuneticks val [pos=1.15]
+

Включает/выключает улучшение вида меток осей путем вынесения общего множителя (для маленьких, типа 0.001...0.002, или больших, типа 1000...2000, значений координат) или общей компоненты (для узкого диапазона, типа 0.999...1.000). Также задает положение pos общего множителя на оси: =0 около минимального значения, =1 около максимального значения. +

+ +
+
Команда MGL: tickshift dx [dy=0 dz=0 dc=0]
+

Задает значение дополнительного сдвига меток осей координат. +

+ + +
+
Команда MGL: origintick val
+

Разрешает/запрещает рисование меток в точке пересечения осей координат. В C/Fortran следует использовать mgl_set_flag(gr,val, MGL_NO_ORIGIN);. +

+ +
+
Команда MGL: ticklen val [stt=1]
+

Задает относительную длину меток осей координат. Значение по умолчанию 0.1. Параметр stt>0 задает относительную длину подметок, которые в sqrt(1+stt) раз меньше. +

+ +
+
Команда MGL: axisstl 'stl' ['tck'='' 'sub'='']
+

Задает стиль осей (stl), меток (tck) и подметок (sub) осей координат. Если stl пустая или ноль, то используется стиль по умолчанию (`k` или `w` в зависимости от типа прозрачности). Если tck, sub пустая или ноль, то используется стиль осей (т.е. stl). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.4 Матрица преобразования

+ + + + + + + + + + + + + + + +

Эти функции контролируют где и как график будет расположен. Существует определенный порядок вызова этих функций для лучшего вида графика. Вначале должны вызываться функции subplot, multiplot или inplot для указания местоположения вывода. После них - функции вращения rotate, shear и aspect. И наконец любые другие функции для рисования графика. Вместо вращения графика можно вызвать функцию columnplot, gridplot, stickplot, shearplot или относительную inplot для расположения графиков в столбец одного над другим без зазора между осями. См. Subplots, для примеров кода и графика. +

+
+
Команда MGL: subplot nx ny m ['stl'='<>_^' dx=0 dy=0]
+

Помещает последующий вывод в m-ую ячейку сетки размером nx*ny от всего рисунка. Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться первой для создания "подграфика". С эстетической точки зрения не рекомендуется вызывать эту функцию с различными (или не кратными) размерами сетки. Дополнительное место для осей/colorbar резервируется только если строка stl содержит: +

    +
  • `L` или `<` - с левого края, +
  • `R` или `>` - с правого края, +
  • `A` или `^` - с верхнего края, +
  • `U` или `_` - с нижнего края, +
  • `#` - место резервироваться не будет - оси координат будут занимать все доступное пространство. +
+

Ячейка может быть дополнительно сдвинута относительно своего обычного положения на относительный размер dx, dy. Отмечу, что colorbar может находиться за пределами рисунка если выбран пустой стиль ``. +

+ +
+
Команда MGL: multiplot nx ny m dx dy ['style'='<>_^' sx sy]
+

Помещает последующий вывод в прямоугольник из dx*dy ячеек, начиная с m-ой ячейки, сетки размером nx*ny от всего рисунка. Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться первой для создания "подграфика". Дополнительное место для осей/colorbar резервируется если строка stl содержит: +

    +
  • `L` или `<` - с левого края, +
  • `R` или `>` - с правого края, +
  • `A` или `^` - с верхнего края, +
  • `U` или `_` - с нижнего края, +
  • `#` - место резервироваться не будет - оси координат будут занимать все доступное пространство. +
+

Область вывода может быть дополнительно сдвинута относительно своего обычного положения на относительный размер sx, sy. +

+ +
+
Команда MGL: inplot x1 x2 y1 y2 [rel=on]
+

Помещает последующий вывод в прямоугольную область [x1, x2]*[y1, y2] (исходный размер [0,1]*[0,1]). Эта функция позволяет поместить график в произвольную область рисунка. Если параметр rel=true, то используется позиция относительно текущего subplot (или inplot с rel=false). Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться первой для создания "подграфика". +

+ +
+
Команда MGL: columnplot num ind [d=0]
+

Помещает последующий вывод в ind-ую строку столбца из num строк. Положение столбца выбирается относительно последнего вызова subplot (или inplot с rel=false). Параметр d задает дополнительный зазор между строк. +

+ +
+
Команда MGL: gridplot nx ny ind [d=0]
+

Помещает последующий вывод в ind-ую ячейку таблицы nx*ny. Положение ячейки выбирается относительно последнего вызова subplot (или inplot с rel=false). Параметр d задает дополнительный зазор между ячеек. +

+ +
+
Команда MGL: stickplot num ind tet phi
+

Помещает последующий вывод в ind-ую ячейку "бруска" из num ячеек. При этом сам брусок повернут на углы tet, phi. Положение выбирается относительно последнего вызова subplot (или inplot с rel=false). +

+ +
+
Команда MGL: shearplot num ind sx sy [xd yd]
+

Помещает последующий вывод в ind-ую ячейку "бруска" из num ячеек. При этом сама ячейка скошена на sx, sy. Направление бруска задается переменными xd и yd. Положение выбирается относительно последнего вызова subplot (или inplot с rel=false). +

+ +
+
Команда MGL: title 'title' ['stl'='' size=-2]
+

Выводит заголовок title для текущего "подграфика" шрифтом stl с размером size. Если строка stl содержит `#`, то рисуется обрамляющий прямоугольник. Функция сбрасывает матрицу трансформации (повороты и сжатие графика) и должна вызываться сразу после создания "подграфика". +

+ +
+
Команда MGL: rotate tetx tetz [tety=0]
+

Вращает систему координат относительно осей {x, z, y} последовательно на углы TetX, TetZ, TetY. +

+ +
+
Команда MGL: rotate tet x y z
+

Вращает систему координат относительно вектора {x, y, z} на угол Tet. +

+ + +
+
Команда MGL: shear sx sy
+

Сдвигает (скашивает) систему координат на значения sx, sy. +

+ + +
+
Команда MGL: aspect ax ay [az=1]
+

Устанавливает соотношение размеров осей в отношении Ax:Ay:Az. Для лучшего вида следует вызывать после функции rotate. Если Ax=NAN, то функция выберет оптимальное соотношение размеров, чтобы шаг по осям x-y был одинаков. При этом, Ay задает фактор пропорциональности шага (обычно 1), или указывает на его автоматический выбор при Ay=NAN. +

+ + + +

Также есть 3 функции, которые управляют перспективой Perspective(), масштабированием Zoom() и вращением View() всего рисунка. Т.е. они действуют как ещё одна матрица трансформации. Они были введены для вращения/приближения графика с помощью мыши. Не рекомендуется вызывать их при рисовании графика. +

+
+
Команда MGL: perspective val
+

Добавляет (включает) перспективу для графика. Параметр a = Depth/(Depth+dz) \in [0,1). По умолчанию (a=0) перспектива отключена. +

+ +
+
Команда MGL: view tetx tetz [tety=0]
+

Вращает систему координат относительно осей {x, z, y} последовательно на углы TetX, TetZ, TetY. Вращение происходит независимо от rotate. Внимание! эти настройки не могут быть переписаны функцией DefaultPlotParam(). Используйте Zoom(0,0,1,1) для возвращения к виду по умолчанию. +

+ +
+
Команда MGL: zoom x1 y1 x2 y2
+

Масштабирует весь рисунок. После вызова функции текущий график будет очищен и в дальнейшем рисунок будет содержать только область [x1,x2]*[y1,y2] от исходного рисунка. Координаты x1, x2, y1, y2 меняются в диапазоне от 0 до 1. Внимание! эти настройки не могут быть переписаны никакими другими функциями, включая DefaultPlotParam(). Используйте Zoom(0,0,1,1) для возвращения к виду по умолчанию. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.5 Экспорт рисунка

+ + + +

Функции в этой группе сохраняют или дают доступ к полученному рисунку. Поэтом обычно они должны вызываться в конце рисования. +

+
+
Команда MGL: setsize w h
+

Изменяет размер картинки в пикселях. Функция должна вызываться перед любыми функциями построения потому что полностью очищает содержимое рисунка при clear=true. Функция только очищает растровый рисунок и масштабирует примитивы при clear=false. +

+ + +
+
Команда MGL: setsizescl factor
+

Задает множитель для высоты и ширины во всех последующих вызовах setsize. +

+ + +
+
Команда MGL: quality [val=2]
+

Задает качество графика в зависимости от значения val: MGL_DRAW_WIRE=0 - нет рисования граней (наиболее быстрый), MGL_DRAW_FAST=1 - нет интерполяции цвета (быстрый), MGL_DRAW_NORM=2 - высокое качество (нормальный), MGL_DRAW_HIGH=3 - высокое качество с рисованием 3d примитивов (стрелок и маркеров). Если установлен бит MGL_DRAW_LMEM=0x4, то происходит прямое рисование в растровое изображение (меньше затраты памяти). Если установлен бит MGL_DRAW_DOTS=0x8, то рисуются точки вместо примитивов (очень быстро). +

+ + + + + + + + + + +
+ + + +

3.5.1 Экспорт в файл

+ + + +

Эти функции экспортируют текущую картинку (кадр) в файл. Имя файла fname должно иметь соответствующее расширение. Параметр descr дает краткое описание картинки. Пока прозрачность поддерживается только для форматов PNG, SVG, OBJ и PRC. +

+
+
Команда MGL: write ['fname'='']
+

Экспортирует текущий кадр в файл fname с типом, определяемым по расширению. Параметр descr добавляет описание (может быть пустым). Если fname пустой, то используется имя `frame####.jpg`, где `####` - текущий номер кадра и имя `frame` определяется переменной plotid. +

+ +
+
Команда MGL: bbox x1 y1 [x2=-1 y2=-1]
+

Задает область изображения, которая будет сохранена в файл 2D формата. Если x2<0 (y2<0), то исходная ширина (высота) рисунка будет использована. Если x1<0 или y1<0 или x1>=x2|Width или y1>=y2|Height, то обрезания рисунка не будет. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Export picture   [Contents][Index]

+
+ +

3.5.2 Кадры/Анимация

+ + +

В MGL нет специальных команд для создания анимации. Однако можно воспользоваться возможностями утилит mglconv и mglview. Например, используя комментарии спеиального вида `##a ` или `##c `. +

+ + +
+ + + +

3.5.3 Рисование в памяти

+ + + + +
+ +
+

+Previous: , Up: Export picture   [Contents][Index]

+
+ +

3.5.4 Распараллеливание

+ + + + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.6 Фоновое изображение

+ + + + + +

These functions change background image. +

+
+
Команда MGL: clf ['col']
+
Команда MGL: clf r g b
+

Очищает рисунок и заполняет фон заданным цветом. +

+ +
+
Команда MGL: rasterize
+

Завершает рисование графика и помещает результат в качестве фона. После этого, очищает список примитивов (как clf). Функция полезна для сохранения части графика (например, поверхностей или векторных полей) в растровом виде, а другой части (кривых, осей и пр.) в векторном. +

+ +
+
Команда MGL: background 'fname' [alpha=1]
+

Загружает PNG или JPEG файл fname в качестве фона для графика. Параметр alpha задает прозрачность фона вручную. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.7 Рисование примитивов

+ + + + + + + + + + + + + + +

Эти функции рисуют рисуют простые объекты типа линий, точек, сфер, капель, конусов, и т.д. +

+
+
Команда MGL: ball x y ['col'='r.']
+
Команда MGL: ball x y z ['col'='r.']
+

Рисует маркер (точку по умолчанию) с координатами p={x, y, z} и цветом col. +

+ +
+
Команда MGL: errbox x y ex ey ['stl'='']
+
Команда MGL: errbox x y z ex ey ez ['stl'='']
+

Рисует 3d error box в точке p={x, y, z} размером e={ex, ey, ez} и стилем stl. Используйте NAN в компонентах e для уменьшения рисуемых элементов. +

+ +
+
Команда MGL: line x1 y1 x2 y2 ['stl'='']
+
Команда MGL: line x1 y1 z1 x2 y2 z2 ['stl'='']
+

Рисует геодезическую линию (декартовых координатах - прямую) из точки p1 в p2 использую стиль линии stl. Параметр num определяет гладкость линии (число точек на линии). Если num=2, то рисуется прямая даже в криволинейных координатах (см. Curved coordinates). Наоборот, для больших значений (например, =100) рисуется геодезическая линия (окружность в полярных координатах, парабола в параболических и т.д.). Линия рисуется даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: curve x1 y1 dx1 dy1 x2 y2 dx2 dy2 ['stl'='']
+
Команда MGL: curve x1 y1 z1 dx1 dy1 dz1 x2 y2 z2 dx2 dy2 dz2 ['stl'='']
+

Рисует кривую Безье из точки p1 в p2 используя стиль линии stl. Касательные в точках пропорциональны d1, d2. Параметр num определяет гладкость линии (число точек на линии). Если num=2, то рисуется прямая даже в криволинейных координатах (см. Curved coordinates). Наоборот, для больших значений (например, =100) рисуется геодезическая линия (окружность в полярных координатах, парабола в параболических и т.д.). Кривая рисуется даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: face x1 y1 x2 y2 x3 y3 x4 y4 ['stl'='']
+
Команда MGL: face x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 ['stl'='']
+

Рисует заполненный четырехугольник (грань) с углами в точках p1, p2, p3, p4 и цветом(-ами) stl. При этом цвет может быть один для всей грани, или различным если указаны все 4 цвета. Грань будет нарисована даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: rect x1 y1 x2 y2 ['stl'='']
+
Команда MGL: rect x1 y1 z1 x2 y2 z2 ['stl'='']
+

Рисует закрашенный прямоугольник (грань) с вершинами {x1, y1, z1} и {x2, y2, z2} цветом stl. При этом цвет может быть один для всей грани, или различным для разных вершин если указаны все 4 цвета. Грань будет нарисована даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: facex x0 y0 z0 wy wz ['stl'='' d1=0 d2=0]
+
Команда MGL: facey x0 y0 z0 wx wz ['stl'='' d1=0 d2=0]
+
Команда MGL: facez x0 y0 z0 wx wy ['stl'='' d1=0 d2=0]
+

Рисует закрашенный прямоугольник (грань) перпендикулярно оси [x,y,z] в точке {x0, y0, z0} цветом stl и шириной wx, wy, wz вдоль соответствующего направления. При этом цвет может быть один для всей грани, или различным для разных вершин если указаны все 4 цвета. Параметры d1!=0, d2!=0 задают дополнительный сдвиг последней точки (т.е. рисуют четырехугольник). Грань будет нарисована даже если часть ее лежит вне диапазона осей координат. +

+ +
+
Команда MGL: sphere x0 y0 r ['col'='r']
+
Команда MGL: sphere x0 y0 z0 r ['col'='r']
+

Рисует сферу радиуса r с центром в точке p={x0, y0, z0} цветом stl. +

+ +
+
Команда MGL: drop x0 y0 dx dy r ['col'='r' sh=1 asp=1]
+
Команда MGL: drop x0 y0 z0 dx dy dz r ['col'='r' sh=1 asp=1]
+

Рисует каплю радиуса r в точке p вытянутую вдоль направления d цветом col. Параметр shift определяет степень вытянутости: `0` - сфера, `1` - классическая капля. Параметр ap определяет относительную ширину капли (аналог "эллиптичности" для сферы). +

+ +
+
Команда MGL: cone x1 y1 z1 x2 y2 z2 r1 [r2=-1 'stl'='' edge=off]
+

Рисует трубу (или усеченный конус если edge=false) между точками p1, p2 с радиусами на концах r1, r2. Если r2<0, то полагается r2=r1. Цвет конуса задается строкой stl. Параметр stl может содержать: +

    +
  • `@` для рисования торцов; +
  • `#` для сетчатой фигуры; +
  • `t` для рисования цилиндра вместо конуса/призмы; +
  • `4`, `6`, `8` для рисования квадратной, шестиугольной или восьмиугольной призмы вместо конуса. +
+ +
+ +
+
Команда MGL: circle x0 y0 r ['col'='r']
+
Команда MGL: circle x0 y0 z0 r ['col'='r']
+

Рисует круг радиуса r с центром в точке p={x0, y0, z0} цветом stl. Если col содержит: `#` то рисуется только граница, `@` то рисуется граница (вторым цветом из col или черными). +

+ +
+
Команда MGL: ellipse x1 y1 x2 y2 r ['col'='r']
+
Команда MGL: ellipse x1 y1 z1 x2 y2 z2 r ['col'='r']
+

Рисует эллипс радиуса r с фокусами в точках p1, p2 цветом stl. Если col содержит: `#` то рисуется только граница, `@` то рисуется граница (вторым цветом из col или черными). +

+ +
+
Команда MGL: rhomb x1 y1 x2 y2 r ['col'='r']
+
Команда MGL: rhomb x1 y1 z1 x2 y2 z2 r ['col'='r']
+

Рисует ромб ширины r с вершинами в точках p1, p2 цветом stl. Если col содержит: `#` то рисуется только граница, `@` то рисуется граница (вторым цветом из col или черными). Если col содержит 3 цвета, то используется градиентная заливка. +

+ +
+
Команда MGL: arc x0 y0 x1 y1 a ['col'='r']
+
Команда MGL: arc x0 y0 z0 x1 y1 a ['col'='r']
+
Команда MGL: arc x0 y0 z0 xa ya za x1 y1 z1 a ['col'='r']
+

Рисует дугу вокруг оси pa (по умолчанию вокруг оси z pa={0,0,1}) с центром в p0, начиная с точки p1. Параметр a задает угол дуги в градусах. Строка col задает цвет дуги и тип стрелок на краях. +

+ +
+
Команда MGL: polygon x0 y0 x1 y1 num ['col'='r']
+
Команда MGL: polygon x0 y0 z0 x1 y1 z1 num ['col'='r']
+

Рисует правильный num-угольник с центром в p0 с первой вершиной в p1 цветом col. Если col содержит: `#` то рисуется только граница, `@` то рисуется граница (вторым цветом из col или черными). +

+ +
+
Команда MGL: logo 'fname' [smooth=off]
+

Draw bitmap (logo) along whole axis range, which can be changed by Command options. Bitmap can be loaded from file or specified as RGBA values for pixels. Parameter smooth set to draw bitmap without or with color interpolation. +

+ + + +
+
Команда MGL: symbol x y 'id' ['fnt'='' size=-1]
+
Команда MGL: symbol x y z 'id' ['fnt'='' size=-1]
+

Рисует определенный пользователем символ с именем id в точке p стилем fnt. Размер задается параметром size (по умолчанию -1). Строка fnt может содержать цвет (до разделителя `:`); стили `a` или `A` для вывода в абсолютной позиции ({x, y} полагаются в диапазоне [0,1]) относительно рисунка (для `A`) или subplot/inplot (для `a`); и стиль `w` для рисования только контура символа. +

+ +
+
Команда MGL: symbol x y dx dy 'id' ['fnt'=':L' size=-1]
+
Команда MGL: symbol x y z dx dy dz 'id' ['fnt'=':L' size=-1]
+

Аналогично предыдущему, но символ рисуется в повернутым в направлении d. +

+ +
+
Команда MGL: addsymbol 'id' xdat ydat
+

Добавляет определенный пользователем символ с именем id и границей {xdat, ydat}. Значения NAN задают разрыв (скачок) граничной кривой. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.8 Вывод текста

+ + + + +

Функции для вывода текста позволяют вывести строку текста в произвольном месте рисунка, в произвольном направлении и вдоль произвольной кривой. MathGL позволяет использовать произвольное начертание шрифта и многие ТеХ-ие команды (детальнее см. Font styles). Все функции вывода текста имеют варианты для 8-bit строк (char *) и для Unicode строк (wchar_t *). В первом случае используется конверсия из текущей локали, т.е. иногда вам требуется явно указать локаль с помощью функции setlocale(). Аргумент size определяет размер текста: размер шрифта если положителен или относительный размер (=-size*SetFontSize()) если отрицателен. Начертание шрифта (STIX, arial, courier, times и др.) можно изменить с помощью функции LoadFont(). See Font settings. +

+

Параметры шрифта задаются строкой, которая может содержать символы цвета `wkrgbcymhRGBCYMHW` (см. Color styles). Также после символа `:` можно указать символы стиля (`rbiwou`) и/или выравнивания (`LRCTV`). Стили шрифта: `r` - прямой, `i` - курсив, `b` - жирный, `w` - контурный, `o` - надчеркнутый, `u` - подчеркнутый. По умолчанию используется прямой шрифт. Типы выравнивания: `L` - по левому краю (по умолчанию), `C` - по центру, `R` - по правому краю, `T` - под текстом, `V` - по центру вертикально. Например, строка `b:iC` соответствует курсиву синего цвета с выравниванием по центру. Начиная с MathGL версии 2.3, вы можете задать цветовой градиент для выводимой строки (см. Color scheme). +

+

Если строка содержит символы `aA`, то текст выводится в абсолютных координатах (полагаются в диапазоне [0,1]). При этом используются координаты относительно рисунка (если указано `A`) или относительно последнего subplot/inplot (если указано `a`). Если строка содержит символ `@`, то вокруг текста рисуется прямоугольник. +

+

См. Text features, для примеров кода и графика. +

+
+
Команда MGL: text x y 'text' ['fnt'='' size=-1]
+
Команда MGL: text x y z 'text' ['fnt'='' size=-1]
+

Выводит строку text от точки p шрифтом определяемым строкой fnt. Размер шрифта задается параметром size (по умолчанию -1). +

+ +
+
Команда MGL: text x y dx dy 'text' ['fnt'=':L' size=-1]
+
Команда MGL: text x y z dx dy dz 'text' ['fnt'=':L' size=-1]
+

Выводит строку text от точки p вдоль направления d. Параметр fnt задает стиль текста и указывает выводить текст под линией (`T`) или над ней (`t`). +

+ +
+
Команда MGL: fgets x y 'fname' [n=0 'fnt'='' size=-1.4]
+
Команда MGL: fgets x y z 'fname' [n=0 'fnt'='' size=-1.4]
+

Выводит n-ую строку файла fname от точки {x,y,z} шрифтом fnt и размером size. По умолчанию используются параметры заданные командой font. +

+ +
+
Команда MGL: text ydat 'text' ['fnt'='']
+
Команда MGL: text xdat ydat 'text' ['fnt'='' size=-1 zval=nan]
+
Команда MGL: text xdat ydat zdat 'text' ['fnt'='' size=-1]
+

Выводит строку text вдоль кривой {x[i], y[i], z[i]} шрифтом fnt. Строка fnt может содержать символы: `t` для вывода текста под кривой (по умолчанию), или `T` для вывода текста под кривой. Размеры по 1-ой размерности должны быть одинаковы для всех массивов x.nx=y.nx=z.nx. Если массив x не указан, то используется "автоматический" массив со значениями в диапазоне осей координат (см. Ranges (bounding box)). Если массив z не указан, то используется минимальное значение оси z. Строка opt содержит опции команды (см. Command options). +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.9 Оси и Colorbar

+ + + + + + + +

Эти функции рисуют объекты для "измерения" типа осей координат, цветовой таблицы (colorbar), сетку по осям, обрамляющий параллелепипед и подписи по осям координат. См. также см. Axis settings. +

+
+
Команда MGL: axis ['dir'='xyz' 'stl'='']
+

Рисует оси координат и метки на них (см. Axis settings) в направлениях `xyz`, указанных строкой dir. Строка dir может содержать: +

    +
  • `xyz` для рисования соответствующих осей; +
  • `XYZ` для рисования соответствующих осей с метками с другой стороны; +
  • `~` или `_` для осей без подписей; +
  • `U` для невращаемых подписей; +
  • `^` для инвертирования положения по умолчанию; +
  • `!` для отключения улучшения вида меток (см. tuneticks); +
  • `AKDTVISO` для вывода стрелки на конце оси; +
  • `a` для принудительной автоматической расстановки меток; +
  • `:` для рисования линий через точку (0,0,0); +
  • `f` для вывода чисел в фиксированном формате; +
  • `E` для вывода `E` вместо `e`; +
  • `F` для вывода в формате LaTeX; +
  • `+` для вывода `+` для положительных чисел; +
  • `-` для вывода обычного `-`; +
  • `0123456789` для задания точности при выводе чисел. +
+

Стиль меток и оси(ей) задается строкой stl. Опция value задает угол вращения меток оси. См. Axis and ticks, для примеров кода и графика. +

+ +
+
Команда MGL: colorbar ['sch'='']
+

Рисует полосу соответствия цвета и числовых значений (colorbar) для цветовой схемы sch (используется текущая для sch="") с краю от графика. Строка sch также может содержать: +

    +
  • `<>^_` для расположения слева, справа, сверху или снизу соответственно; +
  • `I` для расположения около осей (по умолчанию, на краях subplot); +
  • `A` для использования абсолютных координат (относительно рисунка); +
  • `~` для colorbar без подписей; +
  • `!` для отключения улучшения вида меток (см. tuneticks); +
  • `a` для принудительной автоматической расстановки меток; +
  • `f` для вывода чисел в фиксированном формате; +
  • `E` для вывода `E` вместо `e`; +
  • `F` для вывода в формате LaTeX; +
  • `+` для вывода `+` для положительных чисел; +
  • `-` для вывода обычного `-`; +
  • `0123456789` для задания точности при выводе чисел. +
+

См. Colorbars, для примеров кода и графика. +

+ +
+
Команда MGL: colorbar vdat ['sch'='']
+

Аналогично предыдущему, но для цветовой схемы без сглаживания с заданными значениями v. См. contd sample, для примеров кода и графика. +

+ +
+
Команда MGL: colorbar 'sch' x y [w=1 h=1]
+

Аналогично первому, но в произвольном месте графика {x, y} (полагаются в диапазоне [0,1]). Параметры w, h задают относительную ширину и высоту colorbar. +

+ +
+
Команда MGL: colorbar vdat 'sch' x y [w=1 h=1]
+

Аналогично предыдущему, но для цветовой схемы sch без сглаживания с заданными значениями v. См. contd sample, для примеров кода и графика. +

+ +
+
Команда MGL: grid ['dir'='xyz' 'pen'='B']
+

Рисует линии сетки в направлениях перпендикулярным dir. Если dir содержит `!`, то линии рисуются также и для координат под-меток. Шаг сетки такой же как у меток осей координат. Стиль линий задается параметром pen (по умолчанию - сплошная темно синяя линия `B-`). +

+ +
+
Команда MGL: box ['stl'='k' ticks=on]
+

Рисует ограничивающий параллелепипед цветом col. Если col содержит `@`, то рисуются закрашенные задние грани. При этом первый цвет используется для граней (по умолчанию светло жёлтый), а последний для рёбер и меток. +

+ +
+
Команда MGL: xlabel 'text' [pos=1]
+
Команда MGL: ylabel 'text' [pos=1]
+
Команда MGL: zlabel 'text' [pos=1]
+
Команда MGL: tlabel 'text' [pos=1]
+

Выводит подпись text для оси dir=`x`,`y`,`z`,`t` (где `t` - “тернарная” ось t=1-x-y). Параметр pos задает положение подписи: при pos=0 - по центру оси, при pos>0 - около максимальных значений, при pos<0 - около минимальных значений. Опция value задает дополнительный сдвиг текста. See Text printing. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.10 Легенда

+ + + + + + + +

Эти функции обеспечивают рисование легенды графика (полезно для 1D plotting). Запись в легенде состоит из двух строк: одна для стиля линии и маркеров, другая с текстом описания (с включенным разбором TeX-их команд). Можно использовать непосредственно массивы строк, или накопление во внутренние массивы с помощью функции AddLegend() с последующим отображением. Положение легенды можно задать автоматически или вручную. Параметры fnt и size задают стиль и размер шрифта (см. Font settings). Опция value задает зазор между примером линии и текстом (по умолчанию 0.1). Опция size задает размер текста. Если стиль линии пустой, то соответствующий текст печатается без отступа. Строка fnt может содержать: +

    +
  • стиль текста для записей; +
  • `A` для расположения относительно всего рисунка, а не текущего subplot; +
  • `^` для размещения снаружи от указанных координат; +
  • `#` для вывода прямоугольника вокруг легенды; +
  • `-` для горизонтального расположения записей; +
  • цвета для заливки (1-ый), для границы (2-ой) и для текста записей (3-ий). Если указано меньше трех цветов, то цвет границы черный (для 2 и менее цветов), и цвет заливки белый (для 1 и менее цвета). +
+

См. Legend sample, для примеров кода и графика. +

+
+
Команда MGL: legend [pos=3 'fnt'='#']
+

Рисует легенду из накопленных записей шрифтом fnt. Параметр pos задает положение легенды: `0` - в нижнем левом углу, `1` - нижнем правом углу, `2` - верхнем левом углу, `3` - верхнем правом углу (по умолчанию). Опция value задает зазор между примером линии и текстом (по умолчанию 0.1). +

+ +
+
Команда MGL: legend x y ['fnt'='#']
+

Рисует легенду из накопленных записей шрифтом fnt. Положение легенды задается параметрами x, y, которые полагаются нормированными в диапазоне [0,1]. Опция value задает зазор между примером линии и текстом (по умолчанию 0.1). +

+ +
+
Команда MGL: addlegend 'text' 'stl'
+

Добавляет описание text кривой со стилем style (см. Line styles) во внутренний массив записей легенды. +

+ +
+
Команда MGL: clearlegend
+

Очищает внутренний массив записей легенды. +

+ +
+
Команда MGL: legendmarks val
+

Задает число маркеров в легенде. По умолчанию используется 1 маркер. +

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.11 1D графики

+ + + + + + + + + + + + + + + + + + + + + + +

Эти функции строят графики для одномерных (1D) массивов. Одномерными считаются массивы, зависящие только от одного параметра (индекса) подобно кривой в параметрической форме {x(i),y(i),z(i)}, i=1...n. По умолчанию (если отсутствуют) значения x[i] равно распределены в диапазоне оси х, и z[i] равно минимальному значению оси z. Графики рисуются для каждой строки массива данных если он двумерный. Размер по 1-ой координате должен быть одинаков для всех массивов x.nx=y.nx=z.nx. +

+

Строка pen задает цвет и стиль линии и маркеров (см. Line styles). По умолчанию (pen="") рисуется сплошная линия с текущим цветом из палитры (см. Palette and colors). Символ `!` в строке задает использование нового цвета из палитры для каждой точки данных (не для всей кривой, как по умолчанию). Строка opt задает опции графика (см. Command options). +

+
+
Команда MGL: plot ydat ['stl'='']
+
Команда MGL: plot xdat ydat ['stl'='']
+
Команда MGL: plot xdat ydat zdat ['stl'='']
+

Функции рисуют ломанную линию по точкам {x[i], y[i], z[i]}. Если pen содержит `a`, то рисуются и сегменты между точками вне диапазона осей координат. Если pen содержит `~`, то число сегментов уменьшается для квази-линейных участков. См. также area, step, stem, tube, mark, error, belt, tens, tape, meshnum. См. plot sample, для примеров кода и графика. +

+ +
+
Команда MGL: radar adat ['stl'='']
+

Функции рисуют radar chart, представляющий собой ломанную с вершинами на радиальных линиях (типа ломанной в полярных координатах). Параметр value в опциях opt задает дополнительный сдвиг данных (т.е. использование a+value вместо a). Если pen содержит `#`, то рисуется "сетка" (радиальные линии). Если pen содержит `a`, то рисуются и сегменты между точками вне диапазона осей координат. См. также plot, meshnum. См. radar sample, для примеров кода и графика. +

+ +
+
Команда MGL: step ydat ['stl'='']
+
Команда MGL: step xdat ydat ['stl'='']
+
Команда MGL: step xdat ydat zdat ['stl'='']
+

Функции рисуют ступеньки для точек массива. Если x.nx>y.nx, то массив x задает границы ступенек, а не их конец. См. также plot, stem, tile, boxs, meshnum. См. step sample, для примеров кода и графика. +

+ +
+
Команда MGL: tens ydat cdat ['stl'='']
+
Команда MGL: tens xdat ydat cdat ['stl'='']
+
Команда MGL: tens xdat ydat zdat cdat ['stl'='']
+

Функции рисуют ломанную линию по точкам с цветом, определяемым массивом c (типа графика натяжений). Строка pen задает цветовую схему (см. Color scheme) и стиль линий и/или маркеров (см. Line styles). Если pen содержит `a`, то рисуются и сегменты между точками вне диапазона осей координат. Если pen содержит `~`, то число сегментов уменьшается для квази-линейных участков. См. также plot, mesh, fall, meshnum. См. tens sample, для примеров кода и графика. +

+ +
+
Команда MGL: tape ydat ['stl'='']
+
Команда MGL: tape xdat ydat ['stl'='']
+
Команда MGL: tape xdat ydat zdat ['stl'='']
+

Функции рисуют ленты, которые вращаются вокруг кривой {x[i], y[i], z[i]} как её нормали. Начальная лента(ы) выбираются в плоскости x-y (для `x` в pen) и/или y-z (для `x` в pen). Ширина лент пропорциональна barwidth, а также может быть изменена опцией value. См. также plot, flow, barwidth. См. tape sample, для примеров кода и графика. +

+ +
+
Команда MGL: area ydat ['stl'='']
+
Команда MGL: area xdat ydat ['stl'='']
+
Команда MGL: area xdat ydat zdat ['stl'='']
+

Функции рисуют ломанную линию между точками и закрашивает её вниз до плоскости осей координат. Градиентная заливка используется если число цветов равно удвоенному число кривых. Если pen содержит `#`, то рисуется только каркас. Если pen содержит `a`, то рисуются и сегменты между точками вне диапазона осей координат. См. также plot, bars, stem, region. См. area sample, для примеров кода и графика. +

+ +
+
Команда MGL: region ydat1 ydat2 ['stl'='']
+
Команда MGL: region xdat ydat1 ydat2 ['stl'='']
+
Команда MGL: region xdat1 ydat1 xdat2 ydat2 ['stl'='']
+
Команда MGL: region xdat1 ydat1 zdat1 xdat2 ydat2 zdat2 ['stl'='']
+

Функции закрашивают область между 2 кривыми. Градиентная заливка используется если число цветов равно удвоенному число кривых. Если в 2d версии pen содержит `i`, то закрашивается только область y1<y<y2, в противном случае будет закрашена и область y2<y<y1. Если pen содержит `#`, то рисуется только каркас. Если pen содержит `a`, то рисуются и сегменты между точками вне диапазона осей координат. См. также area, bars, stem. См. region sample, для примеров кода и графика. +

+ +
+
Команда MGL: stem ydat ['stl'='']
+
Команда MGL: stem xdat ydat ['stl'='']
+
Команда MGL: stem xdat ydat zdat ['stl'='']
+

Функции рисуют вертикальные линии из точек до плоскости осей координат. См. также area, bars, plot, mark. См. stem sample, для примеров кода и графика. +

+ +
+
Команда MGL: bars ydat ['stl'='']
+
Команда MGL: bars xdat ydat ['stl'='']
+
Команда MGL: bars xdat ydat zdat ['stl'='']
+

Функции рисуют вертикальные полосы (прямоугольники) из точек до плоскости осей координат. Строка pen может содержать: +

    +
  • `a` для вывода линий одной поверх другой (как при суммировании); +
  • `f` для определения кумулятивного эффекта последовательности положительных и отрицательных значений (график типа waterfall); +
  • `F` для использования одинаковой (минимальной) ширины полосок; +
  • `<`, `^` or `>` для выравнивания полосок влево, вправо или центрирования относительно их координат. +
+

Можно использовать разные цвета для положительных и отрицательных значений если число указанных цветов равно удвоенному числу кривых для построения. Если x.nx>y.nx, то массив x задает границы полос, а не их центр. См. также barh, cones, area, stem, chart, barwidth. См. bars sample, для примеров кода и графика. +

+ +
+
Команда MGL: barh vdat ['stl'='']
+
Команда MGL: barh ydat vdat ['stl'='']
+

Функции рисуют горизонтальные полосы (прямоугольники) из точек до плоскости осей координат. Строка pen может содержать: +

    +
  • `a` для вывода линий одной поверх другой (как при суммировании); +
  • `f` для определения кумулятивного эффекта последовательности положительных и отрицательных значений (график типа waterfall); +
  • `F` для использования одинаковой (минимальной) ширины полосок; +
  • `<`, `^` or `>` для выравнивания полосок влево, вправо или центрирования относительно их координат. +
+

Можно использовать разные цвета для положительных и отрицательных значений если число указанных цветов равно удвоенному числу кривых для построения. Если x.nx>y.nx, то массив x задает границы полос, а не их центр. См. также bars, barwidth. См. barh sample, для примеров кода и графика. +

+ +
+
Команда MGL: cones ydat ['stl'='']
+
Команда MGL: cones xdat ydat ['stl'='']
+
Команда MGL: cones xdat ydat zdat ['stl'='']
+

Функции рисуют конусы из точек до плоскости осей координат. Если строка pen содержит символ `a`, то линии рисуются одна поверх другой. Можно использовать разные цвета для положительных и отрицательных значений если число указанных цветов равно удвоенному числу кривых для построения. Параметр pen может содержать: +

    +
  • `@` для рисования торцов; +
  • `#` для сетчатой фигуры; +
  • `t` для рисования цилиндра вместо конуса/призмы; +
  • `4`, `6`, `8` для рисования квадратной, шестиугольной или восьмиугольной призмы вместо конуса; +
  • `<`, `^` или `>` для выравнивания конусов влево, вправо или по центру относительно их координат. +
+

См. также bars, cone, barwidth. См. cones sample, для примеров кода и графика. +

+ + + +
+
Команда MGL: chart adat ['col'='']
+

Рисует цветные полосы (пояса) для массива данных a. Число полос равно числу строк a (равно a.ny). Цвет полос поочерёдно меняется из цветов указанных в col или в палитре (см. Palette and colors). Пробел в цветах соответствует прозрачному "цвету", т.е. если col содержит пробел(ы), то соответствующая полоса не рисуется. Ширина полосы пропорциональна значению элемента в a. График строится только для массивов не содержащих отрицательных значений. Если строка col содержит `#`, то рисуется также чёрная граница полос. График выглядит лучше в (после вращения системы координат) и/или в полярной системе координат (становится Pie chart). См. chart sample, для примеров кода и графика. +

+ +
+
Команда MGL: boxplot adat ['stl'='']
+
Команда MGL: boxplot xdat adat ['stl'='']
+

Функции рисуют boxplot (называемый также как box-and-whisker diagram или как "ящик с усами") в точках x[i] на плоскости z = zVal (по умолчанию z равно минимальному значению оси z). Это график, компактно изображающий распределение вероятностей a[i,j] (минимум, нижний квартиль (Q1), медиана (Q2), верхний квартиль (Q3) и максимум) вдоль второго (j-го) направления. Если pen содержит `<`, `^` или `>`, то полоски будут выровнены влево, вправо или центрированы относительно их координат. См. также plot, error, bars, barwidth. См. boxplot sample, для примеров кода и графика. +

+ +
+
Команда MGL: candle vdat1 ['stl'='']
+
Команда MGL: candle vdat1 vdat2 ['stl'='']
+
Команда MGL: candle vdat1 ydat1 ydat2 ['stl'='']
+
Команда MGL: candle vdat1 vdat2 ydat1 ydat2 ['stl'='']
+
Команда MGL: candle xdat vdat1 vdat2 ydat1 ydat2 ['stl'='']
+

Функции рисуют candlestick chart в точках x[i]. Этот график показывает прямоугольником ("свечой") диапазон изменения величины. Прозрачная (белая) свеча соответствует росту величины v1[i]<v2[i], чёрная - уменьшению. "Тени" показывают минимальное y1 и максимальное y2 значения. Если v2 отсутствует, то он определяется как v2[i]=v1[i+1]. Можно использовать разные цвета для растущих и падающих дней если число указанных цветов равно удвоенному числу кривых для построения. Если pen содержит `#`, то прозрачная свеча будет использована и при 2-цветной схеме. См. также plot, bars, ohlc, barwidth. См. candle sample, для примеров кода и графика. +

+ +
+
Команда MGL: ohlc odat hdat ldat cdat ['stl'='']
+
Команда MGL: ohlc xdat odat hdat ldat cdat ['stl'='']
+

Функции рисуют Open-High-Low-Close диаграмму. Этот график содержит вертикальные линии между максимальным h и минимальным l значениями, и горизонтальные линии перед/после вертикальной линии для начального o и конечного c значений процесса (обычно цены). Можно использовать разные цвета для растущих и падающих дней если число указанных цветов равно удвоенному числу кривых для построения. См. также candle, plot, barwidth. См. ohlc sample, для примеров кода и графика. +

+ + +
+
Команда MGL: error ydat yerr ['stl'='']
+
Команда MGL: error xdat ydat yerr ['stl'='']
+
Команда MGL: error xdat ydat xerr yerr ['stl'='']
+

Функции рисуют размер ошибки {ex[i], ey[i]} в точках {x[i], y[i]} на плоскости z = zVal (по умолчанию z равно минимальному значению оси z). Такой график полезен для отображения ошибки эксперимента, вычислений и пр. Если pen содержит `@`, то будут использованы большие полупрозрачные маркеры. См. также plot, mark. См. error sample, для примеров кода и графика. +

+ +
+
Команда MGL: mark ydat rdat ['stl'='']
+
Команда MGL: mark xdat ydat rdat ['stl'='']
+
Команда MGL: mark xdat ydat zdat rdat ['stl'='']
+

Функции рисуют маркеры размером r[i]*marksize (см. Default sizes) в точках {x[i], y[i], z[i]}. Для рисования маркеров одинакового размера можно использовать функцию plot с невидимой линией (со стилем содержащим ` `). Для маркеров с размером как у координат можно использовать error со стилем `@`. См. также plot, textmark, error, stem, meshnum. См. mark sample, для примеров кода и графика. +

+ +
+
Команда MGL: textmark ydat 'txt' ['stl'='']
+
Команда MGL: textmark ydat rdat 'txt' ['stl'='']
+
Команда MGL: textmark xdat ydat rdat 'txt' ['stl'='']
+
Команда MGL: textmark xdat ydat zdat rdat 'txt' ['stl'='']
+

Функции рисуют текст txt как маркер с размером пропорциональным r[i]*marksize в точках {x[i], y[i], z[i]}. См. также plot, mark, stem, meshnum. См. textmark sample, для примеров кода и графика. +

+ +
+
Команда MGL: label ydat 'txt' ['stl'='']
+
Команда MGL: label xdat ydat 'txt' ['stl'='']
+
Команда MGL: label xdat ydat zdat 'txt' ['stl'='']
+

Функции выводят текстовую строку txt в точках {x[i], y[i], z[i]}. Если строка txt содержит `%x`, `%y`, `%z` или `%n`, то они будут заменены на значения соответствующих координат или на номер точки. Строка fnt может содержать: +

    +
  • стиль текста Font styles; +
  • `f` для вывода чисел в фиксированном формате; +
  • `E` для вывода `E` вместо `e`; +
  • `F` для вывода в формате LaTeX; +
  • `+` для вывода `+` для положительных чисел; +
  • `-` для вывода обычного `-`; +
  • `0123456789` для задания точности при выводе чисел. +
+

См. также plot, mark, textmark, table. См. label sample, для примеров кода и графика. +

+ +
+
Команда MGL: table vdat 'txt' ['stl'='#']
+
Команда MGL: table x y vdat 'txt' ['stl'='#']
+

Рисует таблицу значений массива val с заголовками txt (разделенными символом новой строки `\n`) в точке {x, y} (по умолчанию {0,0}) относительно текущего subplot. Строка fnt может содержать: +

    +
  • стиль текста Font styles; +
  • `#` для рисования границ ячеек; +
  • `=` для одинаковой ширины всех ячеек; +
  • `|` для ограничения ширины таблицы шириной subplot (эквивалентно опции `value 1`); +
  • `f` для вывода чисел в фиксированном формате; +
  • `E` для вывода `E` вместо `e`; +
  • `F` для вывода в формате LaTeX; +
  • `+` для вывода `+` для положительных чисел; +
  • `-` для вывода обычного `-`; +
  • `0123456789` для задания точности при выводе чисел. +
+

Опция value задает ширину таблицы (по умолчанию 1). См. также plot, label. См. table sample, для примеров кода и графика. +

+ +
+
Команда MGL: iris dats 'ids' ['stl'='']
+
Команда MGL: iris dats rngs 'ids' ['stl'='']
+

Рисует Ирисы Фишера для определения зависимостей данных dats друг от друга (см. http://en.wikipedia.org/wiki/Iris_flower_data_set). Массив rngs размером 2*dats.nx задает диапазон изменения осей для каждой из колонки. Строка ids содержит имена колонок данных, разделенных символом `;`. Опция value задает размер текста для имен данных. На график можно добавить новый набор данных если указать тот же размер rngs и использовать пустую строку имен ids. См. также plot. См. iris sample, для примеров кода и графика. +

+ +
+
Команда MGL: tube ydat rdat ['stl'='']
+
Команда MGL: tube ydat rval ['stl'='']
+
Команда MGL: tube xdat ydat rdat ['stl'='']
+
Команда MGL: tube xdat ydat rval ['stl'='']
+
Команда MGL: tube xdat ydat zdat rdat ['stl'='']
+
Команда MGL: tube xdat ydat zdat rval ['stl'='']
+

Функции рисуют трубу радиуса r[i] вдоль кривой между точками {x[i], y[i], z[i]}. Опция value число сегментов в поперечном сечении (по умолчанию 25). См. также plot. См. tube sample, для примеров кода и графика. +

+ +
+
Команда MGL: torus rdat zdat ['stl'='']
+

Функции рисуют поверхность вращения кривой {r, z} относительно оси. Если строка pen содержит `x` или `z`, то ось вращения будет выбрана в указанном направлении (по умолчанию вдоль оси y). Если sch содержит `#`, то рисуется сетчатая поверхность. Если sch содержит `.`, то рисуется поверхность из точек. См. также plot, axial. См. torus sample, для примеров кода и графика. +

+ + + +
+
Команда MGL: lamerey x0 ydat ['stl'='']
+
Команда MGL: lamerey x0 'y(x)' ['stl'='']
+

Функции рисуют диаграмму Ламерея для точечного отображения x_new = y(x_old) начиная с точки x0. Строка stl может содержать стиль линии, символ `v` для стрелок, символ `~` для исключения первого сегмента. Опция value задает число сегментов для рисования (по умолчанию 20). См. также plot, fplot, bifurcation, pmap. См. lamerey sample, для примеров кода и графика. +

+ +
+
Команда MGL: bifurcation dx ydat ['stl'='']
+
Команда MGL: bifurcation dx 'y(x)' ['stl'='']
+

Функции рисуют бифуркационную диаграмму (диаграмму удвоения периода) для точечного отображения x_new = y(x_old). Параметр dx задает точность по оси x. Строка stl задает цвет. Опция value задает число учитываемых стационарных точек (по умолчанию 1024). См. также plot, fplot, lamerey. См. bifurcation sample, для примеров кода и графика. +

+ +
+
Команда MGL: pmap ydat sdat ['stl'='']
+
Команда MGL: pmap xdat ydat sdat ['stl'='']
+
Команда MGL: pmap xdat ydat zdat sdat ['stl'='']
+

Функции рисуют отображение Пуанкаре для кривой {x, y, z} при условии s=0. Проще говоря, рисуются точки пересечения кривой и поверхности. Строка stl задает стиль маркеров. См. также plot, mark, lamerey. См. pmap sample, для примеров кода и графика. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.12 2D графики

+ + + + + + + + + + + + + + + +

Эти функции строят графики для двумерных (2D) массивов. Двумерными считаются массивы, зависящие только от двух параметров (индексов) подобно матрице f(x_i,y_j), i=1...n, j=1...m. По умолчанию (если отсутствуют) значения x, y равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z должны быть одинаковы x.nx=z.nx && y.nx=z.ny или x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Массивы x и y могут быть векторами (не матрицами как z). График строится для каждого z среза данных. Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+
+
Команда MGL: surf zdat ['sch'='']
+
Команда MGL: surf xdat ydat zdat ['sch'='']
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]}. Если sch содержит `#`, то рисуется сетка на поверхности. Если sch содержит `.`, то рисуется поверхность из точек. См. также mesh, dens, belt, tile, boxs, surfc, surfa. См. surf sample, для примеров кода и графика. +

+ +
+
Команда MGL: mesh zdat ['sch'='']
+
Команда MGL: mesh xdat ydat zdat ['sch'='']
+

Рисует сетчатую поверхность, заданную параметрически {x[i,j], y[i,j], z[i,j]}. См. также surf, fall, meshnum, cont, tens. См. mesh sample, для примеров кода и графика. +

+ +
+
Команда MGL: fall zdat ['sch'='']
+
Команда MGL: fall xdat ydat zdat ['sch'='']
+

Рисует водопад для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. График удобен для построения нескольких кривых, сдвинутых вглубь друг относительно друга. Если sch содержит `x`, то линии рисуются вдоль оси x, иначе (по умолчанию) вдоль оси y. См. также belt, mesh, tens, meshnum. См. fall sample, для примеров кода и графика. +

+ +
+
Команда MGL: belt zdat ['sch'='']
+
Команда MGL: belt xdat ydat zdat ['sch'='']
+

Рисует ленточки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. График может использоваться как 3d обобщение графика plot. Если sch содержит `x`, то ленточки рисуются вдоль оси x, иначе (по умолчанию) вдоль оси y. См. также fall, surf, beltc, plot, meshnum. См. belt sample, для примеров кода и графика. +

+ +
+
Команда MGL: boxs zdat ['sch'='']
+
Команда MGL: boxs xdat ydat zdat ['sch'='']
+

Рисует вертикальные ящики для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. См. также surf, dens, tile, step. См. boxs sample, для примеров кода и графика. +

+ +
+
Команда MGL: tile zdat ['sch'='']
+
Команда MGL: tile xdat ydat zdat ['sch'='']
+
Команда MGL: tile xdat ydat zdat cdat ['sch'='']
+

Рисует плитки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. Если строка sch содержит стиль `x` или `y`, то плитки будут ориентированы перпендикулярно x- или y-оси. График может использоваться как 3d обобщение step. См. также surf, boxs, step, tiles. См. tile sample, для примеров кода и графика. +

+ +
+
Команда MGL: dens zdat ['sch'='']
+
Команда MGL: dens xdat ydat zdat ['sch'='']
+

Рисует график плотности для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z равном минимальному значению оси z. Если sch содержит `#`, то рисуется сетка. Если sch содержит `.`, то рисуется поверхность из точек. См. также surf, cont, contf, boxs, tile, dens[xyz]. См. dens sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont vdat zdat ['sch'='']
+
Команда MGL: cont vdat xdat ydat zdat ['sch'='']
+

Рисует линии уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит `_`. Линии уровня рисуются для z[i,j]=v[k]. Если sch содержит `t` или `T`, то значения v[k] будут выведены вдоль контуров над (или под) кривой. См. также dens, contf, contd, axial, cont[xyz]. См. cont sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont zdat ['sch'='']
+
Команда MGL: cont xdat ydat zdat ['sch'='']
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). Если sch содержит `.`, то будут строится только контуры по уровням седловых точек. +

+ +
+
Команда MGL: contf vdat zdat ['sch'='']
+
Команда MGL: contf vdat xdat ydat zdat ['sch'='']
+

Рисует закрашенные линии (контуры) уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит `_`. Линии уровня рисуются для z[i,j]=v[k]. См. также dens, cont, contd, contf[xyz]. См. contf sample, для примеров кода и графика. +

+ +
+
Команда MGL: contf zdat ['sch'='']
+
Команда MGL: contf xdat ydat zdat ['sch'='']
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: contd vdat zdat ['sch'='']
+
Команда MGL: contd vdat xdat ydat zdat ['sch'='']
+

Рисует закрашенные линии (контуры) уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит `_`. Линии уровня рисуются для z[i,j]=v[k]. Строка sch задает цвета контуров: цвет k-го контура определяется как k-ый цвет строки. См. также dens, cont, contf. См. contd sample, для примеров кода и графика. +

+ +
+
Команда MGL: contd zdat ['sch'='']
+
Команда MGL: contd xdat ydat zdat ['sch'='']
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ + +
+
Команда MGL: contp vdat xdat ydat zdat adat ['sch'='']
+

Рисует линии уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. Линии уровня рисуются для a[i,j]=v[k]. Если sch содержит `t` или `T`, то значения v[k] будут выведены вдоль контуров над (или под) кривой. Если sch содержит `f`, то контуры будут закрашены. См. также cont, contf, surfc, cont[xyz].

+ +
+
Команда MGL: contp xdat ydat zdat adat ['sch'='']
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: contv vdat zdat ['sch'='']
+
Команда MGL: contv vdat xdat ydat zdat ['sch'='']
+

Рисует вертикальные цилиндры от линий уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z=v[k] или при z равном минимальному значению оси z если sch содержит `_`. Линии уровня рисуются для z[i,j]=v[k]. См. также cont, contf. См. contv sample, для примеров кода и графика. +

+ +
+
Команда MGL: contv zdat ['sch'='']
+
Команда MGL: contv xdat ydat zdat ['sch'='']
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: axial vdat zdat ['sch'='']
+
Команда MGL: axial vdat xdat ydat zdat ['sch'='']
+

Рисует поверхность вращения линии уровня для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]}. Линии уровня рисуются для z[i,j]=v[k]. Если sch содержит `#`, то рисуется сетчатая поверхность. Если sch содержит `.`, то рисуется поверхность из точек. Если строка содержит символы `x` или `z`, то ось вращения устанавливается в указанное направление (по умолчанию вдоль `y`). См. также cont, contf, torus, surf3. См. axial sample, для примеров кода и графика. +

+ +
+
Команда MGL: axial zdat ['sch'='']
+
Команда MGL: axial xdat ydat zdat ['sch'='']
+

Как предыдущий с вектором v из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 3). +

+ +
+
Команда MGL: grid2 zdat ['sch'='']
+
Команда MGL: grid2 xdat ydat zdat ['sch'='']
+

Рисует плоскую сету для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} при z равном минимальному значению оси z. См. также dens, cont, contf, grid3, meshnum. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.13 3D графики

+ + + + + + + + + +

Эти функции строят графики для трехмерных (3D) массивов. Трёхмерными считаются массивы, зависящие от трёх параметров (индексов) подобно матрице f(x_i,y_j,z_k), i=1...n, j=1...m, k=1...l. По умолчанию (если отсутствуют) значения x, y, z равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z должны быть одинаковы x.nx=a.nx && y.nx=a.ny && z.nz=a.nz или x.nx=y.nx=z.nx=a.nx && x.ny=y.ny=z.ny=a.ny && x.nz=y.nz=z.nz=a.nz. Массивы x, y и z могут быть векторами (не матрицами как a). Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+ +
+
Команда MGL: surf3 adat val ['sch'='']
+
Команда MGL: surf3 xdat ydat zdat adat val ['sch'='']
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Если sch содержит `#`, то рисуется сетчатая поверхность. Если sch содержит `.`, то рисуется поверхность из точек. Замечу, что возможно некорректная отрисовка граней вследствие неопределённости построения сечения если поверхность пересекает ячейку данных 2 и более раз. См. также cloud, dens3, surf3c, surf3a, axial. См. surf3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3 adat ['sch'='']
+
Команда MGL: surf3 xdat ydat zdat adat ['sch'='']
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ +
+
Команда MGL: cloud adat ['sch'='']
+
Команда MGL: cloud xdat ydat zdat adat ['sch'='']
+

Рисует облачный график для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). График состоит из кубиков с цветом и прозрачностью пропорциональной значениям a. Результат похож на облако - малые значения прозрачны, а большие нет. Число кубиков зависит от meshnum. Если sch содержит `.`, то будет построен график более низкого качества, но с заметно меньшим использованием памяти. Если sch содержит `i`, то прозрачность будет инвертирована, т.е. области с более высокими значениями будут более прозрачны, а с более низким - менее прозрачны. См. также surf3, meshnum. См. cloud sample, для примеров кода и графика. +

+ +
+
Команда MGL: dens3 adat ['sch'='' sval=-1]
+
Команда MGL: dens3 xdat ydat zdat adat ['sch'='' sval=-1]
+

Рисует график плотности для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). График рисуется на срезе sVal в направлении {`x`, `y`, `z`}, указанном в строке sch (по умолчанию, в напралении `y`). Если sch содержит `#`, то на срезе рисуется сетка. См. также cont3, contf3, dens, grid3. См. dens3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont3 vdat adat ['sch'='' sval=-1]
+
Команда MGL: cont3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+

Рисует линии уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Линии рисуются для значений из массива v на срезе sVal в направлении {`x`, `y`, `z`}, указанном в строке sch (по умолчанию, в напралении `y`). Если sch содержит `#`, то на срезе рисуется сетка. Если sch содержит `t` или `T`, то значения v[k] будут выведены вдоль контуров над (или под) кривой. См. также dens3, contf3, cont, grid3. См. cont3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: cont3 adat ['sch'='' sval=-1]
+
Команда MGL: cont3 xdat ydat zdat adat ['sch'='' sval=-1]
+

Аналогично предыдущему для num линий уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: contf3 vdat adat ['sch'='' sval=-1]
+
Команда MGL: contf3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
+

Рисует закрашенные линии (контуры) уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Линии рисуются для значений из массива v на срезе sVal в направлении {`x`, `y`, `z`}, указанном в строке sch (по умолчанию, в напралении `y`). Если sch содержит `#`, то на срезе рисуется сетка. См. также dens3, cont3, contf, grid3. См. contf3 sample, для примеров кода и графика. +

+ +
+
Команда MGL: contf3 adat ['sch'='' sval=-1]
+
Команда MGL: contf3 xdat ydat zdat adat ['sch'='' sval=-1]
+

Аналогично предыдущему для num закрашенных линий (контуров) уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 7). +

+ +
+
Команда MGL: grid3 adat ['sch'='' sval=-1]
+
Команда MGL: grid3 xdat ydat zdat adat ['sch'='' sval=-1]
+

Рисует сетку для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). График рисуется на срезе sVal в направлении {`x`, `y`, `z`}, указанном в строке sch (по умолчанию, в напралении `y`). См. также cont3, contf3, dens3, grid2, meshnum. +

+ +
+
Команда MGL: beam tr g1 g2 adat rval ['sch'='' flag=0 num=3]
+

Рисует поверхность уровня для 3d массива a при постоянном значении a=val. Это специальный тип графика для a заданного в сопровождающей системе координат вдоль кривой tr с ортами g1, g2 и с поперечным размером r. Переменная flag - битовый флаг: `0x1` - рисовать в сопровождающих (не лабораторных) координатах; `0x2` - рисовать проекцию на плоскость \rho-z; `0x4` - рисовать нормированное в каждом сечении поле. Размеры массивов по 1-му индексу tr, g1, g2 должны быть nx>2. Размеры массивов по 2-му индексу tr, g1, g2 и размер по 3-му индексу массива a должны быть одинаковы. См. также surf3. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.14 Парные графики

+ + + + + + + + + +

Эти функции строят графики для двух связанных массивов. Есть несколько основных типов 3D графиков: поверхность и поверхность уровня с окраской по второму массиву (SurfC, Surf3C), поверхность и поверхность уровня с прозрачностью по второму массиву (SurfA, Surf3A), плитки переменного размера (TileS), диаграмма точечного отображения (Map), STFA диаграмма (STFA). По умолчанию (если отсутствуют) значения x, y (и z для Surf3C, Surf3A) равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z, c должны быть одинаковы x.nx=a.nx && y.nx=a.ny && z.nz=a.nz или x.nx=y.nx=z.nx=a.nx && x.ny=y.ny=z.ny=a.ny && x.nz=y.nz=z.nz=a.nz. Массивы x, y (и z для Surf3C, Surf3A) могут быть векторами (не матрицами как c). Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+ +
+
Команда MGL: surfc zdat cdat ['sch'='']
+
Команда MGL: surfc xdat ydat zdat cdat ['sch'='']
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. Если sch содержит `#`, то на поверхности рисуется сетка. Если sch содержит `.`, то рисуется поверхность из точек. Размерность массивов z и c должна быть одинакова. График строится для каждого z среза данных. См. также surf, surfa, beltc, surf3c. См. surfc sample, для примеров кода и графика. +

+ + +
+
Команда MGL: beltc zdat cdat ['sch'='']
+
Команда MGL: beltc xdat ydat zdat cdat ['sch'='']
+

Рисует ленточки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. График может использоваться как 3d обобщение графика plot. Если sch содержит `x`, то ленточки рисуются вдоль оси x, иначе (по умолчанию) вдоль оси y. См. также belt, surfc, meshnum.

+ + +
+
Команда MGL: surf3c adat cdat val ['sch'='']
+
Команда MGL: surf3c xdat ydat zdat adat cdat val ['sch'='']
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Аналогично surf3, но цвет задается массивом c. Если sch содержит `#`, то рисуется сетчатая поверхность. Если sch содержит `.`, то рисуется поверхность из точек. См. также surf3, surfc, surf3a. См. surf3c sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3c adat cdat ['sch'='']
+
Команда MGL: surf3c xdat ydat zdat adat cdat ['sch'='']
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. Величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ + +
+
Команда MGL: surfa zdat cdat ['sch'='']
+
Команда MGL: surfa xdat ydat zdat cdat ['sch'='']
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]} с прозрачностью, заданной массивом c[i,j]. Если sch содержит `#`, то на поверхности рисуется сетка. Если sch содержит `.`, то рисуется поверхность из точек. Размерность массивов z и c должна быть одинакова. График строится для каждого z среза данных. См. также surf, surfc, surf3a. См. surfa sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3a adat cdat val ['sch'='']
+
Команда MGL: surf3a xdat ydat zdat adat cdat val ['sch'='']
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Аналогично surf3, но прозрачность задается массивом c. Если sch содержит `#`, то рисуется сетчатая поверхность. Если sch содержит `.`, то рисуется поверхность из точек. См. также surf3, surfc, surf3a. См. surf3a sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3a adat cdat ['sch'='']
+
Команда MGL: surf3a xdat ydat zdat adat cdat ['sch'='']
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. При этом массив c может быть вектором со значениями прозрачности и num=c.nx. В противном случае величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ + + +
+
Команда MGL: surfca zdat cdat adat ['sch'='']
+
Команда MGL: surfca xdat ydat zdat cdat adat ['sch'='']
+

Рисует параметрически заданную поверхность {x[i,j], y[i,j], z[i,j]} с цветом и прозрачностью, заданными массивами c[i,j] и a[i,j] соответственно. Если sch содержит `#`, то на поверхности рисуется сетка. Если sch содержит `.`, то рисуется поверхность из точек. Размерность массивов z и c должна быть одинакова. График строится для каждого z среза данных. См. также surf, surfc, surfa, surf3ca. См. surfca sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3ca adat cdat bdat val ['sch'='']
+
Команда MGL: surf3ca xdat ydat zdat adat cdat bdat val ['sch'='']
+

Рисует поверхность уровня для 3d массива, заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) при a(x,y,z)=val. Аналогично surf3, но цвет и прозрачность задается массивами c и b соответственно. Если sch содержит `#`, то рисуется сетчатая поверхность. Если sch содержит `.`, то рисуется поверхность из точек. См. также surf3, surfc, surf3a. См. surf3a sample, для примеров кода и графика. +

+ +
+
Команда MGL: surf3ca adat cdat ['sch'='']
+
Команда MGL: surf3ca xdat ydat zdat adat cdat ['sch'='']
+

Аналогично предыдущему для num поверхностей уровня равномерно распределённых в диапазоне изменения цвета. Здесь величина num равна значению параметра value в опциях opt (по умолчанию 3). +

+ + +
+
Команда MGL: tiles zdat rdat ['sch'='']
+
Команда MGL: tiles xdat ydat zdat rdat ['sch'='']
+
Команда MGL: tiles xdat ydat zdat rdat cdat ['sch'='']
+

Рисует плитки для параметрически заданной поверхности {x[i,j], y[i,j], z[i,j]} с цветом, заданным массивом c[i,j]. Аналогично Tile(), но размер плиток задается массивов r. Если строка sch содержит стиль `x` или `y`, то плитки будут ориентированы перпендикулярно x- или y-оси. Это создает эффект "прозрачности" при экспорте в файлы EPS. График строится для каждого z среза данных. См. также surfa, tile. См. tiles sample, для примеров кода и графика. +

+ +
+
Команда MGL: map udat vdat ['sch'='']
+
Команда MGL: map xdat ydat udat vdat ['sch'='']
+

Рисует точечное отображение для матриц {ax, ay } параметрически зависящих от координат x, y. Исходное положение ячейки задает ее цвет. Высота пропорциональна якобиану J(ax,ay). График является аналогом диаграммы Арнольда ??? Если sch содержит `.`, то цветные точки рисуются в узлах матриц (полезно для "запутанного" отображения), иначе рисуются грани. См. Mapping visualization, для примеров кода и графика. +

+ +
+
Команда MGL: stfa re im dn ['sch'='']
+
Команда MGL: stfa xdat ydat re im dn ['sch'='']
+

Рисует спектрограмму комплексного массива re+i*im для Фурье размером dn точек в плоскости z равно минимальному значению оси z. Параметр dn - любое чётное число. Например в 1D случае, результатом будет график плотности от массива res[i,j]=|\sum_d^dn exp(I*j*d)*(re[i*dn+d]+I*im[i*dn+d])|/dn размером {int(nx/dn), dn, ny}. Массивы re, im параметрически зависят от координат x, y. Все размеры массивов re и im должны быть одинаковы. Младшие размерности массивов x, y, re должны быть одинаковы. Массивы x и y могут быть векторами (не матрицами как re). См. stfa sample, для примеров кода и графика. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.15 Векторные поля

+ + + + + + + + +

Эти функции рисуют графики для 2D и 3D векторных полей. Есть несколько типов графиков: просто векторное поле (Vect), вектора вдоль траектории (Traj), векторное поле каплями (Dew), нити тока (Flow, FlowP), трубки тока (Pipe). По умолчанию (если отсутствуют) значения x, y и z равно распределены в диапазоне осей координат. Младшие размерности массивов x, y, z и ax должны быть одинаковы. Размеры массивов ax, ay и az должны быть одинаковы. Массивы x, y и z могут быть векторами (не матрицами как ax). Строка sch задает цветовую схему (см. Color scheme). Строка opt задает опции графика (см. Command options). +

+
+
Команда MGL: traj xdat ydat udat vdat ['sch'='']
+
Команда MGL: traj xdat ydat zdat udat vdat wdat ['sch'='']
+

Рисует вектора {ax, ay, az} вдоль кривой {x, y, z}. Длина векторов пропорциональна \sqrt{ax^2+ay^2+az^2}. Строка pen задает цвет (см. Line styles). По умолчанию (pen="") используется текущий цвет из палитры (см. Palette and colors). Опция value задает фактор длины векторов (если не нуль) или выбирать длину пропорционально расстоянию между точками кривой (если value=0). Размер по 1-му индексу должен быть 2 или больше. График рисуется для каждой строки если один из массивов матрица. См. также vect. См. traj sample, для примеров кода и графика. +

+ +
+
Команда MGL: vect udat vdat ['sch'='']
+
Команда MGL: vect xdat ydat udat vdat ['sch'='']
+

Рисует векторное поле {ax, ay} параметрически зависящее от координат x, y на плоскости при z равном минимальному значению оси z. Длина и цвет векторов пропорциональна \sqrt{ax^2+ay^2}. Число рисуемых векторов зависит от meshnum. Вид стрелок/штрихов может быть изменён символами: +

    +
  • `f` для стрелок одинаковой длины, +
  • `>`, `<` для стрелок начинающихся или заканчивающихся в ячейке сетки (по умолчанию центрированы), +
  • `.` для рисования штрихов с точкой в начале вместо стрелок, +
  • `=` для использования градиента цвета вдоль стрелок. +
+

См. также flow, dew. См. vect sample, для примеров кода и графика. +

+ +
+
Команда MGL: vect udat vdat wdat ['sch'='']
+
Команда MGL: vect xdat ydat zdat udat vdat wdat ['sch'='']
+

Это 3d версия графика. Здесь массивы ax, ay, az должны трёхмерными тензорами и длина вектора пропорциональна \sqrt{ax^2+ay^2+az^2}. +

+ +
+
Команда MGL: vect3 udat vdat wdat ['sch'='' sval]
+
Команда MGL: vect3 xdat ydat zdat udat vdat wdat ['sch'='' sval]
+

Рисует 3D векторное поле {ax, ay, az} параметрически зависящее от координат x, y, z. График рисуется на срезе sVal в направлении {`x`, `y`, `z`}, указанном в строке sch (по умолчанию, в напралении `y`). Длина и цвет векторов пропорциональна \sqrt{ax^2+ay^2+az^2}. Число рисуемых векторов зависит от meshnum. Вид стрелок/штрихов может быть изменён символами: +

    +
  • `f` для стрелок одинаковой длины, +
  • `>`, `<` для стрелок начинающихся или заканчивающихся в ячейке сетки (по умолчанию центрированы), +
  • `.` для рисования штрихов с точкой в начале вместо стрелок, +
  • `=` для использования градиента цвета вдоль стрелок. +
+

См. также vect, flow, dew. См. vect sample, для примеров кода и графика. +

+ +
+
Команда MGL: dew udat vdat ['sch'='']
+
Команда MGL: dew xdat ydat udat vdat ['sch'='']
+

Рисует капли для векторного поля {ax, ay}, параметрически зависящего от координат x, y при z равном минимальному значению оси z. Замечу, что график требует много памяти и процессорного времени для своего создания! Цвет капель пропорционален \sqrt{ax^2+ay^2}. Число капель определяется meshnum. См. также vect. См. dew sample, для примеров кода и графика. +

+ +
+
Команда MGL: flow udat vdat ['sch'='']
+
Команда MGL: flow xdat ydat udat vdat ['sch'='']
+

Рисует нити тока для векторного поля {ax, ay}, параметрически зависящего от координат x, y на плоскости при z равном минимальному значению оси z. Число нитей пропорционально значению опции value (по умолчанию 5). Цвет нитей пропорционален \sqrt{ax^2+ay^2}. Строка sch может содержать +

    +
  • цветовую схему - тёплые цвета соответствуют нормальному току (типа стока), холодные цвета соответствуют обратному току (типа источника); +
  • `#` для использования нитей, начинающихся только на границе; +
  • `.` для рисования сепаратрис (нитей из/в стационарных точек). +
  • `*` для использования нитей, начинающихся с двумерной сетки внутри данных; +
  • `v` для рисования стрелок на нитях; +
  • `x`, `z` для рисования лент нормалей, начинающихся в плоскостях x-y и y-z соответственно. +
+

См. также pipe, vect, tape, flow3, barwidth. См. flow sample, для примеров кода и графика. +

+ +
+
Команда MGL: flow udat vdat wdat ['sch'='']
+
Команда MGL: flow xdat ydat zdat udat vdat wdat ['sch'='']
+

Это 3d версия графика. Здесь массивы должны трёхмерными тензорами и цвет пропорционален \sqrt{ax^2+ay^2+az^2}. +

+ +
+
Команда MGL: flow x0 y0 udat vdat ['sch'='']
+
Команда MGL: flow x0 y0 xdat ydat udat vdat ['sch'='']
+

Аналогично flow, но рисует одну нить из точки p0={x0,y0,z0}. +

+ +
+
Команда MGL: flow x0 y0 z0 udat vdat wdat ['sch'='']
+
Команда MGL: flow x0 y0 z0 xdat ydat zdat udat vdat wdat ['sch'='']
+

Это 3d версия графика. +

+ +
+
MGL command: flow3 udat vdat wdat ['sch'='']
+
MGL command: flow3 xdat ydat zdat udat vdat ['sch'='']
+

The function draws flow threads for the 3D vector field {ax, ay, az} parametrically depending on coordinates x, y, z. Flow threads starts from given plane. Option value set the approximate number of threads (default is 5). String sch may contain: +

    +
  • color scheme - up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); +
  • `x`, `z` for normal of starting plane (default is y-direction); +
  • `v` for drawing arrows on the threads; +
  • `t` for drawing tapes of normals in x-y and y-z planes. +
+

See also flow, pipe, vect. См. flow3 sample, для примеров кода и графика. +

+ + +
+
Команда MGL: grad pdat ['sch'='']
+
Команда MGL: grad xdat ydat pdat ['sch'='']
+
Команда MGL: grad xdat ydat zdat pdat ['sch'='']
+

Рисует линии градиента скалярного поля phi[i,j] (или phi[i,j,k] в 3d случае) заданного параметрически {x[i,j,k], y[i,j,k], z[i,j,k]}. Число линий пропорционально значению опции value (по умолчанию 5). См. также dens, cont, flow. +

+ +
+
Команда MGL: pipe udat vdat ['sch'='' r0=0.05]
+
Команда MGL: pipe xdat ydat udat vdat ['sch'='' r0=0.05]
+

Рисует трубки тока для векторного поля {ax, ay}, параметрически зависящего от координат x, y на плоскости при z равном минимальному значению оси z. Число трубок пропорционально значению опции value. Цвет и радиус трубок пропорционален \sqrt{ax^2+ay^2}. Тёплые цвета соответствуют нормальному току (типа стока). Холодные цвета соответствуют обратному току (типа источника). Параметр r0 задает радиус трубок. При r0<0 радиус трубок обратно пропорционален их амплитуде. См. также flow, vect. См. pipe sample, для примеров кода и графика. +

+ +
+
Команда MGL: pipe udat vdat wdat ['sch'='' r0=0.05]
+
Команда MGL: pipe xdat ydat zdat udat vdat wdat ['sch'='' r0=0.05]
+

Это 3d версия графика. Здесь массивы ax, ay, az должны трёхмерными тензорами и цвет пропорционален \sqrt{ax^2+ay^2+az^2}. +

+ + + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.16 Прочие графики

+ + + + + + + + + + + + +

Это функции, не относящиеся к какой-то специальной категории. Сюда входят функции построения графиков по текстовым формулам (FPlot и FSurf), рисования поверхностей из треугольников и четырёхугольников (TriPlot, TriCont, QuadPlot), произвольных точек в пространстве (Dots) и реконструкции по ним поверхности (Crust), графики плотности и линии уровня на плоскостях, перпендикулярных осям x, y или z (Dens[XYZ], Cont[XYZ], ContF[XYZ]). Каждый тип графика имеет похожий интерфейс. Есть версия для рисования одного массива с автоматическими координатами и версия для параметрически заданного массива. Параметры цветовой схемы задаются строкой. See Color scheme. +

+
+
Команда MGL: densx dat ['sch'='' sval=nan]
+
Команда MGL: densy dat ['sch'='' sval=nan]
+
Команда MGL: densz dat ['sch'='' sval=nan]
+

Эти функции рисуют график плотности на x, y или z плоскостях. Если a - 3d массив, то выполняется интерполяция к заданному срезу sVal. Функции полезны для создания проекций 3D массивов на оси координат. См. также ContXYZ, ContFXYZ, dens, Data manipulation. См. dens_xyz sample, для примеров кода и графика. +

+ +
+
Команда MGL: contx dat ['sch'='' sval=nan]
+
Команда MGL: conty dat ['sch'='' sval=nan]
+
Команда MGL: contz dat ['sch'='' sval=nan]
+

Эти функции рисуют линии уровня на x, y или z плоскостях. Если a - 3d массив, то выполняется интерполяция к заданному срезу sVal. Опция value задает число контуров. Функции полезны для создания проекций 3D массивов на оси координат. См. также ContFXYZ, DensXYZ, cont, Data manipulation. См. cont_xyz sample, для примеров кода и графика. +

+ + +
+
Команда MGL: contfx dat ['sch'='' sval=nan]
+
Команда MGL: contfy dat ['sch'='' sval=nan]
+
Команда MGL: contfz dat ['sch'='' sval=nan]
+

Эти функции рисуют закрашенные контуры уровня на x, y или z плоскостях. Если a - 3d массив, то выполняется интерполяция к заданному срезу sVal. Опция value задает число контуров. Функции полезны для создания проекций 3D массивов на оси координат. См. также ContFXYZ, DensXYZ, cont, Data manipulation. См. contf_xyz sample, для примеров кода и графика. +

+ + +
+
Команда MGL: fplot 'y(x)' ['pen'='']
+

Рисует функцию `eqY(x)` в плоскости z равно минимальному значению оси z с координатой `x` в диапазоне осей координат. Опция value задает начальное число точек. См. также plot. +

+ +
+
Команда MGL: fplot 'x(t)' 'y(t)' 'z(t)' ['pen'='']
+

Рисует параметрическую кривую {`eqX(t)`, `eqY(t)`, `eqZ(t)`}, где координата `t` меняется в диапазоне [0, 1]. Опция value задает начальное число точек. См. также plot. +

+ +
+
Команда MGL: fsurf 'z(x,y)' ['sch'='']
+

Рисует поверхность `eqY(x,y)` с координатами `x`, `y` в диапазоне xrange, yrange. Опция value задает число точек. См. также surf. +

+ +
+
Команда MGL: fsurf 'x(u,v)' 'y(u,v)' 'z(u,v)' ['sch'='']
+

Рисует параметрическую поверхность {`eqX(u,v)`, `eqY(u,v)`, `eqZ(u,v)`}, где координаты `u`, `v` меняются в диапазоне [0, 1]. Опция value задает число точек. См. также surf. +

+ +
+
Команда MGL: triplot idat xdat ydat ['sch'='']
+
Команда MGL: triplot idat xdat ydat zdat ['sch'='']
+
Команда MGL: triplot idat xdat ydat zdat cdat ['sch'='']
+

Рисует поверхность из треугольников. Вершины треугольников задаются индексами id в массиве точек {x[i], y[i], z[i]}. Строка sch задает цветовую схему. Если строка содержит `#`, то рисуется сетчатая поверхность. Размер по 1-му индексу массива id должен быть 3 или больше. Массивы x, y, z должны иметь одинаковые размеры. Массив c задает цвет треугольников (если id.ny=c.nx) или цвет вершин (если x.nx=c.nx). См. также dots, crust, quadplot, triangulation. См. triplot sample, для примеров кода и графика. +

+ +
+
Команда MGL: tricont vdat idat xdat ydat zdat cdat ['sch'='']
+
Команда MGL: tricont vdat idat xdat ydat zdat ['sch'='']
+
Команда MGL: tricont idat xdat ydat zdat ['sch'='']
+

Рисует линии уровня поверхности из треугольников при z=v[k] (или при z равном минимальному значению оси z если sch содержит `_`). Вершины треугольников задаются индексами id в массиве точек {x[i], y[i], z[i]}. Если аргуент v не задан, то используется массив из num элементов равно распределенных в диапазоне изменения цвета. Здесь num равен значению параметра value в опциях opt (по умолчанию 7). Строка sch задает цветовую схему. Размер по 1-му индексу массива id должен быть 3 или больше. Массивы x, y, z должны иметь одинаковые размеры. Массив c задает цвет треугольников (если id.ny=c.nx) или цвет вершин (если x.nx=c.nx). См. также triplot, cont, triangulation. +

+ +
+
Команда MGL: quadplot idat xdat ydat ['sch'='']
+
Команда MGL: quadplot idat xdat ydat zdat ['sch'='']
+
Команда MGL: quadplot idat xdat ydat zdat cdat ['sch'='']
+

Рисует поверхность из четырёхугольников. Вершины четырёхугольников задаются индексами id в массиве точек {x[i], y[i], z[i]}. Строка sch задает цветовую схему. Если строка содержит `#`, то рисуется сетчатая поверхность. Размер по 1-му индексу массива id должен быть 4 или больше. Массивы x, y, z должны иметь одинаковые размеры. Массив c задает цвет четырёхугольников (если id.ny=c.nx) или цвет вершин (если x.nx=c.nx). См. также triplot. См. triplot sample, для примеров кода и графика. +

+ +
+
Команда MGL: dots xdat ydat zdat ['sch'='']
+
Команда MGL: dots xdat ydat zdat adat ['sch'='']
+

Рисует произвольно расположенные точки {x[i], y[i], z[i]}. Строка sch задает цветовую схему и тип маркеров. Если определёны массивы c, a то они задают цвет и прозрачность точек соответственно. Непрозрачные точки с заданным цветом можно нарисовать с помощью tens, используя стиль ` .`. Массивы x, y, z, a должны иметь одинаковые размеры. См. также crust, tens, mark, plot. См. dots sample, для примеров кода и графика. +

+ +
+
Команда MGL: crust xdat ydat zdat ['sch'='']
+

Реконструирует и рисует поверхность по произвольно расположенным точкам {x[i], y[i], z[i]}. Опция value задает радиус ошибки (увеличите для удаления дыр). Строка sch задает цветовую схему. Если строка содержит `#`, то рисуется сетчатая поверхность. Массивы x, y, z должны иметь одинаковые размеры. См. также dots, triplot.

+ + +
+ +
+

+Next: , Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.17 Nonlinear fitting

+ + + + + + + + +

Эти функции подбирают параметры функции для наилучшей аппроксимации данных, т.е. минимизируют сумму \sum_i (f(x_i, y_i, z_i) - a_i)^2/s_i^2. При этом аппроксимирующая функция `f` может зависеть от одного аргумента `x` (1D случай), от двух аргументов `x,y` (2D случай) или от трех аргументов `x,y,z` (3D случай). Функция `f` также может зависеть от параметров. Список параметров задается строкой var (например, `abcd`). Обычно пользователь должен предоставить начальные значения параметров в переменной ini. Однако, при его отсутствии используются нулевые значения. Параметр print=true включает вывод найденной формулы в Message (см. Error handling). +

+

Функции Fit() и FitS() не рисуют полученные массивы. Они заполняют массив fit по формуле `f` с найденными коэффициентами и возвращают \chi^2 ошибку аппроксимации. При этом, координаты `x,y,z` равно распределены в диапазоне осей координат. Число точек в fit определяется опцией value (по умолчанию mglFitPnts=100). Функции используют библиотеку GSL. См. Nonlinear fitting hints, для примеров кода и графика. +

+
+
Команда MGL: fits res adat sdat 'func' 'var' [ini=0]
+
Команда MGL: fits res xdat adat sdat 'func' 'var' [ini=0]
+
Команда MGL: fits res xdat ydat adat sdat 'func' 'var' [ini=0]
+
Команда MGL: fits res xdat ydat zdat adat sdat 'func' 'var' [ini=0]
+

"Подгоняют" формулу вдоль x-, y- и z-направлений для 3d массива заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) с весовым множителем s[i,j,k]. +

+ +
+
Команда MGL: fit res adat 'func' 'var' [ini=0]
+
Команда MGL: fit res xdat adat 'func' 'var' [ini=0]
+
Команда MGL: fit res xdat ydat adat 'func' 'var' [ini=0]
+
Команда MGL: fit res xdat ydat zdat adat 'func' 'var' [ini=0]
+

"Подгоняют" формулу вдоль x-, y- и z-направлений для 3d массива заданного параметрически a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) с весовым множителем 1. +

+ + + +
+
Команда MGL: putsfit x y ['pre'='' 'fnt'='' size=-1]
+

Печатает последнюю подобранную формулу с найденными коэффициентами в точке p0. Строка prefix будет напечатана перед формулой. Все другие параметры такие же как в Text printing. +

+ + + + +
+ +
+

+Previous: , Up: MathGL core   [Contents][Index]

+
+ +

3.18 Распределение данных

+ + + + + +
+
Команда MGL: hist RES xdat adat
+
Команда MGL: hist RES xdat ydat adat
+
Команда MGL: hist RES xdat ydat zdat adat
+

Создают распределения данных. Они не рисуют данные. Функции могут быть полезны в случае когда данные пользователя определены на случайно расположенных точка (например, после PIC расчетов) и он хочет построить график, требующий регулярных данных (данных на сетках). Диапазон сеток равен диапазону осей координат. Массивы x, y, z определяют положение (координаты) точек. Массив a задает значения данных. Число точек в результате res определяется опцией value (по умолчанию mglFitPnts=100). +

+ + +
+
Команда MGL: fill dat 'eq'
+
Команда MGL: fill dat 'eq' vdat
+
Команда MGL: fill dat 'eq' vdat wdat
+

Заполняют значения массива `u` в соответствии с формулой в строке eq. Формула - произвольное выражение, зависящее от переменных `x`, `y`, `z`, `u`, `v`, `w`. Координаты `x`, `y`, `z` полагаются в диапазоне изменения осей координат. Переменная `u` - значение исходного массива. Переменные `v` и `w` - значения массивов v, w, которые могут быть NULL (т.е. могут быть опущены). +

+ +
+
Команда MGL: datagrid dat xdat ydat zdat
+

Заполняет значения массива `u` результатом линейной интерполяции по триангулированной поверхности, найденной по произвольно расположенным точкам `x`, `y`, `z`. NAN значение используется для точек сетки вне триангулированной поверхности. См. Making regular data, для примеров кода и графика. +

+ +
+
Команда MGL: refill dat xdat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat zdat vdat
+

Заполняет значениями интерполяции массива v в точках {x, y, z}={X[i], Y[j], Z[k]} (или {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} если x, y, z не 1d массивы), где X,Y,Z равномерно распределены в диапазоне осей координат и имеют такой же размер как и массив dat. Если параметр sl равен 0 или положительный, то изменятся будет только sl-ый срез. +

+ + + +
+
Команда MGL: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+

Решает уравнение в частных производных du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], где p=-i/k0*d/dx, q=-i/k0*d/dy - псевдо-дифференциальные оперторы. Параметры ini_re, ini_im задают действительную и мнимую часть начального распределения поля. Координаты `x`, `y`, `z` полагаются в диапазоне изменения осей координат. Отмечу, ято в действительности этот диапазон увеличен на 3/2 для уменьшения отражения от границ сетки. Параметр dz задает шаг по эволюционной координате z. Сейчас используется упрощенный вид функции ham - исключены все “смешанные” члены (типа `x*p`->x*d/dx). Например, в 2D случае это функция вида ham = f(p,z) + g(x,z,u). Однако, коммутирующие члены (типа `x*q`->x*d/dy) разрешены. Переменная `u` используется для амплитуды поля |u|, что позволяет решать нелинейные задачи - например уравнение Шредингера ham="p^2 + q^2 - u^2". Вы можете задавать мнимую часть для поглощения волн, например ham = "p^2 + i*x*(x>0)", но только для линейной зависимости от переменной `i` (т.е. ham = hre+i*him). См. PDE solving hints, для примеров кода и графика. +

+ + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

4 Обработка данных

+ + +

В данной главе описываются команды для работы с массивами данных. Они включают команды для выделения памяти и изменения размера данных, чтения данных из файла, численного дифференцирования, интегрирования, интерполяции и пр., заполнения по текстовой формуле и т.д. Класс позволяет работать с данными размерности не более 3 (как функции от трёх переменных - x,y,z). Массивы которые могут быть созданы командами MGL отображаются Small Caps шрифтом (например, DAT). +

+ + + + + + + + + + + + + + + + + + +
+ + + +

4.1 Переменные

+ + +

MGL не поддерживает прямой доступ к элементам массива. См. раздел Data filling +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.2 Создание и удаление данных

+ + + +

There are many functions, which can create data for output (see Data filling, File I/O, Make another data, Global functions). Here I put most useful of them. +

+
+
Команда MGL: new DAT [nx=1 'eq']
+
Команда MGL: new DAT nx ny ['eq']
+
Команда MGL: new DAT nx ny nz ['eq']
+

Выделяет память для массива данных и заполняет её нулями. Если указана формула eq, то данные заполняются также как при использовании fill. +

+ +
+
Команда MGL: copy DAT dat2 ['eq'='']
+
Команда MGL: copy DAT val
+

Копирует данные из другого экземпляра данных. Если указана формула eq, то данные заполняются также как при использовании fill. +

+ +
+
Команда MGL: copy REDAT IMDAT dat2
+

Копирует действительную и мнимую часть данных из комплексного массива данных dat2. +

+ +
+
Команда MGL: copy DAT 'name'
+

Копирует данные из другого экземпляра данных с именем name. При этом имя name может быть некорректным с точки зрения MGL (например, взятым из HDF5 файла). +

+ + + +
+
Команда MGL: read DAT 'fname'
+

Читает данные из текстового файла с автоматическим определением размеров массива. +

+ +
+
Команда MGL: delete dat
+
Команда MGL: delete 'name'
+

Удаляет массив данных из памяти. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.3 Изменение размеров данных

+ + + + + + + + + + + + + + +
+
Команда MGL: new DAT [nx=1 ny=1 nz=1]
+

Создает/пересоздает массив данных указанного размера и заполняет его нулями. Ничего не делает при mx, my, mz отрицательных или равных нулю. +

+ +
+
Команда MGL: rearrange dat mx [my=0 mz=0]
+

Изменяет размерность данных без изменения самого массива данных, так что результирующий массив mx*my*mz < nx*ny*nz. Если один из параметров my или mz ноль, то он будет выбран оптимальным образом. Например, если my=0, то будет my=nx*ny*nz/mx и mz=1. +

+ +
+
Команда MGL: transpose dat ['dim'='yxz']
+

Транспонирует (меняет порядок размерностей) массив данных. Новый порядок размерностей задается строкой dim. Функция может быть полезна для транспонирования одномерных (или квазиодномерных) массивов после чтения их из файла. +

+ +
+
Команда MGL: extend dat n1 [n2=0]
+

Увеличивает размер данных путем вставки (|n1|+1) новых срезов после (для n1>0) или перед (для n1<0) существующими данными. Можно добавить сразу 2 размерности для 1d массива, используя второй параметр n2. Данные в новые срезы будут скопированы из существующих. Например, для n1>0 новый массив будет +a_ij^new = a_i^old where j=0...n1. Соответственно, для n1<0 новый массив будет a_ij^new = a_j^old, где i=0...|n1|. +

+ +
+
Команда MGL: squeeze dat rx [ry=1 rz=1 sm=off]
+

Уменьшает размер данных путём удаления элементов с индексами не кратными rx, ry, rz соответственно. Параметр smooth задает использовать сглаживания +(т.е. out[i]=\sum_{j=i,i+r} a[j]/r) или нет (т.е. out[i]=a[j*r]). +

+ +
+
Команда MGL: crop dat n1 n2 'dir'
+

Обрезает границы данных при i<n1 и i>n2 (при n2>0) или i>n[xyz]-n2 (при n2<=0) вдоль направления dir. +

+ +
+
Команда MGL: crop dat 'how'
+

Обрезает дальний край данных, чтобы сделать их более оптимальным для быстрого преобразования Фурье. Размер массива будет равен наиболее близким к исходному из 2^n*3^m*5^l. Строка how может содержать: `x`, `y`, `z` для направлений, и `2`, `3`, `5` для использования соответствующего основания. +

+ +
+
Команда MGL: insert dat 'dir' [pos=off num=0]
+

Вставляет num срезов вдоль направления dir с позиции pos и заполняет их нулями. +

+ +
+
Команда MGL: delete dat 'dir' [pos=off num=0]
+

Удаляет num срезов вдоль направления dir с позиции pos. +

+ +
+
Команда MGL: delete dat
+
Команда MGL: delete 'name'
+

Удаляет массив данных из памяти. +

+ +
+
Команда MGL: sort dat idx [idy=-1]
+

Сортирует строки (или срезы в 3D случае) по значениям в указанной колонке idx (или ячейках {idx,idy} для 3D случая). Не используйте в многопоточных функциях! +

+ +
+
Команда MGL: clean dat idx
+

Удаляет строки в которых значения для заданной колонки idx совпадают со значениями в следующей строке. +

+ + +
+
Команда MGL: join dat vdat [v2dat ...]
+

Объединяет данные из массива vdat с данными массива dat. При этом, функция увеличивает размер массива dat: в z-направлении для массивов с одинаковыми размерами по x и y; в y-направлении для массивов с одинаковыми размерами по x; в x-направлении в остальных случаях. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.4 Заполнение данных

+ + + + + + + + +
+
Команда MGL: list DAT v1 ...
+

Создает новый массив данных dat и заполняет его числовыми значениями аргументов v1 .... Команда может создавать одно- и двухмерные массивы с произвольными значениями. Для создания 2d массива следует использовать разделитель `|`, который означает начало новой строки данных. Размер массива данных будет [maximal of row sizes * number of rows]. Например, команда list 1 | 2 3 создаст массив [1 0; 2 3]. Замечу, что максимальное число аргументов равно 1000. +

+
+
Команда MGL: list DAT d1 ...
+

Создает новый массив данных dat и заполняет его значениями из массивов d1 .... Команда может создавать двух- и трёхмерные (если аргументы - двумерные массивы) массивы. Меньшая размерность всех массивов в аргументах должна совпадать. В противном случае аргумент (массив) будет пропущен. +

+ + +
+
Команда MGL: var DAT num v1 [v2=nan]
+

Создает новый одномерный массив данных dat размером num, и заполняет его равномерно в диапазоне [v1, v2]. Если v2=nan, то используется v2=v1. +

+ +
+
Команда MGL: fill dat v1 v2 ['dir'='x']
+

Заполняет значениями равно распределёнными в диапазоне [x1, x2] в направлении dir={`x`,`y`,`z`}. +

+ +
+
Команда MGL: fill dat 'eq'[vdat wdat]
+

Заполняет значениями вычисленными по формуле eq. Формула представляет собой произвольное выражение, зависящее от переменных `x`, `y`, `z`, `u`, `v`, `w`. Координаты `x`, `y`, `z` полагаются меняющимися в диапазоне Min x Max (в отличие от функции Modify). Переменная `u` - значения исходного массива, переменные `v`, `w` - значения массивов vdat, wdat. Последние могут быть NULL, т.е. опущены. +

+ +
+
Команда MGL: modify dat 'eq' [dim=0]
+
Команда MGL: modify dat 'eq' vdat [wdat]
+

Аналогично предыдущему с координатами `x`, `y`, `z`, меняющимися в диапазоне [0,1]. Если указан dim>0, то изменяются только слои >=dim. +

+ +
+
Команда MGL: fillsample dat 'how'
+

Заполняет массив данных `x` или `k` значениями для преобразований Ханкеля (`h`) или Фурье (`f`). +

+ + +
+
Команда MGL: datagrid dat xdat ydat zdat
+

Заполняет значения массива результатом линейной интерполяции (считая координаты равнораспределенными в диапазоне осей координат или в диапазоне [x1,x2]*[y1,y2]) по триангулированной поверхности, найденной по произвольно расположенным точкам `x`, `y`, `z`. NAN значение используется для точек сетки вне триангулированной поверхности. См. Making regular data, для примеров кода и графика. +

+ + +
+
Команда MGL: put dat val [i=all j=all k=all]
+

Присваивает значения (под-)массива dat[i, j, k] = val. Индексы i, j, k равные `-1` задают значения val для всего диапазона соответствующего направления(ий). Например, Put(val,-1,0,-1); задает a[i,0,j]=val для i=0...(nx-1), j=0...(nz-1). +

+ +
+
Команда MGL: put dat vdat [i=all j=all k=all]
+

Копирует значения из массива v в диапазон значений данного массива. Индексы i, j, k равные `-1` задают диапазон изменения значений в соответствующих направление(ях). Младшие размерности массива v должны быть больше выбранного диапазона массива. Например, Put(v,-1,0,-1); присвоит a[i,0,j]=v.ny>nz ? v.a[i,j] : v.a[i], где i=0...(nx-1), j=0...(nz-1) и условие v.nx>=nx выполнено. +

+ +
+
Команда MGL: refill dat xdat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat vdat [sl=-1]
+
Команда MGL: refill dat xdat ydat zdat vdat
+

Заполняет значениями интерполяции массива v в точках {x, y, z}={X[i], Y[j], Z[k]} (или {x, y, z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} если x, y, z не 1d массивы), где X,Y,Z равномерно распределены в диапазоне [x1,x2]*[y1,y2]*[z1,z2] и имеют такой же размер как и заполняемый массив. Если параметр sl равен 0 или положительный, то изменятся будет только sl-ый срез. +

+ +
+
Команда MGL: gspline dat xdat vdat [sl=-1]
+

Заполняет значениями глобального кубического сплайна для массива v в точках x=X[i], где X равномерно распределен в диапазоне [x1,x2] и имеет такой же размер как и заполняемый массив. Если параметр sl равен 0 или положительный, то изменятся будет только sl-ый срез. +

+ +
+
Команда MGL: idset dat 'ids'
+

Задает названия ids для колонок массива данных. Строка должна содержать один символ `a`...`z` на колонку. Эти названия используются в функции column. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.5 Чтение/сохранение данных

+ + + + + + + + + + + +
+
Команда MGL: read DAT 'fname'
+
Команда MGL: read REDAT IMDAT 'fname'
+

Читает данные из текстового файла с разделителями символом пробела/табуляции с автоматическим определением размера массива. Двойной перевод строки начинает новый срез данных (по направлению z). +

+ +
+
Команда MGL: read DAT 'fname' mx [my=1 mz=1]
+
Команда MGL: read REDAT IMDAT 'fname' mx [my=1 mz=1]
+

Читает данные из текстового файла с заданными размерами. Ничего не делается если параметры mx, my или mz равны нулю или отрицательны. +

+ +
+
Команда MGL: readmat DAT 'fname' [dim=2]
+

Читает данные из текстового файла с размерами, указанными в первых dim числах файла. При этом переменная dim задает размерность (1d, 2d, 3d) данных. +

+ +
+
Команда MGL: readall DAT 'templ' v1 v2 [dv=1 slice=off]
+

Объединяет данные из нескольких текстовых файлов. Имена файлов определяются вызовом функции sprintf(fname,templ,val);, где val меняется от from до to с шагом step. Данные загружаются один за другим в один и тот же срез данных (при as_slice=false) или срез-за-срезом (при as_slice=true). +

+ +
+
Команда MGL: readall DAT 'templ' [slice=off]
+

Объединяет данные из нескольких текстовых файлов, чьи имена удовлетворяют шаблону templ (например, templ="t_*.dat"). Данные загружаются один за другим в один и тот же срез данных (при as_slice=false) или срез-за-срезом (при as_slice=true). +

+ +
+
Команда MGL: scanfile DAT 'fname' 'templ'
+

Читает файл fname построчно и каждую строку сканирует на соответствие шаблону templ. Полученные числа (обозначаются как `%g` в шаблоне) сохраняются. См. Saving and scanning file, для примеров кода и графика. +

+ +
+
Команда MGL: save dat 'fname'
+

Сохраняет весь массив данных при ns=-1 или только ns-ый срез в текстовый файл. +

+ +
+
Команда MGL: save 'str' 'fname' ['mode'='a']
+

Сохраняет строку str в файл fname. Для параметра mode=`a` происходит добавление строки (по умолчанию): для mode=`w` файл будет перезаписан. См. Saving and scanning file, для примеров кода и графика. +

+ +
+
Команда MGL: readhdf DAT 'fname' 'dname'
+

Читает массив с именем dname из HDF5 или HDF4 файла fname. Функция ничего не делает если библиотека была собрана без поддержки HDF5|HDF4. +

+ +
+
Команда MGL: savehdf dat 'fname' 'dname' [rewrite=off]
+

Сохраняет массив под именем dname в HDF5 или HDF4 файл fname. Функция ничего не делает если библиотека была собрана без поддержки HDF5|HDF4. +

+ +
+
Команда MGL: datas 'fname'
+

Помещает имена массивов данных в HDF5 файле fname в строку buf разделёнными символом табуляции `\t`. В версии MGL имена массивов будут выведены как сообщение. Функция ничего не делает если библиотека была собрана без поддержки HDF5. +

+ +
+
Команда MGL: openhdf 'fname'
+

Читает все массивы данных из HDF5 файла fname и создает переменные MGL с соответствующими именами. Если имя данных начинается с `!`, то будут созданы комплексные массивы. +

+ + +
+
Команда MGL: import DAT 'fname' 'sch' [v1=0 v2=1]
+

Читает данные из растрового файла. RGB значения пикселов преобразуются в число в диапазоне [v1, v2] используя цветовую схему sch (see Color scheme). +

+ +
+
Команда MGL: export dat 'fname' 'sch' [v1=0 v2=0]
+

Сохраняет данные в растровый файл. Числовые значения, нормированные в диапазон [v1, v2], преобразуются в RGB значения пикселов, используя цветовую схему sch (see Color scheme). Если v1>=v2, то значения v1, v2 определяются автоматически как минимальное и максимальное значение данных. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.6 Make another data

+ + + + + + + + + + + + + + + + +
+
Команда MGL: subdata RES dat xx [yy=all zz=all]
+

Возвращает в res подмассив массива данных dat с фиксированными значениями индексов с положительными значениями. Например, SubData(-1,2) выделяет третью строку (индексы начинаются с нуля), SubData(4,-1) выделяет 5-ую колонку, SubData(-1,-1,3) выделяет 4-ый срез и т.д. В MGL скриптах обычно используется упрощенная версия dat(xx,yy,zz). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: subdata RES dat xdat [ydat zdat]
+

Возвращает в res подмассив массива данных dat с индексами, заданными в массивах xx, yy, zz (косвенная адресация). Результат будет иметь размерность массивов с индексами. Размеры массивов xx, yy, zz с индексами должна быть одинакова, либо должны быть "скаляром" (т.е. 1*1*1). В MGL скриптах обычно используется упрощенная версия dat(xx,yy,zz). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: column RES dat 'eq'
+

Возвращает массив данных заполненный по формуле eq, вычисленной для именованных колонок (или срезов). Например, Column("n*w^2/exp(t)");. Имена колонок должны быть предварительно заданы функцией idset или при чтении файлов данных. В MGL скриптах обычно используется упрощенная версия dat('eq'). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: resize RES dat mx [my=1 mz=1]
+

Возвращает массив данных размером mx, my, mz со значениями полученными интерполяцией значений из части [x1,x2] x [y1,y2] x [z1,z2] исходного массива. Величины x,y,z полагаются нормированными в диапазоне [0,1]. Если значение mx, my или mz равно 0, то исходный размер используется. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: evaluate RES dat idat [norm=on]
+
Команда MGL: evaluate RES dat idat jdat [norm=on]
+
Команда MGL: evaluate RES dat idat jdat kdat [norm=on]
+

Возвращает массив данных, полученный в результате интерполяции исходного массива в точках других массивов (например, res[i,j]=dat[idat[i,j],jdat[i,j]]). Размеры массивов idat, jdat, kdat должны совпадать. Координаты в idat, jdat, kdat полагаются нормированными в диапазон [0,1] (при norm=true) или в диапазоны [0,nx], [0,ny], [0,nz] соответственно. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: section RES dat ids ['dir'='y' val=nan]
+
Команда MGL: section RES dat id ['dir'='y' val=nan]
+

Возвращает массив данных, являющийся id-ой секцией (диапазоном срезов, разделенных значениями val) исходного массива dat. Для id<0 используется обратный порядок (т.e. -1 даст последнюю секцию). Если указано несколько ids, то выходной массив будет результатом последовательного объединения секций. +

+ +
+
Команда MGL: solve RES dat val 'dir' [norm=on]
+
Команда MGL: solve RES dat val 'dir' idat [norm=on]
+

Возвращает массив индексов (корней) вдоль выбранного направления dir в которых значения массива dat равны val. Выходной массив будет иметь размеры массива dat в направлениях поперечных dir. Если предоставлен массив idat, то его значения используются как стартовые при поиске. Это позволяет найти несколько веток с помощью последовательного вызова функции. Индексы полагаются нормированными в диапазон [0,1] (при norm=true) или в диапазоны [0,nx], [0,ny], [0,nz] соответственно. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. См. Solve sample, для примеров кода и графика. +

+ +
+
Команда MGL: roots RES 'func' ini ['var'='x']
+
Команда MGL: roots RES 'func' ini ['var'='x']
+

Возвращает массив корней уравнения `func`=0 для переменной var с начальными положениями ini. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: roots RES 'funcs' 'vars' ini
+

Возвращает массив корней системы уравнений `funcs`=0 для переменных vars с начальными значениями ini. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: detect RES dat lvl dj [di=0 minlen=0]
+

Возвращает массив кривых {x,y}, разделенных NAN значениями, для локальных максимумов массива dat как функцию координаты x. Шумы амплитудой меньше lvl игнорируются. Параметр dj (в диапазоне [0,ny]) задает область "притяжения" точек в y-направлении к кривой. Аналогично, di продолжает кривые в x-направлении через разрывы длиной менее di точек. Кривые с минимальной длинной менее minlen игнорируются. +

+ +
+
Команда MGL: hist RES dat num v1 v2 [nsub=0]
+
Команда MGL: hist RES dat wdat num v1 v2 [nsub=0]
+

Возвращает распределение (гистограмму) из n точек от значений массива в диапазоне [v1, v2]. Массив w задает веса элементов (по умолчанию все веса равны 1). Параметр nsub задает число дополнительных точек интерполяции (для сглаживания получившейся гистограммы). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. См. также Data manipulation +

+ +
+
Команда MGL: momentum RES dat 'how' ['dir'='z']
+

Возвращает момент (1d массив) данных вдоль направления dir. Строка how определяет тип момента. Момент определяется как +res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij +если dir=`z` и т.д. Координаты `x`, `y`, `z` - индексы массива в диапазоне [0,1]. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: sum RES dat 'dir'
+

Возвращает результат суммирования данных вдоль направления(ий) dir. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: max RES dat 'dir'
+

Возвращает максимальное значение данных вдоль направления(ий) dir. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: min RES dat 'dir'
+

Возвращает минимальное значение данных вдоль направления(ий) dir. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: combine RES adat bdat
+

Возвращает прямое произведение массивов (наподобие, res[i,j] = adat[i]*bdat[j] и т.д.). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: trace RES dat
+

Возвращает массив диагональных элементов a[i,i] (для 2D данных) или a[i,i,i] (для 3D данных) где i=0...nx-1. В 1D случае возвращается сам массив данных. Размеры массива данных должен быть ny,nz >= nx или ny,nz = 1. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ +
+
Команда MGL: correl RES adat bdat 'dir'
+

Возвращает корреляцию массивов a (или this в C++) и b вдоль направлений dir. При вычислении используется преобразование Фурье. Поэтому может потребоваться вызов функций swap и/или norm перед построением. Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. +

+ + +
+
Команда MGL: pulse RES dat 'dir'
+

Находит параметры импульса вдоль направления dir: максимальное значение (в колонке 0), его положение (в колонке 1), ширина по параболлической аппроксимации (в колонке 3) и по полувысоте (в колонке 2), энергию около максимума (в колонке 4). NAN значения используются для ширин если максимум расположен вблизи границ массива. Отмечу, что для комплексных массивов есть неопределенность определения параметров. Обычно следует использовать квадрат абсолютного значения амплитуды (т.е. |dat[i]|^2). Поэтому MathGL не включает эту функцию в mglDataC, хотя формально C функция будет работать и для них, но будет использовать абсолютное значение амплитуды (т.е. |dat[i]|). Функция возвращает NULL или пустой массив если данные не могут быть созданы при данных значениях аргументов. См. также max, min, momentum, sum. См. Pulse properties, для примеров кода и графика. +

+ + +
+ + + +

4.7 Изменение данных

+ + + + + + + + + + + + + + + + + +

These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain `x`, `y` or `z` characters for 1-st, 2-nd and 3-d dimension correspondingly. +

+
+
Команда MGL: cumsum dat 'dir'
+

Суммирует с накоплением в выбранном направлении(ях). +

+ +
+
Команда MGL: integrate dat 'dir'
+

Выполняет интегрирование (методом трапеций) в выбранном направлении(ях). +

+ +
+
Команда MGL: diff dat 'dir'
+

Выполняет дифференцирование в выбранном направлении(ях). +

+ +
+
Команда MGL: diff dat xdat ydat [zdat]
+

Выполняет дифференцирование данных, параметрически зависящих от координат, в направлении x с y, z=constant. Параметр z может быть опущен, что соответствует 2D случаю. Используются следующие формулы (2D случай): da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j), где a_i=da/di, a_j=da/dj обозначает дифференцирование вдоль 1-ой и 2-ой размерности. Похожие формулы используются и в 3D случае. Порядок аргументов можно менять - например, если данные a(i,j) зависят от координат {x(i,j), y(i,j)}, то обычная производная по `x` будет равна Diff(x,y);, а обычная производная по `y` будет равна Diff(y,x);. +

+ +
+
Команда MGL: diff2 dat 'dir'
+

Выполняет двойное дифференцирование (как в операторе Лапласа) в выбранном направлении(ях). +

+ +
+
Команда MGL: sinfft dat 'dir'
+

Выполняет синус преобразование в выбранном направлении(ях). Синус преобразование есть \sum a_j \sin(k j) (см. http://en.wikipedia.org/wiki/Discrete_sine_transform#DST-I). +

+ +
+
Команда MGL: cosfft dat 'dir'
+

Выполняет косинус преобразование в выбранном направлении(ях). Синус преобразование есть \sum a_j \cos(k j) (см. http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-I). +

+ + +
+
Команда MGL: hankel dat 'dir'
+

Выполняет преобразование Ханкеля в выбранном направлении(ях). Преобразование Ханкеля есть \sum a_j J_0(k j) (см. http://en.wikipedia.org/wiki/Hankel_transform). +

+ +
+
Команда MGL: wavelet dat 'dir' k
+

Выполняет преобразование wavelet в выбранном направлении(ях). Параметр dir задает тип: +`d` для daubechies, `D` для центрированного daubechies, `h` для haar, `H` для центрированного haar, `b` для bspline, `B` для центрированного bspline. Если указан символ `i`, то выполняется обратное преобразование. Параметр k задает размер преобразования. +

+ +
+
Команда MGL: swap dat 'dir'
+

Меняет местами левую и правую части данных в выбранном направлении(ях). Полезно для отображения результата FFT. +

+ +
+
Команда MGL: roll dat 'dir' num
+

Сдвигает данные на num ячеек в выбранном направлении(ях). Соответствует замене индекса на i->(i+num)%nx при dir='x'. +

+ +
+
Команда MGL: mirror dat 'dir'
+

Отражает данные в выбранном направлении(ях). Соответствует замене индекса на i->n-i. Отмечу, что похожего эффекта на графике можно достичь используя опции (see Command options), например, surf dat; xrange 1 -1. +

+ +
+
Команда MGL: sew dat ['dir'='xyz' da=2*pi]
+

Удаляет скачки данных (например, скачки фазы после обратных тригонометрических функций) с периодом da в выбранном направлении(ях). +

+ +
+
Команда MGL: smooth data ['dir'='xyz']
+

Сглаживает данные в выбранном направлении(ях) dir. Строка dirs задает направления вдоль которых будет производиться сглаживание. Строка dir может содержать: +

    +
  • `xyz` - сглаживание по x-,y-,z-направлениям, +
  • `0` - ничего не делает, +
  • `3` - линейное усреднение по 3 точкам, +
  • `5` - линейное усреднение по 5 точкам, +
  • `d1`...`d9` - линейное усреднение по (2*N+1) точкам. +
+

По умолчанию используется квадратичное усреднение по 5 точкам. +

+ +
+
Команда MGL: envelop dat ['dir'='x']
+

Находит огибающую данных в выбранном направлении dir. +

+ +
+
Команда MGL: diffract dat 'how' q
+

Вычисляет один шаг диффракции в конечно-разностной схеме с параметром q=\delta t/\delta x^2 используя метод третьего порядка точности. Параметр how может содержать: +

    +
  • `xyz` для расчета вдоль x-,y-,z-направления; +
  • `r` для аксиально симметричного лапласиана по направлению x; +
  • `0` для нулевых граничных условий; +
  • `1` для постоянных граничных условий; +
  • `2` для линейных граничных условий; +
  • `3` для параболлических граничных условий; +
  • `4` для экспоненциальных граничных условий; +
  • `5` для гауссовых граничных условий. +
+
+ +
+
Команда MGL: norm dat v1 v2 [sym=off dim=0]
+

Нормирует данные в интервал [v1,v2]. Если sym=true, то используется симметричный интервал [-max(|v1|,|v2|), max(|v1|,|v2|)]. Изменения применяются только к срезам >=dim. +

+ +
+
Команда MGL: normsl dat v1 v2 ['dir'='z' keep=on sym=off]
+

Нормирует данные срез-за-срезом в выбранном направлении dir в интервал [v1,v2]. Если sym=true, то используется симметричный интервал [-max(|v1|,|v2|), max(|v1|,|v2|)]. Если keep=true, то максимальное значение k-го среза ограничено величиной +\sqrt{\sum a_ij(k)/\sum a_ij(0)}. +

+ +
+
Команда MGL: limit dat val
+

Ограничивает амплитуду данных диапазоном [-val,val]. При этом сохраняется исходный знак (фаза для комплексных чисел). Эквивалентно операции a[i] *= abs(a[i])<val?1.:val/abs(a[i]);. +

+ +
+
Команда MGL: coil dat v1 v2 [sep=on]
+

Проецирует периодические данные на диапазон [v1,v2] (аналогично функции mod()). Разделяет ветки по значениям равным NAN если sep=true. +

+ +
+
Команда MGL: dilate dat [val=1 step=1]
+

Возвращает "расширенный" на step ячеек массив из 0 и 1 для данных больших порогового значения val.

+ +
+
Команда MGL: erode dat [val=1 step=1]
+

Возвращает "суженный" на step ячеек массив из 0 и 1 для данных больших порогового значения val.

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.8 Интерполяция

+ + +

Скрипты MGL могут использовать интерполяцию кубическими сплайнами с помощью команд evaluate или refill. Также можно использовать resize для массива с новыми размерами. +

+ + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.9 Информационные функции

+ + +

В MathGL есть ряд функций для получения свойств массива данных. В MGL скриптах большинство из них реализовано в виде "суффиксов". Суффиксы дают числовое значение некоторой характеристики массива данных. Например, его размер, минимальное и максимальное значение, сумму элементов и т.д. Суффиксы начинаются с точки `.` сразу после массива (без пробелов). Например, a.nx даст размер массива a вдоль x, b(1).max даст максимальное значение второй колонки массива b, (c(:,0)^2).sum даст сумму квадратов в первой строке массива c и т.д. +

+ + +
+
Команда MGL: info dat
+

Возвращает строку с информацией о данных (размеры, моменты и пр.) или пишет её в файл. В MGL скрипте печатает её как сообщение. +

+ +
+
Команда MGL: info 'txt'
+

Печатает строку txt как сообщение. +

+ +
+
Команда MGL: info val
+

Печатает значение числа val как сообщение. +

+ +
+
Команда MGL: print dat
+
Команда MGL: print 'txt'
+
Команда MGL: print val
+

Аналогично info, но сразу выводит в stdout. +

+ +
+
Команда MGL: echo dat
+

Печатает все значения массива dat как сообщение. +

+ +
+
Команда MGL: progress val max
+

Отображает прогресс чего-либо как заполненную полоску с относительной длиной val/max. На данный момент работает только в консоли и основанных на FLTK программах, включая mgllab и mglview. +

+ + + + + +
+
MGL suffix: (dat) .nx
+
MGL suffix: (dat) .ny
+
MGL suffix: (dat) .nz
+

Возвращает размер данных в направлении x, y и z соответственно. +

+ + + + +
+
MGL suffix: (dat) .max
+

Возвращает максимальное значение массива данных. +

+ + +
+
MGL suffix: (dat) .min
+

Возвращает минимальное значение массива данных. +

+ + +
+
MGL suffix: (dat) .mx
+
MGL suffix: (dat) .my
+
MGL suffix: (dat) .mz
+

Возвращает минимальное значение массива данных и его приближенное (интерполированное) положение в переменные x, y, z. +

+ +
+
MGL suffix: (dat) .mxf
+
MGL suffix: (dat) .myf
+
MGL suffix: (dat) .mzf
+
MGL suffix: (dat) .mxl
+
MGL suffix: (dat) .myl
+
MGL suffix: (dat) .mzl
+

Возвращает положение первого (последнего при from<0) максимума в направлении dir, начиная с позиции from. Положение остальных координат для максимума сохраняется в p1, p2. +

+ + + +
+
MGL suffix: (dat) .sum
+
MGL suffix: (dat) .ax
+
MGL suffix: (dat) .ay
+
MGL suffix: (dat) .az
+
MGL suffix: (dat) .aa
+
MGL suffix: (dat) .wx
+
MGL suffix: (dat) .wy
+
MGL suffix: (dat) .wz
+
MGL suffix: (dat) .wa
+
MGL suffix: (dat) .sx
+
MGL suffix: (dat) .sy
+
MGL suffix: (dat) .sz
+
MGL suffix: (dat) .sa
+
MGL suffix: (dat) .kx
+
MGL suffix: (dat) .ky
+
MGL suffix: (dat) .kz
+
MGL suffix: (dat) .ka
+

Возвращает нулевой момент (энергию, I=\sum a_i) и записывает первый (среднее, m = \sum \xi_i a_i/I), второй (ширину, w^2 = \sum (\xi_i-m)^2 a_i/I), третий (асимметрия, s = \sum (\xi_i-m)^3 a_i/ I w^3) и четвёртый моменты (эксцесс, k = \sum (\xi_i-m)^4 a_i / 3 I w^4)). Здесь \xi - соответствующая координата если dir равно `'x'`, `'y'`, `'z'`. В противном случае среднее, ширина, асимметрия, эксцесс равны m = \sum a_i/N, w^2 = \sum (a_i-m)^2/N и т.д. +

+ +
+
MGL suffix: (dat) .fst
+

Находит положение (после заданного в i, j, k) первого не нулевого значения формулы cond. Функция возвращает найденное значение и записывает его положение в i, j, k. +

+ +
+
MGL suffix: (dat) .lst
+

Находит положение (перед заданного в i, j, k) последнего не нулевого значения формулы cond. Функция возвращает найденное значение и записывает его положение в i, j, k. +

+ + +
+
MGL suffix: (dat) .a
+

Возвращает первое число массива (для .a это dat->a[0]). +

+ + + +
+ + + +

4.10 Операторы

+ + +
+
Команда MGL: copy DAT dat2 ['eq'='']
+

Копирует данные из другого экземпляра. +

+ +
+
Команда MGL: copy dat val
+

Устанавливает все значения массива равными val. +

+ +
+
Команда MGL: multo dat dat2
+
Команда MGL: multo dat val
+

Поэлементно умножает на массив d или на число val. +

+ +
+
Команда MGL: divto dat dat2
+
Команда MGL: divto dat val
+

Поэлементно делит на массив d или на число val. +

+ +
+
Команда MGL: addto dat dat2
+
Команда MGL: addto dat val
+

Поэлементно прибавляет d или число val. +

+ +
+
Команда MGL: subto dat dat2
+
Команда MGL: subto dat val
+

Поэлементно вычитает d или число val. +

+ + + +
+ +
+

+Next: , Previous: , Up: Data processing   [Contents][Index]

+
+ +

4.11 Глобальные функции

+ + + +
+
Команда MGL: transform DAT 'type' real imag
+

Выполняет интегральное преобразование комплексных данных real, imag в выбранном направлении и возвращает модуль результата. Порядок и тип преобразований задается строкой type: первый символ для x-направления, второй для y-направления, третий для z-направления. Возможные символы: `f` - прямое преобразование Фурье, `i` - обратное преобразование Фурье, `s` - синус преобразование, `c` - косинус преобразование, `h` - преобразование Ханкеля, `n` или ` ` - нет преобразования. +

+ +
+
Команда MGL: transforma DAT 'type' ampl phase
+

Аналогично предыдущему с заданными амплитудой ampl и фазой phase комплексных чисел. +

+ +
+
Команда MGL: fourier reDat imDat 'dir'
+
Команда MGL: fourier complexDat 'dir'
+

Выполняет Фурье преобразование для комплексных данных re+i*im в направлениях dir. Результат помещается обратно в массивы re и im. Если dir содержит `i`, то выполняется обратное преобразование Фурье. +

+ +
+
Команда MGL: stfad RES real imag dn ['dir'='x']
+

Выполняет оконное преобразование Фурье длиной dn для комплексных данных real, imag и возвращает модуль результата. Например, для dir=`x` результат будет иметь размер {int(nx/dn), dn, ny} и будет равен res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn. +

+ + +
+
Команда MGL: triangulate dat xdat ydat
+

Выполняет триангуляцию Делоне для точек на плоскости и возвращает массив, пригодный для triplot и tricont. См. Making regular data, для примеров кода и графика. +

+ +
+
Команда MGL: tridmat RES ADAT BDAT CDAT DDAT 'how'
+

Возвращает решение трехдиагональной системы уравнений A[i]*x[i-1]+B[i]*x[i]+C[i]*x[i+1]=D[i]. Строка how может содержать: +

    +
  • `xyz` для решения вдоль x-,y-,z-направлений; +
  • `h` для решения вдоль диагонали на плоскости x-y (требует квадратную матрицу); +
  • `c` для использования периодических граничных условий; +
  • `d` для расчета диффракции/диффузии (т.е. для использования -A[i]*D[i-1]+(2-B[i])*D[i]-C[i]*D[i+1] в правой частиц вместо D[i]). +
+

Размеры массивов A, B, C должны быть одинаковы. Также их размерности должны совпадать со всеми или с "младшими" размерностями массива D. См. PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+

Решает уравнение в частных производных du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], где p=-i/k0*d/dx, q=-i/k0*d/dy - псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Координаты в уравнении и в решении полагаются в диапазоне осей координат. Замечу, что внутри этот диапазон увеличивается в 3/2 раза для уменьшения отражения от границ расчетного интервала. Параметр dz задает шаг по эволюционной координате z. В данный момент использован упрощенный алгоритм, когда все “смешанные” члена (типа `x*p`->x*d/dx) исключаются. Например, в 2D случае это функции типа ham = f(p,z) + g(x,z,u). При этом допускаются коммутирующие комбинации (типа `x*q`->x*d/dy). Переменная `u` используется для обозначения амплитуды поля |u|. Это позволяет решать нелинейные задачи - например, нелинейное уравнение Шредингера ham='p^2+q^2-u^2'. Также можно указать мнимую часть для поглощения (типа ham = 'p^2+i*x*(x>0)'). См. также apde, qo2d, qo3d. См. PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: apde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
+

Решает уравнение в частных производных du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], где p=-i/k0*d/dx, q=-i/k0*d/dy - псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Координаты в уравнении и в решении полагаются в диапазоне осей координат. Замечу, что внутри этот диапазон увеличивается в 3/2 раза для уменьшения отражения от границ расчетного интервала. Параметр dz задает шаг по эволюционной координате z. Используется достаточно сложный и медленный алгоритм, способный учесть одновременное влияние пространственной дисперсии и неоднородности среды [см. А.А. Балакин, Е.Д. Господчиков, А.Г. Шалашов, Письма ЖЭТФ 104, 701 (2016)]. Переменная `u` используется для обозначения амплитуды поля |u|. Это позволяет решать нелинейные задачи - например, нелинейное уравнение Шредингера ham='p^2+q^2-u^2'. Также можно указать мнимую часть для поглощения (типа ham = 'p^2+i*x*(x>0)'). См. также apde. См. PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: ray RES 'ham' x0 y0 z0 p0 q0 v0 [dt=0.1 tmax=10]
+

Решает систему геометрооптических уравнений dr/dt = d ham/dp, dp/dt = -d ham/dr. Это гамильтоновы уравнения для траектории частицы в 3D случае. Гамильтониан ham может зависеть от координат `x`, `y`, `z`, импульсов `p`=px, `q`=py, `v`=pz и времени `t`: ham = H(x,y,z,p,q,v,t). Начальная точка (при t=0) задается переменными {x0, y0, z0, p0, q0, v0}. Параметры dt и tmax задают шаг и максимальное время интегрирования. Результат - массив {x,y,z,p,q,v,t} с размером {7 * int(tmax/dt+1) }. +

+ +
+
Команда MGL: ode RES 'df' 'var' ini [dt=0.1 tmax=10]
+

Решает систему обыкновенных дифференциальных уравнений dx/dt = df(x). Функции df могут быть заданны строкой с разделенными `;` формулами (аргумент var задает символы для переменных x[i]) или указателем на функцию, которая заполняет dx по заданным значениям x. Параметры ini, dt, tmax задают начальные значения, шаг и максимальное время интегрирования. Функция обрывает расчет при появлении значений NAN или INF. Результат - массив размером {n * Nt}, где Nt <= int(tmax/dt+1). +

+ +
+
Команда MGL: qo2d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy]
+

Решает уравнение в частных производных du/dt = i*k0*ham(p,q,x,y,|u|)[u] в сопровождающей системе координат, где p=-i/k0*d/dx, q=-i/k0*d/dy - псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Параметр ray задает опорный луч для сопровождающей системы координат. Можно использовать луч найденный с помощью ray. Опорный луч должен быть достаточно гладкий, чтобы система координат была однозначной и для исключения ошибок интегрирования. Если массивы xx и yy указаны, то в них записываются декартовы координаты для каждой точки найденного решения. См. также pde, qo3d. См. PDE solving hints, для примеров кода и графика. +

+ +
+
Команда MGL: qo3d RES 'ham' ini_re ini_im ray [r=1 k0=100 xx yy zz]
+

Решает уравнение в частных производных du/dt = i*k0*ham(p,q,v,x,y,z,|u|)[u] в сопровождающей системе координат, где p=-i/k0*d/dx, q=-i/k0*d/dy, v=-i/k0*d/dz - псевдо-дифференциальные операторы. Параметры ini_re, ini_im задают начальное распределение поля. Параметр ray задает опорный луч для сопровождающей системы координат. Можно использовать луч найденный с помощью ray. Опорный луч должен быть достаточно гладкий, чтобы система координат была однозначной и для исключения ошибок интегрирования. Если массивы xx, yy и zz указаны, то в них записываются декартовы координаты для каждой точки найденного решения. См. также pde, qo2d. +

+ +
+
Команда MGL: jacobian RES xdat ydat [zdat]
+

Вычисляет якобиан преобразования {i,j,k} в {x,y,z}, где координаты {i,j,k} полагаются нормированными в интервал [0,1]. Якобиан находится по формуле det||dr_\alpha/d\xi_\beta||, где r={x,y,z} и \xi={i,j,k}. Все размерности всех массивов должны быть одинаковы. Данные должны быть трехмерными если указаны все 3 массива {x,y,z} или двумерными если только 2 массива {x,y}. +

+ +
+
Команда MGL: triangulation RES xdat ydat [zdat]
+

Выполняет триангуляцию для произвольно расположенных точек с координатами {x,y,z} (т.е. находит треугольники, соединяющие точки). Первая размерность всех массивов должна быть одинакова x.nx=y.nx=z.nx. Получившийся массив можно использовать в triplot или tricont для визуализации реконструированной поверхности. См. Making regular data, для примеров кода и графика. +

+ + + +
+
Команда MGL: ifs2d RES dat num [skip=20]
+

Находит num точек {x[i]=res[0,i], y[i]=res[1,i]} фрактала с использованием итерационной системы функций (IFS). Матрица dat используется для генерации в соответствии с формулами +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[4,i];
+y[i+1] = dat[2,i]*x[i] + dat[3,i]*y[i] + dat[5,i];
+

Значение dat[6,i] - весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Массив dat должен иметь размер по x больше или равный 7. См. также ifs3d, flame2d. См. ifs2d sample, для примеров кода и графика. +

+ +
+
Команда MGL: ifs3d RES dat num [skip=20]
+

Находит num точек {x[i]=res[0,i], y[i]=res[1,i], z[i]=res[2,i]} фрактала с использованием итерационной системы функций (IFS). Матрица dat используется для генерации в соответствии с формулами +

x[i+1] = dat[0,i]*x[i] + dat[1,i]*y[i] + dat[2,i]*z[i] + dat[9,i];
+y[i+1] = dat[3,i]*x[i] + dat[4,i]*y[i] + dat[5,i]*z[i] + dat[10,i];
+z[i+1] = dat[6,i]*x[i] + dat[7,i]*y[i] + dat[8,i]*z[i] + dat[11,i];
+

Значение dat[12,i] - весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Массив dat должен иметь размер по x больше или равный 13. См. также ifs2d. См. ifs3d sample, для примеров кода и графика. +

+ +
+
Команда MGL: ifsfile RES 'fname' 'name' num [skip=20]
+

Считывает параметры фрактала name из файла fname и находит num точек для него. Первые skip итераций будут опущены. См. также ifs2d, ifs3d. +

+

Файл IFS может содержать несколько записей. Каждая запись содержит имя фрактала (`binary` в примере ниже) и тело в фигурных скобках {} с параметрами фрактала. Символ `;` начинает комментарий. Если имя содержит `(3D)` или `(3d)`, то определен 3d IFS фрактал. Пример содержит два фрактала: `binary` - обычный 2d фрактал, и `3dfern (3D)` - 3d фрактал. См. также ifs2d, ifs3d. +

+
 binary
+ { ; comment allowed here
+  ; and here
+  .5  .0 .0 .5 -2.563477 -0.000003 .333333   ; also comment allowed here
+  .5  .0 .0 .5  2.436544 -0.000003 .333333
+  .0 -.5 .5 .0  4.873085  7.563492 .333333
+  }
+
+ 3dfern (3D) {
+   .00  .00 0 .0 .18 .0 0  0.0 0.00 0 0.0 0 .01
+   .85  .00 0 .0 .85 .1 0 -0.1 0.85 0 1.6 0 .85
+   .20 -.20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  -.20  .20 0 .2 .20 .0 0  0.0 0.30 0 0.8 0 .07
+  }
+
+ +
+
Команда MGL: flame2d RES dat func num [skip=20]
+

Находит num точек {x[i]=res[0,i], y[i]=res[1,i]} фрактала с использованием итерационной системы функций (IFS). Массив func задает идентификатор функции (func[0,i,j]), ее вес (func[0,i,j]) и аргументы (func[2 ... 5,i,j]). Матрица dat используется для преобразования координат для аргументов функции. Результирующее преобразование имеет вид: +

xx = dat[0,i]*x[j] + dat[1,j]*y[i] + dat[4,j];
+yy = dat[2,i]*x[j] + dat[3,j]*y[i] + dat[5,j];
+x[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_x(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+y[j+1] = sum_i @var{func}[1,i,j]*@var{func}[0,i,j]_y(xx, yy; @var{func}[2,i,j],...,@var{func}[5,i,j]);
+

Значение dat[6,i] - весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Массив dat должен иметь размер по x больше или равный 7. +Доступные идентификаторы функций: mglFlame2d_linear=0, mglFlame2d_sinusoidal, mglFlame2d_spherical, mglFlame2d_swirl, mglFlame2d_horseshoe, + mglFlame2d_polar, mglFlame2d_handkerchief,mglFlame2d_heart, mglFlame2d_disc, mglFlame2d_spiral, + mglFlame2d_hyperbolic, mglFlame2d_diamond, mglFlame2d_ex, mglFlame2d_julia, mglFlame2d_bent, + mglFlame2d_waves, mglFlame2d_fisheye, mglFlame2d_popcorn, mglFlame2d_exponential, mglFlame2d_power, + mglFlame2d_cosine, mglFlame2d_rings, mglFlame2d_fan, mglFlame2d_blob, mglFlame2d_pdj, + mglFlame2d_fan2, mglFlame2d_rings2, mglFlame2d_eyefish, mglFlame2d_bubble, mglFlame2d_cylinder, + mglFlame2d_perspective, mglFlame2d_noise, mglFlame2d_juliaN, mglFlame2d_juliaScope, mglFlame2d_blur, + mglFlame2d_gaussian, mglFlame2d_radialBlur, mglFlame2d_pie, mglFlame2d_ngon, mglFlame2d_curl, + mglFlame2d_rectangles, mglFlame2d_arch, mglFlame2d_tangent, mglFlame2d_square, mglFlame2d_blade, + mglFlame2d_secant, mglFlame2d_rays, mglFlame2d_twintrian, mglFlame2d_cross, mglFlame2d_disc2, + mglFlame2d_supershape, mglFlame2d_flower, mglFlame2d_conic, mglFlame2d_parabola, mglFlame2d_bent2, + mglFlame2d_bipolar, mglFlame2d_boarders, mglFlame2d_butterfly, mglFlame2d_cell, mglFlame2d_cpow, + mglFlame2d_curve, mglFlame2d_edisc, mglFlame2d_elliptic, mglFlame2d_escher, mglFlame2d_foci, + mglFlame2d_lazySusan, mglFlame2d_loonie, mglFlame2d_preBlur, mglFlame2d_modulus, mglFlame2d_oscope, + mglFlame2d_polar2, mglFlame2d_popcorn2, mglFlame2d_scry, mglFlame2d_separation, mglFlame2d_split, + mglFlame2d_splits, mglFlame2d_stripes, mglFlame2d_wedge, mglFlame2d_wedgeJulia, mglFlame2d_wedgeSph, + mglFlame2d_whorl, mglFlame2d_waves2, mglFlame2d_exp, mglFlame2d_log, mglFlame2d_sin, + mglFlame2d_cos, mglFlame2d_tan, mglFlame2d_sec, mglFlame2d_csc, mglFlame2d_cot, + mglFlame2d_sinh, mglFlame2d_cosh, mglFlame2d_tanh, mglFlame2d_sech, mglFlame2d_csch, + mglFlame2d_coth, mglFlame2d_auger, mglFlame2d_flux. +Значение dat[6,i] - весовой коэффициент для i-ой строки матрицы dat. Первые skip итераций будут опущены. Размеры массивов должны удовлетворять требованиям: dat.nx>=7, func.nx>=2 и func.nz=dat.ny. См. также ifs2d, ifs3d. См. flame2d sample, для примеров кода и графика. +

+ + + + +
+ + + +

4.12 Вычисление выражений

+ + +

В MGL скриптах в качестве аргументов команд можно использовать произвольные формулы от существующих массивов данных и констант. Есть только 2 ограничения: формула не должна содержать пробелов (чтобы распознаваться как один аргумент), формула не может быть аргументом, который может быть пересоздан при выполнении скрипта. +

+ + +
+ + + +

4.13 Special data classes

+ + +

MGL использует специальные классы автоматически. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

5 MathGL examples

+ + +

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. +

+ + + + + + + + + + +
+ +
+

+Next: , Up: Examples   [Contents][Index]

+
+ +

5.1 Basic usage

+ + +

MGL script can be used by several manners. Each has positive and negative sides: +

    +
  • Using UDAV. + +

    Positive sides are possibilities to view the plot at once and to modify it, rotate, zoom or switch on transparency or lighting by hands or by mouse. Negative side is the needness of the X-terminal.

    +
  • Using command line tools. + +

    Positive aspects are: batch processing of similar data set, for example, a set of resulting data files for different calculation parameters), running from the console program, including the cluster calculation), fast and automated drawing, saving pictures for further analysis, or demonstration). Negative sides are: the usage of the external program for picture viewing. Also, the data plotting is non-visual. So, you have to imagine the picture, view angles, lighting and so on) before the plotting. I recommend to use graphical window for determining the optimal parameters of plotting on the base of some typical data set. And later use these parameters for batch processing in console program. +

    +

    In this case you can use the program: mglconv or mglview for viewing. +

    +
  • Using C/C++/... code. + +

    You can easily execute MGL script within C/C++/Fortan code. This can be useful for fast data plotting, for example, in web applications, where textual string (MGL script) may contain all necessary information for plot. The basic C++ code may look as following +

    const char *mgl_script; // script itself, can be of type const wchar_t*
    +mglGraph gr;
    +mglParse pr;
    +pr.Execute(&gr, mgl_script);
    +
+ +

The simplest script is +

box         # draw bounding box
+axis        # draw axis
+fplot 'x^3' # draw some function
+
+

Just type it in UDAV and press F5. Also you can save it in text file `test.mgl` and type in the console mglconv test.mgl what produce file `test.mgl.png` with resulting picture. +

+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.2 Advanced usage

+ + +

Now I show several non-obvious features of MGL: several subplots in a single picture, curvilinear coordinates, text printing and so on. Generally you may miss this section at first reading, but I don`t recommend it. +

+ + + + + + + + + + + + + +
+ + + +

5.2.1 Subplots

+ + +

Let me demonstrate possibilities of plot positioning and rotation. MathGL has a set of functions: subplot, inplot, title, aspect and rotate and so on (see Subplots and rotation). The order of their calling is strictly determined. First, one changes the position of plot in image area (functions subplot, inplot and multiplot). Secondly, you can add the title of plot by title function. After that one may rotate the plot (command rotate). Finally, one may change aspects of axes (command aspect). The following code illustrates the aforesaid it: +

subplot 2 2 0
+box:text -1 1.1 'Just box' ':L'
+inplot 0.2 0.5 0.7 1 off
+box:text 0 1.2 'InPlot example'
+
+subplot 2 2 1:title 'Rotate only'
+rotate 50 60:box
+
+subplot 2 2 2:title 'Rotate and Aspect'
+rotate 50 60:aspect 1 1 2:box
+
+subplot 2 2 3:title 'Shear'
+box 'c':shear 0.2 0.1:box
+

Here I used function Puts for printing the text in arbitrary position of picture (see Text printing). Text coordinates and size are connected with axes. However, text coordinates may be everywhere, including the outside the bounding box. I`ll show its features later in Text features. +

+

Note that several commands can be placed in a string if they are separated by `:` symbol. +

+
Example of several subplots on the single picture. +
+

More complicated sample show how to use most of positioning functions: +

subplot 3 2 0:title 'StickPlot'
+stickplot 3 0 20 30:box 'r':text 0 0 0 '0' 'r'
+stickplot 3 1 20 30:box 'g':text 0 0 0 '1' 'g'
+stickplot 3 2 20 30:box 'b':text 0 0 0 '2' 'b'
+
+subplot 3 2 3 '':title 'ColumnPlot'
+columnplot 3 0:box 'r':text 0 0 '0' 'r'
+columnplot 3 1:box 'g':text 0 0 '1' 'g'
+columnplot 3 2:box 'b':text 0 0 '2' 'b'
+
+subplot 3 2 4 '':title 'GridPlot'
+gridplot 2 2 0:box 'r':text 0 0 '0' 'r'
+gridplot 2 2 1:box 'g':text 0 0 '1' 'g'
+gridplot 2 2 2:box 'b':text 0 0 '2' 'b'
+gridplot 2 2 3:box 'm':text 0 0 '3' 'm'
+
+subplot 3 2 5 '':title 'InPlot':box
+inplot 0.4 1 0.6 1 on:box 'r'
+
+multiplot 3 2 1 2 1 '':title 'MultiPlot and ShearPlot':box
+shearplot 3 0 0.2 0.1:box 'r':text 0 0 '0' 'r'
+shearplot 3 1 0.2 0.1:box 'g':text 0 0 '1' 'g'
+shearplot 3 2 0.2 0.1:box 'b':text 0 0 '2' 'b'
+
+
Example for most of positioning functions. +
+ +
+ + + +

5.2.2 Axis and ticks

+ + +

MathGL library can draw not only the bounding box but also the axes, grids, labels and so on. The ranges of axes and their origin (the point of intersection) are determined by functions SetRange(), SetRanges(), SetOrigin() (see Ranges (bounding box)). Ticks on axis are specified by function SetTicks, SetTicksVal, SetTicksTime (see Ticks). But usually +

+

Command axis draws axes. Its textual string shows in which directions the axis or axes will be drawn (by default "xyz", function draws axes in all directions). Command grid draws grid perpendicularly to specified directions. Example of axes and grid drawing is: +

subplot 2 2 0:title 'Axis origin, Grid'
+origin 0 0:axis:grid:fplot 'x^3'
+
+subplot 2 2 1:title '2 axis'
+ranges -1 1 -1 1:origin -1 -1:axis
+ylabel 'axis_1':fplot 'sin(pi*x)' 'r2'
+ranges 0 1 0 1:origin 1 1:axis
+ylabel 'axis_2':fplot 'cos(pi*x)'
+
+subplot 2 2 3:title 'More axis'
+origin nan nan:xrange -1 1:axis
+xlabel 'x' 0:ylabel 'y_1' 0:fplot 'x^2' 'k'
+yrange -1 1:origin -1.3 -1:axis 'y' 'r'
+ylabel '#r{y_2}' 0.2:fplot 'x^3' 'r'
+
+subplot 2 2 2:title '4 segments, inverted axis':origin 0 0:
+inplot 0.5 1 0.5 1 on:ranges 0 10 0 2:axis
+fplot 'sqrt(x/2)':xlabel 'W' 1:ylabel 'U' 1
+inplot 0 0.5 0.5 1 on:ranges 1 0 0 2:axis 'x'
+fplot 'sqrt(x)+x^3':xlabel '\tau' 1
+inplot 0.5 1 0 0.5 on:ranges 0 10 4 0:axis 'y'
+fplot 'x/4':ylabel 'L' -1
+inplot 0 0.5 0 0.5 on:ranges 1 0 4 0:fplot '4*x^2'
+
+

Note, that MathGL can draw not only single axis (which is default). But also several axis on the plot (see right plots). The idea is that the change of settings does not influence on the already drawn graphics. So, for 2-axes I setup the first axis and draw everything concerning it. Then I setup the second axis and draw things for the second axis. Generally, the similar idea allows one to draw rather complicated plot of 4 axis with different ranges (see bottom left plot). +

+

At this inverted axis can be created by 2 methods. First one is used in this sample - just specify minimal axis value to be large than maximal one. This method work well for 2D axis, but can wrongly place labels in 3D case. Second method is more general and work in 3D case too - just use aspect function with negative arguments. For example, following code will produce exactly the same result for 2D case, but 2nd variant will look better in 3D. +

# variant 1
+ranges 0 10 4 0:axis
+
+# variant 2
+ranges 0 10 0 4:aspect 1 -1:axis
+
+
Example of axis. +
+

Another MathGL feature is fine ticks tunning. By default (if it is not changed by SetTicks function), MathGL try to adjust ticks positioning, so that they looks most human readable. At this, MathGL try to extract common factor for too large or too small axis ranges, as well as for too narrow ranges. Last one is non-common notation and can be disabled by SetTuneTicks function. +

+

Also, one can specify its own ticks with arbitrary labels by help of SetTicksVal function. Or one can set ticks in time format. In last case MathGL will try to select optimal format for labels with automatic switching between years, months/days, hours/minutes/seconds or microseconds. However, you can specify its own time representation using formats described in http://www.manpagez.com/man/3/strftime/. Most common variants are `%X` for national representation of time, `%x` for national representation of date, `%Y` for year with century. +

+

The sample code, demonstrated ticks feature is +

subplot 3 3 0:title 'Usual axis'
+axis
+
+subplot 3 3 1:title 'Too big/small range'
+ranges -1000 1000 0 0.001:axis
+
+subplot 3 3 2:title 'LaTeX-like labels'
+axis 'F!'
+
+subplot 3 3 3:title 'Too narrow range'
+ranges 100 100.1 10 10.01:axis
+
+subplot 3 3 4:title 'No tuning, manual "+"'
+axis '+!'
+# for version <2.3 you can use
+#tuneticks off:axis
+
+subplot 3 3 5:title 'Template for ticks'
+xtick 'xxx:%g':ytick 'y:%g'
+axis
+
+xtick '':ytick '' # switch it off for other plots
+
+subplot 3 3 6:title 'No tuning, higher precision'
+axis '!4'
+
+subplot 3 3 7:title 'Manual ticks'
+ranges -pi pi 0 2
+xtick pi 3 '\pi'
+xtick 0.886 'x^*' on # note this will disable subticks drawing
+# or you can use
+#xtick -pi '\pi' -pi/2 '-\pi/2' 0 '0' 0.886 'x^*' pi/2 '\pi/2' pi 'pi'
+# or you can use
+#list v -pi -pi/2 0 0.886 pi/2 pi:xtick v '-\pi\n-\pi/2\n{}0\n{}x^*\n\pi/2\n\pi'
+axis:grid:fplot '2*cos(x^2)^2' 'r2'
+
+subplot 3 3 8:title 'Time ticks'
+xrange 0 3e5:ticktime 'x':axis
+
+
Features of axis ticks. +
+

The last sample I want to show in this subsection is Log-axis. From MathGL`s point of view, the log-axis is particular case of general curvilinear coordinates. So, we need first define new coordinates (see also Curvilinear coordinates) by help of SetFunc or SetCoor functions. At this one should wary about proper axis range. So the code looks as following: +

subplot 2 2 0 '<_':title 'Semi-log axis'
+ranges 0.01 100 -1 1:axis 'lg(x)' '' ''
+axis:grid 'xy' 'g':fplot 'sin(1/x)'
+xlabel 'x' 0:ylabel 'y = sin 1/x' 0
+
+subplot 2 2 1 '<_':title 'Log-log axis'
+ranges 0.01 100 0.1 100:axis 'lg(x)' 'lg(y)' ''
+axis:grid '!' 'h=':grid:fplot 'sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = \sqrt{1+x^2}' 0
+
+subplot 2 2 2 '<_':title 'Minus-log axis'
+ranges -100 -0.01 -100 -0.1:axis '-lg(-x)' '-lg(-y)' ''
+axis:fplot '-sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = -\sqrt{1+x^2}' 0
+
+subplot 2 2 3 '<_':title 'Log-ticks'
+ranges 0.01 100 0 100:axis 'sqrt(x)' '' ''
+axis:fplot 'x'
+xlabel 'x' 1:ylabel 'y = x' 0
+
+
Features of axis ticks. +
+

You can see that MathGL automatically switch to log-ticks as we define log-axis formula (in difference from v.1.*). Moreover, it switch to log-ticks for any formula if axis range will be large enough (see right bottom plot). Another interesting feature is that you not necessary define usual log-axis (i.e. when coordinates are positive), but you can define “minus-log” axis when coordinate is negative (see left bottom plot). +

+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.3 Curvilinear coordinates

+ + +

As I noted in previous subsection, MathGL support curvilinear coordinates. In difference from other plotting programs and libraries, MathGL uses textual formulas for connection of the old (data) and new (output) coordinates. This allows one to plot in arbitrary coordinates. The following code plots the line y=0, z=0 in Cartesian, polar, parabolic and spiral coordinates: +

origin -1 1 -1
+subplot 2 2 0:title 'Cartesian':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' '':
+subplot 2 2 1:title 'Cylindrical':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+axis '2*y*x' 'y*y - x*x' ''
+subplot 2 2 2:title 'Parabolic':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' 'x+z'
+subplot 2 2 3:title 'Spiral':rotate 50 60
+fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+
Example of curvilinear coordinates +
+ + +
+ + + +

5.2.4 Colorbars

+ + +

MathGL handle colorbar as special kind of axis. So, most of functions for axis and ticks setup will work for colorbar too. Colorbars can be in log-scale, and generally as arbitrary function scale; common factor of colorbar labels can be separated; and so on. +

+

But of course, there are differences - colorbars usually located out of bounding box. At this, colorbars can be at subplot boundaries (by default), or at bounding box (if symbol `I` is specified). Colorbars can handle sharp colors. And they can be located at arbitrary position too. The sample code, which demonstrate colorbar features is: +

call 'prepare2d'
+new v 9 'x'
+
+subplot 2 2 0:title 'Colorbar out of box':box
+colorbar '<':colorbar '>':colorbar '_':colorbar '^'
+
+subplot 2 2 1:title 'Colorbar near box':box
+colorbar '<I':colorbar '>I':colorbar '_I':colorbar '^I'
+
+subplot 2 2 2:title 'manual colors':box:contd v a
+colorbar v '<':colorbar v '>':colorbar v '_':colorbar v '^'
+
+subplot 2 2 3:title '':text -0.5 1.55 'Color positions' ':C' -2
+
+colorbar 'bwr>' 0.25 0:text -0.9 1.2 'Default'
+colorbar 'b{w,0.3}r>' 0.5 0:text -0.1 1.2 'Manual'
+
+crange 0.01 1e3
+colorbar '>' 0.75 0:text 0.65 1.2 'Normal scale'
+colorbar '>':text 1.35 1.2 'Log scale'
+
+
Example of colorbars +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.5 Bounding box

+ + +

Box around the plot is rather useful thing because it allows one to: see the plot boundaries, and better estimate points position since box contain another set of ticks. MathGL provide special function for drawing such box - box function. By default, it draw black or white box with ticks (color depend on transparency type, see Types of transparency). However, you can change the color of box, or add drawing of rectangles at rear faces of box. Also you can disable ticks drawing, but I don`t know why anybody will want it. The sample code, which demonstrate box features is: +

subplot 2 2 0:title 'Box (default)':rotate 50 60:box
+
+subplot 2 2 1:title 'colored':rotate 50 60:box 'r'
+
+subplot 2 2 2:title 'with faces':rotate 50 60:box '@'
+
+subplot 2 2 3:title 'both':rotate 50 60:box '@cm'
+
+
Example of Box() +
+ + +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.6 Ternary axis

+ + +

There are another unusual axis types which are supported by MathGL. These are ternary and quaternary axis. Ternary axis is special axis of 3 coordinates a, b, c which satisfy relation a+b+c=1. Correspondingly, quaternary axis is special axis of 4 coordinates a, b, c, d which satisfy relation a+b+c+d=1. +

+

Generally speaking, only 2 of coordinates (3 for quaternary) are independent. So, MathGL just introduce some special transformation formulas which treat a as `x`, b as `y` (and c as `z` for quaternary). As result, all plotting functions (curves, surfaces, contours and so on) work as usual, but in new axis. You should use ternary function for switching to ternary/quaternary coordinates. The sample code is: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':copy ry (1-rx)*rnd
+light on
+
+subplot 2 2 0:title 'Ordinary axis 3D':rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':zlabel 'Z'
+
+subplot 2 2 1:title 'Ternary axis (x+y+t=1)':ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y 'r2':plot rx ry 'q^ ':cont a:line 0.5 0 0 0.75 'g2'
+xlabel 'B':ylabel 'C':tlabel 'A'
+
+subplot 2 2 2:title 'Quaternary axis 3D':rotate 50 60:ternary 2
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'D'
+
+subplot 2 2 3:title 'Ternary axis 3D':rotate 50 60:ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'Z'
+
+
Ternary and Quaternary axis +
+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.7 Text features

+ + +

MathGL prints text by vector font. There are functions for manual specifying of text position (like Puts) and for its automatic selection (like Label, Legend and so on). MathGL prints text always in specified position even if it lies outside the bounding box. The default size of font is specified by functions SetFontSize* (see Font settings). However, the actual size of output string depends on subplot size (depends on functions SubPlot, InPlot). The switching of the font style (italic, bold, wire and so on) can be done for the whole string (by function parameter) or inside the string. By default MathGL parses TeX-like commands for symbols and indexes (see Font styles). +

+

Text can be printed as usual one (from left to right), along some direction (rotated text), or along a curve. Text can be printed on several lines, divided by new line symbol `\n`. +

+

Example of MathGL font drawing is: +

call 'prepare1d'
+
+subplot 2 2 0 ''
+text 0 1 'Text can be in ASCII and in Unicode'
+text 0 0.6 'It can be \wire{wire}, \big{big} or #r{colored}'
+text 0 0.2 'One can change style in string: \b{bold}, \i{italic, \b{both}}'
+text 0 -0.2 'Easy to \a{overline} or \u{underline}'
+text 0 -0.6 'Easy to change indexes ^{up} _{down} @{center}'
+text 0 -1 'It parse TeX: \int \alpha \cdot \
+\sqrt3{sin(\pi x)^2 + \gamma_{i_k}} dx'
+
+subplot 2 2 1 ''
+ text 0 0.5 '\sqrt{\frac{\alpha^{\gamma^2}+\overset 1{\big\infty}}{\sqrt3{2+b}}}' '@' -2
+text 0 -0.5 'Text can be printed\n{}on several lines'
+
+subplot 2 2 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn under a curve' 'Tr'
+
+subplot 2 2 3 '':line -1 -1 1 -1 'rA':text 0 -1 1 -1 'Horizontal'
+line -1 -1 1 1 'rA':text 0 0 1 1 'At angle' '@'
+line -1 -1 -1 1 'rA':text -1 0 -1 1 'Vertical'
+
+
Example of text printing +
+

You can change font faces by loading font files by function loadfont. Note, that this is long-run procedure. Font faces can be downloaded from MathGL website or from here. The sample code is: +

define d 0.25
+loadfont 'STIX':text 0 1.1 'default font (STIX)'
+loadfont 'adventor':text 0 1.1-d 'adventor font'
+loadfont 'bonum':text 0 1.1-2*d 'bonum font'
+loadfont 'chorus':text 0 1.1-3*d 'chorus font'
+loadfont 'cursor':text 0 1.1-4*d 'cursor font'
+loadfont 'heros':text 0 1.1-5*d 'heros font'
+loadfont 'heroscn':text 0 1.1-6*d 'heroscn font'
+loadfont 'pagella':text 0 1.1-7*d 'pagella font'
+loadfont 'schola':text 0 1.1-8*d 'schola font'
+loadfont 'termes':text 0 1.1-9*d 'termes font'
+
+
Example of font faces +
+ +
+ +
+

+Next: , Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.8 Legend sample

+ + +

Legend is one of standard ways to show plot annotations. Basically you need to connect the plot style (line style, marker and color) with some text. In MathGL, you can do it by 2 methods: manually using addlegend function; or use `legend` option (see Command options), which will use last plot style. In both cases, legend entries will be added into internal accumulator, which later used for legend drawing itself. clearlegend function allow you to remove all saved legend entries. +

+

There are 2 features. If plot style is empty then text will be printed without indent. If you want to plot the text with indent but without plot sample then you need to use space ` ` as plot style. Such style ` ` will draw a plot sample (line with marker(s)) which is invisible line (i.e. nothing) and print the text with indent as usual one. +

+

Command legend draw legend on the plot. The position of the legend can be selected automatic or manually. You can change the size and style of text labels, as well as setup the plot sample. The sample code demonstrating legend features is: +

addlegend 'sin(\pi {x^2})' 'b'
+addlegend 'sin(\pi x)' 'g*'
+addlegend 'sin(\pi \sqrt{x})' 'rd'
+addlegend 'jsut text' ' '
+addlegend 'no indent for this' ''
+
+subplot 2 2 0 '':title 'Legend (default)':box
+legend
+
+text 0.75 0.65 'Absolute position' 'A'
+legend 3 'A#'
+
+subplot 2 2 2 '':title 'coloring':box
+legend 0 'r#':legend 1 'Wb#':legend 2 'ygr#'
+
+subplot 2 2 3 '':title 'manual position':box
+legend 0.5 1:text 0.5 0.55 'at x=0.5, y=1' 'a'
+legend 1 '#-':text 0.75 0.25 'Horizontal legend' 'a'
+
+
Example of legend +
+ +
+ +
+

+Previous: , Up: Advanced usage   [Contents][Index]

+
+ +

5.2.9 Cutting sample

+ + +

The last common thing which I want to show in this section is how one can cut off points from plot. There are 4 mechanism for that. +

    +
  • You can set one of coordinate to NAN value. All points with NAN values will be omitted. + +
  • You can enable cutting at edges by SetCut function. As result all points out of bounding box will be omitted. + +
  • You can set cutting box by SetCutBox function. All points inside this box will be omitted. + +
  • You can define cutting formula by SetCutOff function. All points for which the value of formula is nonzero will be omitted. Note, that this is the slowest variant. +
+ +

Below I place the code which demonstrate last 3 possibilities: +

call 'prepare2d'
+call 'prepare3d'
+
+subplot 2 2 0:title 'Cut on (default)':rotate 50 60
+light on:box:surf a; zrange -1 0.5
+
+subplot 2 2 1:title 'Cut off':rotate 50 60
+box:surf a; zrange -1 0.5; cut off
+
+subplot 2 2 2:title 'Cut in box':rotate 50 60:box:alpha on
+cut 0 -1 -1 1 0 1.1:surf3 c
+cut 0 0 0 0 0 0	# restore back
+
+subplot 2 2 3:title 'Cut by formula':rotate 50 60:box
+cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)':surf3 c
+
+
Example of point cutting +
+ + + +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.3 Data handling

+ + +

Class mglData contains all functions for the data handling in MathGL (see Data processing). There are several matters why I use class mglData but not a single array: it does not depend on type of data (mreal or double), sizes of data arrays are kept with data, memory working is simpler and safer. +

+ + + + + + +
+ +
+

+Next: , Up: Data handling   [Contents][Index]

+
+ +

5.3.1 Array creation

+ + +

One can put numbers into the data instance by several ways. Let us do it for square function: +

    +
  • one can create array by list command +
    list a 0 0.04 0.16 0.36 0.64 1
    +
    +
  • another way is to copy from “inline” array +
    copy a [0,0.04,0.16,0.36,0.64,1]
    +
    +
  • next way is to fill the data by textual formula with the help of modify function +
    new a 6
    +modify a 'x^2'
    +
    +
  • or one may fill the array in some interval and modify it later +
    new a 6
    +fill a 0 1
    +modify a 'u^2'
    +
    +
  • or fill the array using current axis range +
    new a 6
    +fill a '(x+1)^2/4'
    +

    or use single line +

    new a 6 '(x+1)^2/4'
    +
    +
  • finally it can be loaded from file +
    new s 6 '(x+1)^2/4'
    +save s 'sqr.dat'    # create file first
    +read a 'sqr.dat'    # load it
    +
    +
  • at this one can read only part of data +
    new s 6 '(x+1)^2/4'
    +save s 'sqr.dat'    # create file first
    +read a 'sqr.dat' 5  # load it
    +
+ +

Creation of 2d- and 3d-arrays is mostly the same. One can use direct data filling by list command +

list a 11 12 13 | 21 22 23 | 31 32 33
+

or by inline arrays +

copy a [[11,12,13],[21,22,23],[31,32,33]]
+

Also data can be filled by formula +

new z 30 40 'sin(pi*x)*cos(pi*y)'
+

or loaded from a file. +

+ +
+ +
+

+Previous: , Up: Data handling   [Contents][Index]

+
+ +

5.3.2 Change data

+ + +

MathGL has functions for data processing: differentiating, integrating, smoothing and so on (for more detail, see Data processing). Let us consider some examples. The simplest ones are integration and differentiation. The direction in which operation will be performed is specified by textual string, which may contain symbols `x`, `y` or `z`. For example, the call of diff 'x' will differentiate data along `x` direction; the call of integrate 'xy' perform the double integration of data along `x` and `y` directions; the call of diff2 'xyz' will apply 3d Laplace operator to data and so on. Example of this operations on 2d array a=x*y is presented in code: +

ranges 0 1 0 1 0 1:new a 30 40 'x*y'
+subplot 2 2 0:title 'a(x,y)':rotate 60 40
+surf a:box
+
+subplot 2 2 1:title 'da/dx':rotate 60 40
+diff a 'x':surf a:box
+
+subplot 2 2 2:title '\int da/dx dxdy':rotate 60 40
+integrate a 'xy':surf a:box
+
+subplot 2 2 3:title '\int {d^2}a/dxdy dx':rotate 60 40
+diff2 a 'y':surf a:box
+
+
Example of data differentiation and integration +
+

Data smoothing (command smooth) is more interesting and important. This function has single argument which define type of smoothing and its direction. Now 3 methods are supported: `3` - linear averaging by 3 points, `5` - linear averaging by 5 points, and default one - quadratic averaging by 5 points. +

+

MathGL also have some amazing functions which is not so important for data processing as useful for data plotting. There are functions for finding envelope (useful for plotting rapidly oscillating data), for data sewing (useful to removing jumps on the phase), for data resizing (interpolation). Let me demonstrate it: +

subplot 2 2 0 '':title 'Envelop sample'
+new d1 1000 'exp(-8*x^2)*sin(10*pi*x)'
+axis:plot d1 'b'
+envelop d1 'x'
+plot d1 'r'
+
+subplot 2 2 1 '':title 'Smooth sample':ranges 0 1 0 1
+new y0 30 '0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd'
+copy y1 y0:smooth y1 'x3':plot y1 'r';legend '"3" style'
+copy y2 y0:smooth y2 'x5':plot y2 'g';legend '"5" style'
+copy y3 y0:smooth y3 'x':plot y3 'b';legend 'default'
+plot y0 '{m7}:s';legend 'none':legend:box
+
+subplot 2 2 2:title 'Sew sample':rotate 50 60:light on:alpha on
+new d2 100 100 'mod((y^2-(1-x)^2)/2,0.1)'
+box:surf d2 'b'
+sew d2 'xy' 0.1
+surf d2 'r'
+
+subplot 2 2 3:title 'Resize sample (interpolation)'
+new x0 10 'rnd':new v0 10 'rnd'
+resize x1 x0 100:resize v1 v0 100
+plot x0 v0 'b+ ':plot x1 v1 'r-':label x0 v0 '%n'
+
+
Example of data smoothing +
+

Finally one can create new data arrays on base of the existing one: extract slice, row or column of data (subdata), summarize along a direction(s) (sum), find distribution of data elements (hist) and so on. +

+

Another interesting feature of MathGL is interpolation and root-finding. There are several functions for linear and cubic spline interpolation (see Interpolation). Also there is a function evaluate which do interpolation of data array for values of each data element of index data. It look as indirect access to the data elements. +

+

This function have inverse function solve which find array of indexes at which data array is equal to given value (i.e. work as root finding). But solve function have the issue - usually multidimensional data (2d and 3d ones) have an infinite number of indexes which give some value. This is contour lines for 2d data, or isosurface(s) for 3d data. So, solve function will return index only in given direction, assuming that other index(es) are the same as equidistant index(es) of original data. Let me demonstrate this on the following sample. +

+
zrange 0 1
+new x 20 30 '(x+2)/3*cos(pi*y)'
+new y 20 30 '(x+2)/3*sin(pi*y)'
+new z 20 30 'exp(-6*x^2-2*sin(pi*y)^2)'
+
+subplot 2 1 0:title 'Cartesian space':rotate 30 -40
+axis 'xyzU':box
+xlabel 'x':ylabel 'y'origin 1 1:grid 'xy'
+mesh x y z
+
+# section along 'x' direction
+solve u x 0.5 'x'
+var v u.nx 0 1
+evaluate yy y u v
+evaluate xx x u v
+evaluate zz z u v
+plot xx yy zz 'k2o'
+
+# 1st section along 'y' direction
+solve u1 x -0.5 'y'
+var v1 u1.nx 0 1
+evaluate yy y v1 u1
+evaluate xx x v1 u1
+evaluate zz z v1 u1
+plot xx yy zz 'b2^'
+
+# 2nd section along 'y' direction
+solve u2 x -0.5 'y' u1
+evaluate yy y v1 u2
+evaluate xx x v1 u2
+evaluate zz z v1 u2
+plot xx yy zz 'r2v'
+
+subplot 2 1 1:title 'Accompanied space'
+ranges 0 1 0 1:origin 0 0
+axis:box:xlabel 'i':ylabel 'j':grid2 z 'h'
+
+plot u v 'k2o':line 0.4 0.5 0.8 0.5 'kA'
+plot v1 u1 'b2^':line 0.5 0.15 0.5 0.3 'bA'
+plot v1 u2 'r2v':line 0.5 0.7 0.5 0.85 'rA'
+
+
Example of data interpolation and root finding +
+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.4 Data plotting

+ + +

Let me now show how to plot the data. Next section will give much more examples for all plotting functions. Here I just show some basics. MathGL generally has 2 types of plotting functions. Simple variant requires a single data array for plotting, other data (coordinates) are considered uniformly distributed in axis range. Second variant requires data arrays for all coordinates. It allows one to plot rather complex multivalent curves and surfaces (in case of parametric dependencies). Usually each function have one textual argument for plot style and accept options (see Command options). +

+

Note, that the call of drawing function adds something to picture but does not clear the previous plots (as it does in Matlab). Another difference from Matlab is that all setup (like transparency, lightning, axis borders and so on) must be specified before plotting functions. +

+

Let start for plots for 1D data. Term “1D data” means that data depend on single index (parameter) like curve in parametric form {x(i),y(i),z(i)}, i=1...n. The textual argument allow you specify styles of line and marks (see Line styles). If this parameter is empty '' then solid line with color from palette is used (see Palette and colors). +

+

Below I shall show the features of 1D plotting on base of plot function. Let us start from sinus plot: +

new y0 50 'sin(pi*x)'
+subplot 2 2 0
+plot y0:box
+

Style of line is not specified in plot function. So MathGL uses the solid line with first color of palette (this is blue). Next subplot shows array y1 with 2 rows: +

subplot 2 2 1
+new y1 50 2
+fill y1 'cos(pi*(x+y/4))*2/(y+3)'
+plot y1:box
+

As previously I did not specify the style of lines. As a result, MathGL again uses solid line with next colors in palette (there are green and red). Now let us plot a circle on the same subplot. The circle is parametric curve x=cos(\pi t), y=sin(\pi t). I will set the color of the circle (dark yellow, `Y`) and put marks `+` at point position: +

new x 50 'cos(pi*x)'
+plot x y0 'Y+'
+

Note that solid line is used because I did not specify the type of line. The same picture can be achieved by plot and subdata functions. Let us draw ellipse by orange dash line: +

plot y1(:,0) y1(:,1) 'q|'
+
+

Drawing in 3D space is mostly the same. Let us draw spiral with default line style. Now its color is 4-th color from palette (this is cyan): +

subplot 2 2 2:rotate 60 40
+new z 50 'x'
+plot x y0 z:box
+

Functions plot and subdata make 3D curve plot but for single array. Use it to put circle marks on the previous plot: +

new y2 10 3 'cos(pi*(x+y/2))'
+modify y2 '2*x-1' 2
+plot y2(:,0) y2(:,1) y2(:,2) 'bo '
+

Note that line style is empty ` ` here. Usage of other 1D plotting functions looks similar: +

subplot 2 2 3:rotate 60 40
+bars x y0 z 'r':box
+
+

Surfaces surf and other 2D plots (see 2D plotting) are drown the same simpler as 1D one. The difference is that the string parameter specifies not the line style but the color scheme of the plot (see Color scheme). Here I draw attention on 4 most interesting color schemes. There is gray scheme where color is changed from black to white (string `kw`) or from white to black (string `wk`). Another scheme is useful for accentuation of negative (by blue color) and positive (by red color) regions on plot (string `"BbwrR"`). Last one is the popular “jet” scheme (string `"BbcyrR"`). +

+

Now I shall show the example of a surface drawing. At first let us switch lightning on +

light on
+

and draw the surface, considering coordinates x,y to be uniformly distributed in axis range +

new a0 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+subplot 2 2 0:rotate 60 40
+surf a0:box
+

Color scheme was not specified. So previous color scheme is used. In this case it is default color scheme (“jet”) for the first plot. Next example is a sphere. The sphere is parametrically specified surface: +

new x 50 40 '0.8*sin(pi*x)*cos(pi*y/2)'
+new y 50 40 '0.8*cos(pi*x)*cos(pi*y/2)'
+new z 50 40 '0.8*sin(pi*y/2)'
+subplot 2 2 1:rotate 60 40
+surf x y z 'BbwrR':box
+

I set color scheme to "BbwrR" that corresponds to red top and blue bottom of the sphere. +

+

Surfaces will be plotted for each of slice of the data if nz>1. Next example draws surfaces for data arrays with nz=3: +

new a1 50 40 3
+modify a1 '0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))'
+modify a1 '0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*sin(3*pi*(x*y))' 1
+modify a1 '0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))' 2
+subplot 2 2 2:rotate 60 40
+alpha on
+surf a1:box
+

Note, that it may entail a confusion. However, if one will use density plot then the picture will look better: +

subplot 2 2 3:rotate 60 40
+dens a1:box
+
+

Drawing of other 2D plots is analogous. The only peculiarity is the usage of flag `#`. By default this flag switches on the drawing of a grid on plot (grid or mesh for plots in plain or in volume). However, for isosurfaces (including surfaces of rotation axial) this flag switches the face drawing off and figure becomes wired. +

+ +
+ +
+

+Next: , Previous: , Up: Examples   [Contents][Index]

+
+ +

5.5 Hints

+ + +

In this section I`ve included some small hints and advices for the improving of the quality of plots and for the demonstration of some non-trivial features of MathGL library. In contrast to previous examples I showed mostly the idea but not the whole drawing function. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

5.5.1 “Compound” graphics

+ + +

As I noted above, MathGL functions (except the special one, like Clf()) do not erase the previous plotting but just add the new one. It allows one to draw “compound” plots easily. For example, popular Matlab command surfc can be emulated in MathGL by 2 calls: +

  Surf(a);
+  Cont(a, "_");     // draw contours at bottom
+

Here a is 2-dimensional data for the plotting, -1 is the value of z-coordinate at which the contour should be plotted (at the bottom in this example). Analogously, one can draw density plot instead of contour lines and so on. +

+

Another nice plot is contour lines plotted directly on the surface: +

  Light(true);       // switch on light for the surface
+  Surf(a, "BbcyrR"); // select 'jet' colormap for the surface
+  Cont(a, "y");      // and yellow color for contours
+

The possible difficulties arise in black&white case, when the color of the surface can be close to the color of a contour line. In that case I may suggest the following code: +

  Light(true);   // switch on light for the surface
+  Surf(a, "kw"); // select 'gray' colormap for the surface
+  CAxis(-1,0);   // first draw for darker surface colors
+  Cont(a, "w");  // white contours
+  CAxis(0,1);    // now draw for brighter surface colors
+  Cont(a, "k");  // black contours
+  CAxis(-1,1);   // return color range to original state
+

The idea is to divide the color range on 2 parts (dark and bright) and to select the contrasting color for contour lines for each of part. +

+

Similarly, one can plot flow thread over density plot of vector field amplitude (this is another amusing plot from Matlab) and so on. The list of compound graphics can be prolonged but I hope that the general idea is clear. +

+

Just for illustration I put here following sample code: +

call 'prepare2v'
+call 'prepare3d'
+new v 10:fill v -0.5 1:copy d sqrt(a^2+b^2)
+subplot 2 2 0:title 'Surf + Cont':rotate 50 60:light on:box
+surf a:cont a 'y'
+
+subplot 2 2 1 '':title 'Flow + Dens':light off:box
+flow a b 'br':dens d
+
+subplot 2 2 2:title 'Mesh + Cont':rotate 50 60:box
+mesh a:cont a '_'
+
+subplot 2 2 3:title 'Surf3 + ContF3':rotate 50 60:light on
+box:contf3 v c 'z' 0:contf3 v c 'x':contf3 v c
+cut 0 -1 -1 1 0 1.1
+contf3 v c 'z' c.nz-1:surf3 c -0.5
+
+
Example of “combined” plots +
+ +
+ + + +

5.5.2 Transparency and lighting

+ + +

Here I want to show how transparency and lighting both and separately change the look of a surface. So, there is code and picture for that: +

call 'prepare2d'
+subplot 2 2 0:title 'default':rotate 50 60:box
+surf a
+
+subplot 2 2 1:title 'light on':rotate 50 60:box
+light on:surf a
+
+subplot 2 2 3:title 'light on; alpha on':rotate 50 60:box
+alpha on:surf a
+
+subplot 2 2 2:title 'alpha on':rotate 50 60:box
+light off:surf a
+
+
Example of transparency and lightings +
+ +
+ + + +

5.5.3 Types of transparency

+ + +

MathGL library has advanced features for setting and handling the surface transparency. The simplest way to add transparency is the using of command alpha. As a result, all further surfaces (and isosurfaces, density plots and so on) become transparent. However, their look can be additionally improved. +

+

The value of transparency can be different from surface to surface. To do it just use SetAlphaDef before the drawing of the surface, or use option alpha (see Command options). If its value is close to 0 then the surface becomes more and more transparent. Contrary, if its value is close to 1 then the surface becomes practically non-transparent. +

+

Also you can change the way how the light goes through overlapped surfaces. The function SetTranspType defines it. By default the usual transparency is used (`0`) - surfaces below is less visible than the upper ones. A “glass-like” transparency (`1`) has a different look - each surface just decreases the background light (the surfaces are commutable in this case). +

+

A “neon-like” transparency (`2`) has more interesting look. In this case a surface is the light source (like a lamp on the dark background) and just adds some intensity to the color. At this, the library sets automatically the black color for the background and changes the default line color to white. +

+

As example I shall show several plots for different types of transparency. The code is the same except the values of SetTranspType function: +

call 'prepare2d'
+alpha on:light on
+transptype 0:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Example of SetTranspType(0). +
Example of SetTranspType(1). +
Example of SetTranspType(2). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.4 Axis projection

+ + +

You can easily make 3D plot and draw its x-,y-,z-projections (like in CAD) by using ternary function with arguments: 4 for Cartesian, 5 for Ternary and 6 for Quaternary coordinates. The sample code is: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample':ternary 4:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+
Example of axis projections +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.5 Adding fog

+ + +

MathGL can add a fog to the image. Its switching on is rather simple - just use fog function. There is the only feature - fog is applied for whole image. Not to particular subplot. The sample code is: +

call 'prepare2d'
+title 'Fog sample':rotate 50 60:light on
+fog 1
+box:surf a:cont a 'y'
+
+
Example of Fog(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.6 Lighting sample

+ + +

In contrast to the most of other programs, MathGL supports several (up to 10) light sources. Moreover, the color each of them can be different: white (this is usual), yellow, red, cyan, green and so on. The use of several light sources may be interesting for the highlighting of some peculiarities of the plot or just to make an amusing picture. Note, each light source can be switched on/off individually. The sample code is: +

call 'prepare2d'
+title 'Several light sources':rotate 50 60:light on
+light 1 0 1 0 'c':light 2 1 0 0 'y':light 3 0 -1 0 'm'
+box:surf a 'h'
+
+
Example of several light sources. +
+

Additionally, you can use local light sources and set to use diffuse reflection instead of specular one (by default) or both kinds. Note, I use attachlight command to keep light settings relative to subplot. +

light on: attachlight on
+call 'prepare2d'
+subplot 2 2 0:title 'Default':rotate 50 60:box:surf a
+line -1 -0.7 1.7 -1 -0.7 0.7 'BA'
+
+subplot 2 2 1:title 'Local':rotate 50 60
+light 0 1 0 1 -2 -1 -1
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 2:title 'no diffuse':rotate 50 60
+diffuse 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 3:title 'diffusive only':rotate 50 60
+diffuse 0.5:light 0 1 0 1 -2 -1 -1 'w' 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+
Example of different types of lighting. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.7 Using primitives

+ + +

MathGL provide a set of functions for drawing primitives (see Primitives). Primitives are low level object, which used by most of plotting functions. Picture below demonstrate some of commonly used primitives. +

subplot 2 2 0 '':title 'Line, Curve, Rhomb, Ellipse' '' -1.5
+line -1 -1 -0.5 1 'qAI'
+curve -0.6 -1 1 1 0 1 1 1 'rA'
+ball 0 -0.5 '*':ball 1 -0.1 '*'
+rhomb 0 0.4 1 0.9 0.2 'b#'
+rhomb 0 0 1 0.4 0.2 'cg@'
+ellipse 0 -0.5 1 -0.1 0.2 'u#'
+ellipse 0 -1 1 -0.6 0.2 'm@'
+
+light on
+subplot 2 2 1:title 'Face[xyz]':rotate 50 60:box
+facex 1 0 -1 1 1 'r':facey -1 -1 -1 1 1 'g':facez 1 -1 -1 -1 1 'b'
+face -1 -1 1 -1 1 1 1 -1 0 1 1 1 'bmgr'
+
+subplot 2 2 3 '':title 'Cone'
+cone -0.7 -0.3 0 -0.7 0.7 0.5 0.2 0.1 'b':text -0.7 -0.7 'no edges\n(default)'
+cone 0 -0.3 0 0 0.7 0.5 0.2 0.1 'g@':text 0 -0.7 'with edges\n('\@' style)'
+cone 0.7 -0.3 0 0.7 0.7 0.5 0.2 0.1 'ry':text 0.7 -0.7 '"arrow" with\n{}gradient'
+
+subplot 2 2 2 '':title 'Sphere and Drop'
+line -0.9 0 1 0.9 0 1
+text -0.9 -0.7 'sh=0':drop -0.9 0 0 1 0.5 'r' 0:ball -0.9 0 1 'k'
+text -0.3 -0.7 'sh=0.33':drop -0.3 0 0 1 0.5 'r' 0.33:ball -0.3 0 1 'k'
+text 0.3 -0.7 'sh=0.67':drop 0.3 0 0 1 0.5 'r' 0.67:ball 0.3 0 1 'k'
+text 0.9 -0.7 'sh=1':drop 0.9 0 0 1 0.5 'r' 1:ball 0.9 0 1 'k'
+
+
Primitives in MathGL. +
+

Generally, you can create arbitrary new kind of plot using primitives. For example, MathGL don`t provide any special functions for drawing molecules. However, you can do it using only one type of primitives drop. The sample code is: +

alpha on:light on
+subplot 2 2 0 '':title 'Methane, CH_4':rotate 60 120
+sphere 0 0 0 0.25 'k':drop 0 0 0 0 0 1 0.35 'h' 1 2:sphere 0 0 0.7 0.25 'g'
+drop 0 0 0 -0.94 0 -0.33 0.35 'h' 1 2:sphere -0.66 0 -0.23 0.25 'g'
+drop 0 0 0 0.47 0.82 -0.33 0.35 'h' 1 2:sphere 0.33 0.57 -0.23 0.25 'g'
+drop 0 0 0 0.47 -0.82 -0.33 0.35 'h' 1 2:sphere 0.33 -0.57 -0.23 0.25 'g'
+
+subplot 2 2 1 '':title 'Water, H{_2}O':rotate 60 100
+sphere 0 0 0 0.25 'r':drop 0 0 0 0.3 0.5 0 0.3 'm' 1 2:sphere 0.3 0.5 0 0.25 'g'
+drop 0 0 0 0.3 -0.5 0 0.3 'm' 1 2:sphere 0.3 -0.5 0 0.25 'g'
+
+subplot 2 2 2 '':title 'Oxygen, O_2':rotate 60 120
+drop 0 0.5 0 0 -0.3 0 0.3 'm' 1 2:sphere 0 0.5 0 0.25 'r'
+drop 0 -0.5 0 0 0.3 0 0.3 'm' 1 2:sphere 0 -0.5 0 0.25 'r'
+
+subplot 2 2 3 '':title 'Ammonia, NH_3':rotate 60 120
+sphere 0 0 0 0.25 'b':drop 0 0 0 0.33 0.57 0 0.32 'n' 1 2
+sphere 0.33 0.57 0 0.25 'g':drop 0 0 0 0.33 -0.57 0 0.32 'n' 1 2
+sphere 0.33 -0.57 0 0.25 'g':drop 0 0 0 -0.65 0 0 0.32 'n' 1 2
+sphere -0.65 0 0 0.25 'g'
+
+
Example of molecules drawing. +
+

Moreover, some of special plots can be more easily produced by primitives rather than by specialized function. For example, Venn diagram can be produced by Error plot: +

list x -0.3 0 0.3:list y 0.3 -0.3 0.3:list e 0.7 0.7 0.7
+title 'Venn-like diagram':alpha on
+error x y e e '!rgb@#o'
+

You see that you have to specify and fill 3 data arrays. The same picture can be produced by just 3 calls of circle function: +

title 'Venn-like diagram':alpha on
+circle -0.3 0.3 0.7 'rr@'
+circle 0 -0.3 0.7 'gg@'
+circle 0.3 0.3 0.7 'bb@'
+

Of course, the first variant is more suitable if you need to plot a lot of circles. But for few ones the usage of primitives looks easy. +

+
Example of Venn diagram. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.8 STFA sample

+ + +

Short-time Fourier Analysis (stfa) is one of informative method for analyzing long rapidly oscillating 1D data arrays. It is used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. +

+

MathGL can find and draw STFA result. Just to show this feature I give following sample. Initial data arrays is 1D arrays with step-like frequency. Exactly this you can see at bottom on the STFA plot. The sample code is: +

new a 2000:new b 2000
+fill a 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)'
+
+subplot 1 2 0 '<_':title 'Initial signal'
+plot a:axis:xlabel '\i t'
+
+subplot 1 2 1 '<_':title 'STFA plot'
+stfa a b 64:axis:ylabel '\omega' 0:xlabel '\i t'
+
+
Example of STFA(). +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.9 Mapping visualization

+ + +

Sometime ago I worked with mapping and have a question about its visualization. Let me remember you that mapping is some transformation rule for one set of number to another one. The 1d mapping is just an ordinary function - it takes a number and transforms it to another one. The 2d mapping (which I used) is a pair of functions which take 2 numbers and transform them to another 2 ones. Except general plots (like surfc, surfa) there is a special plot - Arnold diagram. It shows the area which is the result of mapping of some initial area (usually square). +

+

I tried to make such plot in map. It shows the set of points or set of faces, which final position is the result of mapping. At this, the color gives information about their initial position and the height describes Jacobian value of the transformation. Unfortunately, it looks good only for the simplest mapping but for the real multivalent quasi-chaotic mapping it produces a confusion. So, use it if you like :). +

+

The sample code for mapping visualization is: +

new a 50 40 'x':new b 50 40 'y':zrange -2 2:text 0 0 '\to'
+subplot 2 1 0:text 0 1.1 '\{x, y\}' '' -2:box
+map a b 'brgk'
+
+subplot 2 1 1:box
+text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2
+fill a '(x^3+y^3)/2':fill b '(x-y)/2':map a b 'brgk'
+
+
Example of Map(). +
+ +
+ + + +

5.5.10 Data interpolation

+ + +

There are many functions to get interpolated values of a data array. Basically all of them can be divided by 3 categories: +

    +
  1. functions which return single value at given point (see Interpolation and mglGSpline() in Global functions); +
  2. functions subdata and evaluate for indirect access to data elements; +
  3. functions refill, gspline and datagrid which fill regular (rectangular) data array by interpolated values. +
+ +

The usage of first category is rather straightforward and don`t need any special comments. +

+

There is difference in indirect access functions. Function subdata use use step-like interpolation to handle correctly single nan values in the data array. Contrary, function evaluate use local spline interpolation, which give smoother output but spread nan values. So, subdata should be used for specific data elements (for example, for given column), and evaluate should be used for distributed elements (i.e. consider data array as some field). Following sample illustrates this difference: +

subplot 1 1 0 '':title 'SubData vs Evaluate'
+new in 9 'x^3/1.1':plot in 'ko ':box
+new arg 99 '4*x+4'
+evaluate e in arg off:plot e 'b.'; legend 'Evaluate'
+subdata s in arg:plot s 'r.';legend 'SubData'
+legend 2
+
+
Example of indirect data access. +
+

Example of datagrid usage is done in Making regular data. Here I want to show the peculiarities of refill and gspline functions. Both functions require argument(s) which provide coordinates of the data values, and return rectangular data array which equidistantly distributed in axis range. So, in opposite to evaluate function, refill and gspline can interpolate non-equidistantly distributed data. At this both functions refill and gspline provide continuity of 2nd derivatives along coordinate(s). However, refill is slower but give better (from human point of view) result than global spline gspline due to more advanced algorithm. Following sample illustrates this difference: +

new x 10 '0.5+rnd':cumsum x 'x':norm x -1 1
+copy y sin(pi*x)/1.5
+subplot 2 2 0 '<_':title 'Refill sample'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:refill r x y:plot r 'r'
+
+subplot 2 2 1 '<_':title 'Global spline'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:gspline r x y:plot r 'r'
+
+new y 10 '0.5+rnd':cumsum y 'x':norm y -1 1
+copy xx x:extend xx 10
+copy yy y:extend yy 10:transpose yy
+copy z sin(pi*xx*yy)/1.5
+alpha on:light on
+subplot 2 2 2:title '2d regular':rotate 40 60
+box:axis:mesh xx yy z 'k'
+new rr 100 100:refill rr x y z:surf rr
+
+new xx 10 10 '(x+1)/2*cos(y*pi/2-1)'
+new yy 10 10 '(x+1)/2*sin(y*pi/2-1)'
+copy z sin(pi*xx*yy)/1.5
+subplot 2 2 3:title '2d non-regular':rotate 40 60
+box:axis:plot xx yy z 'ko '
+new rr 100 100:refill rr xx yy z:surf rr
+
+
Example of non-equidistant data interpolation. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.11 Making regular data

+ + +

Sometimes, one have only unregular data, like as data on triangular grids, or experimental results and so on. Such kind of data cannot be used as simple as regular data (like matrices). Only few functions, like dots, can handle unregular data as is. +

+

However, one can use built in triangulation functions for interpolating unregular data points to a regular data grids. There are 2 ways. First way, one can use triangulation function to obtain list of vertexes for triangles. Later this list can be used in functions like triplot or tricont. Second way consist in usage of datagrid function, which fill regular data grid by interpolated values, assuming that coordinates of the data grid is equidistantly distributed in axis range. Note, you can use options (see Command options) to change default axis range as well as in other plotting functions. +

new x 100 '2*rnd-1':new y 100 '2*rnd-1':copy z x^2-y^2
+# first way - plot triangular surface for points
+triangulate d x y
+title 'Triangulation'
+rotate 50 60:box:light on
+triplot d x y z:triplot d x y z '#k'
+# second way - make regular data and plot it
+new g 30 30:datagrid g x y z:mesh g 'm'
+
+
Example of triangulation. +
+ +
+ + + +

5.5.12 Making histogram

+ + +

Using the hist function(s) for making regular distributions is one of useful fast methods to process and plot irregular data. Hist can be used to find some momentum of set of points by specifying weight function. It is possible to create not only 1D distributions but also 2D and 3D ones. Below I place the simplest sample code which demonstrate hist usage: +

new x 10000 '2*rnd-1':new y 10000 '2*rnd-1':copy z exp(-6*(x^2+y^2))
+hist xx x z:norm xx 0 1:hist yy y z:norm yy 0 1
+multiplot 3 3 3 2 2 '':ranges -1 1 -1 1 0 1:box:dots x y z 'wyrRk'
+multiplot 3 3 0 2 1 '':ranges -1 1 0 1:box:bars xx
+multiplot 3 3 5 1 2 '':ranges 0 1 -1 1:box:barh yy
+subplot 3 3 2:text 0.5 0.5 'Hist and\n{}MultiPlot\n{}sample' 'a' -3
+
+
Example of Hist(). +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.13 Nonlinear fitting hints

+ + +

Nonlinear fitting is rather simple. All that you need is the data to fit, the approximation formula and the list of coefficients to fit (better with its initial guess values). Let me demonstrate it on the following simple example. First, let us use sin function with some random noise: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+

and plot it to see that data we will fit +

title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+
+

The next step is the fitting itself. For that let me specify an initial values ini for coefficients `abc` and do the fitting for approximation formula `a+b*sin(c*x)` +

list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+

Now display it +

plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r'
+text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+

NOTE! the fitting results may have strong dependence on initial values for coefficients due to algorithm features. The problem is that in general case there are several local "optimums" for coefficients and the program returns only first found one! There are no guaranties that it will be the best. Try for example to set ini[3] = {0, 0, 0} in the code above. +

+

The full sample code for nonlinear fitting is: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r'
+text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+
Example of nonlinear fitting. +
+ +
+ + + +

5.5.14 PDE solving hints

+ + +

Solving of Partial Differential Equations (PDE, including beam tracing) and ray tracing (or finding particle trajectory) are more or less common task. So, MathGL have several functions for that. There are ray for ray tracing, pde for PDE solving, qo2d for beam tracing in 2D case (see Global functions). Note, that these functions take “Hamiltonian” or equations as string values. And I don`t plan now to allow one to use user-defined functions. There are 2 reasons: the complexity of corresponding interface; and the basic nature of used methods which are good for samples but may not good for serious scientific calculations. +

+

The ray tracing can be done by ray function. Really ray tracing equation is Hamiltonian equation for 3D space. So, the function can be also used for finding a particle trajectory (i.e. solve Hamiltonian ODE) for 1D, 2D or 3D cases. The function have a set of arguments. First of all, it is Hamiltonian which defined the media (or the equation) you are planning to use. The Hamiltonian is defined by string which may depend on coordinates `x`, `y`, `z`, time `t` (for particle dynamics) and momentums `p`=p_x, `q`=p_y, `v`=p_z. Next, you have to define the initial conditions for coordinates and momentums at `t`=0 and set the integrations step (default is 0.1) and its duration (default is 10). The Runge-Kutta method of 4-th order is used for integration. +

  const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)";
+  mglData r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2);
+

This example calculate the reflection from linear layer (media with Hamiltonian `p^2+q^2-x-1`=p_x^2+p_y^2-x-1). This is parabolic curve. The resulting array have 7 columns which contain data for {x,y,z,p,q,v,t}. +

+

The solution of PDE is a bit more complicated. As previous you have to specify the equation as pseudo-differential operator \hat H(x, \nabla) which is called sometime as “Hamiltonian” (for example, in beam tracing). As previously, it is defined by string which may depend on coordinates `x`, `y`, `z` (but not time!), momentums `p`=(d/dx)/i k_0, `q`=(d/dy)/i k_0 and field amplitude `u`=|u|. The evolutionary coordinate is `z` in all cases. So that, the equation look like du/dz = ik_0 H(x,y,\hat p, \hat q, |u|)[u]. Dependence on field amplitude `u`=|u| allows one to solve nonlinear problems too. For example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". Also you may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)" or ham = "p^2 + i1*x*(x>0)". +

+

Next step is specifying the initial conditions at `z` equal to minimal z-axis value. The function need 2 arrays for real and for imaginary part. Note, that coordinates x,y,z are supposed to be in specified axis range. So, the data arrays should have corresponding scales. Finally, you may set the integration step and parameter k0=k_0. Also keep in mind, that internally the 2 times large box is used (for suppressing numerical reflection from boundaries) and the equation should well defined even in this extended range. +

+

Final comment is concerning the possible form of pseudo-differential operator H. At this moment, simplified form of operator H is supported - all “mixed” terms (like `x*p`->x*d/dx) are excluded. For example, in 2D case this operator is effectively H = f(p,z) + g(x,z,u). However commutable combinations (like `x*q`->x*d/dy) are allowed for 3D case. +

+

So, for example let solve the equation for beam deflected from linear layer and absorbed later. The operator will have the form `"p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)"` that correspond to equation 1/ik_0 * du/dz + d^2 u/dx^2 + d^2 u/dy^2 + x * u + i (x+z)/2 * u = 0. This is typical equation for Electron Cyclotron (EC) absorption in magnetized plasmas. For initial conditions let me select the beam with plane phase front exp(-48*(x+0.7)^2). The corresponding code looks like this: +

new re 128 'exp(-48*(x+0.7)^2)':new im 128
+pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30
+transpose a
+subplot 1 1 0 '<_':title 'PDE solver'
+axis:xlabel '\i x':ylabel '\i z'
+crange 0 1:dens a 'wyrRk'
+fplot '-x' 'k|'
+text 0 0.95 'Equation: ik_0\partial_zu + \Delta u + x\cdot u +\
+ i \frac{x+z}{2}\cdot u = 0\n{}absorption: (x+z)/2 for x+z>0'
+
+
Example of PDE solving. +
+

The next example is example of beam tracing. Beam tracing equation is special kind of PDE equation written in coordinates accompanied to a ray. Generally this is the same parameters and limitation as for PDE solving but the coordinates are defined by the ray and by parameter of grid width w in direction transverse the ray. So, you don`t need to specify the range of coordinates. BUT there is limitation. The accompanied coordinates are well defined only for smooth enough rays, i.e. then the ray curvature K (which is defined as 1/K^2 = (|r''|^2 |r'|^2 - (r'', r'')^2)/|r'|^6) is much large then the grid width: K>>w. So, you may receive incorrect results if this condition will be broken. +

+

You may use following code for obtaining the same solution as in previous example: +

define $1 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)'
+subplot 1 1 0 '<_':title 'Beam and ray tracing'
+ray r $1 -0.7 -1 0 0 0.5 0 0.02 2:plot r(0) r(1) 'k'
+axis:xlabel '\i x':ylabel '\i z'
+new re 128 'exp(-48*x^2)':new im 128
+new xx 1:new yy 1
+qo2d a $1 re im r 1 30 xx yy
+crange 0 1:dens xx yy a 'wyrRk':fplot '-x' 'k|'
+text 0 0.85 'absorption: (x+y)/2 for x+y>0'
+text 0.7 -0.05 'central ray'
+
+
Example of beam tracing. +
+

Note, the pde is fast enough and suitable for many cases routine. However, there is situations then media have both together: strong spatial dispersion and spatial inhomogeneity. In this, case the pde will produce incorrect result and you need to use advanced PDE solver apde. For example, a wave beam, propagated in plasma, described by Hamiltonian exp(-x^2-p^2), will have different solution for using of simplification and advanced PDE solver: +

ranges -1 1 0 2 0 2
+new ar 256 'exp(-2*(x+0.0)^2)':new ai 256
+
+apde res1 'exp(-x^2-p^2)' ar ai 0.01:transpose res1
+subplot 1 2 0 '_':title 'Advanced PDE solver'
+ranges 0 2 -1 1:crange res1
+dens res1:box                                                                     
+axis:xlabel '\i z':ylabel '\i x'                                                  
+text -0.5 0.2 'i\partial_z\i u = exp(-\i x^2+\partial_x^2)[\i u]' 'y'             
+                                                                                  
+pde res2 'exp(-x^2-p^2)' ar ai 0.01
+subplot 1 2 1 '_':title 'Simplified PDE solver'                                   
+dens res2:box                                                                     
+axis:xlabel '\i z':ylabel '\i x'                                                  
+text -0.5 0.2 'i\partial_z\i u \approx\ exp(-\i x^2)\i u+exp(\partial_x^2)[\i u]' 'y'
+
+
Comparison of simplified and advanced PDE solvers. +
+ + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.15 Drawing phase plain

+ + +

Here I want say a few words of plotting phase plains. Phase plain is name for system of coordinates x, x', i.e. a variable and its time derivative. Plot in phase plain is very useful for qualitative analysis of an ODE, because such plot is rude (it topologically the same for a range of ODE parameters). Most often the phase plain {x, x'} is used (due to its simplicity), that allows to analyze up to the 2nd order ODE (i.e. x''+f(x,x')=0). +

+

The simplest way to draw phase plain in MathGL is using flow function(s), which automatically select several points and draw flow threads. If the ODE have an integral of motion (like Hamiltonian H(x,x')=const for dissipation-free case) then you can use cont function for plotting isolines (contours). In fact. isolines are the same as flow threads, but without arrows on it. Finally, you can directly solve ODE using ode function and plot its numerical solution. +

+

Let demonstrate this for ODE equation x''-x+3*x^2=0. This is nonlinear oscillator with square nonlinearity. It has integral H=y^2+2*x^3-x^2=Const. Also it have 2 typical stationary points: saddle at {x=0, y=0} and center at {x=1/3, y=0}. Motion at vicinity of center is just simple oscillations, and is stable to small variation of parameters. In opposite, motion around saddle point is non-stable to small variation of parameters, and is very slow. So, calculation around saddle points are more difficult, but more important. Saddle points are responsible for solitons, stochasticity and so on. +

+

So, let draw this phase plain by 3 different methods. First, draw isolines for H=y^2+2*x^3-x^2=Const - this is simplest for ODE without dissipation. Next, draw flow threads - this is straightforward way, but the automatic choice of starting points is not always optimal. Finally, use ode to check the above plots. At this we need to run ode in both direction of time (in future and in the past) to draw whole plain. Alternatively, one can put starting points far from (or at the bounding box as done in flow) the plot, but this is a more complicated. The sample code is: +

subplot 2 2 0 '<_':title 'Cont':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new f 100 100 'y^2+2*x^3-x^2-0.5':cont f
+
+subplot 2 2 1 '<_':title 'Flow':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new fx 100 100 'x-3*x^2'
+new fy 100 100 'y'
+flow fy fx 'v';value 7
+
+subplot 2 2 2 '<_':title 'ODE':box
+axis:xlabel 'x':ylabel '\dot{x}'
+for $x -1 1 0.1
+  ode r 'y;x-3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+  ode r '-y;-x+3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+next
+
+
Example of ODE solving and phase plain drawing. +
+ + + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.16 Pulse properties

+ + +

There is common task in optics to determine properties of wave pulses or wave beams. MathGL provide special function pulse which return the pulse properties (maximal value, center of mass, width and so on). Its usage is rather simple. Here I just illustrate it on the example of Gaussian pulse, where all parameters are obvious. +

subplot 1 1 0 '<_':title 'Pulse sample'
+# first prepare pulse itself
+new a 100 'exp(-6*x^2)'
+
+# get pulse parameters
+pulse b a 'x'
+
+# positions and widths are normalized on the number of points. So, set proper axis scale.
+ranges 0 a.nx-1 0 1
+axis:plot a # draw pulse and axis
+
+# now visualize found pulse properties
+define m a.max # maximal amplitude
+# approximate position of maximum
+line b(1) 0 b(1) m 'r='
+# width at half-maximum (so called FWHM)
+line b(1)-b(3)/2 0  b(1)-b(3)/2 m 'm|'
+line b(1)+b(3)/2 0  b(1)+b(3)/2 m 'm|'
+line 0 0.5*m a.nx-1 0.5*m 'h'
+# parabolic approximation near maximum
+new x 100 'x'
+plot b(0)*(1-((x-b(1))/b(2))^2) 'g'
+
+
Example of determining of pulse properties. +
+ + + +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.17 Using MGL parser

+ + +

MGL scripts can contain loops, conditions and user-defined functions. Below I show very simple example of its usage: +

title 'MGL parser sample'
+call 'sample'
+stop
+
+func 'sample'
+new dat 100 'sin(2*pi*(x+1))'
+plot dat; xrange 0 1
+box:axis:xlabel 'x':ylabel 'y'
+for $0 -1 1 0.1
+if $0<0
+line 0 0 -1 $0 'r'
+else
+line 0 0 -1 $0 'r'
+endif
+next
+
+
Example of MGL script parsing. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.18 Using options

+ + +

Command options allow the easy setup of the selected plot by changing global settings only for this plot. Often, options are used for specifying the range of automatic variables (coordinates). However, options allows easily change plot transparency, numbers of line or faces to be drawn, or add legend entries. The sample function for options usage is: +

new a 31 41 '-pi*x*exp(-(y+1)^2-4*x^2)'
+alpha on:light on
+subplot 2 2 0:title 'Options for coordinates':rotate 40 60:box
+surf a 'r';yrange 0 1
+surf a 'b';yrange 0 -1
+
+subplot 2 2 1:title 'Option "meshnum"':rotate 40 60:box
+mesh a 'r'; yrange 0 1
+mesh a 'b';yrange 0 -1; meshnum 5
+
+subplot 2 2 2:title 'Option "alpha"':rotate 40 60:box
+surf a 'r';yrange 0 1; alpha 0.7
+surf a 'b';yrange 0 -1; alpha 0.3
+
+subplot 2 2 3 '<_':title 'Option "legend"'
+fplot 'x^3' 'r'; legend 'y = x^3'
+fplot 'cos(pi*x)' 'b'; legend 'y = cos \pi x'
+box:axis:legend 2
+
+
Example of options usage. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.19 “Templates”

+ + +

As I have noted before, the change of settings will influence only for the further plotting commands. This allows one to create “template” function which will contain settings and primitive drawing for often used plots. Correspondingly one may call this template-function for drawing simplification. +

+

For example, let one has a set of points (experimental or numerical) and wants to compare it with theoretical law (for example, with exponent law \exp(-x/2), x \in [0, 20]). The template-function for this task is: +

void template(mglGraph *gr)
+{
+  mglData  law(100);      // create the law
+  law.Modify("exp(-10*x)");
+  gr->SetRanges(0,20, 0.0001,1);
+  gr->SetFunc(0,"lg(y)",0);
+  gr->Plot(law,"r2");
+  gr->Puts(mglPoint(10,0.2),"Theoretical law: e^x","r:L");
+  gr->Label('x',"x val."); gr->Label('y',"y val.");
+  gr->Axis(); gr->Grid("xy","g;"); gr->Box();
+}
+

At this, one will only write a few lines for data drawing: +

  template(gr);     // apply settings and default drawing from template
+  mglData dat("fname.dat"); // load the data
+  // and draw it (suppose that data file have 2 columns)
+  gr->Plot(dat.SubData(0),dat.SubData(1),"bx ");
+

A template-function can also contain settings for font, transparency, lightning, color scheme and so on. +

+

I understand that this is obvious thing for any professional programmer, but I several times receive suggestion about “templates” ... So, I decide to point out it here. +

+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.20 Stereo image

+ + +

One can easily create stereo image in MathGL. Stereo image can be produced by making two subplots with slightly different rotation angles. The corresponding code looks like this: +

call 'prepare2d'
+light on
+subplot 2 1 0:rotate 50 60+1:box:surf a
+subplot 2 1 1:rotate 50 60-1:box:surf a
+
+
Example of stereo image. +
+ +
+ +
+

+Next: , Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.21 Reduce memory usage

+ + +

By default MathGL save all primitives in memory, rearrange it and only later draw them on bitmaps. Usually, this speed up drawing, but may require a lot of memory for plots which contain a lot of faces (like cloud, dew). You can use quality function for setting to use direct drawing on bitmap and bypassing keeping any primitives in memory. This function also allow you to decrease the quality of the resulting image but increase the speed of the drawing. +

+

The code for lower memory usage looks like this: +

quality 6  # firstly, set to draw directly on bitmap
+for $1 0 1000
+  sphere 2*rnd-1 2*rnd-1 0.05
+next
+
+ +
+ + + +

5.5.22 Scanning file

+ + +

MathGL have possibilities to write textual information into file with variable values by help of save command. This is rather useful for generating an ini-files or preparing human-readable textual files. For example, lets create some textual file +

subplot 1 1 0 '<_':title 'Save and scanfile sample'
+list a 1 -1 0
+save 'This is test: 0 -> ',a(0),' q' 'test.txt' 'w'
+save 'This is test: 1 -> ',a(1),' q' 'test.txt'
+save 'This is test: 2 -> ',a(2),' q' 'test.txt'
+

It contents look like +

This is test: 0 -> 1 q
+This is test: 1 -> -1 q
+This is test: 2 -> 0 q
+

Note, that I use option `w` at first call of save to overwrite the contents of the file. +

+

Let assume now that you want to read this values (i.e. [[0,1],[1,-1],[2,0]]) from the file. You can use scanfile for that. The desired values was written using template `This is test: %g -> %g q`. So, just use +

scanfile a 'test.txt' 'This is test: %g -> %g'
+

and plot it to for assurance +

ranges a(0) a(1):axis:plot a(0) a(1) 'o'
+
+

Note, I keep only the leading part of template (i.e. `This is test: %g -> %g` instead of `This is test: %g -> %g q`), because there is no important for us information after the second number in the line. +

+ +
+ +
+

+Previous: , Up: Hints   [Contents][Index]

+
+ +

5.5.23 Mixing bitmap and vector output

+ + +

Sometimes output plots contain surfaces with a lot of points, and some vector primitives (like axis, text, curves, etc.). Using vector output formats (like EPS or SVG) will produce huge files with possible loss of smoothed lighting. Contrary, the bitmap output may cause the roughness of text and curves. Hopefully, MathGL have a possibility to combine bitmap output for surfaces and vector one for other primitives in the same EPS file, by using rasterize command. +

+

The idea is to prepare part of picture with surfaces or other "heavy" plots and produce the background image from them by help of rasterize command. Next, we draw everything to be saved in vector form (text, curves, axis and etc.). Note, that you need to clear primitives (use clf command) after rasterize if you want to disable duplication of surfaces in output files (like EPS). Note, that some of output formats (like 3D ones, and TeX) don`t support the background bitmap, and use clf for them will cause the loss of part of picture. +

+

The sample code is: +

# first draw everything to be in bitmap output
+fsurf 'x^2+y^2' '#';value 10
+
+rasterize   # set above plots as bitmap background
+clf         # clear primitives, to exclude them from file
+
+# now draw everything to be in vector output
+axis:box
+
+# and save file
+write 'fname.eps'
+
+ + +
+ +
+

+Previous: , Up: Examples   [Contents][Index]

+
+ +

5.6 FAQ

+ + +
+
The plot does not appear
+

Check that points of the plot are located inside the bounding box and resize the bounding box using ranges function. Check that the data have correct dimensions for selected type of plot. Sometimes the light reflection from flat surfaces (like, dens) can look as if the plot were absent. +

+
+
I can not find some special kind of plot.
+

Most “new” types of plots can be created by using the existing drawing functions. For example, the surface of curve rotation can be created by a special function torus, or as a parametrically specified surface by surf. See also, Hints. If you can not find a specific type of plot, please e-mail me and this plot will appear in the next version of MathGL library. +

+
+
How can I print in Russian/Spanish/Arabic/Japanese, and so on?
+

The standard way is to use Unicode encoding for the text output. But the MathGL library also has interface for 8-bit (char *) strings with internal conversion to Unicode. This conversion depends on the current locale OS. +

+
+
How can I exclude a point or a region of plot from the drawing?
+

There are 3 general ways. First, the point with nan value as one of the coordinates (including color/alpha range) will never be plotted. Second, special functions define the condition when the points should be omitted (see Cutting). Last, you may change the transparency of a part of the plot by the help of functions surfa, surf3a (see Dual plotting). In last case the transparency is switched on smoothly. +

+
+
How many people write this library?
+

Most of the library was written by one person. This is a result of nearly a year of work (mostly in the evening and on holidays): I spent half a year to write the kernel and half a year to a year on extending, improving the library and writing documentation. This process continues now :). The build system (cmake files) was written mostly by D.Kulagin, and the export to PRC/PDF was written mostly by M.Vidassov. +

+
+
How can I display a bitmap on the figure?
+

You can import data by command import and display it by dens function. For example, for black-and-white bitmap you can use the code: import bmp 'fname.png' 'wk':dens bmp 'wk'. +

+ +
+
How can I create 3D in PDF?
+

Just use command write fname.pdf, which create PDF file if enable-pdf=ON at MathGL configure. +

+
+
How can I create TeX figure?
+

Just use command write fname.tex, which create LaTeX files with figure itself `fname.tex`, with MathGL colors `mglcolors.tex` and main file `mglmain.tex`. Last one can be used for viewing image by command like pdflatex mglmain.tex. +

+ +
+
How I can change the font family?
+

First, you should download new font files from here or from here. Next, you should load the font files into by the following command: loadfont 'fontname'. Here fontname is the base font name like `STIX`. Use loadfont '' to start using the default font. +

+
+
How can I draw tick out of a bounding box?
+

Just set a negative value in ticklen. For example, use ticklen -0.1. +

+
+
How can I prevent text rotation?
+

Just use rotatetext off. Also you can use axis style `U` for disable only tick labels rotation. +

+
+
How can I draw equal axis range even for rectangular image?
+

Just use aspect nan nan for each subplot, or at the beginning of the drawing. +

+
+
Как задать полупрозрачный фон?
+

Просто используйте код типа clf 'r{A5}' или подготовьте PNG файл и задайте его в качестве фона рисунка background 'fname.png'. +

+
+
Как уменьшить поля вокруг графика?
+

Простейший путь состоит в использовании стилей subplot. Однако, вы должны быть осторожны в изменении стиля subplot если вы планируете добавлять colorbar или вращать график - часть графика может стать невидимой. +

+
+
Can I combine bitmap and vector output in EPS?
+

Yes. Sometimes you may have huge surface and a small set of curves and/or text on the plot. You can use function rasterize just after making surface plot. This will put all plot to bitmap background. At this later plotting will be in vector format. For example, you can do something like following: +

surf x y z
+rasterize # make surface as bitmap
+axis
+write 'fname.eps'
+
+
+
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 All samples

+ + +

This chapter contain alphabetical list of MGL and C++ samples for most of MathGL graphics and features. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Up: All samples   [Contents][Index]

+
+ +

6.1 Functions for initialization

+ + +

This section contain functions for input data for most of further samples. +

+

MGL code: +

+func 'prepare1d'
+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
+new x1 50 'x'
+new x2 50 '0.05-0.03*cos(pi*x)'
+new y1 50 '0.5-0.3*cos(pi*x)'
+new y2 50 '-0.3*sin(pi*x)'
+return
+
+func 'prepare2d'
+new a 50 40 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 50 40 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3d'
+new c 61 50 40 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 61 50 40 '1-2*tanh((x+y)*(x+y))'
+return
+
+func 'prepare2v'
+new a 20 30 '0.6*sin(pi*(x+1))*sin(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+new b 20 30 '0.6*cos(pi*(x+1))*cos(1.5*pi*(y+1))+0.4*cos(0.75*pi*(x+1)*(y+1))'
+return
+
+func 'prepare3v'
+define $1 pow(x*x+y*y+(z-0.3)*(z-0.3)+0.03,1.5)
+define $2 pow(x*x+y*y+(z+0.3)*(z+0.3)+0.03,1.5)
+new ex 10 10 10 '0.2*x/$1-0.2*x/$2'
+new ey 10 10 10 '0.2*y/$1-0.2*y/$2'
+new ez 10 10 10 '0.2*(z-0.3)/$1-0.2*(z+0.3)/$2'
+return
+
+ + +
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.2 Sample `3wave`

+ + +

Example of complex ode on basis of 3-wave decay. +

+

MGL code: +

define t 50
+ode !r '-b*f;a*conj(f);a*conj(b)-0.1*f' 'abf' [1,1e-3,0] 0.1 t
+ranges 0 t 0 r.max
+plot r(0) 'b';legend 'a'
+plot r(1) 'g';legend 'b'
+plot r(2) 'r';legend 'f'
+axis:box:legend
+
+
Sample 3wave +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.3 Sample `alpha`

+ + +

Example of light and alpha (transparency). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'default':rotate 50 60:box
+surf a
+subplot 2 2 1:title 'light on':rotate 50 60:box
+light on:surf a
+subplot 2 2 3:title 'light on; alpha on':rotate 50 60:box
+alpha on:surf a
+subplot 2 2 2:title 'alpha on':rotate 50 60:box
+light off:surf a
+
+
Sample alpha +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.4 Sample `apde`

+ + +

Comparison of advanced PDE solver (apde) and ordinary one (pde). +

+

MGL code: +

ranges -1 1 0 2 0 2
+new ar 256 'exp(-2*(x+0.0)^2)'
+new ai 256
+
+apde res1 'exp(-x^2-p^2)' ar ai 0.01:transpose res1
+pde res2 'exp(-x^2-p^2)' ar ai 0.01
+
+subplot 1 2 0 '_':title 'Advanced PDE solver'
+ranges 0 2 -1 1:crange res1
+dens res1:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u = exp(-\i x^2+\partial_x^2)[\i u]' 'y'
+
+subplot 1 2 1 '_':title 'Simplified PDE solver'
+dens res2:box
+axis:xlabel '\i z':ylabel '\i x'
+text -0.5 0.2 'i\partial_z\i u \approx\ exp(-\i x^2)\i u+exp(\partial_x^2)[\i u]' 'y'
+
+
Sample apde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.5 Sample `area`

+ + +

Function area fill the area between curve and axis plane. It support gradient filling if 2 colors per curve is specified. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0
+subplot 2 2 0 '':title 'Area plot (default)':box:area y
+subplot 2 2 1 '':title '2 colors':box:area y 'cbgGyr'
+subplot 2 2 2 '':title '"!" style':box:area y '!'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 3:title '3d variant':rotate 50 60:box
+area xc yc z 'r'
+area xc -yc z 'b#'
+
+
Sample area +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.6 Sample `aspect`

+ + +

Example of subplot, inplot, rotate, aspect, shear. +

+

MGL code: +

subplot 2 2 0:box:text -1 1.1 'Just box' ':L'
+inplot 0.2 0.5 0.7 1 off:box:text 0 1.2 'InPlot example'
+subplot 2 2 1:title 'Rotate only':rotate 50 60:box
+subplot 2 2 2:title 'Rotate and Aspect':rotate 50 60:aspect 1 1 2:box
+subplot 2 2 3:title 'Shear':box 'c':shear 0.2 0.1:box
+
+
Sample aspect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.7 Sample `axial`

+ + +

Function axial draw surfaces of rotation for contour lines. You can draw wire surfaces (`#` style) or ones rotated in other directions (`x`, `z` styles). +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Axial plot (default)':light on:alpha on:rotate 50 60:box:axial a
+subplot 2 2 1:title '"x" style;"." style':light on:rotate 50 60:box:axial a 'x.'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:axial a 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:axial a '#'
+
+
Sample axial +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.8 Sample `axis`

+ + +

Different forms of axis position. +

+

MGL code: +

subplot 2 2 0:title 'Axis origin, Grid':origin 0 0:axis:grid:fplot 'x^3'
+subplot 2 2 1:title '2 axis':ranges -1 1 -1 1:origin -1 -1:axis:ylabel 'axis_1':fplot 'sin(pi*x)' 'r2'
+ranges 0 1 0 1:origin 1 1:axis:ylabel 'axis_2':fplot 'cos(pi*x)'
+subplot 2 2 3:title 'More axis':origin nan nan:xrange -1 1:axis:xlabel 'x' 0:ylabel 'y_1' 0:fplot 'x^2' 'k'
+yrange -1 1:origin -1.3 -1:axis 'y' 'r':ylabel '#r{y_2}' 0.2:fplot 'x^3' 'r'
+
+subplot 2 2 2:title '4 segments, inverted axis':origin 0 0:
+inplot 0.5 1 0.5 1 on:ranges 0 10 0 2:axis
+fplot 'sqrt(x/2)':xlabel 'W' 1:ylabel 'U' 1
+inplot 0 0.5 0.5 1 on:ranges 1 0 0 2:axis 'x':fplot 'sqrt(x)+x^3':xlabel '\tau' 1
+inplot 0.5 1 0 0.5 on:ranges 0 10 4 0:axis 'y':fplot 'x/4':ylabel 'L' -1
+inplot 0 0.5 0 0.5 on:ranges 1 0 4 0:fplot '4*x^2'
+
+
Sample axis +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.9 Sample `barh`

+ + +

Function barh is the similar to bars but draw horizontal bars. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 2 2 0 '':title 'Barh plot (default)':box:barh ys
+subplot 2 2 1 '':title '2 colors':box:barh ys 'cbgGyr'
+ranges -3 3 -1 1:subplot 2 2 2 '':title '"a" style':box:barh ys 'a'
+subplot 2 2 3 '': title '"f" style':box:barh ys 'f'
+
+
Sample barh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.10 Sample `bars`

+ + +

Function bars draw vertical bars. It have a lot of options: bar-above-bar (`a` style), fall like (`f` style), 2 colors for positive and negative values, wired bars (`#` style), 3D variant. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd':origin 0 0 0
+subplot 3 2 0 '':title 'Bars plot (default)':box:bars ys
+subplot 3 2 1 '':title '2 colors':box:bars ys 'cbgGyr'
+subplot 3 2 4 '':title '"\#" style':box:bars ys '#'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:bars xc yc z 'r'
+ranges -1 1 -3 3:subplot 3 2 2 '':title '"a" style':box:bars ys 'a'
+subplot 3 2 3 '':title '"f" style':box:bars ys 'f'
+
+
Sample bars +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.11 Sample `belt`

+ + +

Function belt draw surface by belts. You can use `x` style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Belt plot':rotate 50 60:box:belt a
+
+
Sample belt +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.12 Sample `bifurcation`

+ + +

Function bifurcation draw Bifurcation diagram for multiple stationary points of the map (like logistic map). +

+

MGL code: +

subplot 1 1 0 '<_':title 'Bifurcation sample'
+ranges 0 4 0 1:axis
+bifurcation 0.005 'x*y*(1-y)' 'r'
+
+
Sample bifurcation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.13 Sample `box`

+ + +

Different styles of bounding box. +

+

MGL code: +

subplot 2 2 0:title 'Box (default)':rotate 50 60:box
+subplot 2 2 1:title 'colored':rotate 50 60:box 'r'
+subplot 2 2 2:title 'with faces':rotate 50 60:box '@'
+subplot 2 2 3:title 'both':rotate 50 60:box '@cm'
+
+
Sample box +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.14 Sample `boxplot`

+ + +

Function boxplot draw box-and-whisker diagram. +

+

MGL code: +

new a 10 7 '(2*rnd-1)^3/2'
+subplot 1 1 0 '':title 'Boxplot plot':box:boxplot a
+
+
Sample boxplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.15 Sample `boxs`

+ + +

Function boxs draw surface by boxes. You can use `#` for drawing wire plot. +

+

MGL code: +

call 'prepare2d'
+origin 0 0 0
+subplot 2 2 0:title 'Boxs plot (default)':rotate 40 60:light on:box:boxs a
+subplot 2 2 1:title '"\@" style':rotate 50 60:box:boxs a '@'
+subplot 2 2 2:title '"\#" style':rotate 50 60:box:boxs a '#'
+subplot 2 2 3:title 'compare with Tile':rotate 50 60:box:tile a
+
+
Sample boxs +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.16 Sample `candle`

+ + +

Function candle draw candlestick chart. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. +

+

MGL code: +

new y 30 'sin(pi*x/2)^2'
+subplot 1 1 0 '':title 'Candle plot (default)'
+yrange 0 1:box
+candle y y/2 (y+1)/2
+
+
Sample candle +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.17 Sample `chart`

+ + +

Function chart draw colored boxes with width proportional to data values. Use ` ` for empty box. It produce well known pie chart if drawn in polar coordinates. +

+

MGL code: +

new ch 7 2 'rnd+0.1':light on
+subplot 2 2 0:title 'Chart plot (default)':rotate 50 60:box:chart ch
+subplot 2 2 1:title '"\#" style':rotate 50 60:box:chart ch '#'
+subplot 2 2 2:title 'Pie chart; " " color':rotate 50 60:
+axis '(y+1)/2*cos(pi*x)' '(y+1)/2*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+subplot 2 2 3:title 'Ring chart; " " color':rotate 50 60:
+axis '(y+2)/3*cos(pi*x)' '(y+2)/3*sin(pi*x)' '':box:chart ch 'bgr cmy#'
+
+
Sample chart +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.18 Sample `cloud`

+ + +

Function cloud draw cloud-like object which is less transparent for higher data values. Similar plot can be created using many (about 10...20 - surf3a a a;value 10) isosurfaces surf3a. +

+

MGL code: +

call 'prepare3d'
+subplot 2 2 0:title 'Cloud plot':rotate 50 60:alpha on:box:cloud c 'wyrRk'
+subplot 2 2 1:title '"i" style':rotate 50 60:box:cloud c 'iwyrRk'
+subplot 2 2 2:title '"." style':rotate 50 60:box:cloud c '.wyrRk'
+subplot 2 2 3:title 'meshnum 10':rotate 50 60:box:cloud c 'wyrRk'; meshnum 10
+
+
Sample cloud +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.19 Sample `colorbar`

+ + +

Example of colorbar position and styles. +

+

MGL code: +

call 'prepare2d'
+new v 9 'x'
+subplot 2 2 0:title 'Colorbar out of box':box
+colorbar '<':colorbar '>':colorbar '_':colorbar '^'
+subplot 2 2 1:title 'Colorbar near box':box
+colorbar '<I':colorbar '>I':colorbar '_I':colorbar '^I'
+subplot 2 2 2:title 'manual colors':box:contd v a
+colorbar v '<':colorbar v '>':colorbar v '_':colorbar v '^'
+subplot 2 2 3:title '':text -0.5 1.55 'Color positions' ':C' -2
+colorbar 'bwr>' 0.25 0:text -0.9 1.2 'Default'
+colorbar 'b{w,0.3}r>' 0.5 0:text -0.1 1.2 'Manual'
+crange 0.01 1e3
+colorbar '>' 0.75 0:text 0.65 1.2 'Normal scale':colorbar '>':text 1.35 1.2 'Log scale'
+
+
Sample colorbar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.20 Sample `combined`

+ + +

Example of several plots in the same axis. +

+

MGL code: +

call 'prepare2v'
+call 'prepare3d'
+new v 10:fill v -0.5 1:copy d sqrt(a^2+b^2)
+subplot 2 2 0:title 'Surf + Cont':rotate 50 60:light on:box:surf a:cont a 'y'
+subplot 2 2 1 '':title 'Flow + Dens':light off:box:flow a b 'br':dens d
+subplot 2 2 2:title 'Mesh + Cont':rotate 50 60:box:mesh a:cont a '_'
+subplot 2 2 3:title 'Surf3 + ContF3':rotate 50 60:light on
+box:contf3 v c 'z' 0:contf3 v c 'x':contf3 v c
+cut 0 -1 -1 1 0 1.1
+contf3 v c 'z' c.nz-1:surf3 c -0.5
+
+
Sample combined +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.21 Sample `cones`

+ + +

Function cones is similar to bars but draw cones. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+light on:origin 0 0 0
+subplot 3 2 0:title 'Cones plot':rotate 50 60:box:cones ys
+subplot 3 2 1:title '2 colors':rotate 50 60:box:cones ys 'cbgGyr'
+subplot 3 2 2:title '"\#" style':rotate 50 60:box:cones ys '#'
+subplot 3 2 3:title '"a" style':rotate 50 60:zrange -2 2:box:cones ys 'a'
+subplot 3 2 4:title '"t" style':rotate 50 60:box:cones ys 't'
+subplot 3 2 5:title '"4" style':rotate 50 60:box:cones ys '4'
+
+
Sample cones +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.22 Sample `cont`

+ + +

Function cont draw contour lines for surface. You can select automatic (default) or manual levels for contours, print contour labels, draw it on the surface (default) or at plane (as Dens). +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'Cont plot (default)':rotate 50 60:box:cont a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:cont v a
+subplot 2 2 2:title '"\_" and "." styles':rotate 50 60:box:cont a '_':cont a '_.2k'
+subplot 2 2 3 '':title '"t" style':box:cont a 't'
+
+
Sample cont +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.23 Sample `cont3`

+ + +

Function contf3 draw ordinary contour lines but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box
+cont3 c 'x':cont3 c:cont3 c 'z'
+
+
Sample cont3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.24 Sample `cont_xyz`

+ + +

Functions contz, conty, contx draw contour lines on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Cont[XYZ] sample':rotate 50 60:box
+contx {sum c 'x'} '' -1:conty {sum c 'y'} '' 1:contz {sum c 'z'} '' -1
+
+
Sample cont_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.25 Sample `contd`

+ + +

Function contd is similar to contf but with manual contour colors. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContD plot (default)':rotate 50 60:box:contd a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contd v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contd a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contd a1
+
+
Sample contd +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.26 Sample `contf`

+ + +

Function contf draw filled contours. You can select automatic (default) or manual levels for contours. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0:title 'ContF plot (default)':rotate 50 60:box:contf a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contf v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contf a '_'
+subplot 2 2 3:title 'several slices':rotate 50 60:box:contf a1
+
+
Sample contf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.27 Sample `contf3`

+ + +

Function contf3 draw ordinary filled contours but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Cont3 sample':rotate 50 60:box:light on
+contf3 c 'x':contf3 c:contf3 c 'z'
+cont3 c 'xk':cont3 c 'k':cont3 c 'zk'
+
+
Sample contf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.28 Sample `contf_xyz`

+ + +

Functions contfz, contfy, contfx, draw filled contours on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'ContF[XYZ] sample':rotate 50 60:box
+contfx {sum c 'x'} '' -1:contfy {sum c 'y'} '' 1:contfz {sum c 'z'} '' -1
+
+
Sample contf_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.29 Sample `contv`

+ + +

Function contv draw vertical cylinders (belts) at contour lines. +

+

MGL code: +

call 'prepare2d'
+list v -0.5 -0.15 0 0.15 0.5
+subplot 2 2 0:title 'ContV plot (default)':rotate 50 60:box:contv a
+subplot 2 2 1:title 'manual levels':rotate 50 60:box:contv v a
+subplot 2 2 2:title '"\_" style':rotate 50 60:box:contv a '_'
+subplot 2 2 3:title 'ContV and ContF':rotate 50 60:light on:box
+contv a:contf a:cont a 'k'
+
+
Sample contv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.30 Sample `correl`

+ + +

Test of correlation function (correl). +

+

MGL code: +

new a 100 'exp(-10*x^2)'
+new b 100 'exp(-10*(x+0.5)^2)'
+yrange 0 1
+subplot 1 2 0 '_':title 'Input fields'
+plot a:plot b:box:axis
+correl r a b 'x'
+norm r 0 1:swap r 'x' # make it human readable
+subplot 1 2 1 '_':title 'Correlation of a and b'
+plot r 'r':axis:box
+line 0.5 0 0.5 1 'B|'
+
+
Sample correl +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.31 Sample `curvcoor`

+ + +

Some common curvilinear coordinates. +

+

MGL code: +

origin -1 1 -1
+subplot 2 2 0:title 'Cartesian':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' '':subplot 2 2 1:title 'Cylindrical':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis '2*y*x' 'y*y - x*x' '':subplot 2 2 2:title 'Parabolic':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+axis 'y*sin(pi*x)' 'y*cos(pi*x)' 'x+z':subplot 2 2 3:title 'Spiral':rotate 50 60:fplot '2*t-1' '0.5' '0' '2r':axis:grid
+
+
Sample curvcoor +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.32 Sample `cut`

+ + +

Example of point cutting (cut. +

+

MGL code: +

call 'prepare2d'
+call 'prepare3d'
+subplot 2 2 0:title 'Cut on (default)':rotate 50 60:light on:box:surf a; zrange -1 0.5
+subplot 2 2 1:title 'Cut off':rotate 50 60:box:surf a; zrange -1 0.5; cut off
+subplot 2 2 2:title 'Cut in box':rotate 50 60:box:alpha on
+cut 0 -1 -1 1 0 1.1:surf3 c
+cut 0 0 0 0 0 0	# restore back
+subplot 2 2 3:title 'Cut by formula':rotate 50 60:box
+cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)':surf3 c
+
+
Sample cut +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.33 Sample `dat_diff`

+ + +

Example of diff and integrate. +

+

MGL code: +

ranges 0 1 0 1 0 1:new a 30 40 'x*y'
+subplot 2 2 0:title 'a(x,y)':rotate 60 40:surf a:box
+subplot 2 2 1:title 'da/dx':rotate 60 40:diff a 'x':surf a:box
+subplot 2 2 2:title '\int da/dx dxdy':rotate 60 40:integrate a 'xy':surf a:box
+subplot 2 2 3:title '\int {d^2}a/dxdy dx':rotate 60 40:diff2 a 'y':surf a:box
+
+
Sample dat_diff +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.34 Sample `dat_extra`

+ + +

Example of envelop, sew, smooth and resize. +

+

MGL code: +

subplot 2 2 0 '':title 'Envelop sample':new d1 1000 'exp(-8*x^2)*sin(10*pi*x)'
+axis:plot d1 'b':envelop d1 'x':plot d1 'r'
+subplot 2 2 1 '':title 'Smooth sample':ranges 0 1 0 1
+new y0 30 '0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd'
+copy y1 y0:smooth y1 'x3':plot y1 'r';legend '"3" style'
+copy y2 y0:smooth y2 'x5':plot y2 'g';legend '"5" style'
+copy y3 y0:smooth y3 'x':plot y3 'b';legend 'default'
+plot y0 '{m7}:s';legend 'none'
+legend:box
+subplot 2 2 2:title 'Sew sample':rotate 50 60:light on:alpha on
+new d2 100 100 'mod((y^2-(1-x)^2)/2,0.1)'
+box:surf d2 'b':sew d2 'xy' 0.1:surf d2 'r'
+subplot 2 2 3:title 'Resize sample (interpolation)'
+new x0 10 'rnd':new v0 10 'rnd'
+resize x1 x0 100:resize v1 v0 100
+plot x0 v0 'b+ ':plot x1 v1 'r-':label x0 v0 '%n'
+
+
Sample dat_extra +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.35 Sample `data1`

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:diff b 'x':subplot 5 3 0:call 'splot'
+copy b a:diff2 b 'x':subplot 5 3 1:call 'splot'
+copy b a:cumsum b 'x':subplot 5 3 2:call 'splot'
+copy b a:integrate b 'x':subplot 5 3 3:call 'splot'
+mirror b 'x':subplot 5 3 4:call 'splot'
+copy b a:diff b 'y':subplot 5 3 5:call 'splot'
+copy b a:diff2 b 'y':subplot 5 3 6:call 'splot'
+copy b a:cumsum b 'y':subplot 5 3 7:call 'splot'
+copy b a:integrate b 'y':subplot 5 3 8:call 'splot'
+mirror b 'y':subplot 5 3 9:call 'splot'
+copy b a:diff b 'z':subplot 5 3 10:call 'splot'
+copy b a:diff2 b 'z':subplot 5 3 11:call 'splot'
+copy b a:cumsum b 'z':subplot 5 3 12:call 'splot'
+copy b a:integrate b 'z':subplot 5 3 13:call 'splot'
+mirror b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box:surf3 b
+return
+
+
Sample data1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.36 Sample `data2`

+ + + + +

MGL code: +

new a 40 50 60 'exp(-x^2-4*y^2-16*z^2)'
+light on:alpha on
+copy b a:sinfft b 'x':subplot 5 3 0:call 'splot'
+copy b a:cosfft b 'x':subplot 5 3 1:call 'splot'
+copy b a:hankel b 'x':subplot 5 3 2:call 'splot'
+copy b a:swap b 'x':subplot 5 3 3:call 'splot'
+copy b a:smooth b 'x':subplot 5 3 4:call 'splot'
+copy b a:sinfft b 'y':subplot 5 3 5:call 'splot'
+copy b a:cosfft b 'y':subplot 5 3 6:call 'splot'
+copy b a:hankel b 'y':subplot 5 3 7:call 'splot'
+copy b a:swap b 'y':subplot 5 3 8:call 'splot'
+copy b a:smooth b 'y':subplot 5 3 9:call 'splot'
+copy b a:sinfft b 'z':subplot 5 3 10:call 'splot'
+copy b a:cosfft b 'z':subplot 5 3 11:call 'splot'
+copy b a:hankel b 'z':subplot 5 3 12:call 'splot'
+copy b a:swap b 'z':subplot 5 3 13:call 'splot'
+copy b a:smooth b 'z':subplot 5 3 14:call 'splot'
+stop
+func splot 0
+title 'max=',b.max:norm b -1 1 on:rotate 70 60:box
+surf3 b 0.5:surf3 b -0.5
+return
+
+
Sample data2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.37 Sample `dens`

+ + +

Function dens draw density plot (also known as color-map) for surface. +

+

MGL code: +

call 'prepare2d'
+new a1 30 40 3 '0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)'
+subplot 2 2 0 '':title 'Dens plot (default)':box:dens a
+subplot 2 2 1:title '3d variant':rotate 50 60:box:dens a
+subplot 2 2 2 '':title '"\#" style; meshnum 10':box:dens a '#'; meshnum 10
+subplot 2 2 3:title 'several slices':rotate 50 60:box:dens a1
+
+
Sample dens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.38 Sample `dens3`

+ + +

Function dens3 draw ordinary density plots but at slices of 3D data. +

+

MGL code: +

call 'prepare3d'
+title 'Dens3 sample':rotate 50 60:alpha on:alphadef 0.7
+origin 0 0 0:box:axis '_xyz'
+dens3 c 'x':dens3 c ':y':dens3 c 'z'
+
+
Sample dens3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.39 Sample `dens_xyz`

+ + +

Functions densz, densy, densx draw density plot on plane perpendicular to corresponding axis. One of possible application is drawing projections of 3D field. +

+

MGL code: +

call 'prepare3d'
+title 'Dens[XYZ] sample':rotate 50 60:box
+densx {sum c 'x'} '' -1:densy {sum c 'y'} '' 1:densz {sum c 'z'} '' -1
+
+
Sample dens_xyz +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.40 Sample `detect`

+ + +

Example of curve detect. +

+

MGL code: +

subplot 1 1 0 '':title 'Detect sample'
+new a 200 100 'exp(-30*(y-0.5*sin(pi*x))^2-rnd/10)+exp(-30*(y+0.5*sin(pi*x))^2-rnd/10)+exp(-30*(x+y)^2-rnd/10)'
+ranges 0 a.nx 0 a.ny:box
+alpha on:crange a:dens a
+
+detect r a 0.1 5
+plot r(0) r(1) '.'
+
+
Sample detect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.41 Sample `dew`

+ + +

Function dew is similar to vect but use drops instead of arrows. +

+

MGL code: +

call 'prepare2v'
+subplot 1 1 0 '':title 'Dew plot':light on:box:dew a b
+
+
Sample dew +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.42 Sample `diffract`

+ + + + +

MGL code: +

define n 32	#number of points
+define m 20 # number of iterations
+define dt 0.01 # time step
+new res n m+1
+ranges -1 1 0 m*dt 0 1
+
+#tridmat periodic variant
+new !a n 'i',dt*(n/2)^2/2
+copy !b !(1-2*a)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xdc'
+put res u all $i+1
+next
+subplot 2 2 0 '<_':title 'Tridmat, periodic b.c.'
+axis:box:dens res
+
+#fourier variant
+new k n:fillsample k 'xk'
+copy !e !exp(-i1*dt*k^2)
+
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+fourier u 'x'
+multo u e
+fourier u 'ix'
+put res u all $i+1
+next
+subplot 2 2 1 '<_':title 'Fourier method'
+axis:box:dens res
+
+#tridmat zero variant
+new !u n 'exp(-6*x^2)'
+put res u all 0
+for $i 0 m
+tridmat u a b a u 'xd'
+put res u all $i+1
+next
+subplot 2 2 2 '<_':title 'Tridmat, zero b.c.'
+axis:box:dens res
+
+#diffract exp variant
+new !u n 'exp(-6*x^2)'
+define q dt*(n/2)^2/8 # need q<0.4 !!!
+put res u all 0
+for $i 0 m
+for $j 1 8	# due to smaller dt
+diffract u 'xe' q
+next
+put res u all $i+1
+next
+subplot 2 2 3 '<_':title 'Diffract, exp b.c.'
+axis:box:dens res
+
+
Sample diffract +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.43 Sample `dilate`

+ + +

Example of dilate and erode. +

+

MGL code: +

subplot 2 2 0:title 'Dilate&Erode 1D sample'
+new y 11:put y 1 5
+ranges 0 10 0 1:axis:box
+plot y 'b*'
+dilate y 0.5 2
+plot y 'rs'
+erode y 0.5 1
+plot y 'g#o'
+
+subplot 2 2 1:title 'Dilate&Erode 2D sample':rotate 40 60
+ranges 0 10 0 10 0 3
+axis:box
+new z 11 11:put z 3 5 5
+boxs z 'b':boxs z 'k#'
+dilate z 1 2
+boxs z 'r':boxs z 'k#'
+erode z 1 1
+boxs 2*z 'g':boxs 2*z 'k#'
+
+subplot 2 2 2
+text 0.5 0.7 'initial' 'ba';size -2
+text 0.5 0.5 'dilate=2' 'ra';size -2
+text 0.5 0.3 'erode=1' 'ga';size -2
+
+subplot 2 2 3:title 'Dilate&Erode 3D sample'
+rotate 60 50:light on:alpha on
+ranges 0 10 0 10 0 10:crange 0 3
+axis:box
+new a 11 11 11:put a 3 5 5 5
+surf3a a a 1.5 'b'
+dilate a 1 2
+surf3a a a 0.5 'r'
+erode a 1 1
+surf3a 2*a 2*a 1 'g'
+
+
Sample dilate +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.44 Sample `dots`

+ + +

Function dots is another way to draw irregular points. Dots use color scheme for coloring (see Color scheme). +

+

MGL code: +

new t 2000 'pi*(rnd-0.5)':new f 2000 '2*pi*rnd'
+copy x 0.9*cos(t)*cos(f):copy y 0.9*cos(t)*sin(f):copy z 0.6*sin(t):copy c cos(2*t)
+subplot 2 2 0:title 'Dots sample':rotate 50 60
+box:dots x y z
+alpha on
+subplot 2 2 1:title 'add transparency':rotate 50 60
+box:dots x y z c
+subplot 2 2 2:title 'add colorings':rotate 50 60
+box:dots x y z x c
+subplot 2 2 3:title 'Only coloring':rotate 50 60
+box:tens x y z x ' .'
+
+
Sample dots +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.45 Sample `earth`

+ + +

Example of Earth map by using import. +

+

MGL code: +

import dat 'Equirectangular-projection.jpg' 'BbGYw' -1 1
+subplot 1 1 0 '<>':title 'Earth in 3D':rotate 40 60
+copy phi dat 'pi*x':copy tet dat 'pi*y/2'
+copy x cos(tet)*cos(phi)
+copy y cos(tet)*sin(phi)
+copy z sin(tet)
+
+light on
+surfc x y z dat 'BbGYw'
+contp [-0.51,-0.51] x y z dat 'y'
+
+
Sample earth +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.46 Sample `error`

+ + +

Function error draw error boxes around the points. You can draw default boxes or semi-transparent symbol (like marker, see Line styles). Also you can set individual color for each box. See also error2 sample. +

+

MGL code: +

call 'prepare1d'
+new y 50 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2)'
+new x0 10 'x + 0.1*rnd-0.05':new ex 10 '0.1':new ey 10 '0.2'
+new y0 10 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2) + 0.2*rnd-0.1'
+subplot 2 2 0 '':title 'Error plot (default)':box:plot y:error x0 y0 ex ey 'k'
+subplot 2 2 1 '':title '"!" style; no e_x':box:plot y:error x0 y0 ey 'o!rgb'
+subplot 2 2 2 '':title '"\@" style':alpha on:box:plot y:error x0 y0 ex ey '@'; alpha 0.5
+subplot 2 2 3:title '3d variant':rotate 50 60:axis
+for $1 0 9
+	errbox 2*rnd-1 2*rnd-1 2*rnd-1 0.2 0.2 0.2 'bo'
+next
+
+
Sample error +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.47 Sample `error2`

+ + +

Example of error kinds. +

+

MGL code: +

new x0 10 'rnd':new ex 10 '0.1'
+new y0 10 'rnd':new ey 10 '0.1'
+ranges 0 1 0 1
+subplot 4 3 0 '':box:error x0 y0 ex ey '#+@'
+subplot 4 3 1 '':box:error x0 y0 ex ey '#x@'
+subplot 4 3 2 '':box:error x0 y0 ex ey '#s@'; alpha 0.5
+subplot 4 3 3 '':box:error x0 y0 ex ey 's@'
+subplot 4 3 4 '':box:error x0 y0 ex ey 'd@'
+subplot 4 3 5 '':box:error x0 y0 ex ey '#d@'; alpha 0.5
+subplot 4 3 6 '':box:error x0 y0 ex ey '+@'
+subplot 4 3 7 '':box:error x0 y0 ex ey 'x@'
+subplot 4 3 8 '':box:error x0 y0 ex ey 'o@'
+subplot 4 3 9 '':box:error x0 y0 ex ey '#o@'; alpha 0.5
+subplot 4 3 10 '':box:error x0 y0 ex ey '#.@'
+subplot 4 3 11 '':box:error x0 y0 ex ey; alpha 0.5
+
+
Sample error2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.48 Sample `export`

+ + +

Example of data export and import. +

+

MGL code: +

new a 100 100 'x^2*y':new b 100 100
+export a 'test_data.png' 'BbcyrR' -1 1
+import b 'test_data.png' 'BbcyrR' -1 1
+subplot 2 1 0 '':title 'initial':box:dens a
+subplot 2 1 1 '':title 'imported':box:dens b
+
+
Sample export +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.49 Sample `fall`

+ + +

Function fall draw waterfall surface. You can use meshnum for changing number of lines to be drawn. Also you can use `x` style for drawing lines in other direction. +

+

MGL code: +

call 'prepare2d'
+title 'Fall plot':rotate 50 60:box:fall a
+
+
Sample fall +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.50 Sample `fexport`

+ + +

Example of write to different file formats. +

+

MGL code: +

subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+write 'fexport.jpg':#write 'fexport.png'
+write 'fexport.bmp':write 'fexport.tga'
+write 'fexport.eps':write 'fexport.svg'
+write 'fexport.gif':write 'fexport.xyz'
+write 'fexport.stl':write 'fexport.off'
+write 'fexport.tex':write 'fexport.obj'
+write 'fexport.prc':write 'fexport.json'
+write 'fexport.mgld'
+
+
Sample fexport +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.51 Sample `fit`

+ + +

Example of nonlinear fit. +

+

MGL code: +

new dat 100 '0.4*rnd+0.1+sin(2*pi*x)'
+new in 100 '0.3+sin(2*pi*x)'
+list ini 1 1 3:fit res dat 'a+b*sin(c*x)' 'abc' ini
+title 'Fitting sample':yrange -2 2:box:axis:plot dat 'k. '
+plot res 'r':plot in 'b'
+text -0.9 -1.3 'fitted:' 'r:L'
+putsfit 0 -1.8 'y = ' 'r':text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'b'
+
+
Sample fit +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.52 Sample `flame2d`

+ + +

Function flame2d generate points for flame fractals in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+new B 2 3 A.ny '0.3'
+put B 3 0 0 -1
+put B 3 0 1 -1
+put B 3 0 2 -1
+flame2d fx fy A B 1000000
+subplot 1 1 0 '<_':title 'Flame2d sample'
+ranges fx fy:box:axis
+plot fx fy 'r#o ';size 0.05
+
+
Sample flame2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.53 Sample `flow`

+ + +

Function flow is another standard way to visualize vector fields - it draw lines (threads) which is tangent to local vector field direction. MathGL draw threads from edges of bounding box and from central slices. Sometimes it is not most appropriate variant - you may want to use flowp to specify manual position of threads. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Flow plot (default)':box:flow a b
+subplot 2 2 1 '':title '"v" style':box:flow a b 'v'
+subplot 2 2 2 '':title '"#" and "." styles':box:flow a b '#':flow a b '.2k'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:flow ex ey ez
+
+
Sample flow +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.54 Sample `flow3`

+ + +

Function flow3 draw flow threads, which start from given plane. +

+

MGL code: +

call 'prepare3v'
+subplot 2 2 0:title 'Flow3 plot (default)':rotate 50 60:box
+flow3 ex ey ez
+subplot 2 2 1:title '"v" style, from boundary':rotate 50 60:box
+flow3 ex ey ez 'v' 0
+subplot 2 2 2:title '"t" style':rotate 50 60:box
+flow3 ex ey ez 't' 0
+subplot 2 2 3:title 'from \i z planes':rotate 50 60:box
+flow3 ex ey ez 'z' 0
+flow3 ex ey ez 'z' 9
+
+
Sample flow3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.55 Sample `fog`

+ + +

Example of fog. +

+

MGL code: +

call 'prepare2d'
+title 'Fog sample':rotate 50 60:light on:fog 1
+box:surf a:cont a 'y'
+
+
Sample fog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.56 Sample `fonts`

+ + +

Example of font typefaces. +

+

MGL code: +

define d 0.25
+loadfont 'STIX':text 0 1.1 'default font (STIX)'
+loadfont 'adventor':text 0 1.1-d 'adventor font'
+loadfont 'bonum':text 0 1.1-2*d 'bonum font'
+loadfont 'chorus':text 0 1.1-3*d 'chorus font'
+loadfont 'cursor':text 0 1.1-4*d 'cursor font'
+loadfont 'heros':text 0 1.1-5*d 'heros font'
+loadfont 'heroscn':text 0 1.1-6*d 'heroscn font'
+loadfont 'pagella':text 0 1.1-7*d 'pagella font'
+loadfont 'schola':text 0 1.1-8*d 'schola font'
+loadfont 'termes':text 0 1.1-9*d 'termes font'
+loadfont ''
+
+
Sample fonts +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.57 Sample `grad`

+ + +

Function grad draw gradient lines for matrix. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Grad plot':box:grad a:dens a '{u8}w{q8}'
+
+
Sample grad +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.58 Sample `hist`

+ + +

Example of hist (histogram). +

+

MGL code: +

new x 10000 '2*rnd-1':new y 10000 '2*rnd-1':copy z exp(-6*(x^2+y^2))
+hist xx x z:norm xx 0 1:hist yy y z:norm yy 0 1
+multiplot 3 3 3 2 2 '':ranges -1 1 -1 1 0 1:box:dots x y z 'wyrRk'
+multiplot 3 3 0 2 1 '':ranges -1 1 0 1:box:bars xx
+multiplot 3 3 5 1 2 '':ranges 0 1 -1 1:box:barh yy
+subplot 3 3 2:text 0.5 0.5 'Hist and\n{}MultiPlot\n{}sample' 'a' -3
+
+
Sample hist +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.59 Sample `ifs2d`

+ + +

Function ifs2d generate points for fractals using iterated function system in 2d case. +

+

MGL code: +

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
+	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
+ifs2d fx fy A 100000
+subplot 1 1 0 '<_':title 'IFS 2d sample'
+ranges fx fy:axis
+plot fx fy 'r#o ';size 0.05
+
+
Sample ifs2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.60 Sample `ifs3d`

+ + +

Function ifs3d generate points for fractals using iterated function system in 3d case. +

+

MGL code: +

list A [0,0,0,0,.18,0,0,0,0,0,0,0,.01] [.85,0,0,0,.85,.1,0,-0.1,0.85,0,1.6,0,.85]\
+	[.2,-.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07] [-.2,.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07]
+ifs3d f A 100000
+title 'IFS 3d sample':rotate 50 60
+ranges f(0) f(1) f(2):axis:box
+dots f(0) f(1) f(2) 'G#o';size 0.05
+
+
Sample ifs3d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.61 Sample `indirect`

+ + +

Comparison of subdata vs evaluate/ +

+

MGL code: +

subplot 1 1 0 '':title 'SubData vs Evaluate'
+new in 9 'x^3/1.1':plot in 'ko ':box
+new arg 99 '4*x+4'
+evaluate e in arg off:plot e 'b.'; legend 'Evaluate'
+subdata s in arg:plot s 'r.';legend 'SubData'
+legend 2
+
+
Sample indirect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.62 Sample `inplot`

+ + +

Example of inplot, multiplot, columnplot, gridplot, shearplot, stickplot. +

+

MGL code: +

subplot 3 2 0:title 'StickPlot'
+stickplot 3 0 20 30:box 'r':text 0 0 0 '0' 'r'
+stickplot 3 1 20 30:box 'g':text 0 0 0 '1' 'g'
+stickplot 3 2 20 30:box 'b':text 0 9 0 '2' 'b'
+subplot 3 2 3 '':title 'ColumnPlot'
+columnplot 3 0:box 'r':text 0 0 '0' 'r'
+columnplot 3 1:box 'g':text 0 0 '1' 'g'
+columnplot 3 2:box 'b':text 0 0 '2' 'b'
+subplot 3 2 4 '':title 'GridPlot'
+gridplot 2 2 0:box 'r':text 0 0 '0' 'r'
+gridplot 2 2 1:box 'g':text 0 0 '1' 'g'
+gridplot 2 2 2:box 'b':text 0 0 '2' 'b'
+gridplot 2 2 3:box 'm':text 0 0 '3' 'm'
+subplot 3 2 5 '':title 'InPlot':box
+inplot 0.4 1 0.6 1 on:box 'r'
+multiplot 3 2 1 2 1 '':title 'MultiPlot and ShearPlot':box
+shearplot 3 0 0.2 0.1:box 'r':text 0 0 '0' 'r'
+shearplot 3 1 0.2 0.1:box 'g':text 0 0 '1' 'g'
+shearplot 3 2 0.2 0.1:box 'b':text 0 0 '2' 'b'
+
+
Sample inplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.63 Sample `iris`

+ + +

Function iris draw Iris plot for columns of data array. +

+

MGL code: +

read a 'iris.dat'
+crop a 0 4 'x':rearrange a a.nx 50
+subplot 1 1 0 '':title 'Iris plot'
+iris a 'sepal\n length;sepal\n width;petal\n length;petal\n width' '. ';value -1.5;size -2
+
+
Sample iris +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.64 Sample `label`

+ + +

Function label print text at data points. The string may contain `%x`, `%y`, `%z` for x-, y-, z-coordinates of points, `%n` for point index. +

+

MGL code: +

new ys 10 '0.2*rnd-0.8*sin(pi*x)'
+subplot 1 1 0 '':title 'Label plot':box:plot ys ' *':label ys 'y=%y'
+
+
Sample label +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.65 Sample `lamerey`

+ + +

Function lamerey draw Lamerey diagram. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Lamerey sample'
+axis:xlabel '\i x':ylabel '\bar{\i x} = 2 \i{x}'
+fplot 'x' 'k='
+fplot '2*x' 'b'
+lamerey 0.00097 '2*x' 'rv~';size 2
+lamerey -0.00097 '2*x' 'rv~';size 2
+
+
Sample lamerey +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.66 Sample `legend`

+ + +

Example of legend styles. +

+

MGL code: +

addlegend 'sin(\pi {x^2})' 'b':addlegend 'sin(\pi x)' 'g*'
+addlegend 'sin(\pi \sqrt{x})' 'rd':addlegend 'jsut text' ' ':addlegend 'no indent for this' ''
+subplot 2 2 0 '':title 'Legend (default)':box:legend
+legend 1 0.5 '^':text 0.49 0.88 'Style "\^"' 'A:L'
+legend 3 'A#':text 0.75 0.65 'Absolute position' 'A'
+subplot 2 2 2 '':title 'coloring':box:legend 0 'r#':legend 1 'Wb#':legend 2 'ygr#'
+subplot 2 2 3 '':title 'manual position':box
+legend 0.5 1:text 0.5 0.5 'at x=0.5, y=1' 'a'
+legend 1 '#-':text 0.75 0.25 'Horizontal legend' 'a'
+
+
Sample legend +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.67 Sample `light`

+ + +

Example of light with different types. +

+

MGL code: +

light on:attachlight on
+call 'prepare2d'
+subplot 2 2 0:title 'Default':rotate 50 60:box:surf a
+line -1 -0.7 1.7 -1 -0.7 0.7 'BA'
+
+subplot 2 2 1:title 'Local':rotate 50 60
+light 0 1 0 1 -2 -1 -1
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 2:title 'no diffuse':rotate 50 60
+diffuse 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+subplot 2 2 3:title 'diffusive only':rotate 50 60
+diffuse 0.5:light 0 1 0 1 -2 -1 -1 'w' 0
+line 1 0 1 -1 -1 0 'BAO':box:surf a
+
+
Sample light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.68 Sample `loglog`

+ + +

Example of log- and log-log- axis labels. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Semi-log axis':ranges 0.01 100 -1 1:axis 'lg(x)' '' ''
+axis:grid 'xy' 'g':fplot 'sin(1/x)':xlabel 'x' 0:ylabel 'y = sin 1/x' 0
+subplot 2 2 1 '<_':title 'Log-log axis':ranges 0.01 100 0.1 100:axis 'lg(x)' 'lg(y)' ''
+axis:grid '!' 'h=':grid:fplot 'sqrt(1+x^2)'
+xlabel 'x' 0:ylabel 'y = \sqrt{1+x^2}' 0
+subplot 2 2 2 '<_':title 'Minus-log axis':ranges -100 -0.01 -100 -0.1:axis '-lg(-x)' '-lg(-y)' ''
+axis:fplot '-sqrt(1+x^2)':xlabel 'x' 0:ylabel 'y = -\sqrt{1+x^2}' 0
+subplot 2 2 3 '<_':title 'Log-ticks':ranges 0.01 100 0 100:axis 'sqrt(x)' '' ''
+axis:fplot 'x':xlabel 'x' 1:ylabel 'y = x' 0
+
+
Sample loglog +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.69 Sample `map`

+ + +

Example of map. +

+

MGL code: +

new a 50 40 'x':new b 50 40 'y':zrange -2 2:text 0 0 '\to'
+subplot 2 1 0:text 0 1.1 '\{x, y\}' '' -2:box:map a b 'brgk'
+subplot 2 1 1:text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2
+box:fill a '(x^3+y^3)/2':fill b '(x-y)/2':map a b 'brgk'
+
+
Sample map +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.70 Sample `mark`

+ + +

Example of mark. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Mark plot (default)':box:mark y y1 's'
+
+
Sample mark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.71 Sample `mask`

+ + +

Example of mask kinds. +

+

MGL code: +

new a 10 10 'x'
+subplot 5 4 0 '':title '"-" mask':dens a '3-'
+subplot 5 4 1 '':title '"+" mask':dens a '3+'
+subplot 5 4 2 '':title '"=" mask':dens a '3='
+subplot 5 4 3 '':title '";" mask':dens a '3;'
+subplot 5 4 4 '':title '";I" mask':dens a '3;I'
+subplot 5 4 5 '':title '"o" mask':dens a '3o'
+subplot 5 4 6 '':title '"O" mask':dens a '3O'
+subplot 5 4 7 '':title '"s" mask':dens a '3s'
+subplot 5 4 8 '':title '"S" mask':dens a '3S'
+subplot 5 4 9 '':title '";/" mask':dens a '3;/'
+subplot 5 4 10 '':title '"~" mask':dens a '3~'
+subplot 5 4 11 '':title '"<" mask':dens a '3<'
+subplot 5 4 12 '':title '">" mask':dens a '3>'
+subplot 5 4 13 '':title '"j" mask':dens a '3j'
+subplot 5 4 14 '':title '"-;\" mask':dens a '3;\ '
+subplot 5 4 15 '':title '"d" mask':dens a '3d'
+subplot 5 4 16 '':title '"D" mask':dens a '3D'
+subplot 5 4 17 '':title '"*" mask':dens a '3*'
+subplot 5 4 18 '':title '"^" mask':dens a '3^'
+subplot 5 4 19 '':title 'manual mask'
+mask '+' 'ff00182424f800':dens a '3+'
+
+
Sample mask +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.72 Sample `mesh`

+ + +

Function mesh draw wired surface. You can use meshnum for changing number of lines to be drawn. +

+

MGL code: +

call 'prepare2d'
+title 'Mesh plot':rotate 50 60:box:mesh a
+
+
Sample mesh +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.73 Sample `mirror`

+ + +

Example of using options. +

+

MGL code: +

new a 31 41 '-pi*x*exp(-(y+1)^2-4*x^2)'
+subplot 2 2 0:title 'Options for coordinates':alpha on:light on:rotate 40 60:box
+surf a 'r';yrange 0 1:surf a 'b';yrange 0 -1
+subplot 2 2 1:title 'Option "meshnum"':rotate 40 60:box
+mesh a 'r'; yrange 0 1:mesh a 'b';yrange 0 -1; meshnum 5
+subplot 2 2 2:title 'Option "alpha"':rotate 40 60:box
+surf a 'r';yrange 0 1; alpha 0.7:surf a 'b';yrange 0 -1; alpha 0.3
+subplot 2 2 3 '<_':title 'Option "legend"'
+fplot 'x^3' 'r'; legend 'y = x^3':fplot 'cos(pi*x)' 'b'; legend 'y = cos \pi x'
+box:axis:legend 2
+
+
Sample mirror +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.74 Sample `molecule`

+ + +

Example of drawing molecules. +

+

MGL code: +

alpha on:light on
+subplot 2 2 0 '':title 'Methane, CH_4':rotate 60 120
+sphere 0 0 0 0.25 'k':drop 0 0 0 0 0 1 0.35 'h' 1 2:sphere 0 0 0.7 0.25 'g'
+drop 0 0 0 -0.94 0 -0.33 0.35 'h' 1 2:sphere -0.66 0 -0.23 0.25 'g'
+drop 0 0 0 0.47 0.82 -0.33 0.35 'h' 1 2:sphere 0.33 0.57 -0.23 0.25 'g'
+drop 0 0 0 0.47 -0.82 -0.33 0.35 'h' 1 2:sphere 0.33 -0.57 -0.23 0.25 'g'
+subplot 2 2 1 '':title 'Water, H{_2}O':rotate 60 100
+sphere 0 0 0 0.25 'r':drop 0 0 0 0.3 0.5 0 0.3 'm' 1 2:sphere 0.3 0.5 0 0.25 'g'
+drop 0 0 0 0.3 -0.5 0 0.3 'm' 1 2:sphere 0.3 -0.5 0 0.25 'g'
+subplot 2 2 2 '':title 'Oxygen, O_2':rotate 60 120
+drop 0 0.5 0 0 -0.3 0 0.3 'm' 1 2:sphere 0 0.5 0 0.25 'r'
+drop 0 -0.5 0 0 0.3 0 0.3 'm' 1 2:sphere 0 -0.5 0 0.25 'r'
+subplot 2 2 3 '':title 'Ammonia, NH_3':rotate 60 120
+sphere 0 0 0 0.25 'b':drop 0 0 0 0.33 0.57 0 0.32 'n' 1 2
+sphere 0.33 0.57 0 0.25 'g':drop 0 0 0 0.33 -0.57 0 0.32 'n' 1 2
+sphere 0.33 -0.57 0 0.25 'g':drop 0 0 0 -0.65 0 0 0.32 'n' 1 2
+sphere -0.65 0 0 0.25 'g'
+
+
Sample molecule +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.75 Sample `ode`

+ + +

Example of phase plain created by ode solving, contour lines (cont) and flow threads. +

+

MGL code: +

subplot 2 2 0 '<_':title 'Cont':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new f 100 100 'y^2+2*x^3-x^2-0.5':cont f
+
+subplot 2 2 1 '<_':title 'Flow':box
+axis:xlabel 'x':ylabel '\dot{x}'
+new fx 100 100 'x-3*x^2'
+new fy 100 100 'y'
+flow fy fx 'v';value 7
+
+subplot 2 2 2 '<_':title 'ODE':box
+axis:xlabel 'x':ylabel '\dot{x}'
+for $x -1 1 0.1
+  ode r 'y;x-3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+  ode r '-y;-x+3*x^2' 'xy' [$x,0]
+  plot r(0) r(1)
+next
+
+
Sample ode +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.76 Sample `ohlc`

+ + +

Function ohlc draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high) and minimal(low) values, as well as horizontal lines before/after vertical line for initial(open)/final(close) values of some process. +

+

MGL code: +

new o 10 '0.5*sin(pi*x)'
+new c 10 '0.5*sin(pi*(x+2/9))'
+new l 10 '0.3*rnd-0.8'
+new h 10 '0.3*rnd+0.5'
+subplot 1 1 0 '':title 'OHLC plot':box:ohlc o h l c
+
+
Sample ohlc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.77 Sample `param1`

+ + +

Example of parametric plots for 1D data. +

+

MGL code: +

new x 100 'sin(pi*x)'
+new y 100 'cos(pi*x)'
+new z 100 'sin(2*pi*x)'
+new c 100 'cos(2*pi*x)'
+
+subplot 4 3 0:rotate 40 60:box:plot x y z
+subplot 4 3 1:rotate 40 60:box:area x y z
+subplot 4 3 2:rotate 40 60:box:tens x y z c
+subplot 4 3 3:rotate 40 60:box:bars x y z
+subplot 4 3 4:rotate 40 60:box:stem x y z
+subplot 4 3 5:rotate 40 60:box:textmark x y z c*2 '\alpha'
+subplot 4 3 6:rotate 40 60:box:tube x y z c/10
+subplot 4 3 7:rotate 40 60:box:mark x y z c 's'
+subplot 4 3 8:box:error x y z/10 c/10
+subplot 4 3 9:rotate 40 60:box:step x y z
+subplot 4 3 10:rotate 40 60:box:torus x z 'z';light on
+subplot 4 3 11:rotate 40 60:box:label x y z '%z'
+
+
Sample param1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.78 Sample `param2`

+ + +

Example of parametric plots for 2D data. +

+

MGL code: +

new x 100 100 'sin(pi*(x+y)/2)*cos(pi*y/2)'
+new y 100 100 'cos(pi*(x+y)/2)*cos(pi*y/2)'
+new z 100 100 'sin(pi*y/2)'
+new c 100 100 'cos(pi*x)'
+
+subplot 4 4 0:rotate 40 60:box:surf x y z
+subplot 4 4 1:rotate 40 60:box:surfc x y z c
+subplot 4 4 2:rotate 40 60:box:surfa x y z c;alpha 1
+subplot 4 4 3:rotate 40 60:box:mesh x y z;meshnum 10
+subplot 4 4 4:rotate 40 60:box:tile x y z;meshnum 10
+subplot 4 4 5:rotate 40 60:box:tiles x y z c;meshnum 10
+subplot 4 4 6:rotate 40 60:box:axial x y z;alpha 0.5;light on
+subplot 4 4 7:rotate 40 60:box:cont x y z
+subplot 4 4 8:rotate 40 60:box:contf x y z;light on:contv x y z;light on
+subplot 4 4 9:rotate 40 60:box:belt x y z 'x';meshnum 10;light on
+subplot 4 4 10:rotate 40 60:box:dens x y z;alpha 0.5
+subplot 4 4 11:rotate 40 60:box
+fall x y z 'g';meshnum 10:fall x y z 'rx';meshnum 10
+subplot 4 4 12:rotate 40 60:box:belt x y z '';meshnum 10;light on
+subplot 4 4 13:rotate 40 60:box:boxs x y z '';meshnum 10;light on
+subplot 4 4 14:rotate 40 60:box:boxs x y z '#';meshnum 10;light on
+subplot 4 4 15:rotate 40 60:box:boxs x y z '@';meshnum 10;light on
+
+
Sample param2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.79 Sample `param3`

+ + +

Example of parametric plots for 3D data. +

+

MGL code: +

new x 50 50 50 '(x+2)/3*sin(pi*y/2)'
+new y 50 50 50 '(x+2)/3*cos(pi*y/2)'
+new z 50 50 50 'z'
+new c 50 50 50 '-2*(x^2+y^2+z^4-z^2)+0.2'
+new d 50 50 50 '1-2*tanh(2*(x+y)^2)'
+
+alpha on:light on
+subplot 4 3 0:rotate 40 60:box:surf3 x y z c
+subplot 4 3 1:rotate 40 60:box:surf3c x y z c d
+subplot 4 3 2:rotate 40 60:box:surf3a x y z c d
+subplot 4 3 3:rotate 40 60:box:cloud x y z c
+subplot 4 3 4:rotate 40 60:box:cont3 x y z c:cont3 x y z c 'x':cont3 x y z c 'z'
+subplot 4 3 5:rotate 40 60:box:contf3 x y z c:contf3 x y z c 'x':contf3 x y z c 'z'
+subplot 4 3 6:rotate 40 60:box:dens3 x y z c:dens3 x y z c 'x':dens3 x y z c 'z'
+subplot 4 3 7:rotate 40 60:box:dots x y z c;meshnum 15
+subplot 4 3 8:rotate 40 60:box:densx c '' 0:densy c '' 0:densz c '' 0
+subplot 4 3 9:rotate 40 60:box:contx c '' 0:conty c '' 0:contz c '' 0
+subplot 4 3 10:rotate 40 60:box:contfx c '' 0:contfy c '' 0:contfz c '' 0
+
+
Sample param3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.80 Sample `paramv`

+ + +

Example of parametric plots for vector fields. +

+

MGL code: +

new x 20 20 20 '(x+2)/3*sin(pi*y/2)'
+new y 20 20 20 '(x+2)/3*cos(pi*y/2)'
+new z 20 20 20 'z+x'
+new ex 20 20 20 'x'
+new ey 20 20 20 'x^2+y'
+new ez 20 20 20 'y^2+z'
+
+new x1 50 50 '(x+2)/3*sin(pi*y/2)'
+new y1 50 50 '(x+2)/3*cos(pi*y/2)'
+new e1 50 50 'x'
+new e2 50 50 'x^2+y'
+
+subplot 3 3 0:rotate 40 60:box:vect x1 y1 e1 e2
+subplot 3 3 1:rotate 40 60:box:flow x1 y1 e1 e2
+subplot 3 3 2:rotate 40 60:box:pipe x1 y1 e1 e2
+subplot 3 3 3:rotate 40 60:box:dew x1 y1 e1 e2
+subplot 3 3 4:rotate 40 60:box:vect x y z ex ey ez
+subplot 3 3 5:rotate 40 60:box
+vect3 x y z ex ey ez:vect3 x y z ex ey ez 'x':vect3 x y z ex ey ez 'z'
+grid3 x y z z '{r9}':grid3 x y z z '{g9}x':grid3 x y z z '{b9}z'
+subplot 3 3 6:rotate 40 60:box:flow x y z ex ey ez
+subplot 3 3 7:rotate 40 60:box:pipe x y z ex ey ez
+
+
Sample paramv +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.81 Sample `parser`

+ + +

Basic MGL script. +

+

MGL code: +

title 'MGL parser sample'
+# call function
+call 'sample'
+
+# ordinary for-loop
+for $0 -1 1 0.1
+if $0<0:line 0 0 1 $0 'r':else:line 0 0 1 $0 'g':endif
+next
+
+# if-elseif-else
+for $i -1 1 0.5
+if $i<0
+text 1.1 $i '$i' 'b'
+elseif $i>0
+text 1.1 $i '$i' 'r'
+else
+text 1.1 $i '$i'
+endif
+next
+
+# ordinary do-while
+do
+defnum $i $i-0.2
+line 0 0 $i 1 'b'
+while $i>0
+
+# do-next-break
+do
+defnum $i $i-0.2
+if $i<-1 then break
+line 0 0 $i 1 'm'
+next
+
+# for-while-continue
+for $i -5 10
+text $i/5 1.1 'a'+($i+5)
+if $i<0
+text $i/5-0.06 1.1 '--' 'b'
+elseif mod($i,2)=0
+text $i/5-0.06 1.1 '~' 'r'
+else
+# NOTE: 'continue' bypass the 'while'!
+continue
+endif
+# NOTE: 'while' limit the actual number of iterations
+while $i<5
+
+# nested loops
+for $i 0 1 0.1
+for $j 0 1 0.1
+ball $i $j
+if $j>0.5 then continue
+ball $i $j 'b+'
+next
+next
+
+func 'sample'
+new dat 100 'sin(2*pi*(i/99+1))'
+plot dat;xrange -1 0
+box:axis
+xlabel 'x':ylabel 'y'
+return
+
+
Sample parser +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.82 Sample `pde`

+ + +

Example of pde solver. +

+

MGL code: +

new re 128 'exp(-48*(x+0.7)^2)':new im 128
+pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30
+transpose a
+subplot 1 1 0 '<_':title 'PDE solver'
+axis:xlabel '\i x':ylabel '\i z'
+crange 0 1:dens a 'wyrRk'
+fplot '-x' 'k|'
+text 0 0.95 'Equation: ik_0\partial_zu + \Delta u + x\cdot u + i \frac{x+z}{2}\cdot u = 0\n{}absorption: (x+z)/2 for x+z>0'
+
+
Sample pde +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.83 Sample `pendelta`

+ + +

Example of pendelta for lines and glyphs smoothing. +

+

MGL code: +

quality 6
+list a 0.25 0.5 1 2 4
+for $0 0 4
+pendelta a($0)
+define $1 0.5*$0-1
+line -1 $1 1 $1 'r'
+text 0 $1 'delta=',a($0)
+next
+
+
Sample pendelta +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.84 Sample `pipe`

+ + +

Function pipe is similar to flow but draw pipes (tubes) which radius is proportional to the amplitude of vector field. The color scheme is used for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 2 2 0 '':title 'Pipe plot (default)':light on:box:pipe a b
+subplot 2 2 1 '':title '"i" style':box:pipe a b 'i'
+subplot 2 2 2 '':title 'from edges only':box:pipe a b '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:pipe ex ey ez '' 0.1
+
+
Sample pipe +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.85 Sample `plot`

+ + +

Function plot is most standard way to visualize 1D data array. By default, Plot use colors from palette. However, you can specify manual color/palette, and even set to use new color for each points by using `!` style. Another feature is ` ` style which draw only markers without line between points. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Plot plot (default)':box:plot y
+subplot 2 2 2 '':title ''!' style; 'rgb' palette':box:plot y 'o!rgb'
+subplot 2 2 3 '':title 'just markers':box:plot y ' +'
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:plot xc yc z 'rs'
+
+
Sample plot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.86 Sample `pmap`

+ + +

Function pmap draw Poincare map - show intersections of the curve and the surface. +

+

MGL code: +

subplot 1 1 0 '<_^':title 'Poincare map sample'
+ode r 'cos(y)+sin(z);cos(z)+sin(x);cos(x)+sin(y)' 'xyz' [0.1,0,0] 0.1 100
+rotate 40 60:copy x r(0):copy y r(1):copy z r(2)
+ranges x y z
+axis:plot x y z 'b'
+xlabel '\i x' 0:ylabel '\i y' 0:zlabel '\i z'
+pmap x y z z 'b#o'
+fsurf '0'
+
+
Sample pmap +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.87 Sample `primitives`

+ + +

Example of primitives: line, curve, rhomb, ellipse, face, sphere, drop, cone. +

+

MGL code: +

subplot 2 2 0 '':title 'Line, Curve, Rhomb, Ellipse' '' -1.5
+line -1 -1 -0.5 1 'qAI'
+curve -0.6 -1 1 1 0 1 1 1 'rA'
+ball 0 -0.5 '*':ball 1 -0.1 '*'
+rhomb 0 0.4 1 0.9 0.2 'b#'
+rhomb 0 0 1 0.4 0.2 'cg@'
+ellipse 0 -0.5 1 -0.1 0.2 'u#'
+ellipse 0 -1 1 -0.6 0.2 'm@'
+
+subplot 2 3 1 '':title 'Arc, Polygon, Symbol';size -1.2
+arc -0.6 0 -0.6 0.3 180 '2kA':ball -0.6 0
+polygon 0 0 0 0.4 6 'r'
+new x 50 'cos(3*pi*x)':new y 50 'sin(pi*x)'
+addsymbol 'a' x y
+symbol 0.7 0 'a'
+
+light on
+subplot 2 3 3 '<^>' 0 -0.2:title 'Face[xyz]';size -1.5:rotate 50 60:box
+facex 1 0 -1 1 1 'r':facey -1 -1 -1 1 1 'g':facez 1 -1 -1 -1 1 'b'
+face -1 -1 1 -1 1 1 1 -1 0 1 1 1 'bmgr'
+
+subplot 2 3 5 '':title 'Cone';size -1.5
+cone -0.7 -0.3 0 -0.7 0.7 0.5 0.2 0.1 'b':text -0.7 -0.7 'no edges\n(default)';size -1.5
+cone 0 -0.3 0 0 0.7 0.5 0.2 0.1 'g@':text 0 -0.7 'with edges\n("\@" style)';size -1.5
+cone 0.7 -0.3 0 0.7 0.7 0.5 0.2 0 'Ggb':text 0.7 -0.7 '"arrow" with\n{}gradient';size -1.5
+subplot 2 2 2 '':title 'Sphere and Drop'
+line -0.9 0 1 0.9 0 1
+text -0.9 0.4 'sh=0':drop -0.9 0 0 1 0.5 'r' 0:ball -0.9 0 1 'k'
+text -0.3 0.6 'sh=0.33':drop -0.3 0 0 1 0.5 'r' 0.33:ball -0.3 0 1 'k'
+text 0.3 0.8 'sh=0.67':drop 0.3 0 0 1 0.5 'r' 0.67:ball 0.3 0 1 'k'
+text 0.9 1. 'sh=1':drop 0.9 0 0 1 0.5 'r' 1:ball 0.9 0 1 'k'
+
+text -0.9 -1.1 'asp=0.33':drop -0.9 -0.7 0 1 0.5 'b' 0 0.33
+text -0.3 -1.1 'asp=0.67':drop -0.3 -0.7 0 1 0.5 'b' 0 0.67
+text 0.3 -1.1 'asp=1':drop 0.3 -0.7 0 1 0.5 'b' 0 1
+text 0.9 -1.1 'asp=1.5':drop 0.9 -0.7 0 1 0.5 'b' 0 1.5
+
+
Sample primitives +
+
+ + + +

6.88 Sample `projection`

+ + +

Example of plot projection (ternary=4). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample':ternary 4:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+
Sample projection +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.89 Sample `projection5`

+ + +

Example of plot projection in ternary coordinates (ternary=5). +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+title 'Projection sample (ternary)':ternary 5:rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'X':ylabel 'Y':zlabel 'Z'
+
+
Sample projection5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.90 Sample `pulse`

+ + +

Example of pulse parameter determining. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Pulse sample'
+new a 100 'exp(-6*x^2)':ranges 0 a.nx-1 0 1
+axis:plot a
+
+pulse b a 'x'
+
+define m a.max
+
+line b(1) 0 b(1) m 'r='
+line b(1)-b(3)/2 0  b(1)-b(3)/2 m 'm|'
+line b(1)+b(3)/2 0  b(1)+b(3)/2 m 'm|'
+line 0 0.5*m a.nx-1 0.5*m 'h'
+new x 100 'x'
+plot b(0)*(1-((x-b(1))/b(2))^2) 'g'
+
+
Sample pulse +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.91 Sample `qo2d`

+ + +

Example of PDE solving by quasioptical approach qo2d. +

+

MGL code: +

define $1 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)'
+subplot 1 1 0 '<_':title 'Beam and ray tracing'
+ray r $1 -0.7 -1 0 0 0.5 0 0.02 2:plot r(0) r(1) 'k'
+axis:xlabel '\i x':ylabel '\i z'
+new re 128 'exp(-48*x^2)':new im 128
+new xx 1:new yy 1
+qo2d a $1 re im r 1 30 xx yy
+crange 0 1:dens xx yy a 'wyrRk':fplot '-x' 'k|'
+text 0 0.85 'absorption: (x+y)/2 for x+y>0'
+text 0.7 -0.05 'central ray'
+
+
Sample qo2d +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.92 Sample `quality0`

+ + +

Show all kind of primitives in quality=0. +

+

MGL code: +

quality 0
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.93 Sample `quality1`

+ + +

Show all kind of primitives in quality=1. +

+

MGL code: +

quality 1
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.94 Sample `quality2`

+ + +

Show all kind of primitives in quality=2. +

+

MGL code: +

quality 2
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.95 Sample `quality4`

+ + +

Show all kind of primitives in quality=4. +

+

MGL code: +

quality 4
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality4 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.96 Sample `quality5`

+ + +

Show all kind of primitives in quality=5. +

+

MGL code: +

quality 5
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality5 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.97 Sample `quality6`

+ + +

Show all kind of primitives in quality=6. +

+

MGL code: +

quality 6
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality6 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.98 Sample `quality8`

+ + +

Show all kind of primitives in quality=8. +

+

MGL code: +

quality 8
+subplot 3 2 0:define y 0.95
+define d 0.3:define x0 0.2:define x1 0.5:define x2 0.6
+line x0 1-0*d x1 1-0*d 'k-':text x2 y-0*d 'Solid `-`' ':rL'
+line x0 1-1*d x1 1-1*d 'k|':text x2 y-1*d 'Long Dash `|`' ':rL'
+line x0 1-2*d x1 1-2*d 'k;':text x2 y-2*d 'Dash 1;`' ':rL'
+line x0 1-3*d x1 1-3*d 'k=':text x2 y-3*d 'Small dash `=`' ':rL'
+line x0 1-4*d x1 1-4*d 'kj':text x2 y-4*d 'Dash-dot `j`' ':rL'
+line x0 1-5*d x1 1-5*d 'ki':text x2 y-5*d 'Small dash-dot `i`' ':rL'
+line x0 1-6*d x1 1-6*d 'k:':text x2 y-6*d 'Dots `:`' ':rL'
+line x0 1-7*d x1 1-7*d 'k ':text x2 y-7*d 'None ``' ':rL'
+define d 0.25:define x0 -0.8:define x1 -1:define x2 -0.05
+ball x1 5*d 'k.':text x0 5*d '.' ':rL'
+ball x1 4*d 'k+':text x0 4*d '+' ':rL'
+ball x1 3*d 'kx':text x0 3*d 'x' ':rL'
+ball x1 2*d 'k*':text x0 2*d '*' ':rL'
+ball x1 d 'ks':text x0 d 's' ':rL'
+ball x1 0 'kd':text x0 0 'd' ':rL'
+ball x1 -d 0 'ko':text x0 y-d 'o' ':rL'
+ball x1 -2*d 0 'k^':text x0 -2*d '\^' ':rL'
+ball x1 -3*d 0 'kv':text x0 -3*d 'v' ':rL'
+ball x1 -4*d 0 'k<':text x0 -4*d '<' ':rL'
+ball x1 -5*d 0 'k>':text x0 -5*d '>' ':rL'
+
+define x0 -0.3:define x1 -0.5
+ball x1 5*d 'k#.':text x0 5*d '\#.' ':rL'
+ball x1 4*d 'k#+':text x0 4*d '\#+' ':rL'
+ball x1 3*d 'k#x':text x0 3*d '\#x' ':rL'
+ball x1 2*d 'k#*':text x0 2*d '\#*' ':rL'
+ball x1 d 'k#s':text x0 d '\#s' ':rL'
+ball x1 0 'k#d':text x0 0 '\#d' ':rL'
+ball x1 -d 0 'k#o':text x0 -d '\#o' ':rL'
+ball x1 -2*d 0 'k#^':text x0 -2*d '\#\^' ':rL'
+ball x1 -3*d 0 'k#v':text x0 -3*d '\#v' ':rL'
+ball x1 -4*d 0 'k#<':text x0 -4*d '\#<' ':rL'
+ball x1 -5*d 0 'k#>':text x0 -5*d '\#>' ':rL'
+
+subplot 3 2 1
+define a 0.1:define b 0.4:define c 0.5
+line a 1 b 1 'k-A':text c 1 'Style `A` or `A\_`' ':rL'
+line a 0.8 b 0.8 'k-V':text c 0.8 'Style `V` or `V\_`' ':rL'
+line a 0.6 b 0.6 'k-K':text c 0.6 'Style `K` or `K\_`' ':rL'
+line a 0.4 b 0.4 'k-I':text c 0.4 'Style `I` or `I\_`' ':rL'
+line a 0.2 b 0.2 'k-D':text c 0.2 'Style `D` or `D\_`' ':rL'
+line a 0 b 0 'k-S':text c 0 'Style `S` or `S\_`' ':rL'
+line a -0.2 b -0.2 'k-O':text c -0.2 'Style `O` or `O\_`' ':rL'
+line a -0.4 b -0.4 'k-T':text c -0.4 'Style `T` or `T\_`' ':rL'
+line a -0.6 b -0.6 'k-_':text c -0.6 'Style `\_` or none' ':rL'
+line a -0.8 b -0.8 'k-AS':text c -0.8 'Style `AS`' ':rL'
+line a -1 b -1 'k-_A':text c -1 'Style `\_A`' ':rL'
+
+define a -1:define b -0.7:define c -0.6
+line a 1 b 1 'kAA':text c 1 'Style `AA`' ':rL'
+line a 0.8 b 0.8 'kVV':text c 0.8 'Style `VV`' ':rL'
+line a 0.6 b 0.6 'kKK':text c 0.6 'Style `KK`' ':rL'
+line a 0.4 b 0.4 'kII':text c 0.4 'Style `II`' ':rL'
+line a 0.2 b 0.2 'kDD':text c 0.2 'Style `DD`' ':rL'
+line a 0 b 0 'kSS':text c 0 'Style `SS`' ':rL'
+line a -0.2 b -0.2 'kOO':text c -0.2 'Style `OO`' ':rL'
+line a -0.4 b -0.4 'kTT':text c -0.4 'Style `TT`' ':rL'
+line a -0.6 b -0.6 'k-__':text c -0.6 'Style `\_\_`' ':rL'
+line a -0.8 b -0.8 'k-VA':text c -0.8 'Style `VA`' ':rL'
+line a -1 b -1 'k-AV':text c -1 'Style `AV`' ':rL'
+
+subplot 3 2 2
+#LENUQ
+
+facez -1 -1 0 0.4 0.3 'L#':text -0.8 -0.9 'L' 'w:C' -1.4
+facez -0.6 -1 0 0.4 0.3 'E#':text -0.4 -0.9 'E' 'w:C' -1.4
+facez -0.2 -1 0 0.4 0.3 'N#':text 0 -0.9 'N' 'w:C' -1.4
+facez 0.2 -1 0 0.4 0.3 'U#':text 0.4 -0.9 'U' 'w:C' -1.4
+facez 0.6 -1 0 0.4 0.3 'Q#':text 0.8 -0.9 'Q' 'w:C' -1.4
+#lenuq
+facez -1 -0.7 0 0.4 0.3 'l#':text -0.8 -0.6 'l' 'k:C' -1.4
+facez -0.6 -0.7 0 0.4 0.3 'e#':text -0.4 -0.6 'e' 'k:C' -1.4
+facez -0.2 -0.7 0 0.4 0.3 'n#':text 0 -0.6 'n' 'k:C' -1.4
+facez 0.2 -0.7 0 0.4 0.3 'u#':text 0.4 -0.6 'u' 'k:C' -1.4
+facez 0.6 -0.7 0 0.4 0.3 'q#':text 0.8 -0.6 'q' 'k:C' -1.4
+#CMYkP
+facez -1 -0.4 0 0.4 0.3 'C#':text -0.8 -0.3 'C' 'w:C' -1.4
+facez -0.6 -0.4 0 0.4 0.3 'M#':text -0.4 -0.3 'M' 'w:C' -1.4
+facez -0.2 -0.4 0 0.4 0.3 'Y#':text 0 -0.3 'Y' 'w:C' -1.4
+facez 0.2 -0.4 0 0.4 0.3 'k#':text 0.4 -0.3 'k' 'w:C' -1.4
+facez 0.6 -0.4 0 0.4 0.3 'P#':text 0.8 -0.3 'P' 'w:C' -1.4
+#cmywp
+facez -1 -0.1 0 0.4 0.3 'c#':text -0.8 0 'c' 'k:C' -1.4
+facez -0.6 -0.1 0 0.4 0.3 'm#':text -0.4 0 'm' 'k:C' -1.4
+facez -0.2 -0.1 0 0.4 0.3 'y#':text 0 0 'y' 'k:C' -1.4
+facez 0.2 -0.1 0 0.4 0.3 'w#':text 0.4 0 'w' 'k:C' -1.4
+facez 0.6 -0.1 0 0.4 0.3 'p#':text 0.8 0 'p' 'k:C' -1.4
+#BGRHW
+facez -1 0.2 0 0.4 0.3 'B#':text -0.8 0.3 'B' 'w:C' -1.4
+facez -0.6 0.2 0 0.4 0.3 'G#':text -0.4 0.3 'G' 'w:C' -1.4
+facez -0.2 0.2 0 0.4 0.3 'R#':text 0 0.3 'R' 'w:C' -1.4
+facez 0.2 0.2 0 0.4 0.3 'H#':text 0.4 0.3 'H' 'w:C' -1.4
+facez 0.6 0.2 0 0.4 0.3 'W#':text 0.8 0.3 'W' 'w:C' -1.4
+#bgrhw
+facez -1 0.5 0 0.4 0.3 'b#':text -0.8 0.6 'b' 'k:C' -1.4
+facez -0.6 0.5 0 0.4 0.3 'g#':text -0.4 0.6 'g' 'k:C' -1.4
+facez -0.2 0.5 0 0.4 0.3 'r#':text 0 0.6 'r' 'k:C' -1.4
+facez 0.2 0.5 0 0.4 0.3 'h#':text 0.4 0.6 'h' 'k:C' -1.4
+facez 0.6 0.5 0 0.4 0.3 'w#':text 0.8 0.6 'w' 'k:C' -1.4
+#brighted
+facez -1 0.8 0 0.4 0.3 '{r1}#':text -0.8 0.9 '\{r1\}' 'w:C' -1.4
+facez -0.6 0.8 0 0.4 0.3 '{r3}#':text -0.4 0.9 '\{r3\}' 'w:C' -1.4
+facez -0.2 0.8 0 0.4 0.3 '{r5}#':text 0 0.9 '\{r5\}' 'k:C' -1.4
+facez 0.2 0.8 0 0.4 0.3 '{r7}#':text 0.4 0.9 '\{r7\}' 'k:C' -1.4
+facez 0.6 0.8 0 0.4 0.3 '{r9}#':text 0.8 0.9 '\{r9\}' 'k:C' -1.4
+# HEX
+facez -1 -1.3 0 1 0.3 '{xff9966}#':text -0.5 -1.2 '\{xff9966\}' 'k:C' -1.4
+facez 0 -1.3 0 1 0.3 '{x83CAFF}#':text 0.5 -1.2 '\{x83caff\}' 'k:C' -1.4
+
+subplot 3 2 3
+for $i 0 9
+line -1 0.2*$i-1 1 0.2*$i-1 'r','0'+$i
+text 1.05 0.2*$i-1 '0'+$i ':L'
+next
+
+subplot 3 2 4:title 'TriPlot sample':rotate 50 60
+list tt 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0:list yt -1 -1 1 0:list zt -1 -1 -1 1:light on
+triplot tt xt yt zt 'b':triplot tt xt yt zt 'k#'
+
+subplot 3 2 5:new r 4 'i+1':ranges 1 4 1 4
+axis:mark r r 's':plot r 'b'
+
+
+
Sample quality8 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.99 Sample `radar`

+ + +

The radar plot is variant of plot, which make plot in polar coordinates and draw radial rays in point directions. If you just need a plot in polar coordinates then I recommend to use Curvilinear coordinates or plot in parametric form with x=r*cos(fi); y=r*sin(fi);. +

+

MGL code: +

new yr 10 3 '0.4*sin(pi*(x+1.5+y/2)+0.1*rnd)'
+subplot 1 1 0 '':title 'Radar plot (with grid, "\#")':radar yr '#'
+
+
Sample radar +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.100 Sample `refill`

+ + +

Example of refill and gspline. +

+

MGL code: +

new x 10 '0.5+rnd':cumsum x 'x':norm x -1 1
+copy y sin(pi*x)/1.5
+subplot 2 2 0 '<_':title 'Refill sample'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:refill r x y:plot r 'r'
+
+subplot 2 2 1 '<_':title 'Global spline'
+box:axis:plot x y 'o ':fplot 'sin(pi*x)/1.5' 'B:'
+new r 100:gspline r x y:plot r 'r'
+
+new y 10 '0.5+rnd':cumsum y 'x':norm y -1 1
+copy xx x:extend xx 10
+copy yy y:extend yy 10:transpose yy
+copy z sin(pi*xx*yy)/1.5
+alpha on:light on
+subplot 2 2 2:title '2d regular':rotate 40 60
+box:axis:mesh xx yy z 'k'
+new rr 100 100:refill rr x y z:surf rr
+
+new xx 10 10 '(x+1)/2*cos(y*pi/2-1)':new yy 10 10 '(x+1)/2*sin(y*pi/2-1)'
+copy z sin(pi*xx*yy)/1.5
+subplot 2 2 3:title '2d non-regular':rotate 40 60
+box:axis:plot xx yy z 'ko '
+new rr 100 100:refill rr xx yy z:surf rr
+
+
Sample refill +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.101 Sample `region`

+ + +

Function region fill the area between 2 curves. It support gradient filling if 2 colors per curve is specified. Also it can fill only the region y1<y<y2 if style `i` is used. +

+

MGL code: +

call 'prepare1d'
+copy y1 y(:,1):copy y2 y(:,2)
+subplot 2 2 0 '':title 'Region plot (default)':box:region y1 y2:plot y1 'k2':plot y2 'k2'
+subplot 2 2 1 '':title '2 colors':box:region y1 y2 'yr':plot y1 'k2':plot y2 'k2'
+subplot 2 2 2 '':title '"i" style':box:region y1 y2 'ir':plot y1 'k2':plot y2 'k2'
+subplot 2 2 3 '^_':title '3d variant':rotate 40 60:box
+new x1 100 'sin(pi*x)':new y1 100 'cos(pi*x)':new z 100 'x'
+new x2 100 'sin(pi*x+pi/3)':new y2 100 'cos(pi*x+pi/3)'
+plot x1 y1 z 'r2':plot x2 y2 z 'b2'
+region x1 y1 z x2 y2 z 'cmy!'
+
+
Sample region +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.102 Sample `scanfile`

+ + +

Example of scanfile for reading `named` data. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Save and scanfile sample'
+list a 1 -1 0
+save 'This is test: 0 -> ',a(0),' q' 'test.txt' 'w'
+save 'This is test: 1 -> ',a(1),' q' 'test.txt'
+save 'This is test: 2 -> ',a(2),' q' 'test.txt'
+
+scanfile a 'test.txt' 'This is test: %g -> %g'
+ranges a(0) a(1):axis:plot a(0) a(1) 'o'
+
+
Sample scanfile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.103 Sample `schemes`

+ + +

Example of popular color schemes. +

+

MGL code: +

new x 100 100 'x':new y 100 100 'y'
+call 'sch' 0 'kw'
+call 'sch' 1 '%gbrw'
+call 'sch' 2 'kHCcw'
+call 'sch' 3 'kBbcw'
+call 'sch' 4 'kRryw'
+call 'sch' 5 'kGgew'
+call 'sch' 6 'BbwrR'
+call 'sch' 7 'BbwgG'
+call 'sch' 8 'GgwmM'
+call 'sch' 9 'UuwqR'
+call 'sch' 10 'QqwcC'
+call 'sch' 11 'CcwyY'
+call 'sch' 12 'bcwyr'
+call 'sch' 13 'bwr'
+call 'sch' 14 'wUrqy'
+call 'sch' 15 'UbcyqR'
+call 'sch' 16 'BbcyrR'
+call 'sch' 17 'bgr'
+call 'sch' 18 'BbcyrR|'
+call 'sch' 19 'b{g,0.3}r'
+stop
+func 'sch' 2
+subplot 2 10 $1 '<>_^' 0.2 0:surfa x y $2
+text 0.07+0.5*mod($1,2) 0.92-0.1*int($1/2) $2 'A'
+return
+
+
Sample schemes +
+
+ + + +

6.104 Sample `section`

+ + +

Example of section to separate data and join it back. +

+

MGL code: +

subplot 1 1 0 '<_':title 'Section&Join sample'
+axis:box:line -1 0 1 0 'h:'
+# first lets demonstrate 'join'
+new aa 11 'x^2':new a1 3 '-x':new a2 15 'x^3'
+join aa a1:join aa a2
+# add x-coordinate
+new xx aa.nx 'x':join aa xx
+plot aa(:,1) aa(:,0) '2y'
+# now select 1-st (id=0) section between zeros
+section b1 aa 0 'x' 0
+plot b1(:,1) b1(:,0) 'bo'
+# next, select 3-d (id=2) section between zeros
+section b3 aa 2 'x' 0
+plot b3(:,1) b3(:,0) 'gs'
+# finally, select 2-nd (id=-2) section from the end
+section b4 aa -2 'x' 0
+plot b4(:,1) b4(:,0) 'r#o'
+
+
Sample section +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.105 Sample `several_light`

+ + +

Example of using several light sources. +

+

MGL code: +

call 'prepare2d'
+title 'Several light sources':rotate 50 60:light on
+light 1 0 1 0 'c':light 2 1 0 0 'y':light 3 0 -1 0 'm'
+box:surf a 'h'
+
+
Sample several_light +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.106 Sample `solve`

+ + +

Example of solve for root finding. +

+

MGL code: +

zrange 0 1
+new x 20 30 '(x+2)/3*cos(pi*y)'
+new y 20 30 '(x+2)/3*sin(pi*y)'
+new z 20 30 'exp(-6*x^2-2*sin(pi*y)^2)'
+
+subplot 2 1 0:title 'Cartesian space':rotate 30 -40
+axis 'xyzU':box
+xlabel 'x':ylabel 'y'
+origin 1 1:grid 'xy'
+mesh x y z
+
+# section along 'x' direction
+solve u x 0.5 'x'
+var v u.nx 0 1
+evaluate yy y u v
+evaluate xx x u v
+evaluate zz z u v
+plot xx yy zz 'k2o'
+
+# 1st section along 'y' direction
+solve u1 x -0.5 'y'
+var v1 u1.nx 0 1
+evaluate yy y v1 u1
+evaluate xx x v1 u1
+evaluate zz z v1 u1
+plot xx yy zz 'b2^'
+
+# 2nd section along 'y' direction
+solve u2 x -0.5 'y' u1
+evaluate yy y v1 u2
+evaluate xx x v1 u2
+evaluate zz z v1 u2
+plot xx yy zz 'r2v'
+
+subplot 2 1 1:title 'Accompanied space'
+ranges 0 1 0 1:origin 0 0
+axis:box:xlabel 'i':ylabel 'j':grid2 z 'h'
+
+plot u v 'k2o':line 0.4 0.5 0.8 0.5 'kA'
+plot v1 u1 'b2^':line 0.5 0.15 0.5 0.3 'bA'
+plot v1 u2 'r2v':line 0.5 0.7 0.5 0.85 'rA'
+
+
Sample solve +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.107 Sample `stem`

+ + +

Function stem draw vertical bars. It is most attractive if markers are drawn too. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Stem plot (default)':box:stem y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:stem xc yc z 'rx'
+subplot 2 2 2 '':title '"!" style':box:stem y 'o!rgb'
+
+
Sample stem +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.108 Sample `step`

+ + +

Function step plot data as stairs. At this stairs can be centered if sizes are differ by 1. +

+

MGL code: +

call 'prepare1d'
+origin 0 0 0:subplot 2 2 0 '':title 'Step plot (default)':box:step y
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:step xc yc z 'r'
+subplot 2 2 2 '':title '"!" style':box:step y 's!rgb'
+
+
Sample step +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.109 Sample `stereo`

+ + +

Example of stereo image of surf. +

+

MGL code: +

call 'prepare2d'
+light on
+subplot 2 1 0:rotate 50 60+1:box:surf a
+subplot 2 1 1:rotate 50 60-1:box:surf a
+
+
Sample stereo +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.110 Sample `stfa`

+ + +

Example of stfa. +

+

MGL code: +

new a 2000:new b 2000
+fill a 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
+cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)'
+subplot 1 2 0 '<_':title 'Initial signal':plot a:axis:xlabel '\i t'
+subplot 1 2 1 '<_':title 'STFA plot':stfa a b 64:axis:ylabel '\omega' 0:xlabel '\i t'
+
+
Sample stfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.111 Sample `style`

+ + +

Example of colors and styles for plots. +

+

MGL code: +

+
+
Sample style +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.112 Sample `surf`

+ + +

Function surf is most standard way to visualize 2D data array. Surf use color scheme for coloring (see Color scheme). You can use `#` style for drawing black meshes on the surface. +

+

MGL code: +

call 'prepare2d'
+subplot 2 2 0:title 'Surf plot (default)':rotate 50 60:light on:box:surf a
+subplot 2 2 1:title '"\#" style; meshnum 10':rotate 50 60:box:surf a '#'; meshnum 10
+subplot 2 2 2:title '"." style':rotate 50 60:box:surf a '.'
+new x 50 40 '0.8*sin(pi*x)*sin(pi*(y+1)/2)'
+new y 50 40 '0.8*cos(pi*x)*sin(pi*(y+1)/2)'
+new z 50 40 '0.8*cos(pi*(y+1)/2)'
+subplot 2 2 3:title 'parametric form':rotate 50 60:box:surf x y z 'BbwrR'
+
+
Sample surf +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.113 Sample `surf3`

+ + +

Function surf3 is one of most suitable (for my opinion) functions to visualize 3D data. It draw the isosurface(s) - surface(s) of constant amplitude (3D analogue of contour lines). You can draw wired isosurfaces if specify `#` style. +

+

MGL code: +

call 'prepare3d'
+light on:alpha on
+subplot 2 2 0:title 'Surf3 plot (default)'
+rotate 50 60:box:surf3 c
+subplot 2 2 1:title '"\#" style'
+rotate 50 60:box:surf3 c '#'
+subplot 2 2 2:title '"." style'
+rotate 50 60:box:surf3 c '.'
+
+
Sample surf3 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.114 Sample `surf3a`

+ + +

Function surf3c is similar to surf3 but its transparency is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3A plot':rotate 50 60:light on:alpha on:box:surf3a c d
+
+
Sample surf3a +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.115 Sample `surf3c`

+ + +

Function surf3c is similar to surf3 but its coloring is determined by another data. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3C plot':rotate 50 60:light on:alpha on:box:surf3c c d
+
+
Sample surf3c +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.116 Sample `surf3ca`

+ + +

Function surf3c is similar to surf3 but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare3d'
+title 'Surf3CA plot':rotate 50 60:light on:alpha on:box:surf3ca c d c
+
+
Sample surf3ca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.117 Sample `surfa`

+ + +

Function surfa is similar to surf but its transparency is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfA plot':rotate 50 60:light on:alpha on:box:surfa a b
+
+
Sample surfa +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.118 Sample `surfc`

+ + +

Function surfc is similar to surf but its coloring is determined by another data. +

+

MGL code: +

call 'prepare2d'
+title 'SurfC plot':rotate 50 60:light on:box:surfc a b
+
+
Sample surfc +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.119 Sample `surfca`

+ + +

Function surfca is similar to surf but its coloring and transparency is determined by another data arrays. +

+

MGL code: +

call 'prepare2d'
+title 'SurfCA plot':rotate 50 60:light on:alpha on:box:surfca a b a
+
+
Sample surfca +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.120 Sample `table`

+ + +

Function table draw table with data values. +

+

MGL code: +

new ys 10 3 '0.8*sin(pi*(x+y/4+1.25))+0.2*rnd'
+subplot 2 2 0:title 'Table sample':box
+table ys 'y_1\n{}y_2\n{}y_3'
+
+subplot 2 2 1:title 'no borders, colored'
+table ys 'y_1\n{}y_2\n{}y_3' 'r|'
+
+subplot 2 2 2:title 'no font decrease'
+table ys 'y_1\n{}y_2\n{}y_3' '#'
+
+subplot 2 2 3:title 'manual width and position':box
+table 0.5 0.95 ys 'y_1\n{}y_2\n{}y_3' '#';value 0.7
+
+
Sample table +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.121 Sample `tape`

+ + +

Function tape draw tapes which rotate around the curve as transverse orts of accompanied coordinates. +

+

MGL code: +

call 'prepare1d'
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x'
+subplot 2 2 0 '':title 'Tape plot (default)':box:tape y:plot y 'k'
+subplot 2 2 1:title '3d variant, 2 colors':rotate 50 60:light on
+box:plot xc yc z 'k':tape xc yc z 'rg'
+subplot 2 2 2:title '3d variant, x only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'xr':tape xc yc z 'xr#'
+subplot 2 2 3:title '3d variant, z only':rotate 50 60
+box:plot xc yc z 'k':tape xc yc z 'zg':tape xc yc z 'zg#'
+
+
Sample tape +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.122 Sample `tens`

+ + +

Function tens is variant of plot with smooth coloring along the curves. At this, color is determined as for surfaces (see Color scheme). +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 '':title 'Tens plot (default)':box:tens y(:,0) y(:,1)
+subplot 2 2 2 '':title '" " style':box:tens y(:,0) y(:,1) 'o '
+new yc 30 'sin(pi*x)':new xc 30 'cos(pi*x)':new z 30 'x'
+subplot 2 2 1:title '3d variant':rotate 50 60:box:tens xc yc z z 's'
+
+
Sample tens +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.123 Sample `ternary`

+ + +

Example of ternary coordinates. +

+

MGL code: +

ranges 0 1 0 1 0 1
+new x 50 '0.25*(1+cos(2*pi*x))'
+new y 50 '0.25*(1+sin(2*pi*x))'
+new z 50 'x'
+new a 20 30 '30*x*y*(1-x-y)^2*(x+y<1)'
+new rx 10 'rnd':new ry 10:fill ry '(1-v)*rnd' rx
+light on
+
+subplot 2 2 0:title 'Ordinary axis 3D':rotate 50 60
+box:axis:grid
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':zlabel 'Z'
+
+subplot 2 2 1:title 'Ternary axis (x+y+t=1)':ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y 'r2':plot rx ry 'q^ ':cont a:line 0.5 0 0 0.75 'g2'
+xlabel 'B':ylabel 'C':tlabel 'A'
+
+subplot 2 2 2:title 'Quaternary axis 3D':rotate 50 60:ternary 2
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'D'
+
+subplot 2 2 3:title 'Ternary axis 3D':rotate 50 60:ternary 1
+box:axis:grid 'xyz' 'B;'
+plot x y z 'r2':surf a '#'
+xlabel 'B':ylabel 'C':tlabel 'A':zlabel 'Z'
+
+
Sample ternary +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.124 Sample `text`

+ + +

Example of text possibilities. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0 ''
+text 0 1 'Text can be in ASCII and in Unicode'
+text 0 0.6 'It can be \wire{wire}, \big{big} or #r{colored}'
+text 0 0.2 'One can change style in string: \b{bold}, \i{italic, \b{both}}'
+text 0 -0.2 'Easy to \a{overline} or \u{underline}'
+text 0 -0.6 'Easy to change indexes ^{up} _{down} @{center}'
+text 0 -1 'It parse TeX: \int \alpha \cdot \
+\sqrt3{sin(\pi x)^2 + \gamma_{i_k}} dx'
+subplot 2 2 1 ''
+ text 0 0.5 '\sqrt{\frac{\alpha^{\gamma^2}+\overset 1{\big\infty}}{\sqrt3{2+b}}}' '@' -2
+text 0 -0.1 'More text position: \frac{a}{b}, \dfrac{a}{b}, [\stack{a}{bbb}], [\stackl{a}{bbb}], [\stackr{a}{bbb}], \sup{a}{sup}, \sub{a}{sub}'text 0 -0.5 'Text can be printed\n{}on several lines'
+text 0 -0.9 'or with color gradient' 'BbcyrR'
+subplot 2 2 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn above a curve' 'Tr'
+subplot 2 2 3 '':line -1 -1 1 -1 'rA':text 0 -1 1 -1 'Horizontal'
+line -1 -1 1 1 'rA':text 0 0 1 1 'At angle' '@'
+line -1 -1 -1 1 'rA':text -1 0 -1 1 'Vertical'
+
+
Sample text +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.125 Sample `text2`

+ + +

Example of text along curve. +

+

MGL code: +

call 'prepare1d'
+subplot 1 3 0 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k'
+text y 'Another string drawn under a curve' 'Tr'
+subplot 1 3 1 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:C'
+text y 'Another string drawn under a curve' 'Tr:C'
+subplot 1 3 2 '':box:plot y(:,0)
+text y 'This is very very long string drawn along a curve' 'k:R'
+text y 'Another string drawn under a curve' 'Tr:R'
+
+
Sample text2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.126 Sample `textmark`

+ + +

Function textmark is similar to mark but draw text instead of markers. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'TextMark plot (default)':box:textmark y y1 '\gamma' 'r'
+
+
Sample textmark +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.127 Sample `ticks`

+ + +

Example of axis ticks. +

+

MGL code: +

subplot 3 3 0:title 'Usual axis with ":" style'
+axis ':'
+
+subplot 3 3 1:title 'Too big/small range'
+ranges -1000 1000 0 0.001:axis
+
+subplot 3 3 2:title 'LaTeX-like labels'
+axis 'F!'
+
+subplot 3 3 3:title 'Too narrow range'
+ranges 100 100.1 10 10.01:axis
+
+subplot 3 3 4:title 'No tuning, manual "+"'
+axis '+!'
+# for version <2.3 you can use
+#tuneticks off:axis
+
+subplot 3 3 5:title 'Template for ticks'
+xtick 'xxx:%g':ytick 'y:%g'
+axis
+
+xtick '':ytick '' # switch it off for other plots
+
+subplot 3 3 6:title 'No tuning, higher precision'
+axis '!4'
+
+subplot 3 3 7:title 'Manual ticks'
+ranges -pi pi 0 2
+xtick pi 3 '\pi'
+xtick 0.886 'x^*' on # note this will disable subticks drawing
+# or you can use
+#xtick -pi '\pi' -pi/2 '-\pi/2' 0 '0' 0.886 'x^*' pi/2 '\pi/2' pi 'pi'
+list v 0 0.5 1 2:ytick v '0
+0.5
+1
+2'
+axis:grid:fplot '2*cos(x^2)^2' 'r2'
+
+subplot 3 3 8:title 'Time ticks'
+xrange 0 3e5:ticktime 'x':axis
+
+
Sample ticks +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.128 Sample `tile`

+ + +

Function tile draw surface by tiles. +

+

MGL code: +

call 'prepare2d'
+title 'Tile plot':rotate 50 60:box:tile a
+
+
Sample tile +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.129 Sample `tiles`

+ + +

Function tiles is similar to tile but tile sizes is determined by another data. This allows one to simulate transparency of the plot. +

+

MGL code: +

call 'prepare2d'
+subplot 1 1 0 '':title 'Tiles plot':box:tiles a b
+
+
Sample tiles +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.130 Sample `torus`

+ + +

Function torus draw surface of the curve rotation. +

+

MGL code: +

call 'prepare1d'
+subplot 2 2 0:title 'Torus plot (default)':light on:rotate 50 60:box:torus y1 y2
+subplot 2 2 1:title '"x" style':light on:rotate 50 60:box:torus y1 y2 'x'
+subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:torus y1 y2 'z'
+subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:torus y1 y2 '#'
+
+
Sample torus +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.131 Sample `traj`

+ + +

Function traj is 1D analogue of vect. It draw vectors from specified points. +

+

MGL code: +

call 'prepare1d'
+subplot 1 1 0 '':title 'Traj plot':box:plot x1 y:traj x1 y y1 y2
+
+
Sample traj +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.132 Sample `triangulation`

+ + +

Example of use triangulate for arbitrary placed points. +

+

MGL code: +

new x 100 '2*rnd-1':new y 100 '2*rnd-1':copy z x^2-y^2
+new g 30 30:triangulate d x y
+title 'Triangulation'
+rotate 50 60:box:light on
+triplot d x y z:triplot d x y z '#k'
+datagrid g x y z:mesh g 'm'
+
+
Sample triangulation +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.133 Sample `triplot`

+ + +

Functions triplot and quadplot draw set of triangles (or quadrangles, correspondingly) for irregular data arrays. Note, that you have to provide not only vertexes, but also the indexes of triangles or quadrangles. I.e. perform triangulation by some other library. See also triangulate. +

+

MGL code: +

list q 0 1 2 3 | 4 5 6 7 | 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7
+list xq -1 1 -1 1 -1 1 -1 1
+list yq -1 -1 1 1 -1 -1 1 1
+list zq -1 -1 -1 -1 1 1 1 1
+light on
+subplot 2 2 0:title 'QuadPlot sample':rotate 50 60
+quadplot q xq yq zq 'yr'
+quadplot q xq yq zq '#k'
+subplot 2 2 2:title 'QuadPlot coloring':rotate 50 60
+quadplot q xq yq zq yq 'yr'
+quadplot q xq yq zq '#k'
+list t 0 1 2 | 0 1 3 | 0 2 3 | 1 2 3
+list xt -1 1 0 0
+list yt -1 -1 1 0
+list zt -1 -1 -1 1
+subplot 2 2 1:title 'TriPlot sample':rotate 50 60
+triplot t xt yt zt 'b'
+triplot t xt yt zt '#k'
+subplot 2 2 3:title 'TriPlot coloring':rotate 50 60
+triplot t xt yt zt yt 'cb'
+triplot t xt yt zt '#k'
+tricont t xt yt zt 'B'
+
+
Sample triplot +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.134 Sample `tube`

+ + +

Function tube draw tube with variable radius. +

+

MGL code: +

call 'prepare1d'
+light on
+new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x':divto y1 20
+subplot 2 2 0 '':title 'Tube plot (default)':box:tube y 0.05
+subplot 2 2 1 '':title 'variable radius':box:tube y y1
+subplot 2 2 2 '':title '"\#" style':box:tube y 0.05 '#'
+subplot 2 2 3:title '3d variant':rotate 50 60:box:tube xc yc z y2 'r'
+
+
Sample tube +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.135 Sample `type0`

+ + +

Example of ordinary transparency (transptype=0). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 0:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Sample type0 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.136 Sample `type1`

+ + +

Example of glass-like transparency (transptype=1). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 1:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Sample type1 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.137 Sample `type2`

+ + +

Example of lamp-like transparency (transptype=2). +

+

MGL code: +

call 'prepare2d'
+alpha on:light on:transptype 2:clf
+subplot 2 2 0:rotate 50 60:surf a:box
+subplot 2 2 1:rotate 50 60:dens a:box
+subplot 2 2 2:rotate 50 60:cont a:box
+subplot 2 2 3:rotate 50 60:axial a:box
+
+
Sample type2 +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.138 Sample `vect`

+ + +

Function vect is most standard way to visualize vector fields - it draw a lot of arrows or hachures for each data cell. It have a lot of options which can be seen on the figure (and in the sample code), and use color scheme for coloring (see Color scheme). +

+

MGL code: +

call 'prepare2v'
+call 'prepare3v'
+subplot 3 2 0 '':title 'Vect plot (default)':box:vect a b
+subplot 3 2 1 '':title '"." style; "=" style':box:vect a b '.='
+subplot 3 2 2 '':title '"f" style':box:vect a b 'f'
+subplot 3 2 3 '':title '">" style':box:vect a b '>'
+subplot 3 2 4 '':title '"<" style':box:vect a b '<'
+subplot 3 2 5:title '3d variant':rotate 50 60:box:vect ex ey ez
+
+
Sample vect +
+
+ +
+

+Next: , Previous: , Up: All samples   [Contents][Index]

+
+ +

6.139 Sample `vect3`

+ + +

Function vect3 draw ordinary vector field plot but at slices of 3D data. +

+

MGL code: +

call 'prepare3v'
+subplot 2 1 0:title 'Vect3 sample':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'x':vect3 ex ey ez:vect3 ex ey ez 'z'
+subplot 2 1 1:title '"f" style':rotate 50 60
+origin 0 0 0:box:axis '_xyz'
+vect3 ex ey ez 'fx':vect3 ex ey ez 'f':vect3 ex ey ez 'fz'
+grid3 ex 'Wx':grid3 ex 'W':grid3 ex 'Wz'
+
+
Sample vect3 +
+
+ +
+

+Previous: , Up: All samples   [Contents][Index]

+
+ +

6.140 Sample `venn`

+ + +

Example of venn-like diagram. +

+

MGL code: +

list x -0.3 0 0.3:list y 0.3 -0.3 0.3:list e 0.7 0.7 0.7
+subplot 1 1 0:title 'Venn-like diagram'
+transptype 1:alpha on:error x y e e '!rgb@#o';alpha 0.1
+
+
Sample venn +
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix A Symbols and hot-keys

+ + +

This appendix contain the full list of symbols (characters) used by MathGL for setting up plot. Also it contain sections for full list of hot-keys supported by mglview tool and by UDAV program. +

+ + + + + + + +
+ + + +

A.1 Symbols for styles

+ + +

Below is full list of all characters (symbols) which MathGL use for setting up the plot. +

+
+
`space ' '`
+

empty line style (see Line styles); +

+

empty color in chart. +

+
+
`!`
+

set to use new color from palette for each point (not for each curve, as default) in 1D plotting; +

+

set to disable ticks tuning in axis and colorbar; +

+

set to draw grid lines at subticks coordinates too; +

+

define complex variable/expression in MGL script if placed at beginning. +

+
+
`#`
+

set to use solid marks (see Line styles) or solid error boxes; +

+

set to draw wired plot for axial, surf3, surf3a, surf3c, triplot, quadplot, area, region, bars, barh, tube, tape, cone, boxs and draw boundary only for circle, ellipse, rhomb; +

+

set to draw also mesh lines for surf, surfc, surfa, dens, densx, densy, densz, dens3, or boundary for chart, facex, facey, facez, rect; +

+

set to draw boundary and box for legend, title, or grid lines for table; +

+

set to draw grid for radar; +

+

set to start flow threads and pipes from edges only for flow, pipe; +

+

set to use whole are for axis range in subplot, inplot; +

+

change text color inside a string (see Font styles); +

+

start comment in MGL scripts or in Command options. +

+
+
`$`
+

denote parameter of MGL scripts. +

+
+
`%`
+

set color scheme along 2 coordinates Color scheme; +

+

operation in Textual formulas. +

+
+
`&`
+
+

set to pass long integer number in tick template xtick, ytick, ztick, ctick; +

+

specifier of drawing user-defined symbols as mark (see Line styles); +

+

operation in Textual formulas. +

+
+
```
+

denote string in MGL scripts or in Command options. +

+
+
`*`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to start flow threads from 2d array inside data (see flow); +

+

operation in Textual formulas. +

+
+
`+`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

set to print `+` for positive numbers in axis, label, table; +

+

operation of increasing last character value in MGL strings; +

+

operation in Textual formulas. +

+
+
`,`
+

separator for color positions (see Color styles) or items in a list +

+

concatenation of MGL string with another string or numerical value. +

+
+
`-`
+

solid line style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

place entries horizontally in legend; +

+

set to use usual `-` for negative numbers in axis, label, table; +

+

operation in Textual formulas. +

+
+
`.`
+

one of marks (see Line styles) or kind of error boxes; +

+

set to draw hachures instead of arrows for vect, vect3; +

+

set to use dots instead of faces for cloud, torus, axial, surf3, surf3a, surf3c, surf, surfa, surfc, dens, map; +

+

delimiter of fractional parts for numbers. +

+
+
`/`
+

operation in Textual formulas. +

+
+
`:`
+

line dashing style (see Line styles); +

+

stop color scheme parsing (see Color scheme); +

+

range operation in MGL scripts; +

+

style for axis; +

+

separator of commands in MGL scripts. +

+
+
`;`
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

start of an option in MGL scripts or in Command options; +

+

separator of equations in ode; +

+

separator of labels in iris. +

+
+
`<`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align left in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+ +
+
`>`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

style of vect, vect3; +

+

align right in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
`=`
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

set to use equidistant columns for table; +

+

set to use color gradient for vect, vect3; +

+

operation in Textual formulas. +

+
+
`@`
+

set to draw box around text for text and similar functions; +

+

set to draw boundary and fill it for circle, ellipse, rhomb; +

+

set to fill faces for box; +

+

set to draw large semitransparent mark instead of error box for error; +

+

set to draw edges for cone; +

+

set to draw filled boxes for boxs; +

+

reduce text size inside a string (see Font styles); +

+

operation in Textual formulas. +

+
+
`^`
+

one of marks (see Line styles); +

+

one of mask for face filling (see Color scheme); +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set outer position for legend; +

+

inverse default position for axis; +

+

switch to upper index inside a string (see Font styles); +

+

align center in bars, barh, boxplot, cones, candle, ohlc; +

+

operation in Textual formulas. +

+
+
`_`
+

empty arrow style (see Line styles); +

+

disable drawing of tick labels for axis; +

+

style of subplot and inplot; +

+

set position of colorbar; +

+

set to draw contours at bottom for cont, contf, contd, contv, tricont; +

+

switch to lower index inside a string (see Font styles). +

+
+
`[]`
+

contain symbols excluded from color scheme parsing (see Color scheme); +

+

operation of getting n-th character from MGL string. +

+
+
`{}`
+

contain extended specification of color (see Color styles), dashing (see Line styles) or mask (see Color scheme); +

+

denote special operation in MGL scripts; +

+

denote `meta-symbol` for LaTeX like string parsing (see Font styles). +

+
+
`|`
+

line dashing style (see Line styles); +

+

set to use sharp color scheme (see Color scheme); +

+

set to limit width by subplot width for table; +

+

delimiter in list command; +

+

operation in Textual formulas. +

+
+
`\`
+

string continuation symbol on next line for MGL scripts. +

+
+
`~`
+

disable drawing of tick labels for axis and colorbar; +

+

disable first segment in lamerey; +

+

reduce number of segments in plot and tens; +

+

one of mask for face filling (see Color scheme). +

+
+
`0,1,2,3,4,5,6,7,8,9`
+

line width (see Line styles); +

+

brightness of a color (see Color styles); +

+

precision of numbers in axis, label, table; +

+

kind of smoothing (for digits 1,3,5) in smooth; +

+

digits for a value. +

+
+
`4,6,8`
+

set to draw square, hex- or octo-pyramids instead of cones in cone, cones. +

+
+
`A,B,C,D,E,F,a,b,c,d,e,f`
+

can be hex-digit for color specification if placed inside {} (see Color styles). +

+
+
`A`
+

arrow style (see Line styles); +

+

set to use absolute position in whole picture for text, colorbar, legend. +

+
+
`a`
+

set to use absolute position in subplot for text; +

+

style of plot, radar, tens, area, region to draw segments between points outside of axis range; +

+

style of bars, barh, cones. +

+
+
`B`
+

dark blue color (see Color styles). +

+
+
`b`
+

blue color (see Color styles); +

+

bold font face if placed after `:` (see Font styles). +

+
+
`C`
+

dark cyan color (see Color styles); +

+

align text to center if placed after `:` (see Font styles). +

+
+
`c`
+

cyan color (see Color styles); +

+

name of color axis; +

+

cosine transform for transform. +

+
+
`D`
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`d`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-dash description if placed inside {} (see Line styles). +

+
+
`E`
+

dark green-yellow color (see Color styles). +

+
+
`e`
+

green-yellow color (see Color styles). +

+
+
`F`
+
+

set fixed bar widths in bars, barh; +

+

set LaTeX-like format for numbers in axis, label, table. +

+
+
`f`
+

style of bars, barh; +

+

style of vect, vect3; +

+

set fixed format for numbers in axis, label, table; +

+

Fourier transform for transform. +

+
+
`G`
+

dark green color (see Color styles). +

+
+
`g`
+

green color (see Color styles). +

+
+
`H`
+

dark gray color (see Color styles). +

+
+
`h`
+

gray color (see Color styles); +

+

Hankel transform for transform. +

+
+
`I`
+

arrow style (see Line styles); +

+

set colorbar position near boundary. +

+
+
`i`
+

line dashing style (see Line styles); +

+

italic font face if placed after `:` (see Font styles). +

+

set to use inverse values for cloud, pipe, dew; +

+

set to fill only area with y1<y<y2 for region; +

+

inverse Fourier transform for transform, transforma, fourier. +

+
+
`j`
+

line dashing style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`K`
+

arrow style (see Line styles). +

+
+
`k`
+

black color (see Color styles). +

+
+
`L`
+

dark green-blue color (see Color styles); +

+

align text to left if placed after `:` (see Font styles). +

+
+
`l`
+

green-blue color (see Color styles). +

+
+
`M`
+

dark magenta color (see Color styles). +

+
+
`m`
+

magenta color (see Color styles). +

+
+
`N`
+

dark sky-blue color (see Color styles). +

+
+
`n`
+

sky-blue color (see Color styles). +

+
+
`O`
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`o`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

over-line text if placed after `:` (see Font styles). +

+
+
`P`
+

dark purple color (see Color styles). +

+
+
`p`
+

purple color (see Color styles). +

+
+
`Q`
+

dark orange or brown color (see Color styles). +

+
+
`q`
+

orange color (see Color styles). +

+
+
`R`
+

dark red color (see Color styles); +

+

align text to right if placed after `:` (see Font styles). +

+
+
`r`
+

red color (see Color styles). +

+
+
`S`
+

arrow style (see Line styles); +

+

one of mask for face filling (see Color scheme). +

+
+
`s`
+

one of marks (see Line styles) or kind of error boxes; +

+

one of mask for face filling (see Color scheme); +

+

start hex-mask description if placed inside {} (see Color scheme); +

+

sine transform for transform. +

+
+
`t`
+

draw tubes instead of cones in cone, cones; +

+
+
`T`
+

arrow style (see Line styles); +

+

place text under the curve for text, cont, cont3. +

+
+
`t`
+

set to draw text labels for cont, cont3; +

+

name of t-axis (one of ternary axis); +

+

variable in Textual formulas, which usually is varied in range [0,1]. +

+
+
`U`
+

dark blue-violet color (see Color styles); +

+

disable rotation of tick labels for axis. +

+
+
`u`
+

blue-violet color (see Color styles); +

+

under-line text if placed after `:` (see Font styles); +

+

name of u-axis (one of ternary axis); +

+

variable in Textual formulas, which usually denote array itself. +

+
+
`V`
+

arrow style (see Line styles); +

+

place text centering on vertical direction for text. +

+
+
`v`
+

one of marks (see Line styles); +

+

set to draw vectors on flow threads for flow and on segments for lamerey. +

+
+
`W`
+

bright gray color (see Color styles). +

+
+
`w`
+

white color (see Color styles); +

+

wired text if placed after `:` (see Font styles); +

+

name of w-axis (one of ternary axis); +

+
+
`X`
+

arrow style (see Line styles). +

+
+
`x`
+
+

name of x-axis or x-direction or 1st dimension of a data array; +

+

start hex-color description if placed inside {} (see Color styles); +

+

one of marks (see Line styles) or kind of error boxes; +

+

tiles orientation perpendicular to x-axis in tile, tiles; +

+

style of tape. +

+
+
`Y`
+

dark yellow or gold color (see Color styles). +

+
+
`y`
+

yellow color (see Color styles); +

+

name of y-axis or y-direction or 2nd dimension of a data array; +

+

tiles orientation perpendicular to y-axis in tile, tiles. +

+
+
`z`
+
+

name of z-axis or z-direction or 3d dimension of a data array; +

+

style of tape. +

+
+
+ + + +
+ + + +

A.2 Hot-keys for mglview

+ + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-POpen printer dialog and print graphics.
Ctrl-WClose window.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop drawing and script execution.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Shift-GCopy graphics to clipboard.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + +
+ + + +

A.3 Hot-keys for UDAV

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
Ctrl-NCreate new window with empty script. Note, all scripts share variables. So, second window can be used to see some additional information of existed variables.
Ctrl-OOpen and execute/show script or data from file. You may switch off automatic exection in UDAV properties
Ctrl-SSave script to a file.
Ctrl-POpen printer dialog and print graphics.
Ctrl-ZUndo changes in script editor.
Ctrl-Shift-ZRedo changes in script editor.
Ctrl-XCut selected text into clipboard.
Ctrl-CCopy selected text into clipboard.
Ctrl-VPaste selected text from clipboard.
Ctrl-ASelect all text in editor.
Ctrl-FShow dialog for text finding.
F3Find next occurrence of the text.
Win-C or Meta-CShow dialog for new command and put it into the script.
Win-F or Meta-FInsert last fitted formula with found coefficients.
Win-S or Meta-SShow dialog for styles and put it into the script. Styles define the plot view (color scheme, marks, dashing and so on).
Win-O or Meta-OShow dialog for options and put it into the script. Options are used for additional setup the plot.
Win-N or Meta-NReplace selected expression by its numerical value.
Win-P or Meta-PSelect file and insert its file name into the script.
Win-G or Meta-GShow dialog for plot setup and put resulting code into the script. This dialog setup axis, labels, lighting and other general things.
Ctrl-Shift-OLoad data from file. Data will be deleted only at exit but UDAV will not ask to save it.
Ctrl-Shift-SSave data to a file.
Ctrl-Shift-CCopy range of numbers to clipboard.
Ctrl-Shift-VPaste range of numbers from clipboard.
Ctrl-Shift-NRecreate the data with new sizes and fill it by zeros.
Ctrl-Shift-RResize (interpolate) the data to specified sizes.
Ctrl-Shift-TTransform data along dimension(s).
Ctrl-Shift-MMake another data.
Ctrl-Shift-HFind histogram of data.
Ctrl-TSwitch on/off transparency for the graphics.
Ctrl-LSwitch on/off additional lightning for the graphics.
Ctrl-GSwitch on/off grid of absolute coordinates.
Ctrl-SpaceRestore default graphics rotation, zoom and perspective.
F5Execute script and redraw graphics.
F6Change canvas size to fill whole region.
F7Stop script execution and drawing.
F8Show/hide tool window with list of hidden plots.
F9Restore status for `once` command and reload data.
Ctrl-F5Run slideshow. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-Comma, Ctrl-PeriodShow next/previous slide. If no parameter specified then the dialog with slideshow options will appear.
Ctrl-WOpen dialog with slideshow options.
Ctrl-Shift-GCopy graphics to clipboard.
F1Show help on MGL commands
F2Show/hide tool window with messages and information.
F4Show/hide calculator which evaluate and help to type textual formulas. Textual formulas may contain data variables too.
Meta-Shift-Up, Meta-Shift-DownChange view angle \theta.
Meta-Shift-Left, Meta-Shift-RightChange view angle \phi.
Alt-Minus, Alt-EqualZoom in/out whole image.
Alt-Up, Alt-Down, Alt-Right, Alt-LeftShift whole image.
Alt-PExport as semitransparent PNG.
Alt-FExport as solid PNG.
Alt-JExport as JPEG.
Alt-EExport as vector EPS.
Alt-SExport as vector SVG.
Alt-LExport as LaTeX/Tikz image.
Alt-MExport as MGLD.
Alt-DExport as PRC/PDF.
Alt-OExport as OBJ.
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix B GNU Free Documentation License

+
Version 1.2, November 2002 +
+ +
+
Copyright © 2000,2001,2002 Free Software Foundation, Inc.
+51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+ +
    +
  1. PREAMBLE + +

    The purpose of this License is to make a manual, textbook, or other +functional and useful document free in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. +

    +

    This License is a kind of “copyleft”, which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. +

    +

    We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. +

    +
  2. APPLICABILITY AND DEFINITIONS + +

    This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The “Document”, below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as “you”. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. +

    +

    A “Modified Version” of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. +

    +

    A “Secondary Section” is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document`s overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. +

    +

    The “Invariant Sections” are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. +

    +

    The “Cover Texts” are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. +

    +

    A “Transparent” copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not “Transparent” is called “Opaque”. +

    +

    Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input +format, SGML or XML using a publicly available +DTD, and standard-conforming simple HTML, +PostScript or PDF designed for human modification. Examples +of transparent image formats include PNG, XCF and +JPG. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, SGML or +XML for which the DTD and/or processing tools are +not generally available, and the machine-generated HTML, +PostScript or PDF produced by some word processors for +output purposes only. +

    +

    The “Title Page” means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, “Title Page” means +the text near the most prominent appearance of the work`s title, +preceding the beginning of the body of the text. +

    +

    A section “Entitled XYZ” means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as “Acknowledgements”, +“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” +of such a section when you modify the Document means that it remains a +section “Entitled XYZ” according to this definition. +

    +

    The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. +

    +
  3. VERBATIM COPYING + +

    You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. +

    +

    You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +

    +
  4. COPYING IN QUANTITY + +

    If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document`s license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. +

    +

    If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. +

    +

    If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. +

    +

    It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. +

    +
  5. MODIFICATIONS + +

    You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: +

    +
      +
    1. Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +
    2. List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +
    3. State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +
    4. Preserve all the copyright notices of the Document. + +
    5. Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +
    6. Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +
    7. Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document`s license notice. + +
    8. Include an unaltered copy of this License. + +
    9. Preserve the section Entitled “History”, Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled “History” in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +
    10. Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the “History” section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +
    11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +
    12. Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +
    13. Delete any section Entitled “Endorsements”. Such a section +may not be included in the Modified Version. + +
    14. Do not retitle any existing section to be Entitled “Endorsements” or +to conflict in title with any Invariant Section. + +
    15. Preserve any Warranty Disclaimers. +
    + +

    If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version`s license notice. +These titles must be distinct from any other section titles. +

    +

    You may add a section Entitled “Endorsements”, provided it contains +nothing but endorsements of your Modified Version by various +parties—for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. +

    +

    You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. +

    +

    The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +

    +
  6. COMBINING DOCUMENTS + +

    You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. +

    +

    The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. +

    +

    In the combination, you must combine any sections Entitled “History” +in the various original documents, forming one section Entitled +“History”; likewise combine any sections Entitled “Acknowledgements”, +and any sections Entitled “Dedications”. You must delete all +sections Entitled “Endorsements.” +

    +
  7. COLLECTIONS OF DOCUMENTS + +

    You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. +

    +

    You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. +

    +
  8. AGGREGATION WITH INDEPENDENT WORKS + +

    A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an “aggregate” if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation`s users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. +

    +

    If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document`s Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. +

    +
  9. TRANSLATION + +

    Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. +

    +

    If a section in the Document is Entitled “Acknowledgements”, +“Dedications”, or “History”, the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. +

    +
  10. TERMINATION + +

    You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. +

    +
  11. FUTURE REVISIONS OF THIS LICENSE + +

    The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. +

    +

    Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License “or any later version” applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +

+ + +

ADDENDUM: How to use this License for your documents

+ +

To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: +

+
+
  Copyright (C)  year  your name.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.2
+  or any later version published by the Free Software Foundation;
+  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+  Texts.  A copy of the license is included in the section entitled ``GNU
+  Free Documentation License''.
+
+ +

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the “with…Texts.” line with this: +

+
+
    with the Invariant Sections being list their titles, with
+    the Front-Cover Texts being list, and with the Back-Cover Texts
+    being list.
+
+ +

If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. +

+

If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. +

+ + +
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

Index

+ +
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +Н +   +С +   +Т +   +Ц +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

A
AddLegend: Legend
Adjust: Ticks
alpha: Command options
Alpha: Transparency
alphadef: Command options
AlphaDef: Transparency
Ambient: Lighting
Area: 1D plotting
ArrowSize: Default sizes
ask: Program flow commands
Aspect: Subplots and rotation
AutoCorrel: Make another data
Axial: 2D plotting
Axis: Curved coordinates
Axis: Axis and Colorbar
AxisStl: Ticks

B
Ball: Primitives
Barh: 1D plotting
Bars: 1D plotting
BarWidth: Default sizes
Beam: 3D plotting
Belt: 2D plotting
Box: Axis and Colorbar
BoxPlot: 1D plotting
Boxs: 2D plotting

C
call: Program flow commands
Candle: 1D plotting
Chart: 1D plotting
chdir: Program flow commands
Clean: Data resizing
ClearLegend: Legend
Clf: Background
Cloud: 3D plotting
Colorbar: Axis and Colorbar
Column: Make another data
ColumnPlot: Subplots and rotation
Combine: Make another data
Cone: Primitives
Cones: 1D plotting
Cont: 2D plotting
Cont3: 3D plotting
ContD: 2D plotting
ContF: 2D plotting
ContF3: 3D plotting
ContFXYZ: Other plotting
ContXYZ: Other plotting
Correl: Make another data
CosFFT: Data changing
CRange: Ranges (bounding box)
Create: Data resizing
Crop: Data resizing
Crust: Other plotting
CTick: Ticks
CumSum: Data changing
Curve: Primitives
cut: Command options
Cut: Cutting

D
DataGrid: Data manipulation
defchr: Program flow commands
define: Program flow commands
defnum: Program flow commands
Delete: Data resizing
Dens: 2D plotting
Dens3: 3D plotting
DensXYZ: Other plotting
Dew: Vector fields
Diff: Data changing
Diff2: Data changing
do: Program flow commands
Dots: Other plotting
Drop: Primitives

E
else: Program flow commands
elseif: Program flow commands
endif: Program flow commands
Envelop: Data changing
Error: 1D plotting
Evaluate: Make another data
Export: File I/O
Extend: Data resizing

F
Face: Primitives
FaceX: Primitives
FaceY: Primitives
FaceZ: Primitives
Fall: 2D plotting
fgets: Text printing
Fill: Data manipulation
Fill: Data filling
Fit: Nonlinear fitting
Fit2: Nonlinear fitting
Fit3: Nonlinear fitting
FitS: Nonlinear fitting
Flow: Vector fields
FlowP: Vector fields
Fog: Fog
Font: Font settings
fontsize: Command options
for: Program flow commands
FPlot: Other plotting
FSurf: Other plotting
func: Program flow commands

G
GetNx: Data information
GetNy: Data information
GetNz: Data information
Glyph: Primitives
Grad: 2D plotting
Grid: Axis and Colorbar
Grid: 2D plotting
Grid3: 3D plotting

H
Hankel: Data changing
Hist: Data manipulation
Hist: Make another data

I
if: Program flow commands
Import: File I/O
InPlot: Subplots and rotation
Insert: Data resizing
Integral: Data changing

J
Join: Data resizing

L
Label: Axis and Colorbar
Label: 1D plotting
legend: Command options
Legend: Legend
Light: Lighting
Line: Primitives
List: Data filling
load: Program flow commands
LoadBackground: Background

M
Map: Dual plotting
Mark: 1D plotting
MarkSize: Default sizes
Max: Make another data
Maximal: Data information
Mesh: 2D plotting
meshnum: Command options
MeshNum: Default sizes
mglData: Data constructor
mglFitPnts: Nonlinear fitting
mglGraph: MathGL core
Min: Make another data
Minimal: Data information
Mirror: Data changing
Modify: Data filling
Momentum: Make another data
Momentum: Data information
MultiPlot: Subplots and rotation

N
next: Program flow commands
Norm: Data changing
NormSl: Data changing

O
once: Program flow commands
Origin: Ranges (bounding box)

P
Palette: Palette and colors
Perspective: Subplots and rotation
Pipe: Vector fields
Plot: 1D plotting
Pop: Subplots and rotation
PrintInfo: Data information
Push: Subplots and rotation
PutsFit: Nonlinear fitting

Q
QuadPlot: Other plotting

R
Radar: 1D plotting
Ranges: Ranges (bounding box)
Rasterize: Background
Read: File I/O
ReadAll: File I/O
ReadHDF: File I/O
ReadMat: File I/O
ReadRange: File I/O
Rearrange: Data resizing
Refill: Data filling
Region: 1D plotting
Resize: Make another data
return: Program flow commands
rkstep: Program flow commands
Roll: Data changing
Roots: Make another data
Rotate: Subplots and rotation
RotateN: Subplots and rotation
RotateText: Font settings

S
Save: File I/O
SaveHDF: File I/O
Set: Data filling
SetLegendBox: Legend
SetLegendMarks: Legend
SetMask: Masks
SetMaskAngle: Masks
SetSize: Export picture
Sew: Data changing
SinFFT: Data changing
Smooth: Data changing
Sort: Data resizing
Sphere: Primitives
Squeeze: Data resizing
Stem: 1D plotting
Step: 1D plotting
STFA: Dual plotting
StickPlot: Subplots and rotation
stop: Program flow commands
SubData: Make another data
SubPlot: Subplots and rotation
Sum: Make another data
Surf: 2D plotting
Surf3: 3D plotting
Surf3A: Dual plotting
Surf3C: Dual plotting
SurfA: Dual plotting
SurfC: Dual plotting
Swap: Data changing

T
Tape: 1D plotting
Tens: 1D plotting
Text: Text printing
TextMark: 1D plotting
TickLen: Ticks
Tile: 2D plotting
TileS: Dual plotting
Title: Subplots and rotation
Torus: 1D plotting
Trace: Make another data
Traj: Vector fields
Transpose: Data resizing
TranspType: Transparency
TriCont: Other plotting
TriPlot: Other plotting
Tube: 1D plotting

V
value: Command options
Var: Data filling
variant: Program flow commands
Vect: Vector fields
View: Subplots and rotation

W
while: Program flow commands
Write: Export to file

X
xrange: Command options
XRange: Ranges (bounding box)
XTick: Ticks

Y
yrange: Command options
YRange: Ranges (bounding box)
YTick: Ticks

Z
zrange: Command options
ZRange: Ranges (bounding box)
ZTick: Ticks

Н
Настройка MathGL: Graphics setup

С
Стиль линий: Line styles
Стиль маркеров: Line styles
Стиль стрелок: Line styles
Стиль текста: Font styles

Т
Текстовые формулы: Textual formulas

Ц
Цветовая схема: Color scheme

+
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +V +   +W +   +X +   +Y +   +Z +   +Н +   +С +   +Т +   +Ц +   +
+ +
+ + + + + diff --git a/website/mk61.png b/website/mk61.png new file mode 100644 index 0000000000000000000000000000000000000000..e512899fb7b0420fbacbe2f796c5f54aacc8657a GIT binary patch literal 5592 zcmV;}6({P6P)J(oH2{jso|?B(oPYW#Q}cb+^Cd6s?i&iv*#xA(kr5MvBt z#azL$5X6EN3sx*xv0%l56$@4@1hHUsNa20|P)Y#|cBhErxPXs-gb)k>k|a?|Db>RL zFvcn?D=DRZv@Az}06R4k0K^78V_U{O_7(=_ue6%`eXF-)n75He0b zRaHB8?(A~8bo~$kqG?+9?%nt8+vkUvVM$C(bT}M3mI#G0*1dc8qN1XxSdx;G91aJ@ z7yvYlMm+ENS+JR-Aw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D0L->3o*s}NlGjc6U7Q`m@iD3-DOd`Z4QV{<cE zcB&{NP%hRCnFGpUZB~|`T&xP21Imq6NH(Bc%yY<8P;RV3vH|5{ZCP_bxp1gw z1PHKQ3Qji!h-kZMd zErwM@bT?`_6D$9HcM+sm5u^xGtO!yBDOLn2f)p!)6hVqfvi|^>!-@ihbUot$0000< KMNUMnLSTYC?FIJ$ literal 0 HcmV?d00001 diff --git a/website/prepare_doc.sh b/website/prepare_doc.sh new file mode 100755 index 0000000..100963e --- /dev/null +++ b/website/prepare_doc.sh @@ -0,0 +1,18 @@ +sed -i -- 's///g' *_*.html +sed -i -- 's//
<\/div>
/g' *_*.html +sed -i -- 's//
<\/div>
/g' *_*.html +sed -i -- 's/<\/body>/<\/div>