Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The option TEXT90 did not work together with COL #12494

Merged
merged 2 commits into from Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 19 additions & 20 deletions hist/histpainter/src/THistPainter.cxx
Expand Up @@ -238,7 +238,7 @@ using `TH1::GetOption`:
| "LEGO3" | Draw a lego plot with hidden surface removal, like LEGO1 but the border lines of each lego-bar are not drawn.|
| "LEGO4" | Draw a lego plot with hidden surface removal, like LEGO1 but without the shadow effect on each lego-bar.|
| "TEXT" | Draw bin contents as text (format set via `gStyle->SetPaintTextFormat`).|
| "TEXTnn" | Draw bin contents as text at angle nn (0 < nn < 90). |
| "TEXTnn" | Draw bin contents as text at angle nn (0 < nn <= 90). |
| "X+" | The X-axis is drawn on the top side of the plot. |
| "Y+" | The Y-axis is drawn on the right side of the plot. |
| "MIN0" | Set minimum value for the Y axis to 0, equivalent to gStyle->SetHistMinimumZero(). |
Expand Down Expand Up @@ -1634,7 +1634,7 @@ By default the format `g` is used. This format can be redefined
by calling `gStyle->SetPaintTextFormat()`.

It is also possible to use `TEXTnn` in order to draw the text with
the angle `nn` (`0 < nn < 90`).
the angle `nn` (`0 < nn <= 90`).

For 2D histograms the text is plotted in the center of each non empty cells.
It is possible to plot empty cells by calling `gStyle->SetHistMinimumZero()`
Expand Down Expand Up @@ -1689,9 +1689,8 @@ Begin_Macro(source)
htext4->SetMarkerSize(1.8);
htext5->SetMarkerSize(1.8);
htext5->SetMarkerColor(kRed);
htext3->Draw("COL");
htext4->SetBarOffset(0.2);
htext4->Draw("TEXT SAME");
htext4->Draw("COL TEXT SAME");
htext5->SetBarOffset(-0.2);
htext5->Draw("TEXT SAME");
}
Expand Down Expand Up @@ -2338,7 +2337,7 @@ The following options are supported:
| "0" | When used with any COL options, the empty bins are not drawn.|
| "TEXT" | Draw bin contents as text (format set via `gStyle->SetPaintTextFormat`).|
| "TEXTN" | Draw bin names as text.|
| "TEXTnn" | Draw bin contents as text at angle nn (0 < nn < 90).|
| "TEXTnn" | Draw bin contents as text at angle nn (0 < nn <= 90).|
| "L" | Draw the bins boundaries as lines. The lines attributes are the TGraphs ones.|
| "P" | Draw the bins boundaries as markers. The markers attributes are the TGraphs ones.|
| "F" | Draw the bins boundaries as filled polygons. The filled polygons attributes are the TGraphs ones.|
Expand Down Expand Up @@ -4252,6 +4251,21 @@ Int_t THistPainter::MakeChopt(Option_t *choptin)
Hoption.Hist = 1;
}
}
l = strstr(chopt,"TEXT");
if (l) {
Int_t angle;
if (sscanf(&l[4],"%d",&angle) > 0) {
if (angle < 0) angle=0;
if (angle > 90) angle=90;
Hoption.Text = 1000+angle;
} else {
Hoption.Text = 1;
}
memcpy(l," ", 4);
l = strstr(chopt,"N");
if (l && fH->InheritsFrom(TH2Poly::Class())) Hoption.Text += 3000;
Hoption.Scat = 0;
}
l = strstr(chopt,"COLZ");
if (l) {
memcpy(l," ",4);
Expand Down Expand Up @@ -4284,21 +4298,6 @@ Int_t THistPainter::MakeChopt(Option_t *choptin)
l = strstr(chopt,"AXIS"); if (l) { Hoption.Axis = 1; memcpy(l," ",4); }
l = strstr(chopt,"AXIG"); if (l) { Hoption.Axis = 2; memcpy(l," ",4); }
l = strstr(chopt,"SCAT"); if (l) { Hoption.Scat = 1; memcpy(l," ",4); }
l = strstr(chopt,"TEXT");
if (l) {
Int_t angle;
if (sscanf(&l[4],"%d",&angle) > 0) {
if (angle < 0) angle=0;
if (angle > 90) angle=90;
Hoption.Text = 1000+angle;
} else {
Hoption.Text = 1;
}
memcpy(l," ", 4);
l = strstr(chopt,"N");
if (l && fH->InheritsFrom(TH2Poly::Class())) Hoption.Text += 3000;
Hoption.Scat = 0;
}
l = strstr(chopt,"POL"); if (l) { Hoption.System = kPOLAR; memcpy(l," ",3); }
l = strstr(chopt,"CYL"); if (l) { Hoption.System = kCYLINDRICAL; memcpy(l," ",3); }
l = strstr(chopt,"SPH"); if (l) { Hoption.System = kSPHERICAL; memcpy(l," ",3); }
Expand Down