Skip to content

Improve look of standard plots #312

Open

Description

@rdisipio

Hi,

I used BAT 1.0.0-RC1 for an unfolding paper (arXiv:1808.01930). However, the plots showing the prior update have a really low quality, the labels are too small and there is no way to tell the difference between the two histograms if printed b/w. How do I change the style of this plot without recompiling BAT from scratch? Shouldn't the default style be prettier (and easily recognizable as "BAT-like") in any case?

Best,
Riccardo

Activity

  1. oschulz commented on Sep 25, 2018

    @oschulz
    Member

    There's no configuration files or so (though playing with the ROOT plot style defaults may work). But on the plus side, compiling BAT doesn't take very long. ;-)

    Regarding the default style/quality of the plots, a PR with improvments will of course be welcome.

  2. rdisipio commented on Sep 25, 2018

    @rdisipio
    Author

    Hi,

    I'm trying to work out some changes so that the prior appears as a grey filled histogram, and the posterior is represented by black dots. I'll let you know what I changed as soon as I get something decent so I can make a pull request.

    Cheers,
    Riccardo

  3. oschulz commented on Sep 26, 2018

    @oschulz
    Member
  4. rdisipio commented on Sep 26, 2018

    @rdisipio
    Author

    Hi,

    I think I obtained something I like more. It was also partially my fault. Switching on BCAux::SetStyle() improved things a lot, I recommend to make it the default mode. Then, I also realized that I was using an older version of BAT. Pulling a newer version from GIT fixed a few more thing such as the position of the legend.
    I modified BCAux.cxx to make the prior histogram filled. When printed b/w, the grey line is hard to distinguish from the posterior.
    You can find in attachment an example of how it looks like now.

    Cheers,
    Riccardo
    screen shot 2018-09-26 at 10 52 56

    BCAux.cxx.txt

  5. oschulz commented on Sep 26, 2018

    @oschulz
    Member

    Hm, @greenwald , what do you think?

  6. greenwald commented on Oct 11, 2018

    @greenwald
    Contributor

    I believe this is similar (if not identical) to what BAT currently produces. @rdisipio, please consider using the most up-to-date version of BAT. This is currently version 1.0. Many changes were made to the drawing style between 1.0.0-RC1 and 1.0.0 to adapt to changes in ROOT. In version 1.0 BCAux::SetStyle() is an empty dummy function included only for backwards compatibility. All basic style choices are set through the normal ROOT interface.

  7. rdisipio commented on Oct 23, 2018

    @rdisipio
    Author

    Hi,

    long story short: the style is greatly improved, I like it! However, I got the preprint rejected again because the size of the labels of the axes and of the legend is too small. Since they did not complain about other plots, it seems that setting it to 0.06 (or larger) should make the editors happy.

    How do I change that in the code?

  8. rdisipio commented on Nov 19, 2018

    @rdisipio
    Author

    Hi,

    coming back to this issue. As I said, I think the style was greatly improved, but I need to make the text larger. I'm quite lost inside BCAux.cxx . Any suggestion where to change the code? For example, I tried to add (without success) the following lines to src/BCAux.cxx :

    void BCAux::SetKnowledgeUpdateDrawingStyle(BCH1D& prior, BCH1D& posterior, BCAux::BCKnowledgeUpdateDrawingStyle style)
    {
        switch (style) {
            case BCAux::kKnowledgeUpdateDetailedPosterior:
            ....
            prior.GetHistogram()->GetXaxis()->SetTitleSize(1.00);
            posterior.GetHistogram()->GetXaxis()->SetTitleSize(1.00);
    
  9. greenwald commented on Nov 19, 2018

    @greenwald
    Contributor

    The problem is that these are the options stored in dummy BCH1D's; they are handed off to the individual BCH1D's that are drawn via BCHistogramBase::CopyOptions(...). And this does not copy the options from the histogram itself, since ROOT has no such functionality built in, unfortunately.

    Your best option is to communicate with ROOT directly. Before calling the function to draw the knowledge update plots, ask ROOT to increase the title size: gStyle->SetTitleSize(1.). I can't verify that will work, but something like that should.

  10. rdisipio commented on Nov 19, 2018

    @rdisipio
    Author

    Is there an option to save all the histograms to a ROOT file, so I can read them after they are created and plot them with my own macro?
    I can call the function BCEngineMCMC::WriteMarginalizedDistributions(), but that only writes out the posteriors. I can access the priors only from the derived class BCModel::GetPrior().

  11. rdisipio commented on Nov 20, 2018

    @rdisipio
    Author

    Hi,
    ok so I've found a workaround. I added a function to my derived class to save a ROOT file containing TH1Ds and TH2Ds for priors and marginalized posterior distributions. This way, I can create an external script to create the plots. While this is a solution for me, you may want to consider implementing a similar function in BCModel.

    Thanks for helping out!

    Best,
    Riccardo

  12. greenwald commented on Nov 20, 2018

    @greenwald
    Contributor

    You can save the samples in a TTree and then draw them in any way you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions