Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions hist/hist/src/TH1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6758,9 +6758,12 @@ void TH1::SetDefaultSumw2(Bool_t sumw2)
////////////////////////////////////////////////////////////////////////////////
/// Change/set the title.
///
/// If title is in the form `stringt;stringx;stringy;stringz`
/// If title is in the form `stringt;stringx;stringy;stringz;stringc`
/// the histogram title is set to `stringt`, the x axis title to `stringx`,
/// the y axis title to `stringy`, and the z axis title to `stringz`.
/// the y axis title to `stringy`, the z axis title to `stringz`, and the c
/// axis title for the palette is ignored at this stage.
/// Note that you can use e.g. `stringt;stringx` if you only want to specify
/// title and x axis title.
///
/// To insert the character `;` in one of the titles, one should use `#;`
/// or `#semicolon`.
Expand Down Expand Up @@ -6792,8 +6795,15 @@ void TH1::SetTitle(const char *title)
fYaxis.SetTitle(str2.Data());
lns = str1.Length();
str1 = str1(isc+1, lns);
str1.ReplaceAll("#semicolon",10,";",1);
fZaxis.SetTitle(str1.Data());
isc = str1.Index(";");
if (isc >=0 ) {
str2 = str1(0,isc);
str2.ReplaceAll("#semicolon",10,";",1);
fZaxis.SetTitle(str2.Data());
} else {
str1.ReplaceAll("#semicolon",10,";",1);
fZaxis.SetTitle(str1.Data());
}
} else {
str1.ReplaceAll("#semicolon",10,";",1);
fYaxis.SetTitle(str1.Data());
Expand Down
6 changes: 6 additions & 0 deletions hist/histpainter/src/TGraphPainter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4727,6 +4727,12 @@ void TGraphPainter::PaintScatter2D(TScatter2D *theScatter, Option_t* chopt)

functions->AddFirst(palette);
}
TString scTitle(theScatter->GetTitle());
if (palette && scTitle.CountChar(';') == 4) {
auto pos = scTitle.Last(';') + 1;
auto cTitle = scTitle(pos, scTitle.Length() - pos);
palette->SetTitle(cTitle.Data());
}
if (palette && !optionP) palette->Paint();
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion tutorials/visualisation/graphs/gr019_scatter2d.C
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void gr019_scatter2d()
c1[0] = 1;

auto scatter1 = new TScatter2D(n, x1, y1, z1, c1, s1);
scatter1->SetTitle("Scatter plot title;X title;Y title;Z title");
scatter1->SetTitle("Scatter plot title;X title;Y title;Z title;C title");
scatter1->SetMarkerStyle(20);

auto scatter2 = new TScatter2D(n, x2, y2, z2, c2, s2);
Expand Down
3 changes: 3 additions & 0 deletions tutorials/visualisation/graphs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ In addition, ROOT offers multiple variations to basic TGraphs, such as:
- [TGraphSmooth](https://root.cern/doc/master/classTGraphSmooth.html)
- [TGraphStruct](https://root.cern/doc/master/classTGraphStruct.html)
- [TGraphTime](https://root.cern/doc/master/classTGraphTime.html).
- [TScatter](https://root.cern/doc/master/classTScatter.html).
- [TScatter2D](https://root.cern/doc/master/classTScatter2D.html).

TGraphs are painted through the [TGraphPainter](https://root.cern/doc/master/classTGraphPainter.html) or [TGraph2DPainter](https://root.cern/doc/master/classTGraph2DPainter.html) classes. As a general remark, TGraphs are not binned, each point is painted individually.

Expand All @@ -44,6 +46,7 @@ These examples showcase the creation of different types of graphs and basic ways
| gr004_errors_asym.C | gr004_errors_asym.py | Create and draw a graph with asymmetric x & y errors. |
| gr005_apply.C | gr005_apply.py | Demonstrate the functionality of the TGraph::Apply() method. |
| gr006_scatter.C | gr006_scatter.py | Scatter plot for 4 variables, mapped to: x, y, marker color and marker size. |
| gr019_scatter2.C | | Scatter plot for 5 variables, mapped to: x, y, z, marker color and marker size. |
| gr007_multigraph.C | gr007_multigraph.py | Create and draw a TMultiGraph (several graphs superposed). |
| gr008_multierrors.C | | Graph with multiple y errors in each bin. |
| gr009_bent_err.C | gr009_bent_err.py | Graph with bent (non-vertical/non-horizontal) error bars. |
Expand Down
Loading