Hi Ray,

thank you so much for your answer and code!

While what you posted worked for me in plain Python, the legend was 
still clipped in my IPython Notebook.

I noticed this issue on Github:

https://github.com/ipython/ipython/issues/2210

and can confirm that upgrading my Matplotlib from version 1.0.1 to 1.2.1 
resolved my issue with the clipped legend and your code works as expected.


Georg


On 06/12/2013 08:49 PM, Raymond Smith wrote:
> Hi Georg,
>
> I did this by following Joe Kington's answer at
> http://stackoverflow.com/questions/4700614/how-to-put-the-legend-out-of-the-plot
> and also taking a quick glance at the matplotlib1DViewer.py code in fipy
> (to figure out how to reference the axes). Here's example fipy-based
> script with the legend off to the right: http://pastebin.com/vD2hF4WY
>
> Cheers,
> Ray
>
>
> On Wed, Jun 12, 2013 at 12:11 PM, Georg Walther <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Hi,
>
>
>     I have searched the mailing list for the term 'legend' and have not yet
>     found the answer to my question.
>
>     I run FiPy 3.0 and for 1D plots would like to place the legend outside
>     the plotting area so as not to obstruct any lines.
>
>     My FiPy seems to be set up to interface with Matplotlib.
>
>     When calling this:
>
>     fp.Viewer(vars=(variable_1, variable_2),
>                            datamin=-.1, datamax=1.1)
>
>     the legend usually ends up obstructing lines in my graph.
>
>     I am aware of the legend='right', etc. options but all of these will
>     place the legend inside the axes.
>
>
>     I can call this:
>
>     fp.Viewer(vars=(active, inactive, heterodimer),
>                            datamin=-.1, datamax=1.1, legend=((1.0, 0.5)))
>
>     to place the legend outside the axes but this cuts off the legend as the
>     resultant figure is not resized to show both the plot and the legend.
>
>
>     Thank you for a generally fantastic package!
>
>
>     Georg
>
>     _______________________________________________
>     fipy mailing list
>     [email protected] <mailto:[email protected]>
>     http://www.ctcms.nist.gov/fipy
>        [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
>
>
>
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>    [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>

_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to