Subscribe Bookmark
XanGregg

Staff

Joined:

Jun 23, 2011

Connected Trails in Bubble Plot

The most common question we get regarding Stephen Few's white paper and webcast on visualizing change is about the scripts for showing the connected trails in bubble plots. Often the existing bubble trails are overlapping, so the progression is clear, but when the bubble trails are spaced out it can be helpful to connect the bubbles with a line.


Bubble Plot with Connected Trails


In addition to the journal file that contains the data and plots from the paper, you can also download from the JMP Extras area the graphics script by itself which can be added to any bubble plot (via Right-Click and Customize) if you edit the column names in the script.


Local( {s = "", c = 0, xx = {}, yy = {}},

For Each Row(

If( Selected( Row State() ),

s = :State;

c = Color Of( Row State() );

Insert Into( xx, :Property Rate );

Insert Into( yy, :Violent Rate );

);

If( N Items( xx ) != 0 & (Row() == N Rows()

| !Selected( Row State( Row() + 1 ) )

| s != :State[Row() + 1]),

Pen Color( c );

Pen Size( 2 );

Transparency( 0.3 );

Line( Matrix( xx ), Matrix( yy ) );

xx = {};

yy = {};

);

)

);



The script requires that the data be sorted by the ID column, "State" in this case.

Article Tags