Annotating Your Graph - page 1

Annotating Your Graph - page 1
Site Index | Store | Home
Company
|
Products
Resources:
Main Page
Case Studies
Graph Gallery
LabTalk Resources
Documentation
Technical Reviews
E-mail this page
Site Search
Find
|
Support
|
Services
|
News/Events
|
Downloads |
Resources
|
I'm looking for...
Annotating Your Graph
- by Mike Genthner
Graphics are an essential part of any technical presentation. Because your target audience are rarely as
familiar with your data as you are, it is essential that your graphics be clear and concise. Frequently, a well
placed line or text annotation can help to draw the viewer's attention to the essential elements of your
graphic. Origin allows substantial flexibility to add text and other features. In this paper, we will look at
some methods for adding and arranging some commonly used graphic elements.
For purposes of illustration, let's start by plotting some hypothetical data. In this example, we will use
some rainfall and water table data. Here I have chosen to plot the data on a vertical two-panel graph, with
rainfall data on the upper axes and water table data on the lower axes.
Site Login/Help
User ID
Password
Login
If you would like to work along with me, download annotate.exe, a self-extracting executable file. Once
you have downloaded the EXE, double-click on it and extract its contents (ANNOTATE.OPJ) to the
folder of your choice. Then, start Origin, select File: Open, and enter the path to ANNOTATE.OPJ.
Finally, click the Open button to open the file. When the file opens, you will see the data and the
accompanying graph as they appear above.
When you are ready, move on to page 2 to begin.
page 1
page 2
page 3
page 4
page 5
page 6
OriginLab® Corporation (formerly Microcal Software, Inc.) - © 2000
http://www.originlab.com/www/resources/tech_reviews/jan01/page1.asp [12/13/2000 10:10:55 AM]
Annotating Your Graph - page 2
Site Index | Store | Home
Company
|
Products
|
Support
|
Services
|
News/Events
|
Downloads |
Resources
|
I'm looking for...
Resources:
Main Page
Case Studies
Graph Gallery
LabTalk Resources
Documentation
Technical Reviews
Adding text through the worksheet
X- and Y-Axis Titles
E-mail this page
Site Search
Find
Site Login/Help
User ID
Password
Login
Frequently, it is convenient to add text to a graph through the worksheet. For instance, we can automate
the task of assigning X- and Y-axis titles by naming our worksheet columns and doing the following:
For the Y-axis titles...
1. ALT + double-click on the words "Y Axis Title" in either the top or bottom graph panel. This will
open the Label Control dialog box.
2. Select the Link to Variables (%, $) check box and click OK.
3. Double-click on the same Y-Axis title (do not hold down the ALT key this time). This opens the
Text Control dialog box. The words "Y Axis Title" will be highlighted.
4. Type in %(1) (but do not click OK). In this example, %(1) creates a text label that contains the
name of the dataset in the first Y column.
For Layer 2 (the top panel), the Y column name is WaterTable, while in Layer 1 (the bottom
panel), the Y column name is Rainfall. In the more general case, specifying %(n) returns the name
of the nth Y column.
There are limitations to using this method to enter axis titles. The column name must be a single
word no more than 11 characters long and the name must begin with a letter. Additionally, special
characters are not allowed. You may find it easier to add axis titles manually by way of the Text
Tool and the Text Control dialog box.
In the figure below, you will see that I have entered Y-axis units as a second line of text under the
Y-axis title in the graph.
5. After typing %(1) in the Text Control dialog box, press the ENTER key on keyboard and type in
your units -- in this case "cm." Make sure that the Center Multi Line check-box is checked. This
will center the units under the Y-axis title. Now click OK.
6. Repeat this procedure for the other Y-axis title.
For the X-axis titles...
To automatically add X-axis titles, perform steps 1-5 for the words "X Axis Title", replacing %(1) with
%(Data1,@Xn). This command tells Origin to look in the worksheet named "Data1" and return the name
of the X column. While a more complex command would be needed for a worksheet that has multiple X
columns, in this example, we have only one X column so this notation will suffice.
http://www.originlab.com/www/resources/tech_reviews/jan01/page2.asp (1 of 2) [12/13/2000 10:11:13 AM]
Annotating Your Graph - page 2
Continue adding text through the worksheet on page 3.
page 1
page 2
page 3
page 4
page 5
page 6
OriginLab® Corporation (formerly Microcal Software, Inc.) - © 2000
http://www.originlab.com/www/resources/tech_reviews/jan01/page2.asp (2 of 2) [12/13/2000 10:11:13 AM]
Annotating Your Graph - page 3
Site Index | Store | Home
Company
|
Products
|
Support
|
Services
|
News/Events
|
Downloads |
Resources
|
I'm looking for...
Resources:
Main Page
Case Studies
Graph Gallery
LabTalk Resources
Documentation
Technical Reviews
E-mail this page
Site Search
Find
Site Login/Help
User ID
Password
Login
Tick Labels
Tick labels may also be added to the graph through the worksheet. Text values in an X-column that has
been set to Text and Numeric will plot as tick labels. In our case, we can see that the rainfall and water
table data are plotted by date along the lower X-axis. You might wonder why I have chosen to set the
column to Display: Text & Numeric (Worksheet Column Format dialog box) rather than to Display:
Date.
If you look at the Data1 worksheet, you will see that I measured rainfall (cumulative since the previous
sampling date) and water table on specific dates. Were I to set the column to Display: Date, Origin would
create a scale based on the specified increment and the number of minor ticks. In other words, Origin
would choose the tick labels. However, I want to display these precise dates.
The downside of my treating dates as labels is that, when the sampling increment varies as mine (very
slightly) does, the scale will not accurately depict the temporal relationship between sampling dates
because the distance between tick marks is fixed. Thus, a 21 and a 22-day increment appear as the same
"distance" along the X-axis.
Text values in any data set can be made to plot as tick labels by selecting Text from data set or
Tick-indexed dataset from the Type drop down list on the Tick Labels tab in the Axis dialog box. The
data set which contains the labels is chosen from the Dataset drop down list on the same tab. Note that in
our graph we have elected to show the upper X-axis, but have chosen not to display the associated tick
labels since this information is redundant and would only clutter the graph. To hide the tick labels on the
upper graph, I double-clicked on the upper X-axis and unchecked the Show major labels check-box on
the Tick Labels tab of the Axis dialog box.
Label Columns
We can also annotate a graph by entering text from a Label column. Suppose that we wanted to emphasize
high and low water tables on the lower graph. We could insert a column to the right of the column
containing the water table readings (click on the Rainfall(Y) heading to highlight this column and choose
Edit: Insert from the shortcut menu). Then right-click on the new column heading and select Set As:
Label. The column designation will change to (L). In the cell adjacent to the high water table reading, we
enter the word "max" and adjacent the low water table reading we enter the word "min."
In order for these labels to display on our graph, we need to add the data set to the appropriate layer.
Right-click on the lower plot and select Layer Contents. In the left side of the Layer 1 dialog box, all of
the data sets contained in this Origin project are listed. Look for the "minmax(L)" data set; in Origin's
syntax, this data set would be named data1_minmax. This denotes the data set "minmax" contained in the
worksheet "Data1." Select the minmax data set and click the => (right arrow) button to add the data set to
Layer 1. Click OK and you should see words "min" and "max" inserted into the lower graph panel.
http://www.originlab.com/www/resources/tech_reviews/jan01/page3.asp (1 of 2) [12/13/2000 10:11:20 AM]
Annotating Your Graph - page 3
Learn how to add text manually on page 4.
page 1
page 2
page 3
page 4
page 5
page 6
OriginLab® Corporation (formerly Microcal Software, Inc.) - © 2000
http://www.originlab.com/www/resources/tech_reviews/jan01/page3.asp (2 of 2) [12/13/2000 10:11:20 AM]
Annotating Your Graph - page 4
Site Index | Store | Home
Company
|
Products
Resources:
Main Page
Case Studies
Graph Gallery
LabTalk Resources
Documentation
Technical Reviews
E-mail this page
Site Search
Find
Site Login/Help
|
Support
|
Services
|
News/Events
|
Downloads |
Resources
|
I'm looking for...
Adding text manually
Text annotations can always be added to your graphic manually. In our example, it would be appropriate
to add a header to our graphs. Select the
Text Tool
and click on the top and center portion of the graph (inside the white area, not on the window's title bar).
This opens the Text Control dialog box. Enter a heading "Measurements of Rainfall vs. Water Table,"
press the ENTER key and type in a sub-heading of "Research Site #1." We can format each line
individually by selecting the text within the Text Control dialog box, and applying various formatting
options. We could opt to draw a box around the header by choosing Background and selecting Black
Line, Shadow or another option from the drop-down list. When you are satisfied with the appearance of
the heading, click OK to close the Text Control dialog box.
User ID
Password
Login
Path and Filename Text
There are a couple of methods for adding text to graphics that are not necessarily relevant within the
context of our example, but which are important enough to warrant mention. Occasionally, you may want
to add a path and filename to an Origin graph. To do this, use the Text tool to create a text object
somewhere on your graph. Double-click on the object and open the Text Control dialog box. In the text
window, type \v(%X%G) and click OK. Right-click on the text object and select Label Control from the
pop-up menu. Check the Link to variables (%,$) checkbox and click OK. From the Origin menu bar,
select Window: Refresh and the path and filename of your Origin .OPJ file will be printed on your graph.
Registered users of Origin 6.1 may want to go to
http://www.originlab.com/www/downloads/addon_modules/index.cfm
and download Stamp.opk 1.0. This Addon Module contains a path and filename stamp button which you
can add to your Origin toolbar space.
Date and Time Stamp
Another potentially useful annotation is a date and time stamp. This might be particularly useful in
applications where you are doing some sort of time series analysis. We can add a date and time stamp
manually by simply clicking on the Date & Time button (the clock-face) on the Graph toolbar.
An alternative method involves creating a graph template. Templates are especially useful where you
http://www.originlab.com/www/resources/tech_reviews/jan01/page4.asp (1 of 2) [12/13/2000 10:11:26 AM]
Annotating Your Graph - page 4
expect to create a series of plots and you want the format to be precisely the same each time. To create a
template that has a date and time stamp, create a text object in a convenient location on your graph (the
lower left corner of your screen is a good, out-of-the-way location). Enter the word timestamp in the Text
Control dialog box. Click OK. Now, hold down the ALT key and double-click on the text label. In the
Label Control dialog box, enter the word timestamp into the Object Name text box. Check Link to
variables (%,$). From the Script, Run After drop-down list, select Window Create. In the text box enter
timestamp.text$=$ (@D,D10) (make sure that D is uppercase). Save the graph window as a template
(File: Save Template As…). Origin saves the file with an .OTP file extension.
Now, when you want to create a graph that is automatically stamped with the date and time of graph
creation, you can select Plot: Template. This opens the Open dialog box. Browse to the folder containing
your custom template and double-click on the file, or single-click and select Open to close the dialog box
and bring up the template.
Learn about text formatting and special characters on page 5.
page 1
page 2
page 3
page 4
page 5
page 6
OriginLab® Corporation (formerly Microcal Software, Inc.) - © 2000
http://www.originlab.com/www/resources/tech_reviews/jan01/page4.asp (2 of 2) [12/13/2000 10:11:26 AM]
Annotating Your Graph - page 5
Site Index | Store | Home
Company
|
Products
|
Support
|
Services
|
News/Events
|
Downloads |
Resources
|
I'm looking for...
Resources:
Main Page
Case Studies
Graph Gallery
LabTalk Resources
Documentation
Technical Reviews
E-mail this page
Site Search
Find
Site Login/Help
User ID
Password
Login
Text Formatting and Special Characters
When creating text objects, you may want to apply custom text formatting or add special characters that
are not available from the keyboard or the main menu. There are a couple of ways to do this. One method
uses toolbar buttons in the Text Control dialog box to specify certain text formatting options such as Bold
or Italicized text, Underscore, super- or sub-scripts, or Greek letters. To make use of these formatting
options, type in your text, highlight the text, and click on the appropriate button. As mentioned, multiple
lines of text must be formatted separately.
You may also choose to format text or enter special characters in the Text Control dialog box using the
backslash \ formatting command (or escape sequence). The \ command is used with a control character
which specifies the desired format option. For instance, to enter text as a superscript, type \+(text). To
enter text as a subscript, type \-(text). For access to the full character set for any font, type \ followed by
the number which corresponds to the desired character for the font set currently selected in the Text
Control dialog box. These characters are visible in the Windows Character Map. For instance \(169)
produces a © when the TT OCRB font is selected; \(169) produces the symbol © when the TT Symbol
font is selected.
Adding lines, arrows, etc.
Frequently, you may want to add lines to a graphic in order to point to some element or to emphasize a
certain threshold value. Lines can be added to the graphic manually by selecting the Straight Line,
Curved Line, or Arrow tool. Click the left mouse button at the point on the graphic where you want to
start to draw and move the cross hair to the point of ending and click again. In the case of the curved line,
click once to start the line, twice more to anchor the curve and click again to end the line. To align your
manually drawn line horizontally or vertically, click on the Snap lines/arrows perfectly horizontal and
vertical buttons on the Arrow toolbar.
To add/remove arrows, double-click on the line or arrow (or click once to select, and then right-click and
select Properties). This will bring up the Arrow Control dialog box. Use the check-boxes to format your
line or arrow.
Creating vertical or horizontal lines at specific X or Y values
There is another method for adding horizontal and vertical lines to a graph when you want the line to
appear at a specific X- or Y-axis value. In our example, I have would like to add a horizontal line
corresponding to the ground surface at 0 on the Y-axis on the lower graph. This could be added manually
with the line drawing tool but this is more precisely accomplished with the Lab Talk draw command.
Click on the lower graph to select that layer. Open the Script window (Window: Script Window) and
type draw -l -h 0 into the window. Press ENTER. This draws a line the length of the X-axis at the Y=0
value on the lower set of axes. This added line denotes the ground surface.
http://www.originlab.com/www/resources/tech_reviews/jan01/page5.asp (1 of 2) [12/13/2000 10:11:31 AM]
Annotating Your Graph - page 5
Origin version 6.1 users have another method for adding horizontal or vertical lines. Select the Line or
Arrow Tool, hold down the SHIFT key and drag out a line with your mouse. To align an existing line
horizontally or vertically, select the line by clicking on it. Hold down the SHIFT key and drag the control
handle at either end of the line to snap the line into a horizontal or vertical position. To reorient the line,
grab the handle without holding down the SHIFT key and drag it.
Complete the process of annotating your graph on page 6 where you will learn how to tweak your
annotations for final output.
page 1
page 2
page 3
page 4
page 5
page 6
OriginLab® Corporation (formerly Microcal Software, Inc.) - © 2000
http://www.originlab.com/www/resources/tech_reviews/jan01/page5.asp (2 of 2) [12/13/2000 10:11:31 AM]
Annnotating Your Graph - page 6
Site Index | Store | Home
Company
|
Products
Resources:
Main Page
Case Studies
Graph Gallery
LabTalk Resources
Documentation
Technical Reviews
E-mail this page
Site Search
Find
Site Login/Help
User ID
Password
Login
|
Support
|
Services
|
News/Events
|
Downloads |
Resources
|
I'm looking for...
Tweaking Annotations
Once you have added all of the desired elements to your graph, you may want to rearrange certain
elements to polish your graphic. Before doing so, you will want to make sure that your display is set to
Print View (View: Print View from the Origin menu bar). Print View displays spatial relationships
between elements as your selected printer interprets them. If you are using View: Page View, spatial
relationships are determined by the video driver and when you select Print or Print Preview, you will
probably see that some elements have shifted slightly. Therefore, before you do your final tweaking, make
sure that you are in Print View.
When you do your final tweaking, the most obvious method for moving and aligning graphic elements is
by dragging them into position. Turning on the grid facilitates this (View: Show: Axis Grid or Object
Grid). If we select Format: Snap Object to Grid, the object will be aligned to the nearest grid line when
it is moved.
Frequently, however, we might wish for a more precise way of aligning objects. We can do this using the
Object Edit toolbar (View: Toolbars, Object Edit). In our example, I want to ensure that the Y-axis text
labels are aligned. Buttons on the Object Edit toolbar affect only selected items. To select multiple items
hold down the SHIFT key while clicking on the objects. Keep in mind that objects will be aligned to the
first item selected. Thus, I click on the upper Y-axis label, hold down the SHIFT key and click on the
lower Y-axis title. I click on the Right Alignment button and the labels are aligned vertically. Other
alignment options available from the Object Edit toolbar include Left, Top, Bottom, Vertical,
Horizontal, Front or Back for overlapping objects.
On the subject of alignment, we should mention that different printer drivers will interpret spatial
relationships between graphic elements differently. If you create your graphic with a particular printer
installed and then port your document to a different computer with a different printer installed, you will
probably see that some elements of your graphic have changed position.
Most of us have observed this phenomenon when moving text documents from one computer and printer
combination to another. Frequently, we will see our documents "shrink" or "grow" by a line or two. While
this is perhaps not critical when working with text documents, it can be very frustrating when working
with graphics, especially if you have spent a good deal of time arranging the objects on your graph to your
liking. Therefore, do the final tweaking of your graphic in Print View with the printer that you plan to
print to, set as default. If this is not possible, install the printer driver for the printing device that you plan
to use and make sure that it is selected while composing your graph.
Thank you for taking a look at Annotating Your Graphs. We encourage you to continue using the
Technical Review articles as a means to develop your skills as an Origin user! If you would like browse
the complete listing of Technical Review articles, please go to our Technical Review Directory.
page 1
page 2
page 3
page 4
page 5
page 6
OriginLab® Corporation (formerly Microcal Software, Inc.) - © 2000
http://www.originlab.com/www/resources/tech_reviews/jan01/page6.asp [12/13/2000 10:11:36 AM]