Code Monkey home page Code Monkey logo

Comments (9)

lukasheinrich avatar lukasheinrich commented on July 29, 2024 1

yeah this was just about being able to transparenttly arrange a set of ratio plots similar to subplots..

from mplhep.

radiradev avatar radiradev commented on July 29, 2024 1

Hi @lukasheinrich could you share the code for this? I have been looking for something similar.

from mplhep.

lukasheinrich avatar lukasheinrich commented on July 29, 2024

fwiw it seems to play nice with mplhep

screenshot

from mplhep.

andrzejnovak avatar andrzejnovak commented on July 29, 2024

That's kinda neat. I collect similar helper functions in mplhep.plot as well, though they're not well documented yet. A PR is welcome! One thing that feels kinda weird is having the subplot as a dict with main and aux could it be a tuple instead?

from mplhep.

andrzejnovak avatar andrzejnovak commented on July 29, 2024

hmm or better yet, two arrays like fig, ax, subax = ... then the shape is clear and you can iterate over both with zip

from mplhep.

nsmith- avatar nsmith- commented on July 29, 2024

There is a ratioplot utility in coffea that might be able to be ported over, as was done for the others: https://coffeateam.github.io/coffea/api/coffea.hist.plotratio.html

from mplhep.

acampove avatar acampove commented on July 29, 2024

The problem with this is that the type of plots that ATLAS, LHCb, etc will accept for publication should look more like:

image

I won't use anything that looks radically different because at the end the collaboration will make us change it so that it looks like the standard style. For which I would end up using the old ROOT way of doing things anyway.

from mplhep.

andrzejnovak avatar andrzejnovak commented on July 29, 2024

@acampove I am not sure I follow. This issue is about automating layout for multiple subplots. The styling is separate and fairly straightforward.

import matplotlib.pyplot as plt
import mplhep as hep
import numpy as np

hists = [np.histogram(np.random.normal(i, 2, 10000), bins=np.linspace(0, 10, 50)) for i in [4, 5, 6]]

hep.histplot(hists[:2])
hep.histplot(hists[2], histtype='errorbar')

image

hep.style.use('ATLAS')
hep.histplot(hists[:2], color=['black', 'red'], label=['mc1', 'mc2'])
hep.histplot(hists[2], histtype='errorbar', color='k', yerr=True, label='Data')
plt.legend()

image

from mplhep.

acampove avatar acampove commented on July 29, 2024

@andrzejnovak Yes, I did not know that switching from that matplotlib style to an ATLAS style was that simple and that the layout was so easy to change.

from mplhep.

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.