Difference between revisions of "Using PLplot"

From PLplotWiki
Jump to: navigation, search
(C/C++: Added links to win32 wx-config binaries)
(Added information on locale settings)
 
Line 16: Line 16:
  
 
If you built PLplot with the wxWidgets driver, a win32 binary of [http://wxconfig.googlepages.com/ wx-config] [http://wx-config-win.googlecode.com/svn/binary/wx-config.exe (Direct link)] may also be useful.
 
If you built PLplot with the wxWidgets driver, a win32 binary of [http://wxconfig.googlepages.com/ wx-config] [http://wx-config-win.googlecode.com/svn/binary/wx-config.exe (Direct link)] may also be useful.
 +
 +
=== Localization ===
 +
 +
PLplot supports the use of so-called locales (under Windows also known as ''regional settings'') via, for instance the command-line option <tt>-locale</tt>. If you give this option, then numeric labels along the axes will be drawn using the decimal separator of the locale.
 +
 +
There is a difference with the way locale settings work under Windows compared to Linux:
 +
 +
- Under Windows the regional settings from the ''Control Panel'' are used. There is apparently no effect from environment variables like LC_NUMERIC
 +
- The names of locales (you can set them in a C program via the function setlocale()) are different: <tt>Dutch_Netherlands</tt> for instance, instead of <tt>nl_NL</tt> under Linux. For other languages there may or may not be direct support.
 +
- On input a period is used, not the regional character. On output, it ''is'' used.
 +
 +
''Note:'' the statements above are based on experiments with MicroSoft Visual C/C++ 6.0 and MicroSoft Visual C/C++ 2008 compilers. It is not clear at the moment if other compilers available under Windows behave in the same way.
 +
 +
The simplest method of using localization on Windows is presumably the use of the ''Regional Settings'' utility from the ''Control Panel''.
  
 
== Mac OS X ==
 
== Mac OS X ==
 
=== C/C++ ===
 
=== C/C++ ===

Latest revision as of 22:49, 10 September 2009

The next step after you have successfully managed to configure and build the PLplot library is to build your own program using PLplot. Basically one has to tell the compiler where to find the include files and the library. This depends on the programming language you use and the platform you are working one. It's always a good idea to have a look in the Makefiles which on Linux are based in /usr/local/share/plplot/examples/language if you installed PLplot in the standard location.

Linux

C/C++

If the pkg-config is available and CMake found it during the configuration stage than programs might be compiled for C via:

gcc `pkg-config --cflags --libs plplotd` prog.c -o prog

For C++:

g++ `pkg-config --cflags --libs plplotd-c++` prog.cpp -o prog


Windows

C/C++

Although pkg-config is not a standard Windows utility, there is a win32 binary available from GTK (Direct link). Be sure to set the PKG_CONFIG_PATH variable to the <PLplot install>\lib\pkgconfig directory so it can find the PLplot files. You will still not be able to call pkg-config directly from the gcc/g++ command since the Windows CLI does not support `` (backticks), but at least you can copy and paste the options.

If you built PLplot with the wxWidgets driver, a win32 binary of wx-config (Direct link) may also be useful.

Localization

PLplot supports the use of so-called locales (under Windows also known as regional settings) via, for instance the command-line option -locale. If you give this option, then numeric labels along the axes will be drawn using the decimal separator of the locale.

There is a difference with the way locale settings work under Windows compared to Linux:

- Under Windows the regional settings from the Control Panel are used. There is apparently no effect from environment variables like LC_NUMERIC - The names of locales (you can set them in a C program via the function setlocale()) are different: Dutch_Netherlands for instance, instead of nl_NL under Linux. For other languages there may or may not be direct support. - On input a period is used, not the regional character. On output, it is used.

Note: the statements above are based on experiments with MicroSoft Visual C/C++ 6.0 and MicroSoft Visual C/C++ 2008 compilers. It is not clear at the moment if other compilers available under Windows behave in the same way.

The simplest method of using localization on Windows is presumably the use of the Regional Settings utility from the Control Panel.

Mac OS X

C/C++