visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How would I animate a connected scatter plot?

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Getting Started
View previous topic :: View next topic  
Author Message
SPatel



Joined: 24 Aug 2015
Posts: 3

PostPosted: Mon Aug 24, 2015 12:47 pm    Post subject: How would I animate a connected scatter plot? Reply with quote

Hello,

I have run a cluster analysis in another program and have obtained a dataset of X,Y coordinates (each couplet representing one sample).

I would like to plot these samples as a scatter graph, with lines joining each point (easily done in data graph).

However, is it possible to animate the joining of these points through lines/connectors?

Each point represents a time slice, and essentially I would like to show the evolution of the samples in a 2D space (X,Y coords).

Any help would be much appreciated.


At the moment, I have 3 data columns (e.g.):

Sample | X | Y |
EG1 | 1 | 1 |
EG2 | 1 | 2 |
EG3 | 2 | 1 |


Hopeful animation order:

EG! --- EG2 EG3
EG! --- EG2 --- EG3

Any help would be much appreciated!

Thanks
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1967
Location: Chapel Hill, NC

PostPosted: Mon Aug 24, 2015 2:41 pm    Post subject: Reply with quote

This is typically done by using the mask functionality. So set the range of the "t" variable appropriately, and set it to be an integer if needed.

Then use a mask for the time. You can mask based on the # column or X, Y, etc. In the range, use the t variable, for example "0,t" instead of "0,1". This means that the mask will depend on the time variable and then you vary that using the slider. You can also export the graph as a QuickTime movie.

David
Back to top
View user's profile Send private message Send e-mail
SPatel



Joined: 24 Aug 2015
Posts: 3

PostPosted: Tue Aug 25, 2015 7:48 am    Post subject: Reply with quote

Thank you for the prompt reply, David!

This is all probably fairly trivial, but I am not familiar with this side of the application at all, so please bare with me!

I followed the example in the manual, and got that working (just to get used to the various inputs etc.).

However, in this case, when you say set the range of the "t" variable, I am at a loss as to how to go about it. Apologies! I assume I do not need to create a function to get this to work, do I? Would I just create an upper and lower range based on the highest/lowest x or y variable?

I have added a screenshot of my working screen with a simplified dataset, and can provide the file if needed?

http://i.imgur.com/1Ie70Sw.png

Any help would be appreciated!

Many Thanks.


Last edited by SPatel on Tue Aug 25, 2015 10:23 am; edited 1 time in total
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1967
Location: Chapel Hill, NC

PostPosted: Tue Aug 25, 2015 8:36 am    Post subject: Reply with quote

Looking at your screen shot, first the number and slider variables have a red dot since you don't have a name specified.

Below them is the "Animate:" field which has the value "t". This is a global variable, similar to the variables in the list, but different in that you can play the animation and export the animation as a QuickTime movie (the icons on the right side).

In your case, at the bottom right where it says "Range:" change "0,1" to "1,5" and check the "Integer" check box.

Open the Plot command and for the menu "Use as mask:" select "#", the row column.

In the entry that just pops up to the right, change "0,1" to "0,t". The mask entry means that the plot will be based on the sub-set of the rows that satisfy the mask. The range will depend on the variable so it will change when the variable changes.

Initially you will not see anything since likely the "t" value is 0. Just change the slider in the lower left corner.

What will now happen is that the x and y ranges will change as the time changes. This is because the range is determined automatically from the plot result. To work around that you can go into the Axis setting (third entry) and set a minimum range there. You can also use a slight trick. Create a second plot command and select the same "x,y" variables, but don't set the mask. But check the "Hide" check box on the right side. Since it is hidden it will not be drawn, but it will affect the x and y ranges.

Click on the play button to play the animation. Adjust the "Duration:" field to make the movie go slower or faster.

David
Back to top
View user's profile Send private message Send e-mail
SPatel



Joined: 24 Aug 2015
Posts: 3

PostPosted: Tue Aug 25, 2015 9:25 am    Post subject: Reply with quote

This is tremendously helpful, thank you very much.
Back to top
View user's profile Send private message
pharmpk



Joined: 14 Mar 2017
Posts: 2

PostPosted: Tue Mar 14, 2017 7:45 pm    Post subject: Reply with quote

I need to look around on the board and help some more but thought I'd ask here too. Thanks for the information so far. I did get some animation to work but the x-axis is rescaling. How do I set/fix the x-axis to the final time so the line is drawn from left to right? Thanks
Back to top
View user's profile Send private message
pharmpk



Joined: 14 Mar 2017
Posts: 2

PostPosted: Tue Mar 14, 2017 7:53 pm    Post subject: Reply with quote

pharmpk wrote:
I need to look around on the board and help some more but thought I'd ask here too. Thanks for the information so far. I did get some animation to work but the x-axis is rescaling. How do I set/fix the x-axis to the final time so the line is drawn from left to right? Thanks


OK, I found the answer. Set upper, lower axes limits in the Include in x: (or ySmile field. Restrict x: (and ySmile may not be necessary... but it works. Interesting software. I gather the Range in lower right is the row range. Not sure about the meaning of 't' yet.
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1967
Location: Chapel Hill, NC

PostPosted: Tue Mar 14, 2017 10:25 pm    Post subject: Reply with quote

This is an aspect where DataGraph does things fairly differently from other tools. The main reason for this is that I always want to design things so that it does the right thing when data changes. One effect of this is that you should not have to constantly tinker with settings.

The axis range, both x and y, are computed as follows:

1 : Take the union of ranges coming from each drawing command.
2 : Take the union of that range and the values that are in the include field. This does not have to be an interval. For example you can just put a 0 there if you want the origin to always be included. Or you can put 0,a,1 where a is a global variable. If a<0 the range is [a,1], if a>1 then the range is [0,a], otherwise [0,1].
3 : If padding is turned on increase the range based on the selection.
4 : Crop the resulting range with the restrict range. [a,b] intersect [-∞,∞] is equal to [a,b], so that value won't affect it.


Regarding the question about t, this is a default global variable defined below the column definitions. You can change the value to something else, but this variable is special in that when you create a movie the movie is based on varying this variable from the minimum to the maximum of the slider range.

You can use this t variable or any other global variable in any numerical field such as the range field, line thickness, plot cropping, expression columns, mask setting etc.

David
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Getting Started All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group