HomeHow do I...? • Kaleidagraph • Fitting ExerciseOrigin 3.5Origin 4.0Lab Note Books

Plotting Data with Kaleidagraph

Running from a PC? Be sure to use the Novell Application Launcher.

Data · Calculations · Functions · Plotting · Fitting · Printing · Exporting for a Paper · Troubleshooting

data data axes residuals Plotting

Sample Plot
Plot Styles · Error Bars · Functions · Axes · Fitting · Residuals

To learn how to make a graph such as the one shown above, follow the discussion below the graph. Click on a feature of the graph, or the text links beneath it, to jump to the instructions for that feature.


Kaleidagraph is an easy-to-use if somewhat limited graphics program that runs on both Macintoshes and PCs under Windows. Data are entered in a tabular sheet which can easily be edited. Data can be linked to graphs so that graphs are automatically updated when the data sheet is changed. Kaleidagraph offers a variety of graph styles, the most useful of which are Line (for xy plots), Double Y (for xy plots with two y axis scales), and Polar.

Running Kaleidagraph from a dorm PC?

You need to take the following steps.

  1. If you're running Windows98, download the Novell 32-bit client software from Novell's website. This will make sure that all of KATO's drives map properly on your system.

  2. Be sure to launch from the Network Application Launcher (NAL), which is at Z:PUBLICNAL.EXE. This copies needed resources to your local drive.

Entering Data

You may type data directly into a data sheet or import data from the clipboard, from a text file, or from an Excel data sheet.

Keyboard Entry

Type your data in columns noting the following points:

Import from the Clipboard

If the data exist in some other program, copy to the clipboard, switch to Kaleidagraph, select the upper left corner of the region of a data sheet into which you wish to place the data, and paste. If the data are not tab-delimited, this method does not work. Save the data in a text file and proceed with the following, instead. To save the text file, issue the Edit Text.. command (command E), paste the data, and click the save button.

Text Import from a File

Use the Open command to access the text file. After you have selected the file, a dialog box appears with options for parsing the data. You may specify whether to import the first line of data as column titles, how many lines at the top of the file to skip, whether the data are delimited with tabs (Macintosh standard), spaces (popular on the PC), commas, or in some other fashion.

Data Import from an Excel File

Use the Import Data command to access the Excel file. More recent versions of Kaleidagraph can handle more Excel formats. Version 3.5 can handle Excel98/2000 formats, but older versions need a version 3 or version 4 format. Note that you can save a sheet from a version 5/97/98/2000 notebook in version 4 form for import.


Often you would like to calculate a new column of data based on one or more data columns already in a data sheet. For example, you might need to compute the sine of an angle, or the product of two values, row by row.

Let's say that you have values for x in the leftmost column (which is numbered zero, and called c0) and values for y in the column immediately to its right (column 1, or c1). Here's how to put the ratio in column 2:

  1. Click in the data sheet to make sure that only one data cell is selected (I'll explain why below)
  2. Press command-F or chooseFormula Entry from the Window menu to bring the Formula Entry window to the front
  3. Enter the Kaleidamumbo: c2 = c0 / c1
  4. Click the Run button


  1. Any data in c2 will be overwritten
  2. If a complete data column is selected before the command is run, this will change the definition of column 0. Let's say you have selected column 1 (by clicking at the top of the column). Notice that this changes the number of the column at the top, making it 0. For purposes of the calculation, this is now column 0, and the column to its immediate right is column 1. This is not a bug but a feature! It allows you to enter a formula once and apply it to several columns by selecting them in turn.
  3. If you refer to a column that doesn't yet exist (e.g., c3 in a sheet that has only 3 columns), it will be created automatically.

Useful Functions

Plotting Functions

To plot a function in Kaleidagraph, you must make a data column for the y values of your function. If you do not already have a corresponding columns of x values, you will have to make that to.

Let's say I would like to plot the function

f(x) = exp(-x^2 / 2)
over the range from 0 to 4. Here's how:
  1. Make a column of x values by bringing a data sheet frontmost, deciding on which column to fill with the values, then press command F to bring the formula entry window to the front. Let's say the sheet already has data in columns 0 and 1, so we'll put the new x values in column 2.

  2. Enter the formula c2 = 4 * index()/127 By default Kaleidagraph sheets have 128 rows in them. This formula will make 128 evenly spaced x values between 0 and 4, inclusive.

  3. Calculate the y values by entering the following formula into the formula window (which should still be frontmost) c3 = exp(-c2^2 / 2) This puts the y values in column 3.

  4. Add the data to your plot.

Computing Residuals

Residuals are the difference between the actual data points and the fitted line or curve. To compute residuals, you must first perform the fit. In version 3.5, you then select the same fit function from the fitting menu to bring up the fit dialog, which will now contain a popup View menu of options. Select Paste Residuals to Data Window...

In older versions of Kaleidagraph, follow this sequence. Bring the data sheet to the front, and determine the number of the column for the residuals. Usually this is one greater than the last occupied column, so you don't overwrite any data.

Bring the Formula Entry window to the front (using the Window menu, if necessary). Enter a formula like the following

Cn = Cy - gen(Cx, Cy)

where n is the destination column, y is the number of the column with the y-axis data, and x is the number of the x-axis data. The "gen" function looks for a fit you have defined, as opposed to one of the built-in fitting functions. If you have used a built-in fitting function, Kaleidagraph has ignored your errors and you should probably define your own fitting function to include that information. If you have used a built-in function, use the appropriate name of that function in place of "gen". Use the Curve Fits menu in the Formula Entry window for this.

When you hit Run, the residuals will be placed in column Cn.

Plotting Data

Use the Gallery menu to select the plot style: Line or Double Y (for xy plots) or Polar. Unlike Origin, there is no need to "bless" columns with particular roles (X, Y, or errors) before creating the graph. Name the columns with meaningful names before preparing the plot: the names will be used on the x and y axes, and in the plot legend.


By default, Kaleidagraph adjusts the range of each axis automatically. You can override its choices by double-clicking on the axis and changing settings in the dialog. Alternatively, you can click once on the axis to select it, and use the pop-up menus at the bottom of the tool palette. Using either of these methods you can set the following options:

Plot Style

The style (symbols and/or lines) used to plot data points can be adjusted either through a dialog box or directly on the plot when the legend is displayed. To activate the dialog, choose Plot Style... from the Plot menu. The use the legend, make sure Display Legend is checked in the Plot menu. Select the data series whose line and/or symbol you wish to modify with a click in the legend. Then use the tool palette to change the symbol size, shape, color, and frequency, as well as the line style, weight, and color. For most data sets, you should not display a line connecting data points, so select none. You may change the style of box around the legend by selecting the legend and adjusting the line width with the pop-up menu at the bottom of the tool palette.

Error Bars

To add error bars to a data series, add a data column to the worksheet with the appropriate errors. Then bring forward the plot and choose Error Bars... from the Plot menu.

Annotating the Graph

If you enter appropriate column headings in your data sheet, the axes of your plot will be labeled with reasonable guesses for the appropriate quantities. If you need to fix them, just double click on the text to change. Text formatting is a real weakness of Kaleidagraph versions prior to 3.5. You cannot, for example, mix plain text and italics in a single text item. You can, however, use Greek letters and other characters in Symbol font using the flag f. Use n to return to normal text, u for superscripts, and d for subscripts. You may either type these in directly or use the Style menu in the text editing dialog box. As an example, the following text produces Euler's equation

  :   euifpn = -1

You may add additional text labels using the text tool ("T" in the tool palette) and lines, with or without arrows, with the line tool. Labels you don't want can be deleted by selecting them and pressing delete (backspace).

In version 3.5 you can set the style and font of each individual character, if you are so perverse. You can also still use the flags f, u, etc. in text fields to switch to Symbol font, to produce superscripts, etc.

Fitting Data

The built-in fitting functions (line, exponential, polynomial, logarithmic) should be used with caution, as they do not take uncertainties in the data into account. In most physics courses, you will have some independent estimate of uncertainties, which you should use to guide the fitting operation. If you do have uncertainties for your data, make sure they are entered in a column on the data sheet, so you can select them when you initiate a fit to a user-defined fitting function, as described below. Note that the operations of displaying error bars on the plot and using them in the fit are completely independent.

Fitting to a Line

For a quick and dirty fit, select Linear... from the Fit menu when a plot is front-most. Select the y data you wish to fit and a line will be put through your points. If Display Equation is checked in the Plot menu, the equation of the fit will appear near the top of your graph. Note: this fit does not pay attention to error bars, even if you have them displayed on the graph. It is therefore useful only when each point has the same error in y and you don't care to inquire how confident you should be in the fit. In most cases, you will want to know the value of c2 for your fit. To get this, you must define a fit function, as described in the following section.

Fitting to an Arbitrary Curve

Kaleidagraph uses an archaic calculator-derived programming language for curve fitting that begs for an update. Still, it's easy enough to use. As an example, consider a linear fit function of the form y = mx + b. This function has two free parameters, namely m and b. In Kaleidagraph, these are called M1 and M2. The independent variable, x, is called M0. To enter the linear fit function, select Edit General... from the Curve Fit menu, define a new function, click the Edit button, and type in the following Kaleidamumbo: M1+M2*M0; M1=1; M2=1 The first part is the function. The second part gives initial values for the fit parameters. For a complicated nonlinear fit function, it is very important to choose initial values carefully to start the fit close to the correct values. For a simple, linear function, it is not so important.Next, check the Weight Data box and, optionally, fill in the partial derivative expressions. For this simple example, they are 1 and M0. Then close the dialog. To apply this fit to your data, go back to the Curve Fit menu and select the fit you defined from the General submenu. The results will be displayed in a table, as shown in the following figure. The table includes the fit parameters, their standard errors, the value of c2, and the goodness of fit coefficient R.

Fit Information

Using the Display Equation item in the Plot menu you can display the results of the fit. If you have defined your own function, the information displayed includes the value of c2, written as chisq. This value is not reduced by dividing by the number of degrees of freedom, as it is in Origin. You must divide by the number of degrees of freedom yourself.

For including a graph in a technical report or publication, you should copy down the information from the fit, remove it from the graph, and place it in the figure caption.

Printing Graphs

For use in a lab notebook, it is very convenient to print a version of your graph that is small enough to permit you to annotate the graph and explain its significance on the same notebook page. A graph with a plot area of about 4 inches by 3 inches is quite good for this. I recommend the following settings. Make your plot area 5 inches wide by 3.75 inches tall. Use the Page Setup... command to set the page scale factor to 80% and print.

If you need the graph to fill the page, just make sure that the page uses landscape orientation and set a page scale factor of 130%.

Using the Layout Page... command you can print multiple graphs on a single page.

Exporting Information

You may export data and graphics from Kaleidagraph by copying to the clipboard or by saving to a file. Export data using the file menu Export command, and choose the format for the exported data.

There are a few tricks for exporting graphs successfully, depending on the destination for the graph.

Copying a Graph to a Word Processor

Be sure the graph you wish to copy is the frontmost window, then issue the Copy Graph... command. You may select the plot size either by choosing the same as the plot window or by typing dimensions directly into the dialog.

If the destination for the graph is a PostScript printer, check the box to include PostScript in the picture. If the destination is a bitmap (inkjet) printer, check the high resolution picture box, if available. (It has been removed in recent versions, for which it is effectively always checked.)

Using LaTeX

To include a figure in LaTeX, "print" the graph from Kaleidagraph in encapsulated postscript format. Make sure that the computer is set to print to a PostScript printer, then issue the print command. Instead of directing the output to the printer, choose to save it to a file and select EPS. On a Macintosh, the recommended option is EPS Mac Enhanced Preview. The print driver will create an EPS file that you can include in your LaTeX document.

The LaTeX commands you'll need are as follows

  1. Add the command usepackage{epsfig} at the top of your document, or simply add the epsfig package to the list of packages.
  2. Add a line such as the following, to include the eps file, which should be in the same directory as the source .tex file. includegraphics[scale=0.75]{MyFig.epsf} Note that you can omit the scale command if you don't need to scale the figure.

Posting a Graph on the Web

Version 3.5 of Kaleidagraph allows you to save directly to GIF format, which is preferable to JPEG format for line art. (JPEG works better for photographs.) Use the Export command from the file menu.

For versions which do not support direct export to GIF format, prepare the graph in final form, then press Command-Shift-4, which is a Macintosh system function. The cursor changes to a cross. Drag from the top left corner of the graph to the bottom right. When you let up the mouse button, a picture named "Picture n" is written to the root directory of the boot drive, where n is a serial number. Edit this picture with GraphicConverter, Photoshop, or similar program to save it as a GIF (JPEG format distorts line art). If you include the dimensions of the image in the <img> tag, you will speed display in the browser. Use a tag such as the following

<img src="mygraph.gif" alt="My Graph" width="500" height="375">


When I paste data into a datasheet, it all comes out smashed in one column. Usually this means that spaces are present between columns in the data. Web browsers may substitute spaces for tabs when they display tabular information, so even if the original file had tabs, the copy on the clipboard may not. You can overcome this problem by first saving the text to a file.

Fitting doesn't work. I can't see a curve and I just hear a beep. There are several possibilities.
  • Check that you have entered the function correctly.

  • Make sure that you have given sensible initial values to each fit parameter. Fitting is a tricky business, and unless you give a good set of initial guesses for the parameters, the program will more than likely run away from the right answer and end with an annoying Singular Matrix Error.

  • If you checked the box to weight the data, make sure that none of the uncertainties in your errors column is zero.
I want to make a line plot out of a column of numbers, but I need an x column. See the index() command above.

logo picture
Copyright © 2001 Harvey Mudd College Physics Department
This page was last modified on Wed, Jan 31, 2001.