Re: [Matplotlib-users] multiplot in a for loop

2014-03-10 Thread Paul Hobson
Gabriele,

I'm confused. I only see 1 series in each subplot. Could you trim your
example down into some code that we can copy, paste, and run? A more
thorough description of the problem might help too.
-p


On Mon, Mar 10, 2014 at 9:39 AM, Gabriele Brambilla 
gb.gabrielebrambi...@gmail.com wrote:

 Hi I'm trying to do a particular plot similar to this one:
 http://matplotlib.org/examples/pylab_examples/line_styles.html

 but my code pastes different datas in the same plot. I want only one array
 per each plot. I attach the wrong result

 fdatas = plt.figure()
 for filename in filenames:

 [various things]

 for obsangl in angles:
   [various things]

   #fitspectrum4.fitSpec is one my personal
 fitting routine

   pa0, era0, pa1, era1, pa2, era2, pa3, era3 =
 fitspectrum4.fitSpec(eels, averspe, (1.0)*(10**(-8)), 0.66, 10**6, 1)
   GAMMAs.append(pa1)
   EcutS.append(pa2)
   Bees.append(pa3)
   GeR.append(era1)
   EeR.append(era2)
   beR.append(era3)

   ialph += 1
   ialpg = ialph
   axum1 = fdatas.add_subplot(numalp, 3, ialpg)
   da1 = axum1.errorbar(angles, GAMMAs, yerr=GeR, marker = .)

   ialpg = ialph + 1
   axum2 = fdatas.add_subplot(numalp, 3, ialpg)
   da2 = axum2.errorbar(angles, EcutS, yerr=EeR, marker = .)

   ialpg = ialph + 2
   axum3 = fdatas.add_subplot(numalp, 3, ialpg)
   da3 = axum3.errorbar(angles, Bees, yerr=beR, marker = .)



 thanks

 Gabriele


 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: multiplot in a for loop

2014-03-10 Thread Gabriele Brambilla
No, if you look better near the zero there are some COLOURED lines: you
have this impression because the values in EcutS are enormous respect the
other one in GAMMAs and Bees. When you plot them all together the other
ones disappear... I don't want to plot them all together.

Excuse me but it's very difficult for me to give you a self running code:
it's an enormous code with a lot of things that recall each others...

Thanks

Gabriele


2014-03-10 12:54 GMT-04:00 Paul Hobson pmhob...@gmail.com:

Gabriele,

 I'm confused. I only see 1 series in each subplot. Could you trim your
 example down into some code that we can copy, paste, and run? A more
 thorough description of the problem might help too.
 -p


 On Mon, Mar 10, 2014 at 9:39 AM, Gabriele Brambilla 
 gb.gabrielebrambi...@gmail.com wrote:

 Hi I'm trying to do a particular plot similar to this one:
 http://matplotlib.org/examples/pylab_examples/line_styles.html

 but my code pastes different datas in the same plot. I want only one
 array per each plot. I attach the wrong result

 fdatas = plt.figure()
 for filename in filenames:

 [various things]

 for obsangl in angles:
   [various things]

   #fitspectrum4.fitSpec is one my personal
 fitting routine

   pa0, era0, pa1, era1, pa2, era2, pa3, era3
 = fitspectrum4.fitSpec(eels, averspe, (1.0)*(10**(-8)), 0.66, 10**6, 1)
   GAMMAs.append(pa1)
   EcutS.append(pa2)
   Bees.append(pa3)
   GeR.append(era1)
   EeR.append(era2)
   beR.append(era3)

   ialph += 1
   ialpg = ialph
   axum1 = fdatas.add_subplot(numalp, 3, ialpg)
   da1 = axum1.errorbar(angles, GAMMAs, yerr=GeR, marker =
 .)
   ialpg = ialph + 1
   axum2 = fdatas.add_subplot(numalp, 3, ialpg)
   da2 = axum2.errorbar(angles, EcutS, yerr=EeR, marker = .)

   ialpg = ialph + 2
   axum3 = fdatas.add_subplot(numalp, 3, ialpg)
   da3 = axum3.errorbar(angles, Bees, yerr=beR, marker = .)



 thanks

 Gabriele


 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] multiplot in a for loop

2014-03-10 Thread Paul Hobson
So it sounds like you're not specifying the subplots correctly.

I recommend using `fig, axes = plt.subplots(nrows=R, ncols=C)` as a
replacement for `fig = plt.figure` and `fig.add_subplot()`.

`axes` will be a numpy array of Axes objects through which you'll be able
to loop along with your other variable.

Good luck.
-paul


On Mon, Mar 10, 2014 at 10:46 AM, Gabriele Brambilla 
gb.gabrielebrambi...@gmail.com wrote:

 No, if you look better near the zero there are some COLOURED lines: you
 have this impression because the values in EcutS are enormous respect the
 other one in GAMMAs and Bees. When you plot them all together the other
 ones disappear... I don't want to plot them all together.

 Excuse me but it's very difficult for me to give you a self running code:
 it's an enormous code with a lot of things that recall each others...

 Thanks

 Gabriele


 2014-03-10 12:54 GMT-04:00 Paul Hobson pmhob...@gmail.com:

 Gabriele,

 I'm confused. I only see 1 series in each subplot. Could you trim your
 example down into some code that we can copy, paste, and run? A more
 thorough description of the problem might help too.
 -p


 On Mon, Mar 10, 2014 at 9:39 AM, Gabriele Brambilla 
 gb.gabrielebrambi...@gmail.com wrote:

 Hi I'm trying to do a particular plot similar to this one:
 http://matplotlib.org/examples/pylab_examples/line_styles.html

 but my code pastes different datas in the same plot. I want only one
 array per each plot. I attach the wrong result

 fdatas = plt.figure()
 for filename in filenames:

 [various things]

 for obsangl in angles:
   [various things]

   #fitspectrum4.fitSpec is one my personal
 fitting routine

   pa0, era0, pa1, era1, pa2, era2, pa3, era3
 = fitspectrum4.fitSpec(eels, averspe, (1.0)*(10**(-8)), 0.66, 10**6, 1)
   GAMMAs.append(pa1)
   EcutS.append(pa2)
   Bees.append(pa3)
   GeR.append(era1)
   EeR.append(era2)
   beR.append(era3)

   ialph += 1
   ialpg = ialph
   axum1 = fdatas.add_subplot(numalp, 3, ialpg)
   da1 = axum1.errorbar(angles, GAMMAs, yerr=GeR, marker =
 .)
   ialpg = ialph + 1
   axum2 = fdatas.add_subplot(numalp, 3, ialpg)
   da2 = axum2.errorbar(angles, EcutS, yerr=EeR, marker =
 .)
   ialpg = ialph + 2
   axum3 = fdatas.add_subplot(numalp, 3, ialpg)
   da3 = axum3.errorbar(angles, Bees, yerr=beR, marker = .)



 thanks

 Gabriele


 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and
 their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] multiplot in a for loop

2014-03-10 Thread Gabriele Brambilla
And how can I select in which position of the grid of plots put my errorbar
plot?

like axes[i].errorbar(...)?

thanks

Gabriele


2014-03-10 13:51 GMT-04:00 Paul Hobson pmhob...@gmail.com:

 So it sounds like you're not specifying the subplots correctly.

 I recommend using `fig, axes = plt.subplots(nrows=R, ncols=C)` as a
 replacement for `fig = plt.figure` and `fig.add_subplot()`.

 `axes` will be a numpy array of Axes objects through which you'll be able
 to loop along with your other variable.

 Good luck.
 -paul


 On Mon, Mar 10, 2014 at 10:46 AM, Gabriele Brambilla 
 gb.gabrielebrambi...@gmail.com wrote:

 No, if you look better near the zero there are some COLOURED lines: you
 have this impression because the values in EcutS are enormous respect the
 other one in GAMMAs and Bees. When you plot them all together the other
 ones disappear... I don't want to plot them all together.

 Excuse me but it's very difficult for me to give you a self running code:
 it's an enormous code with a lot of things that recall each others...

 Thanks

 Gabriele


 2014-03-10 12:54 GMT-04:00 Paul Hobson pmhob...@gmail.com:

 Gabriele,

 I'm confused. I only see 1 series in each subplot. Could you trim your
 example down into some code that we can copy, paste, and run? A more
 thorough description of the problem might help too.
 -p


 On Mon, Mar 10, 2014 at 9:39 AM, Gabriele Brambilla 
 gb.gabrielebrambi...@gmail.com wrote:

 Hi I'm trying to do a particular plot similar to this one:
 http://matplotlib.org/examples/pylab_examples/line_styles.html

 but my code pastes different datas in the same plot. I want only one
 array per each plot. I attach the wrong result

 fdatas = plt.figure()
 for filename in filenames:

 [various things]

 for obsangl in angles:
   [various things]

   #fitspectrum4.fitSpec is one my personal
 fitting routine

   pa0, era0, pa1, era1, pa2, era2, pa3,
 era3 = fitspectrum4.fitSpec(eels, averspe, (1.0)*(10**(-8)), 0.66, 10**6, 
 1)
   GAMMAs.append(pa1)
   EcutS.append(pa2)
   Bees.append(pa3)
   GeR.append(era1)
   EeR.append(era2)
   beR.append(era3)

   ialph += 1
   ialpg = ialph
   axum1 = fdatas.add_subplot(numalp, 3, ialpg)
   da1 = axum1.errorbar(angles, GAMMAs, yerr=GeR, marker =
 .)
   ialpg = ialph + 1
   axum2 = fdatas.add_subplot(numalp, 3, ialpg)
   da2 = axum2.errorbar(angles, EcutS, yerr=EeR, marker =
 .)
   ialpg = ialph + 2
   axum3 = fdatas.add_subplot(numalp, 3, ialpg)
   da3 = axum3.errorbar(angles, Bees, yerr=beR, marker =
 .)


 thanks

 Gabriele


 --
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and
 their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users





--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] multiplot in a for loop

2014-03-10 Thread Joe Kington
On Mar 10, 2014 1:00 PM, Gabriele Brambilla 
gb.gabrielebrambi...@gmail.com wrote:

 And how can I select in which position of the grid of plots put my
errorbar plot?

 like axes[i].errorbar(...)?

Exactly. Except that axes will be a 2d array if you have multiple rows and
columns, so it would be axes[i,j].errorbar(...).

If you just want to iterate over all of the subplots, use for ax in
axes.flat:.

Hope that helps,
-Joe

 thanks

 Gabriele


 2014-03-10 13:51 GMT-04:00 Paul Hobson pmhob...@gmail.com:

 So it sounds like you're not specifying the subplots correctly.

 I recommend using `fig, axes = plt.subplots(nrows=R, ncols=C)` as a
replacement for `fig = plt.figure` and `fig.add_subplot()`.

 `axes` will be a numpy array of Axes objects through which you'll be
able to loop along with your other variable.

 Good luck.
 -paul


 On Mon, Mar 10, 2014 at 10:46 AM, Gabriele Brambilla 
gb.gabrielebrambi...@gmail.com wrote:

 No, if you look better near the zero there are some COLOURED lines: you
have this impression because the values in EcutS are enormous respect the
other one in GAMMAs and Bees. When you plot them all together the other
ones disappear... I don't want to plot them all together.

 Excuse me but it's very difficult for me to give you a self running
code: it's an enormous code with a lot of things that recall each others...

 Thanks

 Gabriele


 2014-03-10 12:54 GMT-04:00 Paul Hobson pmhob...@gmail.com:

 Gabriele,

 I'm confused. I only see 1 series in each subplot. Could you trim your
example down into some code that we can copy, paste, and run? A more
thorough description of the problem might help too.
 -p


 On Mon, Mar 10, 2014 at 9:39 AM, Gabriele Brambilla 
gb.gabrielebrambi...@gmail.com wrote:

 Hi I'm trying to do a particular plot similar to this one:
http://matplotlib.org/examples/pylab_examples/line_styles.html

 but my code pastes different datas in the same plot. I want only one
array per each plot. I attach the wrong result

 fdatas = plt.figure()
 for filename in filenames:

 [various things]

 for obsangl in angles:
   [various things]

   #fitspectrum4.fitSpec is one my
personal fitting routine

   pa0, era0, pa1, era1, pa2, era2, pa3,
era3 = fitspectrum4.fitSpec(eels, averspe, (1.0)*(10**(-8)), 0.66, 10**6, 1)
   GAMMAs.append(pa1)
   EcutS.append(pa2)
   Bees.append(pa3)
   GeR.append(era1)
   EeR.append(era2)
   beR.append(era3)

   ialph += 1
   ialpg = ialph
   axum1 = fdatas.add_subplot(numalp, 3, ialpg)
   da1 = axum1.errorbar(angles, GAMMAs, yerr=GeR, marker =
.)
   ialpg = ialph + 1
   axum2 = fdatas.add_subplot(numalp, 3, ialpg)
   da2 = axum2.errorbar(angles, EcutS, yerr=EeR, marker =
.)
   ialpg = ialph + 2
   axum3 = fdatas.add_subplot(numalp, 3, ialpg)
   da3 = axum3.errorbar(angles, Bees, yerr=beR, marker =
.)


 thanks

 Gabriele


--
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and
their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users







--
 Learn Graph Databases - Download FREE O'Reilly Book
 Graph Databases is the definitive new guide to graph databases and their
 applications. Written by three acclaimed leaders in the field,
 this first edition is now available. Download your free book today!
 http://p.sf.net/sfu/13534_NeoTech
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] multiplot in a for loop

2014-03-10 Thread Gabriele Brambilla
thank you guys, it works very well!

Gabriele


2014-03-10 14:07 GMT-04:00 Joe Kington joferking...@gmail.com:


 On Mar 10, 2014 1:00 PM, Gabriele Brambilla 
 gb.gabrielebrambi...@gmail.com wrote:
 
  And how can I select in which position of the grid of plots put my
 errorbar plot?
 
  like axes[i].errorbar(...)?

 Exactly. Except that axes will be a 2d array if you have multiple rows and
 columns, so it would be axes[i,j].errorbar(...).

 If you just want to iterate over all of the subplots, use for ax in
 axes.flat:.

 Hope that helps,
 -Joe

 
  thanks
 
  Gabriele
 
 
  2014-03-10 13:51 GMT-04:00 Paul Hobson pmhob...@gmail.com:
 
  So it sounds like you're not specifying the subplots correctly.
 
  I recommend using `fig, axes = plt.subplots(nrows=R, ncols=C)` as a
 replacement for `fig = plt.figure` and `fig.add_subplot()`.
 
  `axes` will be a numpy array of Axes objects through which you'll be
 able to loop along with your other variable.
 
  Good luck.
  -paul
 
 
  On Mon, Mar 10, 2014 at 10:46 AM, Gabriele Brambilla 
 gb.gabrielebrambi...@gmail.com wrote:
 
  No, if you look better near the zero there are some COLOURED lines:
 you have this impression because the values in EcutS are enormous respect
 the other one in GAMMAs and Bees. When you plot them all together the other
 ones disappear... I don't want to plot them all together.
 
  Excuse me but it's very difficult for me to give you a self running
 code: it's an enormous code with a lot of things that recall each others...
 
  Thanks
 
  Gabriele
 
 
  2014-03-10 12:54 GMT-04:00 Paul Hobson pmhob...@gmail.com:
 
  Gabriele,
 
  I'm confused. I only see 1 series in each subplot. Could you trim
 your example down into some code that we can copy, paste, and run? A more
 thorough description of the problem might help too.
  -p
 
 
  On Mon, Mar 10, 2014 at 9:39 AM, Gabriele Brambilla 
 gb.gabrielebrambi...@gmail.com wrote:
 
  Hi I'm trying to do a particular plot similar to this one:
 http://matplotlib.org/examples/pylab_examples/line_styles.html
 
  but my code pastes different datas in the same plot. I want only one
 array per each plot. I attach the wrong result
 
  fdatas = plt.figure()
  for filename in filenames:
 
  [various things]
 
  for obsangl in angles:
[various things]
 
#fitspectrum4.fitSpec is one my
 personal fitting routine
 
pa0, era0, pa1, era1, pa2, era2, pa3,
 era3 = fitspectrum4.fitSpec(eels, averspe, (1.0)*(10**(-8)), 0.66, 10**6, 1)
GAMMAs.append(pa1)
EcutS.append(pa2)
Bees.append(pa3)
GeR.append(era1)
EeR.append(era2)
beR.append(era3)
 
ialph += 1
ialpg = ialph
axum1 = fdatas.add_subplot(numalp, 3, ialpg)
da1 = axum1.errorbar(angles, GAMMAs, yerr=GeR, marker
 = .)
ialpg = ialph + 1
axum2 = fdatas.add_subplot(numalp, 3, ialpg)
da2 = axum2.errorbar(angles, EcutS, yerr=EeR, marker =
 .)
ialpg = ialph + 2
axum3 = fdatas.add_subplot(numalp, 3, ialpg)
da3 = axum3.errorbar(angles, Bees, yerr=beR, marker =
 .)
 
 
  thanks
 
  Gabriele
 
 
 --
  Learn Graph Databases - Download FREE O'Reilly Book
  Graph Databases is the definitive new guide to graph databases and
 their
  applications. Written by three acclaimed leaders in the field,
  this first edition is now available. Download your free book today!
  http://p.sf.net/sfu/13534_NeoTech
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 
 
 
 --
  Learn Graph Databases - Download FREE O'Reilly Book
  Graph Databases is the definitive new guide to graph databases and
 their
  applications. Written by three acclaimed leaders in the field,
  this first edition is now available. Download your free book today!
  http://p.sf.net/sfu/13534_NeoTech
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!