Check duplicate issues.
Description
The reproducer creates an image with a different size of the axis labels depending on the ROOT version. The size is set via SetTextSize(tsize) where tsize==21. With this parameter:
- ROOT 6.38 shows a reasonable label size
- ROOT master shows a huge text size such that the labels become invisible in the canvas
- For context, in ROOT master a somewhat reasonable text size can be achieved with
SetTextSize(0.05), but see also the wrong positioning of the labels in the attached image
Note
If in the reproducer below one comments out the lines
// style.SetLabelFont(font, "x");
// style.SetTitleFont(font, "x");
// style.SetLabelFont(font, "y");
// style.SetTitleFont(font, "y");
// style.SetLabelFont(font, "z");
// style.SetTitleFont(font, "z");
Then the huge labels appear also in 6.38.
Reproducer
#include <iostream>
#include <TH1D.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TROOT.h>
void repro()
{
TStyle style{"MyStyle", "MyStyle"};
// use plain black on white colors
Int_t icol = 0; // WHITE
style.SetFrameBorderMode(icol);
style.SetFrameFillColor(icol);
style.SetCanvasBorderMode(icol);
style.SetCanvasColor(icol);
style.SetPadBorderMode(icol);
style.SetPadColor(icol);
style.SetStatColor(icol);
// set the paper & margin sizes
style.SetPaperSize(20, 26);
// set margin sizes
style.SetPadTopMargin(0.05);
style.SetPadRightMargin(0.05);
style.SetPadBottomMargin(0.16);
style.SetPadLeftMargin(0.16);
// set title offsets (for axis label)
style.SetTitleXOffset(1.4);
style.SetTitleYOffset(1.4);
// use large fonts
Int_t font = 43;
Double_t tsize = 21;
style.SetTextFont(font);
style.SetTextSize(tsize);
style.SetLabelFont(font, "x");
style.SetTitleFont(font, "x");
style.SetLabelFont(font, "y");
style.SetTitleFont(font, "y");
style.SetLabelFont(font, "z");
style.SetTitleFont(font, "z");
style.SetLabelSize(tsize, "x");
style.SetTitleSize(tsize, "x");
style.SetLabelSize(tsize, "y");
style.SetTitleSize(tsize, "y");
style.SetLabelSize(tsize, "z");
style.SetTitleSize(tsize, "z");
style.SetLegendFont(font);
// use bold lines and markers
style.SetMarkerStyle(20);
style.SetMarkerSize(1.2);
style.SetHistLineWidth(2.);
style.SetLineStyleString(2, "[12 12]"); // postscript dashes
// get rid of X error bars
// get rid of error bar caps
style.SetEndErrorSize(0.);
// do not display any of the standard histogram decorations
style.SetOptTitle(0);
style.SetOptStat(0);
style.SetOptFit(0);
// put tick marks on top and RHS of plots
style.SetPadTickX(1);
style.SetPadTickY(1);
gROOT->SetStyle("MyStyle");
gROOT->ForceStyle();
gStyle->SetErrorX(0.5);
TH1D h("", "", 1, 0, 1);
h.Fill(0.5);
TCanvas c("", "", 800, 600);
auto size = h.GetXaxis()->GetLabelSize();
std::cout << "label size: " << size << "\n";
h.Draw("HIST");
c.SaveAs("h.png");
}
int main()
{
repro();
}
ROOT version
master
Installation method
Any
Operating system
Any
Additional context
No response
Check duplicate issues.
Description
The reproducer creates an image with a different size of the axis labels depending on the ROOT version. The size is set via
SetTextSize(tsize)wheretsize==21. With this parameter:SetTextSize(0.05), but see also the wrong positioning of the labels in the attached imageNote
If in the reproducer below one comments out the lines
Then the huge labels appear also in 6.38.
Reproducer
ROOT version
master
Installation method
Any
Operating system
Any
Additional context
No response