[Tutor] HELP: Creating animation from multiple plots
Amit Saha
amitsaha.in at gmail.com
Wed Mar 27 07:23:13 CET 2013
Hi Sayan,
On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee
<sayanchatterjee at gmail.com> wrote:
> Dear All,
>
> I am a newbie to Python but have a fair know how of other languages i.e C
> etc.
>
> I want to run an astrophysical simulation in Python. All I have to do it to
> generate a set of 'plots' depending on a varying parameter and then stitch
> them up.
>
> 1) Is it possible to automatically generate different data files( say in the
> orders of 1000) with different names depending on a parameter?
It certainly is. Are you talking about the file names being
file_1001.txt, file_1002.txt and so on? If yes, let's say your
parameter values are stored in param. Then something like this would
do the trick:
param_values = [1000,1001, 1005, 2001]
for param in param_values:
fname = 'file_' + str(param)
# write to file fname
#
#
Sorry if its different from what you are looking for. But yes, its
certainly possible.
>
> 2) Is it possible to plot the data sets right from Python itself and save
> the plots in different jpeg files to stitched upon later on.
It is possible to generate plots and save each as JPEGs. [1].
What do you mean by stitching together?
[1] http://stackoverflow.com/questions/8827016/matplotlib-savefig-in-jpeg-format
Best,
Amit
--
http://amitsaha.github.com/
More information about the Tutor
mailing list