Giter Club home page Giter Club logo

Comments (5)

kponder avatar kponder commented on July 4, 2024 2

Thanks for the suggestion, Kyle.

I was able to do it with

import matplotlib.lines as mlines

blue_line = mlines.Line2D([], [], color='blue', label='SGM')
red_line = mlines.Line2D([], [], color='red', label='GMM')
fig = corner(samples, color = 'b')
corner(samples1, color = 'r', fig=fig)

plt.legend(handles=[blue_line,red_line], bbox_to_anchor=(0., 1.0, 1., .0), loc=4)

This does attach the legend to the last plot in the figure (the bottom right histogram) so I moved it out of the plot and into the empty space.

from corner.py.

kbarbary avatar kbarbary commented on July 4, 2024

I don't know of a simple way.

You should be able to use fig.legend as in this example: http://matplotlib.org/examples/pylab_examples/figlegend_demo.html

However, you need a handle to the lines in the plot for that. If you can't pull these out of the figure object, you could use a proxy artist.

from corner.py.

drphilmarshall avatar drphilmarshall commented on July 4, 2024

Nice! Can you paste in the resulting plot so we can take a look at your
handiwork, please? Thanks!

On Fri, Oct 23, 2015 at 1:32 PM, Kara Ponder [email protected]
wrote:

Thanks for the suggestion, Kyle.

I was able to do it with

import matplotlib.lines as mlines

blue_line = mlines.Line2D([], [], color='blue', label='SGM')
red_line = mlines.Line2D([], [], color='red', label='GMM')
fig = corner(samples, color = 'b')
corner(samples1, color = 'r', fig=fig)

plt.legend(handles=[blue_line,red_line], bbox_to_anchor=(0., 1.0, 1., .0), loc=4)

This does attach the legend to the last plot in the figure (the bottom
right histogram) so I moved it out of the plot and into the empty space.


Reply to this email directly or view it on GitHub
#63 (comment).

from corner.py.

kponder avatar kponder commented on July 4, 2024

Sure thing!

20151024_0_smo_10_dM_1000_num_2_OmW.pdf

(Look for it on the arXiv next week.)

from corner.py.

drphilmarshall avatar drphilmarshall commented on July 4, 2024

Alright! Very nice :-) The only design choices I might suggest would be to
center the legend in the blank panel (both horizontally and vertically) and
remove the box around it. I guess at least sometimes one would also want to
legend the truth point as well.

On Friday, November 13, 2015, Kara Ponder [email protected] wrote:

Sure thing!

20151024_0_smo_10_dM_1000_num_2_OmW.pdf
https://github.com/dfm/corner.py/files/34136/20151024_0_smo_10_dM_1000_num_2_OmW.pdf

(Look for it on the arXiv next week.)


Reply to this email directly or view it on GitHub
#63 (comment).

from corner.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.