You're not adding your subplot to an existing figure, so a new one is
created.

put "fig = plt.figure(...)" at the top of your script and replace "axii =
plt.subplot(numalp, numobs, axisNum)" with "axii = fig.add_subplot(numalp,
numobs, axisNum)"


On Sat, Feb 22, 2014 at 5:28 PM, Gabriele Brambilla <
gb.gabrielebrambi...@gmail.com> wrote:

> Hi,
> I'm trying to follow this example to make a grid of subplot:
>
> http://matplotlib.org/examples/pylab_examples/line_styles.html
>
> but my code plot the two rows in two different figures (i attach them but
> I don't know if they are useful). Does anyone understand why?
>
> this is an extract of my code:
>
> alphas = [45, 75]
> numalp = len(alphas)
>
> angles = np.linspace(pi/12, pi/2, num=10)
> numobs = len(angles)
>
> axisNum = 0
>
> for a in alphas:
>
>           #[some operations]
>
>           for obsangl in angles:
>
>                        #[some operations]
>
>                        axisNum += 1
>                        axii = plt.subplot(numalp, numobs, axisNum)
>                        plt.errorbar(g, Pgamma, yerr = ePgamma, color =
> 'green', fmt = '.')
>                        axii1 = axii.twinx()
>                        plt.plot(g, lightcurva, 'b-')
>                        axii.set_yticklabels([])
>                        axii.set_xticklabels([])
>                        axii1.set_yticklabels([])
>                        axii1.set_xticklabels([])
>
>
>
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to