Subscribe Bookmark RSS Feed

bubble plots - unequal time intervals


Super User


Jun 23, 2011

hi all,

does anyone have experience producing bubble plots with uneven time spaces?

in Bubble plots the time dimension is rather limited. It is not a real time dimension but rather animates row by row. Therfore, when attempting to animate real log data events with uneven time differences the animation is disrespectful to the time.

in the attached file there is a log of events - each row is an event - in which an individual (ID) is locatad in an X, Y space. at each row there is a time reading of the event. the bubble plot script in the file animates row by row without properly accommodating for the different durations of each.

The following script  inflates the data table so each row is just one minute and produces a more honest representation of the space over time.

i would apriciate any comments on the matter.

// first open the attached table "Bubble Plot2"

// then run the scrtipt.

dt = Current Data Table();

// original table is usually sorted by time of registration.

// Sort by ID to allow the calculation of duration per event for each ID.

dt << sort( by( ID ), Ascending, replace table( 1 ) );

// Add a column to calculate the duration of each event.

dt << New Column( "Event Duration",



     Format( "Best", 6 ),



                ID == Lag( ID, -1 ), Date Difference( :time, Lag( :time, -1 ), "minute", "actual" ),

                // this was supposed to calculate a hypothetical duration until the last event in the data set but does not work.

                Date Difference( :time, Col Max( time ) ), "minute",





dt << run formulas;

Column( dt, "Event Duration" ) << delete formula;

// Record the original length of the table before adding rows.

// Using Nrow() directly in the For loop will produce an endless loop.

rowN = N Row();

// For each original row, produce new rows as many as the duration of each event.

For( i = 1, i <= rowN, i++,

     rowi = dt << get row( i );

     For( z = 1, z <= (:Name( "Event Duration" )[i] - 1), z++,


           dt << add row( rowi );

           dt << run formulas;



// sort the data table once again in order to simplify the next formula.

dt << sort( by( ID, time ), Ascending, replace table( 1 ) );

// Add new column with actual time for each row.

New Column( "Real time",



     Format( "yyyy-mm-ddThh:mm", 16 ),

     Input Format( "yyyy-mm-ddThh:mm" ),



                Row() == 1, :time,

                :ID > Lag( :ID, 1 ), :time,

                // this will add a minute to the previous time indication.

                Lag( :Real time, 1 ) + 60




// Set marker the color by ID

Current Data Table() << Color by Column(


     Color( 1 ),

     Color Theme( "JMP Default" ),

     Marker( 0 ),

     Marker Theme( "" ),

     Continuous Scale( 0 ),

     Reverse Scale( 0 ),

     Excluded Rows( 0 )


// produce the bubble plot with actual time indication.

Bubble Plot(

     X( :x ),

     Y( :y ),

     Time( :Real time ),

     ID( :ID ),

     Title Position( 1.61111111111111, 2.7 ),




                "Bubble Plot of y by x Across Real time ID ID",


                {Set Title( "Bubble Plot of y by x Across Real time ID ID - Correct time intervals!!!" )}


           Dispatch( {}, "1", ScaleBox, {Min( 0.5 ), Max( 3.5 ), Inc( 0.5 ), Minor Ticks( 1 ), Rotated Labels( "Horizontal" )} ),

           Dispatch( {}, "2", ScaleBox, {Min( 0.5 ), Max( 3.5 ), Inc( 0.5 ), Minor Ticks( 1 ), Rotated Labels( "Horizontal" )} )






Sep 21, 2012

Hi Ron,

Thanks for the example - there are several other event models that are interesting to consider for Bubble Plot.  I think there may be two issues here:

1) Bubble Plot does not have the concept of event duration.  Each observation is instantaneous and ID groups are assumed to move linearly between the observations.  I notice that when you expanded the table you keep the position constant, so I assume the interpolation is not desired in your case.

2) The bigger issue may be that time itself is animated linearly between each observation, but not linearly overall.  This helps in cases where there observations may appear in clusters with large gaps in between, but it may appear distorted when you expect the animation to follow time at a constant rate.

If these issues sound correct, I will add these as suggestions for future Bubble Plot work..

Best regards,



Super User


Jun 23, 2011

thanks Dan,

the issues are correct. i was actually wondering if it would be possible to add a "Duration" option in the platform as other platforms have a weight or Frequency option.

the thing is data can have all sorts of structures. for example, a column for staring time and another for end time of each event. or alternatively, starting time and duration. furthermore, in many cases there is an issue of defining the duration of the last event.

in my case the animation between the events is not that important. what is more crucial is the correct relative position of the events at each point in time like in a chess game. the problem arises when data is not collected at fixed intervals from each observation but only changes are recorded (Event log),