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

2.10 FAQ

The plot does not appear

Check that points of the plot lie inside the bounding box and resize the bounding box using Axis() 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 autoconf/automake script. 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);

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 will never be plotted. Second, special variables CutMin, CutMax or function 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 this 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, the recommended class mglGraph (header file #include <mgl2/mgl.h>) contains only inline functions and is acceptable for any compiler with the same binary files. However, if you plan to access low-level features (i.e. classes mglBase, mglCanvas and so on) then you have to recompile MathGL by yours compiler.

How I can build MathGL under Windows?

The simplest way is using the combination CMake+MinGW. Also you 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 configurator and make 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 autoconf/automake script was written mostly by D.Kulagin, and the export to IDTF was written mostly by M.Vidassov.

How can I display a bitmap on the figure?

You can import data into a mglData instance 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::GetBits().

How can I create U3D file (make 3D in PDF)?

There are 2 steps: first you should create IDTF file, and later convert it to U3D. You can use U3D tools for converting IDTF file to U3D. It needs libharu 2.1.0 or later. For installation use ./bootstrap, ./configure, make, sudo make install. It provides IDTFConverter program for converting text files *.idtf to binary files *.u3d. The latter can be included into PDF.

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 SetTickLen. For example, use gr->SetTickLen(-0.1);.

How can I prevent text rotation?

Just use SetRotatedText(false).

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

This standard GNU tool. There is special FAQ about its usage under Windows – http://www.mingw.org/wiki/FAQ.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 13, 2012 using texi2html 5.0.

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