Tutorial Contents

Moving line chart: external data

Data source

Data display

Non-canonical formats

Leg limitations

Contents

Moving Line Chart: External Data

This facility enables you to display multiple lines, each defined by sets of XY coordinates. Individual lines can be highlighted in turn to produce an animated display showing changes in the line shapes. The lines do not have to be monotonic and they can be self-intersecting (i.e. they can curve back on themselves).

The aim is to facilitate analysis of moving and changing shapes in which the location of particular parts of the shape are defined by XY coordinates, with each row of coordinates (line) representing the shape at sequential moments in time.

Data source

The canonical data source is plain-text tab- or comma-separated numbers defining X, Y coordinates, arranged in a square matrix. Each row defines a line, with X and Y values in alternating columns, thus:

ln 1 X 1 ln 1 Y 1 ln 1 X 2 ln 1 Y 2
ln 2 X 1 ln 2 Y 1 ln 2 X 2 ln 2 Y 2
...

However, there can be an arbitrary number of header rows and left-hand columns containing information that does not define line point coordinates, and also the X and Y columns can be interspersed by columns containing non-coordinate information, so long as the same format repeats for each X, Y pair. When data are loaded, the user specifies the format of the data, which can vary within the limits just described.

There are 3 ways to load data into the program:

  1. Copy the data onto the clipboard outside of DataView and then click the Paste button in the Moving Line Chart dialog.
  2. Click the Load button in the dialog and select a text (.txt) or CSV (.csv) file defining the data.
  3. Drag-and-drop a text or CSV file containing the data from File Explorer onto the dialog.

The table below shows 15 lines, each containing 8 X-Y coordinate pairs, arranged in the canonical format (so 16 columns in total).

635.9 800.0 649.5 813.0 662.5 824.4 671.7 838.5 675.4 854.2 675.5 866.8 678.9 878.1 687.1 894.4
634.4 796.9 645.4 808.7 658.9 820.1 671.2 832.9 676.7 847.4 678.6 863.0 679.6 877.7 678.5 891.4
628.9 794.5 640.2 804.8 653.6 815.7 667.7 828.0 678.2 842.0 679.7 859.4 681.0 873.0 676.1 891.6
624.3 790.3 635.0 803.6 646.9 815.7 658.7 825.2 671.7 833.3 680.7 849.1 681.1 864.1 677.7 881.9
621.9 785.3 630.5 800.0 640.7 813.9 651.8 823.2 666.4 832.3 675.2 842.9 682.3 856.2 681.1 875.4
620.7 781.9 627.4 797.2 636.6 813.7 648.8 825.0 660.0 830.8 673.3 839.2 683.1 850.0 685.3 865.3
620.1 778.8 626.0 795.2 634.4 812.9 642.8 826.2 652.2 833.1 670.3 839.4 681.3 846.5 687.9 858.3
617.6 773.9 624.1 791.1 631.4 808.3 637.3 822.8 648.2 833.8 665.8 840.5 679.1 847.1 688.3 854.3
617.6 769.0 624.1 787.0 630.8 802.4 633.8 818.8 644.8 831.1 659.1 841.1 675.2 845.9 687.5 848.6
617.7 764.4 625.7 779.9 632.2 796.9 635.1 812.9 640.6 829.9 650.7 840.1 663.5 847.2 684.9 848.9
616.0 761.3 625.0 775.7 633.6 792.2 634.5 808.1 639.4 825.8 646.6 837.1 656.9 846.1 675.5 852.1
613.8 756.4 625.3 770.7 633.2 784.9 638.3 802.8 640.4 821.1 643.4 831.0 651.6 844.0 665.6 853.8
611.2 751.1 622.8 765.1 632.1 778.2 641.2 793.4 641.1 812.1 643.9 825.8 645.8 838.2 654.2 851.3
609.2 747.7 620.0 762.0 632.4 774.0 639.3 785.1 645.0 801.7 645.4 815.7 642.9 832.4 650.8 849.0
607.2 744.8 616.1 757.6 627.9 770.1 638.5 781.6 644.7 794.4 649.6 806.8 645.5 820.8 642.6 832.7

The lines load into the Moving Line Chart dialog graphical display. Near the top left the dialog reports that there are 15 lines, each with 8 coordinate points. The data show the location of points along the body of a tadpole as it swims.

Data display

Above the top-left of the graph there is an edit box Selected line ID, which shows 1 in red. The graph itself shows 14 lines in grey with no symbol markers, and 1 coloured line with coloured symbols. The latter is the selected line, and with the default settings, the first coordinate point on the line has a red symbol marker, while the line itself and the remaning coordinate markers are blue. This differentiates the polarity of the line. These display features can all be adjusted by changing options in the Data display frame on the lower left of the graph.

Animation

Swimming in tadpoles is driven by alternating left-right flexions of the tail, and these movements are clearly visible as the animation progresses.

Interpolation

By default, coordinate points within a line are connected by straight-line segments (linear interpolation). Alternatively, data points can be connected by lines using Catmull-Rom spline interpolation.

One problem with this interpolation method is that the first and last segments can be distorted because there is no defined tangent to the curve at the end points. In DataView, the default solution is to use Linear end segment interpolation, but this can be turned off by de-selection if desired.

Non-canonical formats (DeepLabCut)

The file swimming coordinates.csv contains data directly exported from the animal pose analysis program DeepLabCut.

The CSV file will be read and parsed into cells, and displayed in the Read Data Format dialog. The dialog can be expanded by dragging on a corner if desired.

The data format is the standard export format used by DeepLabCut. It has 3 non-data header rows, and 1 left-hand column specifying the line sequence number. The remaining data in each line is a repeating sequence consisting of a pair of columns specifying X and Y coordinates, followed by a column labelled "likelihood".

Note that Top rows to skip is set to 3, the Left columns to skip is set to 1, and the skip value to the right of Y is set to 1 so that the likelihood column is skipped (other skip values remain at 0 since there are no other non-XY columns in the repeat sequence).

There are now 405 lines of data, each containing 11 coordinate points. The totality of grey (unselected) lines show a curving "C" shape showing the swim path of the tadpole, but the coloured first (selected) line is at the top left of the C.

More display options

This has given you a tour of some of the display options that may be useful. However, in most cases the default values will probably be satisfactory.

Leg limitations

DataView currently assumes that all the data points lie on a single line, and that connecting them in sequence will yield a suitable representation of the shape. This is fine for something like a tadpole (or a snake), but could be confusing for a shape with branch points in the data, such as limbs projecing from the body of a legged animal. A partial solution might be to set the Selected line size to 0, in which case no connecting line is drawn. However, the viewer would then have to imagine the connections between the coordinate points to mentally construct the appropriate shape (or copy appropriate lines to an external drawing program, and manually add the connecting lines).