Making Plots Using Excel

shaker response - 300Often, it's useful to plot data gathered by a microcontroller system.  Data might be temperature vs time, voltage vs current or any other information.  An X - Y plot can aid in understanding information.  Microsoft Excel can easily polt many types of data.

The first issue is getting the desired data from a microcontoller system.  The usual method is to capture a data stream in a terminal emulator and to save the data in a file.  A little forethought in microcontroller programing will make plotting easier.  A common format is CSV or comma-separated-values.  Each x-y pair is one a single line, separated by a comma and the line is terminated with a carriage return (chr$(13)) and a line feed (chr$(10)).  The captured data file will look something line this:

 

File
x,y
0,0
1,1
2,4
3,9
4,16
5,25
6,36
7,49
8,64
9,81
10,100
11,121
12,144
13,169
14,196
...

 

Files formatted like this are easily imported into Excel.

Start Excel and open the text file.  You'll see a screen something like this:

image 9

Select the delimited option and the screen will change to this:

image 10

Check comma as the delimiter and click next.  The data will be placed in two columns representing x and y values.

image 1

Now that the hard part is done, select the data for the graph.

image 2

Next, click INSERT on the menu bar and select SCATTER PLOT.

image 3

The scatter menu shows several options - straight lines between points, curve-fit lines and markers or not.  Select the desired format.  Be sure to select the SCATTER option rather than the LINE option.

image 4

A small version of the plot will be shown on the sheet.  Right-click in the body of the graph, select NOVE GRAPH and choose new sheet.

image 5

The graph will be created full size in its own sheet.  Next, right-click in the axes to change scaling.  I like to choose fixed scaling to maximize plot area.  If several graphs are to be compared, it's best to fix the scaling the same on each for easy comparison.

image 6

 

image 7

Finally, with a little editing is the final graph.

image 8

 

 

The process is pretty simple.  There are a lot of options to be investigated to achieve the look you want.

Forum Activity

Member Access