Community Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Interface to Graphics Layout Engine (GLE) to create publication quality graphs (from LabVIEW)

Overview

GLE is a scripting language which gives real flexibility in creating publication quality figures, including vector graphic output formats ( http://glx.sourceforge.net/index.html  ). This demo project is just an example to show how to use GLE from LabVIEW in a limited way (via System Exec).

Description

I have found GLE very useful in the last years, specially because of its fast learning curve and easy command line usage. GLE supports LaTeX too, so easy to create publication quality ps/eps figures/graphs for articles, university thesis, etc using LaTeX. This example code demonstrates how to automatize some common features in GLE, and can create output files in several formats: jpg, png (including transparent option), ps, eps, and pdf. Note that, for ps/eps we only need GLE to be installed on the PC (and a LaTeX package if we wish to use it for the graphs' text). To be able to create jpg/png/pdf files, GLE relies on GhostScript to be installed on the target PC.

 

This code creates a GLE script file based on user inputs, and then by calling the "System Exec.vi", it compiles it into the required output file format., thus automatizing/speeding up the often slow manual procedure. The code shows how to use GLE to create quality figures (as a png file which can be loaded into LV) for LabVIEW 2D Picture indicators and how to rescale them depending on the indicator size. Due to the required compile time this library is not intended to be a live plotting option, but more as a static graph/figure creator.

 

It is possible to access the GLE source files and functions to call them directly, but for easy interface creation I decided only to use the command line option (System Exec VI). Another reason to do so is that, the option to generate and keep the .gle and ascii data files. This can be very useful when we have to change GLE figures manually later (to match journal or report format requirements, etc.).

 

Finally, this is only a demo example which recently fulfills my needs for our projects. Feel free to modify the library as you need. Here I have only implemented a very limited feature set, if you have GLE and not LabVIEW related question, please refer to the GLE manual or mail list forum! GLE is much much more than what is shown in this LabVIEW interface, browse the example page what kind of things can be created with this very useful tool: http://glx.sourceforge.net/examples/index.html

 

All credits to the developers of GLE!

Hardware and Software Requirements

  1. If you wish to use LaTeX features, install a TeX/LaTeX package (optional). I recommend MiKTeX: https://miktex.org/download
  2. If you wish to create png/jpg/pdf files (part of the example VI relies on a png output!), you need to install GhostScript! https://ghostscript.com/Releases.html
  3. If you wish to review created GhostScript files, you might need GhostView (also useful for LaTeX): http://www.gsview.com/
  4. Install GLE using the online Installation Guides and Tutorials. GLE should automatically recognize the previously installed LaTeX/GhostScript/GhostView packages. http://glx.sourceforge.net/downloads/downloads.html

Steps to Implement or Execute Code

  1. Open the project file, and open the "MAIN_sandbox.vi"!
  2. Launch the VI, and select a filename for output file path ("Specify file path" control).
  3. The VI saved with some test data, and some input controls are saved with their values as default to easily demonstrate the usage of the library.
  4. The "Generate Plot!" button creates and shows a png file based on the configured GLE script file.
  5. At the "Generated GLE script" Tab, experiment with the different file types which GLE is able to create ("Generate file!").

Additional Information or References

GLE website:  http://glx.sourceforge.net/index.html

 

Since I only use GLE and LabVIEW for non commercial projects, please refer to the webpages for licensing information. I do not own any rights, etc...The zipped projects do not include any GLE or GhostScript installers or binaries, the users can download these via the given links.

 

Some screenshots from the project:

 

MAIN_sandbox.png

 

MAIN_sandbox_FP_1.png

 

MAIN_sandbox_FP_2.png

 

Comments
Blokk
Trusted Enthusiast
Trusted Enthusiast
on

GLE_library_update1_v2013.zip

 

Added feature: "Add_GLE_label.vi". Free labels can be added to the Graph, parameters: position of label (either absolute pos in cm from origo, or referenced to the Graph x/y values), Font type, size, color. Label box optional: fill color, border color (or off), gap (between border and text), border rounded edges specified by value.

Plus some minor bug fixes, like if the Y-axis hidden, the Y2 axis got hidden too (if an "off" parameter is used for an axis in the GLE script, the "on" parameter must be present for the other axis).

Jarrod_S.
Active Participant
Active Participant
on

Looks cool! I think this would be more usable if instead of a functional global, you passed the GLE_main_cluster value between each call. That would allow you to generate multiple graphs in parallel without worrying about one graph conflicting with the state of another graph.

Jarrod S.
National Instruments
Blokk
Trusted Enthusiast
Trusted Enthusiast
on

Yes, I totally agree. In my case I just wanted to hide this "reference" or GLE_main_cluster value inside the Action Engine. In my project I plan to use these VIs in a single place serial only. But if someone needs to have a more general solution, it is better to get rid of that FGV, and as you say just pass the wire around as needed.

Contributors