Data Cursors with Histograms

When you use the Data Cursor tool on a histogram plot, it customizes the data tips it displays in an appropriate way. Instead of providing x-, y-,z- coordinates, the datatips display the following information:

  • Number of observations falling into the selected bin

  • The x value of the bin's center

  • The lower and upper x values for the bin

For example, The following figures show a line plot and a histogram of count.dat, a data set that contains three columns, giving hourly traffic counts at three different locations. The plots depict the sum the values over the locations. Each graph displays two datatips, but the datatips in the right-hand plot give information specific to histograms.

load count.dat
subplot(1,2,1); plot(count(:))
subplot(1,2,2); hist(count(:),5)
datacursormode on

Click to place a datatip or drag an existing one to a new location. You can add new datatips to a plot by right-clicking, selecting Create new datatip, and clicking the graph where you want to put it.

When you add datatips to histograms or bar graphs showing groups of data, you can move a datatip to any other bar by clicking inside that bar. If you use the cursor keys to shift a datatip back or forth across the graph, the datatip moves to the preceding or succeeding bar of the same color.

Was this topic helpful?