You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to draw a histogram with a transparent box on top of it, I noticed that whenever I set CanvasPreferGL to true, the canvas moves down, and the X-axis title is cut off.
What is the expected behaviour?
The only change I would expect is the transparency introduced to my box. Things are not supposed to be moved around only due to
gStyle->SetCanvasPreferGL(true);
How to reproduce?
Consider this macro:
voidtranspar()
{
gStyle->SetCanvasPreferGL(false);
TH2F *h = newTH2F("h", "h;X;Y;Z", 10, 0., 10., 10, 0., 10.);
h->Draw();
TMarker *m = newTMarker(4., 7., 8);
m->Draw();
TBox *b = newTBox(1., 1., 8., 8.);
printf("CanvasPreferGL is set to %s\n", gStyle->GetCanvasPreferGL() ? "true, the red box is expected to be transparent":"false, the red box is expected to be non-transparent");
b->SetFillColorAlpha(kRed, 0.2);
b->Draw();
}
Now if I run this as
root -l -n transpar.cxx
I get the following:
(no transparency is expected, so it is all good).
But when I change false to true at the third line
gStyle->SetCanvasPreferGL(true);
and run again
root -l -n transpar.cxx
, I get
The box is now transparent, which is good, but there is too much empty space above the histogram name (“h”) and, as a consequence, the X-axis title is now cut off. Is there a way to make my box transparent and keep everything else where it was before?
Please note I’m using the -n option when running transpar.cxx, so it’s not due to something I have in my style file.
this is irreproducible if ran on local computers with Windows or Mac OS. The issue is observed only via SSH (from e.g. lxplus7)
in principle, the issue can be mitigated by adding the following five lines at the very end of the macro (right after b->Draw();; the transparency remains; the +/- 0.1 offsets need a bit of a tuning of course):
if (gStyle->GetCanvasPreferGL())
{
gPad->SetBottomMargin(gPad->GetBottomMargin() + 0.1);
gPad->SetTopMargin(gPad->GetTopMargin() - 0.1);
}
ROOT version
6.28/00
How did you install ROOT?
provided by ATLAS @ lxplus7
Which operating system are you using?
CentOS 7
Additional context
No response
The text was updated successfully, but these errors were encountered:
-bash-4.2$ root transpar.C
------------------------------------------------------------------
| Welcome to ROOT 6.24/08 https://root.cern |
| (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Sep 29 2022, 13:04:57 |
| From tags/v6-24-08@v6-24-08 |
| With c++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0]
Processing transpar.C...
Fontconfig warning: ignoring UTF-8: not a valid region tag
Error in <TX11GLManager::CreateContext>: glXCreateContext failed
Error in <TRootCanvas::CreateCanvas>: GL context creation failed.
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
CanvasPreferGL is set to true, the red box is expected to be transparent
root [1]
This is weird. I tried to connect specifically on lxplus7. That does not help. Even the standard app glxgears fails:
-bash-4.2$ glxgears
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 149 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 26
Current serial number in output stream: 27
-bash-4.2$
Again, glxgears works fine for me on lxplus7, even before I set up my usual ATLAS environment. FWIW, one difference I could notice is that I use zsh while you are using bash...
Check duplicate issues.
Describe the bug
When trying to draw a histogram with a transparent box on top of it, I noticed that whenever I set
CanvasPreferGL
totrue
, the canvas moves down, and the X-axis title is cut off.What is the expected behaviour?
The only change I would expect is the transparency introduced to my box. Things are not supposed to be moved around only due to
How to reproduce?
Consider this macro:
Now if I run this as
I get the following:
(no transparency is expected, so it is all good).
But when I change
false
totrue
at the third lineand run again
, I get
The box is now transparent, which is good, but there is too much empty space above the histogram name (“
h
”) and, as a consequence, the X-axis title is now cut off. Is there a way to make my box transparent and keep everything else where it was before?Please note I’m using the
-n
option when runningtranspar.cxx
, so it’s not due to something I have in my style file.The original discussion at the ROOT forum revealed that:
lxplus7
)b->Draw();
; the transparency remains; the +/- 0.1 offsets need a bit of a tuning of course):ROOT version
6.28/00
How did you install ROOT?
provided by ATLAS @ lxplus7
Which operating system are you using?
CentOS 7
Additional context
No response
The text was updated successfully, but these errors were encountered: