Introduction

 Top Next

A graphics course

by Wolfgang Theiss

W. Theiss – Hard- and Software

Phone: + 49 241 5661390 Fax: + 49 241 9529100

e-mail: theiss@mtheiss.com

web: www.mtheiss.com

January 2012

Programs like SCOUT, CODE or SPRAY are object oriented which means that many program components (e.g. optical constant objects) show up in several applications. This simplifies program development, but also the handling of the software products by the user who benefits from a unique program control philosophy.

The general features of many objects developed by W.Theiss - Hard and Software regarding their graphical output are described in this manual which is a reference for several of our applications. You will learn what you can expect from 2D and 3D graphics and how you get it.

· 2D graphics

· 3D graphics


Example

 Top Previous Next

Most objects generate two-dimensional graphs, i.e. they display a relation between two quantities using a horizontal and a vertical axis. In this section the control of 2D graphics is explained using as an example data generated with our tool Data Factory. The graph below shows the formula used to compute the data and a first graph in the main window of the program:

The data are computed in the range 0.001 ... 5 with 5000 data points.


The drawing area

The picture above shows a typical object producing graphics output in its window: on a gray background a white rectangle with a black shadow represents the current drawing area. Under normal operation this is the paper in the Windows default printer and what you see on the screen is what you will get on the printer.

If you resize the window a re-scaling of the drawing area is done such that you get the largest possible size without changing the proportions of the drawing area, i.e. you can have something like

or like

and you will always see an undistorted graph on the 'white paper'.


Automatic page re-sizing after a printout or a printer setup

After a printout of the graph to a printer (using the print command) the drawing area is set to the current printer page. The same happens if you do a printer setup which is possible from every graphics window. If you change from landscape to portrait format, for example, it can happen that the graph does not fit any more onto the paper which then looks like

.

Here you could switch back to landscape format or resize your graph (see below) to fit on the current printer page.


Printer output

Every object producing graphics can printout its picture to any printer installed in the Windows system. The appropriate command can be found in the Object submenu (Object | Print or File | Print) which usually provides a printer setup command as well. The latter should be used to customize printer settings. Sometimes Print and Printer setup buttons are placed on toolbars.

Of course, what you finally get on paper depends not only on our software and the chosen graphics parameters (see below how to choose those appropriately) but also strongly on the printer and how efficiently it is used by the Windows printer driver. Here it's your part to test and try which driver setting gives the best results.


Metafile and clipboard output

Besides printing to a printer a very useful kind of output is to store the graph in a Windows metafile (which then can be re-imported by other programs like word processors or desktop publishers) or to copy it to the Windows clipboard (which is also done using the metafile format internally). The appropriate menu commands can usually be found in the Object, File or Graphics submenus. For creating files, you should use the type 'placeable metafile'.

Although the use of the metafile format is strongly recommended (because – as a vector graphics format – it provides re-scalable transfer without loss of quality) this kind of picture exchange has some drawbacks which can be severe occasionally. Difficulties may occur if you use

·rotated text (like it is used for labeling the y-axis). Some programs rotate text counterclockwise, while the metafile standard (and W.Theiss Hard- and Software products) rotates clockwise

·text using sub- or superscripts (here their might appear irregular spacings between the 'normal' text and the elevated portions)

Pasting metafile graphics:

Once you have used the command Graphics|to clipboard to copy a picture into the clipboard you can paste it in text processors. In OpenOffice Writer, for example, you can simply paste the graph into your document. Here is the result (with the German version of OpenOffice):


Window 'hardcopy' to the clipboard

Since Windows provides an easy mechanism to make screenshots you can copy the current content of the total screen or an individual window as a bitmap to the clipboard. The example graphics shown up to now in this documentation have been produced this way. To make a shot of the whole screen simply press the Print key on your keyboard, to make a bitmap copy of the active windows only use the combination Alt-Print.

Nevertheless, keep in mind the bitmap copies require much larger space in memory as compared to metafiles and cannot be re-scaled without loss of quality.


Introduction

Key and mouse commands

The basics of the appearance of a 2D graphics is setup by the 2D plot parameters explained below. Nevertheless, some quick changes can be made by some key commands which have turned out to be quite useful. After a short training you will certainly appreciate these short-cuts.


Moving around

Starting from the situation already shown above

you can shift the visible range of the x-axis to the right by hitting the right cursor key:

Note that the shift is by 25% of the total axis range. Of course, the graphics window must be the active Windows window for this mechanism to work.

As you might have guessed already the other cursor keys work as well in the obvious directions – the shift being always 25% of the present axis range.

You can also move diagonally using the Home, End, PageUp and PageDown keys which are located conveniently on the numeric keypad. The Num option must be de-activated for the proper use of these keys.


Keyboard commands

Here are the keyboard commands to control zoom-functions: press the x- or the y-key to select an axis for the next commands. De-activate the Num option of your keyboard and press the + or - keys on the numeric keypad to zoom in and out by a factor of 2.

Example:

If you start from

and you press x and then twice + on the numeric keypad the graphics should look like

If you try to go back by hitting the - also two times your picture probably looks like

which is almost the same as before. Note that the division of the x-axis is different compared to the start picture – during zoom operations the software calculates automatically new appropriate axis divisions which must not necessarily coincide with user defined settings (see below).

Automatic Scaling

Pressing an 'a' on the keyboard activates an automatic scaling of the graph in the currently active window. The x-and y-axis are scaled in a way that the displayed data fit exactly in the frame. Starting at the last situation above you would get this:

Restoring previous scaling settings

The 'r' key can be used to restore the last axis scaling that was set using the graphics parameters dialog. If the dialog has not used up to now the setting from the program start or the last loaded configuration is restored.


Mouse control

Starting with object generation 2.56 all mouse operations require that you simultaneously press the Ctrl-key.

An alternative technique to zoom is to click with the mouse (left button) somewhere in the graph: the position of the mouse cursor is the center of the newly created view. Both the new x-and y-axis have half the range of the previous setting.

Clicking with the right mouse button also selects the mouse cursor position as the new center but now both axis ranges are doubled.

With lots of left and right mouse clicks you can move – again after the investment of a certain training time – very quickly through the data.

If you click a graph with the left mouse button outside the x- and the y-axis the plot parameter dialog (see below) pops up. Also for this action you must press the Ctrl-key as well.


Overview

2D plot parameter overview

When you have chosen an appropriate view and you want to use the picture for some further report or a publicaton you might want to have some more influence on the final design of the graph. The next section describes which plot parameters can be modified and how you do it.

Besides the menu command Graphics | Edit graphics parameters which provides the standard access to the plot parameters dialog you can also click with the left mouse button somewhere in the window (except into the data area inside the frame spanned by the axes where the left mouse click means you want a zoom, as explained above). For the mouse click to work you must press the Ctrl-key on your keyboard at the same time.


The dialog

The plot parameter dialog

Almost all objects featuring 2D graphics offer the following dialog to set plot parameters:

The general parameters to control the design are in the top half of the dialog: the Title parameter specifies the title of the plot, i.e. text appearing as header on top of the picture. The parameter Height to the right of the title parameter defines the height of the title text in true mm. If you printout the graph without any further scaling operations all dimensions specified in mm should really appear on the paper as large as set in the dialog.

The Frame mode specifies the general style of the graph and is discussed below, also the Line mode and Grid line mode parameters which set the style of the line drawing for the 'data curve' as well as for an optional grid filling the data area (see below).

A 2D plot is done with up to three pens: one for the title and the frame (including the x- and y-axis) specified by Pen frame, one for the actual data (Pen data) and one for the optional grid (Pen grid).

In addition the settings for the appearance of the x- and y-axis (scaling and labeling) are done in the 2D plot parameter dialog as explained in more detail below.


Pens

There are 16 pens (numbered from 1 to 16) that you can used in W.Theiss Hard- and Software programs. A pen has two properties, namely a color and a thickness. All the pens have pre-defined colors and thicknesses that you cannot change at run time in most programs.

The first 8 pre-defined pens are the following:

Pens 9 to 16 are the same as pens 1 to 8 but with a slightly smaller thickness.


Line modes

There are several styles of line drawing available which are set by the line mode parameter. There are 8 line styles defined which cannot – up to now –be modified at run time but must be taken as they are. The line styles are

Symbols to display data points

In addition, there are options to represent data points by symbols which can also be controlled by the line mode parameter. Here are the presently defined symbols and the corresponding line mode parameters:


Frame modes

The general appearance of the graph is set by the frame mode parameter. Here are the currently defined frame modes:


Axis definition

The x-axis as well as the y-axis are specified by the following parameters: Title specifies the axis title, Height its height in mm on the printed page. Unit of course is the unit of whatever quantity is represented by the axis, the Unit factor is a multiplier of Minimum, Maximum and Tick spacing. It should be a (positive or negative) power of 10.

The displayed range of the axis is given by Minimum and Maximum. The distance between adjacent axis 'ticks' is determined by Tick spacing. An example: if Minimum is set to 20.0, Maximum to 200.0,Tick spacing to 20 and Unit factor to 0.02, x-values between 20 and 200 are displayed as shown on the x-axis on this plot:

Note the negative power of ten on the x-axis and the use of units. Here is the corresponding graphics dialog with the parameters that generate the output above:

If you set Tick spacing to 0 the software tries to find a reasonable tick spacing automatically (which can be adjusted afterwards, if necessary).

Decimals means – of course – the number of digits used for axis labeling.

The position of the graph on the paper is given by Offset (distance from the lower left corner of the paper to the lower left corner of the frame of the plot, specified in mm) and Length (length of the axis in mm).

Activating the option 'logarithmic scale' switches on logarithmic scaling - be sure that the axis minimum is positive in this case. It is recommended to use frame mode 3 if you turn on logarithmic scaling:


Text output

All text output in W.Theiss Hard- and Software programs is done using the Times New Roman true type font that comes with Windows. For scientific publications the use of sub- and superscripts and greek symbols is possible. To achieve this the text to display is specified as a string containing control characters which must be chosen according to the following rules:

·an input of this is a _sub_script leads to the output this is a subscript

·an input of this is a ^super^script leads to the output this is a superscript

·ut as an input of switch to symbol font |abc| to obtain greek characters leads to the output switch to symbol font αβχ to obtain greek characters


Load and save plot parameters

Use the Load and Save buttons in the graphics parameters dialog to load and save graphics parameters to files.


Introduction

3D graphics Introduction

Some applications like the Collector or View_RT tools display several 2D data sets in 2D or 3D graphs. Each data set must have a characterizing parameter which is used to display the set in the 3rd dimension. Here is an example of a tyical Collector configuration:

This sections describes how to use 3D plot parameters under the assumption that you are familiar by now with 2D plots as discussed above.

A graph like the one above is handled like a set of 2D curves. The x-axis is the one on the front (the wavelength axis in this example), the y-axis is the vertical 'Reflectance' axis. The new z-dimension - new with respect to 2D graphs as discussed above -is the axis on the right side ('Deposition time'). The z-values of the various data sets may be non-equidistant.

Keyboard commands

The keyboard commands are the same as for 2D graphs (see above) - consequently they act on the x- and y-axis.

Mouse commands

Up to now mouse commands are not supported in 3D graphics.


The dialog

There are many similarities to the 2D case as you can see looking at the 3D plot parameter dialog:


Basic parameters

The frame mode parameter determines the general style of the graph. The same frame modes as for 2D graphs are supported here as well. In this case a 2D graph is shown using different colors and line types for the individual curves:

In addition to the 2D frame modes the following frame modes are defined:

Frame mode | Meaning | Button to set this frame mode
1 | 2D graph with frame mode 1 |
31 | Data grid for both x- and z-axis |
32 | Data lines in x-direction, no connections in z-direction |
33 | False color plot |

Pen data, pen axis and pen back control which pens are used for drawing the data points, the axes and the frame, and the guiding lines in the back of the frame.

The position of the graph on the paper is given by vert. offset and horiz. offset (distances from the lower left corner of the paper to the lower left corner of the frame of the plot in the vertical and horizontal direction) and its size is given by vert. size and horiz. size. As in the 2D case all these lengths must be specified in mm.


Axis parameters

The axis labeling for the x-, y- and z-axis is the same in the 3D case as described for 2D plot parameters2D_plotparameter.

If y-values are too large or too small to fit in the 3D graph, they are set to the corresponding limits as shown in the following example:

Starting with

and setting the minimum of the z-axis to 0.2 and the maximum to 0.5 one gets a picture like this:


False color plots

In false color plots the y-values are shown as colors in a 2D graph based on the x-axis and z-axis:

The minimum of the y-axis is displayed using the color of the 'grid pen', the maximum values have the color of the 'data pen'.


Moving around

 Top Previous

You – the observer – can move around the 3D data and select a view appropriate for what you want to show. To change your position you can use the buttons labeled Up, Down, Left and Right in the center of the toolbar:

With the Forward button you can move towards the data in order to get a rather extreme 3D look like this:

The Backward button moves you away from the data and from the distance the perspective is like this: