Giter Site home page Giter Site logo

plotlyjswrapper.jl's Introduction

PlotlyJSWrapper.jl

Dev

A wrapper of PlotlyJS to plot HEP-style plots quickly with FHist as inputs

Quick Example

using PlotlyJSWrapper
using FHist

# Creating example histograms
h1 = Hist1D(randn(3000),-5:0.5:5)
h2 = Hist1D(randn(1000).+1,-5:0.5:5)
h3 = Hist1D((randn(1000).+2)./2,-5:0.5:5)
h4 = Hist1D((randn(2000).-2).*2,-5:0.5:5)
h5 = Hist1D(randn(2000).*5,-5:0.5:5)
h6 = Hist1D(randn(2000).-0.5,-5:0.5:5)
data = Hist1D(randn(9000),-5:0.5:5)
signal = Hist1D((randn(1000).+10)./3,-5:0.5:5)

# Plotting
plot_stack(

  # Hists are FHist's Hist1D

  # Background histograms
  backgrounds=[h1, h2, h3,
               h4, h5, h6],

  # Data histograms
  data=[data],

  # Signal histograms
  signals=[signal, signal2,
           signal3, signal4],

  # Options
  xaxistitle = "Δϕ<sub>jj</sub> [GeV]",
  outputname = "plot.pdf",
  backgroundlabels =
        ["tt̄",
         "Higgs",
         "Drell-Yan",
         "tt̄Z",
         "ZZ",
         "VBS WW"],
  signallabels =
        ["VVV",
         "VVH",
         "VHH",
         "HHH"],
  # Some extra features
  stacksignals = true,
  hideratio = false,
  showsignalsinratio = true,

)

plotlyjswrapper.jl's People

Contributors

sgnoohc avatar aminnj avatar moelf avatar

Stargazers

 avatar Matthew Feickert avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

moelf aminnj

plotlyjswrapper.jl's Issues

support for poisson errors on data

I think it would be useful to have a feature to toggle on Poisson asymmetric errors for data. I tested that this formula works:

using Distributions
α = 1 - 0.6827
data = [0, 1, 5, 100]
for d in data
    low = d > 0 ? quantile(Gamma(d), α/2) : 0.0
    high = quantile(Gamma(d + 1), 1 - α/2)
    @show d, low, high
end
# (d, low, high) = (0, 0, 1.8410547609529329)
# (d, low, high) = (1, 0.17274753435968146, 3.2995697115682554)
# (d, low, high) = (5, 2.8402756839659467, 8.382539221199023)
# (d, low, high) = (100, 90.01654275363143, 111.03359338627418)

from
https://github.com/aminnj/yahist/blob/a6a906923c6de557ffad56211c13c9e6b1fc5565/yahist/utils.py#L150-L153
and
https://github.com/aminnj/yahist/blob/a6a906923c6de557ffad56211c13c9e6b1fc5565/tests/test_utils.py#L48-L50

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.