Skip to content
Snippets Groups Projects
Commit acb00a92 authored by Olivier Couet's avatar Olivier Couet
Browse files

Support custom line styles in `TTeXDump` as requested...

Support custom line styles in `TTeXDump` as requested [here](https://sft.its.cern.ch/jira/browse/ROOT-8215)
parent 4c03c2c0
No related branches found
No related tags found
No related merge requests found
......@@ -140,8 +140,8 @@ We added a cache specifically for the fast option of the TTreeCloner to signific
## Math Libraries
* Improve thread safety of TMinuit constructor [ROOT-8217]
* Vc has ben removed from the ROOT sources. If the option 'vc' is enabled, the package will be searched (by default),
alternatively the source tarfile can be downloded and build with the option 'builtin_vc'.
* Vc has ben removed from the ROOT sources. If the option 'vc' is enabled, the package will be searched (by default),
alternatively the source tarfile can be downloded and build with the option 'builtin_vc'.
## RooFit Libraries
......@@ -214,9 +214,10 @@ We added a cache specifically for the fast option of the TTreeCloner to signific
* New optional parameter "option" in TPad::BuildLegend to set the TLegend option (Georg Troska).
* TCandle: a new candle plot painter class. It is now used in THistPainter and THStack
to paint candle plots (Georg Troska).
* Fix two issues with the fill patterns in `TTextDump` (reported [here](https://sft.its.cern.ch/jira/browse/ROOT-8206)):
* Fix two issues with the fill patterns in `TTeXDump` (reported [here](https://sft.its.cern.ch/jira/browse/ROOT-8206)):
- The pattern number 3 was not implemented.
- Filled area drawn with pattern where surrounded by a solid line.
* Support custom line styles in `TTeXDump` as requested [here](https://sft.its.cern.ch/jira/browse/ROOT-8215)
* `TColor::GetFreeColorIndex()` allows to make sure the new color is created with an
unused color index.
......
......@@ -522,36 +522,34 @@ void TTeXDump::DrawPS(Int_t nn, Double_t *xw, Double_t *yw)
SetColor(fLineColor);
PrintStr("@");
PrintStr("\\draw [c");
switch(fLineStyle) {
case 1:
break;
case 2:
PrintStr(",dashed");
break;
case 3:
PrintStr(",dotted");
break;
case 4:
PrintStr(",dash pattern=on 2.4pt off 3.2pt on 0.8pt off 3.2pt");
break;
case 5:
PrintStr(",dash pattern=on 4pt off 2.4pt on 0.8pt off 2.4pt");
break;
case 6:
PrintStr(",dash pattern=on 4pt off 2.4pt on 0.8pt off 2.4pt on 0.8pt off 2.4pt on 0.8pt off 2.4pt");
break;
case 7:
PrintStr(",dash pattern=on 4pt off 4pt");
break;
case 8:
PrintStr(",dash pattern=on 4pt off 2.4pt on 0.8pt off 2.4pt on 0.8pt off 2.4pt");
break;
case 9:
PrintStr(",dash pattern=on 16pt off 4pt");
break;
case 10:
PrintStr(",dash pattern=on 16pt off 8pt on 0.8pt off 8pt");
break;
TString spec = gStyle->GetLineStyleString(fLineStyle);
TString tikzSpec;
TString stripped = TString{spec.Strip(TString::kBoth)};
if (stripped.Length()) {
tikzSpec.Append(",dash pattern=");
Ssiz_t i{0}, j{0};
bool on{true}, iterate{true};
while (iterate){
j = stripped.Index(" ", 1, i, TString::kExact);
if (j == kNPOS){
iterate = false;
j = stripped.Length();
}
if (on) {
tikzSpec.Append("on ");
on = false;
} else {
tikzSpec.Append("off ");
on = true;
}
int num = TString{stripped(i, j - i)}.Atoi();
float pt = 0.2*num;
tikzSpec.Append(TString::Format("%.2fpt ", pt));
i = j + 1;
}
PrintStr(tikzSpec.Data());
}
PrintStr(",line width=");
WriteReal(0.3*fLineScale*fLineWidth, kFALSE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment