The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 making animated plots
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Kalle0303

Sweden
2 Posts

Posted - 01/05/2016 :  08:02:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi
Does anyone know how to make animated plots where one can follow development (in e.g. time) of y as function of x?

See e.g. the type of graphs used by Hans Rosling at the gapminder.org (link below).

I would like to be able to plot things like capacity utilization vs maintance over time. (Or market share vs development spend, or product volume vs customer segment... ).

Any ideas?
Kalle



http://www.gapminder.org/world/#$majorMode=chart$is;shi=t;ly=2003;lb=f;il=t;fs=11;al=30;stl=t;st=t;nsl=t;se=t$wst;tts=C$ts;sp=5.59290322580644;ti=2013$zpv;v=0$inc_x;mmid=XCOORDS;iid=phAwcNAVuyj1jiMAkmq1iMg;by=ind$inc_y;mmid=YCOORDS;iid=phAwcNAVuyj2tPLxKvvnNPA;by=ind$inc_s;uniValue=8.21;iid=phAwcNAVuyj0XOoBL_n5tAQ;by=ind$inc_c;uniValue=255;gid=CATID0;by=grp$map_x;scale=log;dataMin=194;dataMax=96846$map_y;scale=lin;dataMin=23;dataMax=86$map_s;sma=49;smi=2.65$cd;bd=0$inds=;example=75

KenLefebvre

USA
66 Posts

Posted - 01/05/2016 :  09:19:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Kalle-

Yes, animating a graph similar to the one you've described is entirely possible. It's also something that would require some scripting.
Here is a link to our general page on animation http://www.originlab.com/doc/Origin-Help/Graph-Animation, and here is an example script for creating a sin wave animation that runs iteratively.

int codec = vw.FourCC(1, 0, 0, 0); // Microsoft Run Length Encoded

// Create video writer. (fileName, codec, framesPerSec, width, height)

// Triggers a dialog to set the name of your video. Best to save within User Files directory for permissions reasons
dlgSave fname:=myfile ext:=*.avi title:="Save your video file";
int err = vw.Create(%(myfile$), codec, 30, 800, 600);
if( 0 == err )
{
range rZ = [Book1]Sheet1!col(J); //Active dataset var, a series of values the program runs through
range ee = [Book1]Sheet1!col(L)[1]; //Modifier, each individual value in an iteration

range -wx rngXCol = %C; //Active x-range var
loop(ii,0.02,rZ.GetSize()) //Loop var ii, from 1 to size of active dataset
{
//set display by angle
ee = rZ[ii];


// Update the Angle display
double dd = rZ[ii]; //integer cycles through x with loop var ii
GObject goText = 1!updco; //defines object "gotext" in layer 1 as object xtext
goText.text$ = %(rZ[L]$) = $(dd,.3*); //disp Lname equal to xval to 3 decimals if necessary


//set %C ee;
// Wait for graph window to redraw.
// This allows watching the animation while creating the video file.
sec -p au;
sec -pw %h;
run.section(STANDARD,Refresh);
// Write graph to video as a single frame.
err = vw.WriteGraph(%H);
if( err )
break;
}

// Release the video file from the writer so you can open it without closing Origin.
vw.Release();

if( err )
type "WriteGraph error $(err)";
}
else
type "VideoWriter Create error $(err).";



I recently wrote this for the above radial graph of a sine wave being multiplied by a growing coefficient. The "updco" mentioned in the Angle display is an arbitrary name for the coefficient value textbox (given by right clicking on it and going to the "programming controls" dialog).
As the value of the coefficient increases, the textbox displays the updated figure. I understand if this is somewhat difficult to follow, and unfortunately to run this kind of thing each script must be made specifically for each graph.
This is just an example of the kind of script you'd need to make, if you wanted to display your graph being plotted from left to right, you would have to make "Range rZ" your set of values, and "Range ee" the value you want to display at a given time.

If you also wanted to make the bubbles on your plot gradual grow as they're plotted (like an "inflating" effect), you could also set up a range of growing values to do that as well.
I apologize if I've left you with more questions than answers, the above script was made for a blog post that may be released in the future. If you would like to see the full OPJ and animation associated with it, just leave an email addressed to me at tech@originlab.com and I'd be glad to send this to anyone who wants to tinker with the concept.

Best regards,
Ken Lefebvre
Technical Services
OriginLab Corp.

Edited by - KenLefebvre on 01/05/2016 09:41:06 AM
Go to Top of Page

Kalle0303

Sweden
2 Posts

Posted - 01/05/2016 :  09:24:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Ken!
I will try this. It will render me videos with what I want to show and I can then run them back and forth during presentations.

Kalle



Kalle
Go to Top of Page

KenLefebvre

USA
66 Posts

Posted - 01/05/2016 :  09:45:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You're welcome Kalle, feel free to ask us other questions about this. In my opinion, animation is one of Origin's most underrated features, and I think we'd be glad to showcase more examples of it if we have the chance.

Ken
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000