Common Uses of Sliders

Previous  Terms  Next

TinkerPlots_logoV2-rgb


Common Uses of Sliders

Here we describe a few possible uses of sliders in TinkerPlots. The folder Data and Demos | Demos includes several TinkerPlots files that use sliders in various ways. As you'll see in those documents, sliders are easy to use once they have been created. But useful sliders are not so easy to set up in the first place. Thus sliders are not things that students themselves should in general be figuring out how to construct. Rather, they are resources for teachers and curriculum designers to use in creating data sets and activities for students.

Animate Time Series Data

Many data are collected over time. For example, the data set NY Marathon.tp includes the running times for the male and female winners of the New York City Marathon from 1970 through 2004. Plotting data such as these over time often reveals interesting patterns and trends. You can use plot filters and sliders to "re-enact" such events that occur over time. This allows you to add data to the plot over time. Results are much like time-lapse photography. These time animations can help students learn how to read time series plots (by scanning visually from left to right along the time axis). The animations can also help you detect subtle patterns in the data that are hard to see when you view them all at once.

To create a slider that allows you to add data to a plot in the order they were collected,

1.

Make a time series graph, putting the time attribute on the horizontal axis and the attribute you want to view over time on the vertical axis. Fully separate each attribute.

Marathon and slider

2.

Create a slider that will control time (in this case, Year). To do this, add a slider to the document by selecting New Slider | New | Object. Here it is right below the plot. By default, the name of the slider will be V1. Double-click the V1 and rename the slider (in this case, VaryYear).

3.

Set the slider axis. Double-click the slider axis to open the Inspect Slider window. Set the Lower and Upper values so that they include the full range of your time attribute. Because the values of Year are integers, enter 1 into the value for Restrict_to_multiples_of. Now the slider will take on only integer values. Click the close button of the Inspect Slider window to close it.

Inspect slider Marathon

4.

Add a filter to the plot. With the plot selected, choose Add Filter from the plot's Options menu. Type a formula that will allow you to control the cases that appear in the plot with the slider. After you've entered the formula, click OK.

 

This example shows the filter formula Year ≤ VaryYear. The formula instructs TinkerPlots to include in the plot only the values of Year that are less than or equal to the current value of the slider VaryYear. To enter , press Ctrl (Win) Option (Mac) and click the ≤ button on the formula editor keypad.

5.

Set the plot axis. To prevent the plot axis from automatically rescaling as data are added or removed, click the upper value of the time-based plot axis and set the axis endpoint to some value that is greater than the maximum data value.

 

Edit axis end point

6.

Use the slider to control the plot. Do this either by dragging on the slider's thumb or by clicking the arrow next to the slider name to animate the slider. Click the red X to stop the animation.

In this example, when you add the data to the plot over time, you clearly see that the winning times for males and females tend to go up and down together from year to year, perhaps reflecting the effect of weather conditions on run-times. This relationship is not as easy to detect when all the data are on the graph at once.

Grow a Sample

When looking at a sample to explore a particular question, students will often ask, "But what would happen if we collected more data?" One way to let young students explore this question is to "grow" samples-to randomly draw cases from a larger population and observe how the sample changes, and doesn't change, as it gets larger. Though you can do this with real data, the example here uses made-up data.

Open the demonstration document Fish Experiment Demo.tp to see the data. The cover story involves a fish farmer who has stocked a pond with both normal fish and a new type of genetically altered fish that is supposed to grow longer than the normal fish. To test this claim, the farmer catches the matured fish from the pond and measures them. The demonstration allows you to capture data from the collection and display it in a plot. Use the slider beneath the plot to gradually increase the sample size until, if you want, you can view all 625 fish in the pond.

When students in grades 4-6 have used these data both on and off the computer, they have come to observe that even when their sample is still relatively small, certain features of the larger population are usually already evident, such as where the data tend to be centered.

The following steps describe how this document was set up using sliders, filters, and attribute formulas.

TinkerPlotsHelp-1-101-130

1.

Create a slider that will allow you to add data to the plot. To do this, add a slider by selecting New Slider | New | Object. Here it is below the plot. By default, the name of the slider will be V1. Double-click V1 and rename the slider, (in this case, Samplesize).

2.

Set the slider axis. Double-click the slider axis to bring up the Inspect Slider window, as shown. Set the Lower and Upper values to cover the range of the number of cases, in this example from 0 to 625. Enter 1 into the value for Restrict_to_multiples_of so that the slider will take on only integer values. Click the close button of the Inspect Slider window to close it.

Slider Fish Exp

3.

Add a filter to the plot. With the plot selected, choose Add Filter from the plot's Options menu. Type a formula that will allow you to control the cases that appear in the plot with the slider. After you've entered the formula, click OK.

 

This example shows we entered the formula CaseNo ≤ Samplesize. The attribute CaseNo ranges from 1 to 625, and each case has a unique number. This filter formula instructs TinkerPlots to include in the plot only the values of CaseNo that are less than or equal to the value of the slider Samplesize. Thus by adjusting this slider, you can grow the sample all the way from 0 case to 625 cases. (To enter ≤ into the formula editor, press Ctrl (Win) Option (Mac) and click the ≤ button on the formula editor keypad.)

 

TinkerPlotsHelp-1-101-135

4.

Set the plot axis. To prevent the plot axis from automatically rescaling as new values are added, click the upper end of the plot axis. In the dialog box, enter the value 45 even though it was already set to this value. By retyping it into the dialog box, you lock that end so it won't change. Do the same for the lower end of the axis, setting it to be below the minimum value of the data.

 

TinkerPlotsHelp-1-101-136

5.

Use the slider to control the number of cases in the plot. Do this either by dragging on the slider's thumb or by clicking the arrow next to the slider name to animate the slider. Click the red X to stop the slider animation.

 

In this example, the attribute CaseNo was created using a formula that allows you to quickly reassign case numbers to the 625 values. Thus you can redo this experiment over and over, seeing what happens if the fish happened to be sampled in a different order.

To randomly assign new values of CaseNo to the cases,

1.

Choose Rerandomize from the Data menu.

If you have data in the graph, you'll see it change location as a new sample of fish are "caught." Here's the formula for CaseNo we use to do that.

TinkerPlotsHelp-1-101-137

The formula combines two functions. The inner-most function, random(), randomly assigns each case a real number from 0 to 1 (the default range for this function). So each case in the data set gets some value such as 0.56779. The function uniqueRank then takes these random numbers and assigns them a unique ranking from 1 to 625 (the number of cases we have) based on their value. If two or more of the cases happened to have random numbers of the same value, which would be extremely unlikely, the function uniqueRank will arbitrarily give them unique rankings anyway. This is all just a complicated way of randomly reordering the 625 cases and giving them a number based on this ordering.

Create Realistic Data

You can use a slider along with formula-derived attributes to create and quickly modify hypothetical data. See Create Realistic Data in the section Common Uses of Formula-Defined Attributes.


TinkerPlots Help

© 2012 Clifford Konold and Craig D. Miller