[Matplotlib-users] Plotting from datafile

2013-03-27 Thread Sayan Chatterjee
Dear All,

I'm new to Matplotlib. It might be a silly question, how does one plot
data(not functions) in Matplotlib.

How:
1)Two arrays (X and Y) can be plotted in a scatter diagram?

2) or a number of data files can used to produce different plots having
different(sequential) name?

Thanks in anticipation.
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
--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting from datafile

2013-03-27 Thread Florian M. Wagner

Hey Sayan,

for reading in simple ASCII-Files containing your two arrays you should 
have a look at the numpy.loadtxt function.


Scatter plots in matplotlib are then easily created as shown here 
http://matplotlib.org/examples/pylab_examples/scatter_demo.html


For your purpose you can do something like:

   import os
   import numpy as np
   import matplotlib.pyplot as plt

   for file in os.path.listdir():
x, y = np.loadtxt(file, unpack=True)
plt.scatter(x,y)
plt.savefig(file + '.png')

Cheers,

Florian


Am 27.03.2013 09:32, schrieb Sayan Chatterjee:

Dear All,

I'm new to Matplotlib. It might be a silly question, how does one plot 
data(not functions) in Matplotlib.


How:
1)Two arrays (X and Y) can be plotted in a scatter diagram?

2) or a number of data files can used to produce different plots 
having different(sequential) name?


Thanks in anticipation.
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 
http://www.blissprofound.blogspot.com


Volunteer , Padakshep
www.padakshep.org http://www.padakshep.org


--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting from datafile

2013-03-27 Thread Alexander Eberspaecher
On Wed, 27 Mar 2013 14:02:58 +0530
Sayan Chatterjee sayanchatter...@gmail.com wrote:

 I'm new to Matplotlib. It might be a silly question, how does one plot
 data(not functions) in Matplotlib.

Besides the solution given in the first reply, you may also check
https://github.com/dmcdougall/mpl_binutils

Regards

Alex

--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] set_scale and set_xscale

2013-03-27 Thread Benjamin Root
On Wed, Mar 27, 2013 at 1:03 AM, Gökhan Sever gokhanse...@gmail.com wrote:

 Hello,

 Aren't these two log scaling calls supposed to be performing the same
 action?

 Here is a simple script tested in ipython --pylab

 fig = plt.figure(figsize=(5, 5))
 ax1 = fig.add_subplot(1,1,1)
 ax1.plot(np.random.randn(100))

 ax1.xaxis.set_scale('log')
 ax1.set_xscale('log')


Intuitively, I guess they should be identical, but they don't seem to be.
It seems like for ax1.xaxis.set_scale('log'), everything is set
correctly, except the projection.

Ben Root
--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trouble with legend and axis scaling

2013-03-27 Thread Hackstein
Sterling,

I'm using matplotlib version 1.2.0 with agg backend.

Here are two code examples, one for each problem. The first one doesn't save 
the figure due to the legend problem, seterr causes the script to stop with an 
error at that position.
The second example shows the scientific labels on the y-axis, although it 
should be disabled in the code. I can't get the y-axis to display plain labels. 

First example:
[code]
import numpy as np
np.seterr(all='raise')
import matplotlib.pyplot as plt

x_i = [11.7574075935, 11.66520713579, 11.6762413105, 11.6580992311, 
11.65636838851]
x_r = []
dates = [2.83611000e-01,   2.69330463e+02,   2.70280648e+02,   2.71359248e+02,  
 2.72320822e+02]

diff = 0.16
ra = [0., 110.5349726]
dec = [0., -16.1061281]
med_i = np.median(x_i)
med_r = np.median(x_r)

plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
if x_r == []:
   plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
   plt.title('i_mag', fontsize='16')
else:
   plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s')
   plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
   plt.title('i_mag', fontsize='16')
plt.rcParams['xtick.major.pad']=10
plt.rcParams['ytick.major.pad']=10
ax = plt.gca()
ax.title.set_y(1.1)
formy = plt.ScalarFormatter()
formy.set_powerlimits((-5, 5))
formy.set_scientific(False)
ax.yaxis.set_major_formatter(formy)
ax.set_ylim(ax.get_ylim()[::-1])
for tick in ax.xaxis.get_major_ticks():
   tick.label.set_fontsize(16)
for tick in ax.yaxis.get_major_ticks():
   tick.label.set_fontsize(16)
plt.xlabel('Days', fontsize='20', labelpad=20)
plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)

if x_r == []:
   plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
  numpoints=1, ncol=2, borderaxespad=0.)
else:
   plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
  numpoints=1, ncol=2, borderaxespad=0.)
leg = plt.gca().get_legend()
ltext = leg.get_texts()
plt.setp(ltext, fontsize='16')
plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
plt.close(i_only)
[/code]

Second example:
[code]
import numpy as np
import matplotlib.pyplot as plt

y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168, 
11.12513415219]
y_r = [11.14866716899, 11.10194503, 11.11235246531, 11.11168787179, 
11.1214449011]
dates_i = [2.83611000e-01,   2.69330463e+02, 2.70280648e+02,   2.72320822e+02, 
2.73250579e+02]
dates_r = [311.28215,   324.25844,   325.25194,   330.20983,   338.21356]

diff = 0.16
ra = [112.5379659, 110.5349726]
dec = [ -15.9841039, -16.1061281]
med_i = np.median(y_i)
med_r = np.median(y_r)

plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
if y_r == []:
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
else:
plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
plt.rcParams['xtick.major.pad']=10
plt.rcParams['ytick.major.pad']=10
ax = plt.gca()
ax.title.set_y(1.1)
formy = plt.ScalarFormatter()
formy.set_powerlimits((-5, 5))
formy.set_scientific(False)
ax.yaxis.set_major_formatter(formy)
ax.set_ylim(ax.get_ylim()[::-1])
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(16)
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(16)
plt.xlabel('Days', fontsize='20', labelpad=20)
plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)

if y_r == []:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
else:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
leg = plt.gca().get_legend()
ltext = leg.get_texts()
plt.setp(ltext, fontsize='16')
plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
plt.close(i_only) 
[/code]

Best regards,

frix


Am 26.03.2013 um 20:36 schrieb Sterling Smith smit...@fusion.gat.com:

 Frix,
 
 It may be useful to post the version and backend you are using to the list.
 
 import matplotlib
 print matplotlib.__version__
 print matplotlib.get_backend()
 
 Also, if you can format the code as a simple self-contained example, that 
 would help others confirm what you are seeing.
 
 -Sterling
 
 On Mar 26, 2013, at 12:01PM, Hackstein wrote:
 
 Hello everyone,
 
 I have two issues with my current projects:
 
 1)  I automatically generate plots of several data sets in a for-loop, all 
 of which have the same shape of x and y values, but some of which have two 
 of those data (i.e. graphs) sets per figure, others have only one.
 I create the legend by
 
 plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', 
 numpoints=1, borderaxespad=0.)
 
 which works perfectly if I plot two data sets (and therefore two labels) in 
 a figure, but sometimes (not always) causes an error, if only one data set 
 is 

Re: [Matplotlib-users] Plotting from datafile

2013-03-27 Thread Steven Boada
Another, slightly more flexible, option is the genfromtxt function, 
also in numpy. Normally you should try genfromtxt after loadtxt doesn't 
work. Or, that is my normal method.

Steven

On Wed Mar 27 07:16:45 2013, Sayan Chatterjee wrote:
 Thank you very much for your prompt reply.

 Florian,  your reply seems to be the answer to my question. I'll try
 it out. If can't figure out,I'll get back to you.


 On 27 March 2013 15:37, Florian M. Wagner wagne...@student.ethz.ch
 mailto:wagne...@student.ethz.ch wrote:

 Hey Sayan,

 for reading in simple ASCII-Files containing your two arrays you
 should have a look at the numpy.loadtxt function.

 Scatter plots in matplotlib are then easily created as shown here
 http://matplotlib.org/examples/pylab_examples/scatter_demo.html

 For your purpose you can do something like:

 import os
 import numpy as np
 import matplotlib.pyplot as plt

 for file in os.path.listdir():
 x, y = np.loadtxt(file, unpack=True)
 plt.scatter(x,y)
 plt.savefig(file + '.png')

 Cheers,

 Florian


 Am 27.03.2013 09:32, schrieb Sayan Chatterjee:
 Dear All,

 I'm new to Matplotlib. It might be a silly question, how does one
 plot data(not functions) in Matplotlib.

 How:
 1)Two arrays (X and Y) can be plotted in a scatter diagram?

 2) or a number of data files can used to produce different plots
 having different(sequential) name?

 Thanks in anticipation.
 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
 http://www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org http://www.padakshep.org


 
 --
 Own the Future-Intelreg; Level Up Game Demo Contest 2013
 Rise to greatness in Intel's independent game demo contest.
 Compete for recognition, cash, and the chance to get your game
 on Steam. $5K grand prize plus 10 genre and skill prizes.
 Submit your demo by 6/6/13.http://p.sf.net/sfu/intel_levelupd2d


 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net  
 mailto:Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 
 --
 Own the Future-Intelreg; Level Up Game Demo Contest 2013
 Rise to greatness in Intel's independent game demo contest.
 Compete for recognition, cash, and the chance to get your game
 on Steam. $5K grand prize plus 10 genre and skill prizes.
 Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 mailto:Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --


 --
 *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
 http://www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org http://www.padakshep.org


 --
 Own the Future-Intelreg; Level Up Game Demo Contest 2013
 Rise to greatness in Intel's independent game demo contest.
 Compete for recognition, cash, and the chance to get your game
 on Steam. $5K grand prize plus 10 genre and skill prizes.
 Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d


 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

Steven Boada

Doctoral Student
Dept of Physics and Astronomy
Texas AM University
bo...@physics.tamu.edu

--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting from datafile

2013-03-27 Thread Sayan Chatterjee
Hi Steven,

I am a newbie to Python and hence Matplotlib. I cannot get your point
properly. Could you please redirect me to a page where the usage is
demonstrated?

As I can see, you're a doctoral student in Physics, it might be worthwhile
to tell you that I'm trying to code a  Zeldovich Approximation for a simple
sinusoidal potential and want to make it evolve with varying scale factor
and make an animation of it.

Cheers,
Sayan


On 27 March 2013 19:58, Steven Boada bo...@physics.tamu.edu wrote:

 Another, slightly more flexible, option is the genfromtxt function, also
 in numpy. Normally you should try genfromtxt after loadtxt doesn't work.
 Or, that is my normal method.

 Steven


 On Wed Mar 27 07:16:45 2013, Sayan Chatterjee wrote:

 Thank you very much for your prompt reply.

 Florian,  your reply seems to be the answer to my question. I'll try
 it out. If can't figure out,I'll get back to you.


 On 27 March 2013 15:37, Florian M. Wagner wagne...@student.ethz.ch
 mailto:wagne...@student.ethz.**ch wagne...@student.ethz.ch wrote:

 Hey Sayan,

 for reading in simple ASCII-Files containing your two arrays you
 should have a look at the numpy.loadtxt function.

 Scatter plots in matplotlib are then easily created as shown here
 
 http://matplotlib.org/**examples/pylab_examples/**scatter_demo.htmlhttp://matplotlib.org/examples/pylab_examples/scatter_demo.html

 For your purpose you can do something like:

 import os
 import numpy as np
 import matplotlib.pyplot as plt

 for file in os.path.listdir():
 x, y = np.loadtxt(file, unpack=True)
 plt.scatter(x,y)
 plt.savefig(file + '.png')

 Cheers,

 Florian


 Am 27.03.2013 09:32, schrieb Sayan Chatterjee:

 Dear All,

 I'm new to Matplotlib. It might be a silly question, how does one
 plot data(not functions) in Matplotlib.

 How:
 1)Two arrays (X and Y) can be plotted in a scatter diagram?

 2) or a number of data files can used to produce different plots
 having different(sequential) name?

 Thanks in anticipation.
 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
 
 http://www.blissprofound.**blogspot.comhttp://www.blissprofound.blogspot.com
 

 Volunteer , Padakshep
 www.padakshep.org http://www.padakshep.org



 --**--**
 --
 Own the Future-Intelreg; Level Up Game Demo Contest 2013
 Rise to greatness in Intel's independent game demo contest.
 Compete for recognition, cash, and the chance to get your game
 on Steam. $5K grand prize plus 10 genre and skill prizes.
 Submit your demo by 
 6/6/13.http://p.sf.net/sfu/**intel_levelupd2dhttp://p.sf.net/sfu/intel_levelupd2d


 __**_
 Matplotlib-users mailing list
 
 Matplotlib-users@lists.**sourceforge.netMatplotlib-users@lists.sourceforge.net
  mailto:
 Matplotlib-users@**lists.sourceforge.netMatplotlib-users@lists.sourceforge.net
 
 
 https://lists.sourceforge.net/**lists/listinfo/matplotlib-**usershttps://lists.sourceforge.net/lists/listinfo/matplotlib-users



 --**--**
 --
 Own the Future-Intelreg; Level Up Game Demo Contest 2013
 Rise to greatness in Intel's independent game demo contest.
 Compete for recognition, cash, and the chance to get your game
 on Steam. $5K grand prize plus 10 genre and skill prizes.
 Submit your demo by 6/6/13. 
 http://p.sf.net/sfu/intel_**levelupd2dhttp://p.sf.net/sfu/intel_levelupd2d
 __**_
 Matplotlib-users mailing list
 
 Matplotlib-users@lists.**sourceforge.netMatplotlib-users@lists.sourceforge.net
 
 mailto:Matplotlib-users@**lists.sourceforge.netMatplotlib-users@lists.sourceforge.net
 
 
 https://lists.sourceforge.net/**lists/listinfo/matplotlib-**usershttps://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --


 --**--**
 --
 *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
 http://www.blissprofound.**blogspot.comhttp://www.blissprofound.blogspot.com
 

 Volunteer , Padakshep
 www.padakshep.org http://www.padakshep.org



 --**--**
 --
 Own the Future-Intelreg; Level Up Game Demo Contest 2013
 Rise to greatness in Intel's independent game demo contest.
 

Re: [Matplotlib-users] Trouble with legend and axis scaling

2013-03-27 Thread Sterling Smith
Frix,

I get the same error for your first example with v1.1.1 [although I had to 
comment out the med_r = np.median(x_r) to get it to run].  You should probably 
file a bug at [1].

I get the same result for your yaxis.  You need to change the formatter to 

ax.yaxis.set_major_formatter(plt.ScalarFormatter(useOffset=False))

-Sterling

[1] https://github.com/matplotlib/matplotlib/issues

On Mar 27, 2013, at 7:09AM, Hackstein wrote:

 Sterling,
 
 I'm using matplotlib version 1.2.0 with agg backend.
 
 Here are two code examples, one for each problem. The first one doesn't save 
 the figure due to the legend problem, seterr causes the script to stop with 
 an error at that position.
 The second example shows the scientific labels on the y-axis, although it 
 should be disabled in the code. I can't get the y-axis to display plain 
 labels. 
 
 First example:
 [code]
 import numpy as np
 np.seterr(all='raise')
 import matplotlib.pyplot as plt
 
 x_i = [11.7574075935, 11.66520713579, 11.6762413105, 11.6580992311, 
 11.65636838851]
 x_r = []
 dates = [2.83611000e-01,   2.69330463e+02,   2.70280648e+02,   
 2.71359248e+02,   2.72320822e+02]
 
 diff = 0.16
 ra = [0., 110.5349726]
 dec = [0., -16.1061281]
 med_i = np.median(x_i)
 med_r = np.median(x_r)
 
 plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
 if x_r == []:
   plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
   plt.title('i_mag', fontsize='16')
 else:
   plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s')
   plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
   plt.title('i_mag', fontsize='16')
 plt.rcParams['xtick.major.pad']=10
 plt.rcParams['ytick.major.pad']=10
 ax = plt.gca()
 ax.title.set_y(1.1)
 formy = plt.ScalarFormatter()
 formy.set_powerlimits((-5, 5))
 formy.set_scientific(False)
 ax.yaxis.set_major_formatter(formy)
 ax.set_ylim(ax.get_ylim()[::-1])
 for tick in ax.xaxis.get_major_ticks():
   tick.label.set_fontsize(16)
 for tick in ax.yaxis.get_major_ticks():
   tick.label.set_fontsize(16)
 plt.xlabel('Days', fontsize='20', labelpad=20)
 plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
 
 if x_r == []:
   plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
  numpoints=1, ncol=2, borderaxespad=0.)
 else:
   plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
  numpoints=1, ncol=2, borderaxespad=0.)
 leg = plt.gca().get_legend()
 ltext = leg.get_texts()
 plt.setp(ltext, fontsize='16')
 plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
 plt.close(i_only)
 [/code]
 
 Second example:
 [code]
 import numpy as np
 import matplotlib.pyplot as plt
 
 y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168, 
 11.12513415219]
 y_r = [11.14866716899, 11.10194503, 11.11235246531, 
 11.11168787179, 11.1214449011]
 dates_i = [2.83611000e-01,   2.69330463e+02, 2.70280648e+02,   
 2.72320822e+02, 2.73250579e+02]
 dates_r = [311.28215,   324.25844,   325.25194,   330.20983,   338.21356]
 
 diff = 0.16
 ra = [112.5379659, 110.5349726]
 dec = [ -15.9841039, -16.1061281]
 med_i = np.median(y_i)
 med_r = np.median(y_r)
 
 plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
 if y_r == []:
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
 else:
plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
 plt.rcParams['xtick.major.pad']=10
 plt.rcParams['ytick.major.pad']=10
 ax = plt.gca()
 ax.title.set_y(1.1)
 formy = plt.ScalarFormatter()
 formy.set_powerlimits((-5, 5))
 formy.set_scientific(False)
 ax.yaxis.set_major_formatter(formy)
 ax.set_ylim(ax.get_ylim()[::-1])
 for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(16)
 for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(16)
 plt.xlabel('Days', fontsize='20', labelpad=20)
 plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
 
 if y_r == []:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
 else:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
 leg = plt.gca().get_legend()
 ltext = leg.get_texts()
 plt.setp(ltext, fontsize='16')
 plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
 plt.close(i_only) 
 [/code]
 
 Best regards,
 
 frix
 
 
 Am 26.03.2013 um 20:36 schrieb Sterling Smith smit...@fusion.gat.com:
 
 Frix,
 
 It may be useful to post the version and backend you are using to the list.
 
 import matplotlib
 print matplotlib.__version__
 print matplotlib.get_backend()
 
 Also, if you can format the code as a simple self-contained example, that 
 would help others confirm what you are seeing.
 
 -Sterling
 
 On Mar 26, 2013, at 12:01PM, Hackstein wrote:
 
 Hello everyone,
 
 I have two issues with my 

[Matplotlib-users] ANN: matplotlib 1.2.1 release

2013-03-27 Thread Michael Droettboom
I'm pleased to announce the release of matplotlib 1.2.1.  This is a bug 
release and improves stability and quality over the 1.2.0 release from 
four months ago.  All users on 1.2.0 are encouraged to upgrade.


Since github no longer provides download hosting, our tarballs and 
binaries are back on SourceForge, and we have a master index of 
downloads here:


http://matplotlib.org/downloads http://matplotlib.org/downloads.html

Highlights include:

- Usage of deprecated APIs in matplotlib are now displayed by default on 
all Python versions
- Agg backend: Cleaner rendering of rectilinear lines when snapping to 
pixel boundaries, and fixes rendering bugs when using clip paths

- Python 3: Fixes a number of missed Python 3 compatibility problems
- Histograms and stacked histograms have a number of important bugfixes
- Compatibility with more 3rd-party TrueType fonts
- SVG backend: Image support in SVG output is consistent with other backends
- Qt backend: Fixes leaking of window objects in Qt backend
- hexbin with a log scale now works correctly
- autoscaling works better on 3D plots
- ...and numerous others.

Enjoy!  As always, there are number of good ways to get help with 
matplotlib listed on the homepage at http://matplotlib.org/ and I thank 
everyone for their continued support of this project.


Mike Droettboom
--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] difficult LaTeX formula for rendering

2013-03-27 Thread Ilias Miroslav
Dear experts,

in our sphinx-based project documentation (www.diracprogram.org) we have a 
complicated latex math formula, which is not rendered:

/usr/lib/pymodules/python2.7/matplotlib/sphinxext/mathmpl.py:56: Warning: Could 
not render math expression $i \hbar \frac{\partial}{\partial t} \left( 
\begin{array}{c}\Psi^L \\\Psi^S \end{array} \right) = c  \left( 
\begin{array}{c}(\vec{\sigma} \cdot \vec{\pi}) \Psi^S \\(\vec{\sigma} \cdot 
\vec{\pi}) \Psi^L \end{array} \right)+ m_ec^2  \left( \begin{array}{c} \Psi^L 
\\-\Psi^S \end{array} \right) + V  \left( \begin{array}{c}\Psi^L \\\Psi^S 
\end{array} \right)$

The index.rst file with the sole math formula is attached.

I have most recent Ubuntu 12.10 (x86_64) with default packages python-sphinx 
1.1.2, python-matplotlib 1.1.1.

Any help, please ? I was trying to cut this formula down; the smallest LaTeX 
part not rendered is \begin{array}{c}\Psi^L \\ \Psi^S \end{array}.

Yours, 

Miro


index.rst
Description: index.rst
--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trouble with legend and axis scaling

2013-03-27 Thread Jae-Joon Lee
The first issue is a bug, and I opened a PR that fixes this.

https://github.com/matplotlib/matplotlib/pull/1864

In the comments of the PR, you can find a workaround.

Regards,

-JJ




On Wed, Mar 27, 2013 at 11:09 PM, Hackstein news.hackst...@gmx.net wrote:

 Sterling,

 I'm using matplotlib version 1.2.0 with agg backend.

 Here are two code examples, one for each problem. The first one doesn't
 save the figure due to the legend problem, seterr causes the script to stop
 with an error at that position.
 The second example shows the scientific labels on the y-axis, although it
 should be disabled in the code. I can't get the y-axis to display plain
 labels.

 First example:
 [code]
 import numpy as np
 np.seterr(all='raise')
 import matplotlib.pyplot as plt

 x_i = [11.7574075935, 11.66520713579, 11.6762413105, 11.6580992311,
 11.65636838851]
 x_r = []
 dates = [2.83611000e-01,   2.69330463e+02,   2.70280648e+02,
 2.71359248e+02,   2.72320822e+02]

 diff = 0.16
 ra = [0., 110.5349726]
 dec = [0., -16.1061281]
 med_i = np.median(x_i)
 med_r = np.median(x_r)

 plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
 if x_r == []:
plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
 else:
plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s')
plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
plt.title('i_mag', fontsize='16')
 plt.rcParams['xtick.major.pad']=10
 plt.rcParams['ytick.major.pad']=10
 ax = plt.gca()
 ax.title.set_y(1.1)
 formy = plt.ScalarFormatter()
 formy.set_powerlimits((-5, 5))
 formy.set_scientific(False)
 ax.yaxis.set_major_formatter(formy)
 ax.set_ylim(ax.get_ylim()[::-1])
 for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(16)
 for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(16)
 plt.xlabel('Days', fontsize='20', labelpad=20)
 plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)

 if x_r == []:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
 else:
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
   numpoints=1, ncol=2, borderaxespad=0.)
 leg = plt.gca().get_legend()
 ltext = leg.get_texts()
 plt.setp(ltext, fontsize='16')
 plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
 plt.close(i_only)
 [/code]

 Second example:
 [code]
 import numpy as np
 import matplotlib.pyplot as plt

 y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168,
 11.12513415219]
 y_r = [11.14866716899, 11.10194503, 11.11235246531,
 11.11168787179, 11.1214449011]
 dates_i = [2.83611000e-01,   2.69330463e+02, 2.70280648e+02,
 2.72320822e+02, 2.73250579e+02]
 dates_r = [311.28215,   324.25844,   325.25194,   330.20983,   338.21356]

 diff = 0.16
 ra = [112.5379659, 110.5349726]
 dec = [ -15.9841039, -16.1061281]
 med_i = np.median(y_i)
 med_r = np.median(y_r)

 plt.figure(i_only, figsize=(14.40, 9.00), dpi=100)
 if y_r == []:
 plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
 plt.title('i_mag', fontsize='16')
 else:
 plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
 plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
 plt.title('i_mag', fontsize='16')
 plt.rcParams['xtick.major.pad']=10
 plt.rcParams['ytick.major.pad']=10
 ax = plt.gca()
 ax.title.set_y(1.1)
 formy = plt.ScalarFormatter()
 formy.set_powerlimits((-5, 5))
 formy.set_scientific(False)
 ax.yaxis.set_major_formatter(formy)
 ax.set_ylim(ax.get_ylim()[::-1])
 for tick in ax.xaxis.get_major_ticks():
 tick.label.set_fontsize(16)
 for tick in ax.yaxis.get_major_ticks():
 tick.label.set_fontsize(16)
 plt.xlabel('Days', fontsize='20', labelpad=20)
 plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)

 if y_r == []:
 plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
numpoints=1, ncol=2, borderaxespad=0.)
 else:
 plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
numpoints=1, ncol=2, borderaxespad=0.)
 leg = plt.gca().get_legend()
 ltext = leg.get_texts()
 plt.setp(ltext, fontsize='16')
 plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
 plt.close(i_only)
 [/code]

 Best regards,

 frix


 Am 26.03.2013 um 20:36 schrieb Sterling Smith smit...@fusion.gat.com:

  Frix,
 
  It may be useful to post the version and backend you are using to the
 list.
 
  import matplotlib
  print matplotlib.__version__
  print matplotlib.get_backend()
 
  Also, if you can format the code as a simple self-contained example,
 that would help others confirm what you are seeing.
 
  -Sterling
 
  On Mar 26, 2013, at 12:01PM, Hackstein wrote:
 
  Hello everyone,
 
  I have two issues with my current projects:
 
  1)  I automatically generate plots of several data sets in a for-loop,
 all of which have the same shape of x and y values, but some of which have
 two of