Dear All,

I have some data files with numpy arrays stored in it in 2 columns. I want
to add a third column with just floating point numbers(not numpy array) and
plot them later with Matplotlib in 3d. How is it done? Could you please
illuminate me?

This is the concerned snippet of the code:


while *t < 1*:


  pp_za = pp_init + t*K*np.sin(K*pp_init)

# Periodic Boundary Condition

  for i in range(0,999):

    if pp_za[i] < 0:
      pp_za[i] = 2 - abs(pp_za[i])
    if pp_za[i] > 2:
      pp_za[i] = pp_za[i] % 2

  pv_za = +K*np.sin(K*pp_init)

  fname = 'file_' + str(t) + '.dat'

# Generating dataset for Phase Space diagram

  *np.savetxt(fname, np.array([pp_za,pv_za]).T, '%f')*

  t = t + 0.01

And the sample data generated is :

0.105728 0.098678
0.126865 0.118406
0.147998 0.138128
0.169126 0.157845
0.190247 0.177556
0.211362 0.197259
0.232469 0.216955
0.253567 0.236643
0.274657 0.256321
0.295737 0.275989
0.316806 0.295646

Precisely what I want is, I want to add the 't' (over which the while loop
is run) in the 3 rd column. 't' is float and constant for each looping. If
you know what a phase plot is(doesn't matter if you don't), I want to see
the phase plot evolving with time. Thus the need of a time axis and hence
plot with V(velocity-Yaxis), X ( Position -X axis) and t (Time-Z axis).Once
the data files are created properly, how to plot them using Matplotlib?



Regards,
Sayan
-- 


--------------------------------------------------------------------------
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to