# Line attributes in lego1 & lego2

**URL:** <https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152>\
**Category:** ROOT\
**Created:** [May 27, 2013, 12:07pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152 "2013-05-27T12:07:02Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [May 31, 2013, 10:27pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/21 "2013-05-31T22:27:17Z")

</div>

[quote]This is the best we can do for now without deep changes I reckon.[/quote]Unless a DrawFillAreaWithBorders() method exist or be implemented.  
Unfortunately this does not seem to be the case

`// TVirtualX
// Semi-Abstract base class defining a generic interface to the
// underlying, low level, graphics system (X11, Win32, MacOS).
`  
Cheers,  
Z

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 2, 2013, 5:49pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/22 "2013-06-02T17:49:40Z")

</div>

Hi again,

In order to be complete attached’s an extension of the last patch that also:

- handles line attributes for surfaces (all modes)  
[canvas\_stack0\_plotlegosurf\_systcar.pdf](https://root-forum.cern.ch/uploads/default/original/2X/0/0bd53a13c25c529791b849994de60ad26b5ec310.pdf) (134 KB)
- takes into account all coordinate systems (car, pol, cyl, sph, (and psr))  
[canvas\_stack0\_plotlegosurf\_systall.pdf](https://root-forum.cern.ch/uploads/default/original/2X/9/94807d5fd839fa8b2e755f081d746e177515d28d.pdf) (524 KB)even for stacks (lego only since stacks are not (yet?) supported for surfaces).  
[canvases.pdf](https://root-forum.cern.ch/uploads/default/original/2X/9/98aa253d469c1bea257414b9ef48930449e5bf8c.pdf) (1.6 MB)(26 canvases in all).

The archive ztest.tgz contains the programs used to generate these outputs.  
Run ztest.max (it will compile and execute stack0.cpp & stack1.cpp).

The diff files attached (THistPainter.cxx.diff & TPainter3dAlgorithms.cxx.diff) were generated against trunk rev 2fa236059378392c87f53e4821adb7593ad3955e.  
So TPainter3dAlgorithms.cxx.diff cancels and replaces TPainter3dAlgorithms.cxx.3.diff above.

Enjoy! 🙂  
Z  
[TPainter3dAlgorithms.cxx.diff](https://root-forum.cern.ch/uploads/default/original/2X/d/d9a059f58c496a9f0a708b5b36218b5a91150344.diff) (17.1 KB)  
[THistPainter.cxx.diff](https://root-forum.cern.ch/uploads/default/original/2X/0/0baa0427de390ea3176a794325270c3acb7c2025.diff) (1.61 KB)  
[ztest.tgz](https://root-forum.cern.ch/uploads/default/original/2X/2/2afde5a134c0669ce5f691c346ead6e5c18b926d.tgz) (3.6 KB)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 10, 2013, 6:19am UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/23 "2013-06-10T06:19:09Z")

</div>

Hello,

I was away last week. Give me time to recover my emails and I will look at this.

Olivier

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 17, 2013, 9:40am UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/24 "2013-06-17T09:40:27Z")

</div>

A bit of time this week?  
Cheers,  
Z

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 17, 2013, 12:54pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/25 "2013-06-17T12:54:27Z")

</div>

Yep, but this THistPainter patch is not appropriate now. I get:

```auto
imaccouet:roottrunk couet$ patch -p1 < /Users/couet/Downloads/THistPainter.cxx.diff
patching file hist/histpainter/src/THistPainter.cxx
Hunk #1 succeeded at 6604 (offset 10 lines).
Hunk #2 succeeded at 7768 (offset 15 lines).
Hunk #3 succeeded at 7845 (offset 15 lines).
Hunk #4 succeeded at 7929 (offset 15 lines).

```

Can you provide a diff against the latest version ?  
Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 17, 2013, 1:51pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/26 "2013-06-17T13:51:54Z")

</div>

Here we go.  
Could you please run ztest.max (see ztest.tgz above) and make sure you get the same plots as above?  
Cheers,  
Z  
[THistPainter.cxx.5.diff](https://root-forum.cern.ch/uploads/default/original/2X/1/17f35dc8728d9054ad7302d93ab5f9d9c209518a.diff) (1.61 KB)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 17, 2013, 1:56pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/27 "2013-06-17T13:56:01Z")

</div>

> [@](#):
>
> Could you please run ztest.max (see ztest.tgz above) and make sure you get the same plots as above?

I will 🙂

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 17, 2013, 2:25pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/28 "2013-06-17T14:25:31Z")

</div>

Ok it seems fine. Sorry to ask you but I lost a bit the tracks of your mods now. Can you provide me a small  
piece of text for the release notes explaining what this patches are supposed to do ?

also, In you code I see:

```auto
   for (i=0;i<fNStack;i++) { fColorMain[i] = 1; fColorDark[i] = 1; fEdgeColor[i] = kMagenta; fEdgeStyle[i] = 10; fEdgeWidth[i] = 10; } /// default foolish values for errors to be spotted easily
```

That’s sounds a bit like a dirty trick, specially with a just comment ☹ … I do not like this too much …

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 17, 2013, 2:43pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/29 "2013-06-17T14:43:18Z")

</div>

[quote]Can you provide me a small piece of text for the release notes explaining what these patches are supposed to do ?[/quote]This patch allows to take into account line attributes (color, style, width) when drawing a TH2 in lego or surf mode whatever the coordinate system used (car, pol, cyl, sph, (and psr)). It also handles THStack (lego only).

[quote]`for (i=0;i<fNStack;i++) { 
fColorMain[i] = 1; fColorDark[i] = 1; 
fEdgeColor[i] = kMagenta; fEdgeStyle[i] = 10; fEdgeWidth[i] = 10; 
}
/// default foolish values for errors to be spotted easily`That sounds a bit like a dirty trick, specially with a just comment ☹ … I do not like this too much …[/quote]Not at all. These were just the default values I used to make sure eveything was going fine i.e. no apparition of huge (width=10) “dotted” (style=10) magenta (color=kMagenta) lines on screen. You can set everything to 1 and remove the comment safely.

Cheers,  
Z

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 17, 2013, 2:49pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/30 "2013-06-17T14:49:28Z")

</div>

```auto
You can set everything to 1 and remove the comment safely.
```

I will go that way. That kind of comment becomes very quickly very obscure with time  
and does not help developers coming after.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 17, 2013, 3:50pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/31 "2013-06-17T15:50:37Z")

</div>

Patch applied. Let me know if ok.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 18, 2013, 2:27pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/32 "2013-06-18T14:27:18Z")

</div>

Your last mods generate a big bug in surface plotting.  
See the result of the SURF3 option in the attached plot.  
Can you fix that please ?  
[sg35.pdf](https://root-forum.cern.ch/uploads/default/original/2X/a/a54388944daebd09a42de39e4e2140693403d93e.pdf) (152 KB)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 18, 2013, 3:44pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/33 "2013-06-18T15:44:02Z")

</div>

the way to reproduce it is:

```auto
TH2D * histo = new TH2D ("histo","histo",20,-5.,5.,20,-5.,5.) ;
histo->FillRandom("gaus",1000) ;
histo->SetStats(kFALSE) ;
histo->SetFillColor(kRed) ;
histo->SetLineColor(kBlack) ;
histo->Draw("surf3");
```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 18, 2013, 4:11pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/34 "2013-06-18T16:11:46Z")

</div>

Ok, now fixed.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 18, 2013, 8:56pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/35 "2013-06-18T20:56:29Z")

</div>

Actually I could not reproduce your problem: the 2D col plane always lies above the 3D plot in my case (your example and all the plots provided above).  
But if you managed to fix it in your case, everything’s fine.  
Note that the change made (I never touched this part!) should be corrected though. A semicolon rather than a comma (between the assignments) would be better I reckon (see lines 114 & 198).  
Cheers,  
Z

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 19, 2013, 7:33am UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/36 "2013-06-19T07:33:52Z")

</div>

> [@](#):
>
> a comma (between the assignments) would be better I reckon (see lines 114 & 198).

You are right. Now changed.

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [June 26, 2013, 9:06pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/37 "2013-06-26T21:06:24Z")

</div>

Hi Olivier,

I’m a bit disappointed these changes  
(and others [url][TH1::Integral(“width”) in TPaveStats (statbox)](https://root-forum.cern.ch/t/th1-integral-width-in-tpavestats-statbox/16238/1) & [url][No shadow in lego1](https://root-forum.cern.ch/t/no-shadow-in-lego1/16148/1)  
did not get implemented in the last ROOT patch release (v5-34-09)  
(I’m very happy they got commited to the trunk though).  
Should I provide the corresponding patches against the head of the “v5-34-00-patches” branch  
to see them included in the next patch release (v5-34-10)?

Cheers,  
Z

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 28, 2013, 7:52am UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/38 "2013-06-28T07:52:33Z")

</div>

> [@](#):
>
> Should I provide the corresponding patches against the head of the “v5-34-00-patches” branch

Yes

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [July 1, 2013, 9:55pm UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/39 "2013-07-01T21:55:53Z")

</div>

Here we go (diff against heads/v5-34-00-patches@v5-34-09-10-g2ed83fa)  
It holds for the 3 posts abovementioned (attline for lego & surf, lego4 and TH1::Integral(“width”) in TPaveStats) since all bring in THistPainter.cxx.  
Checks passed using the different test macros provided.  
Cheers,  
Z  
[patch6.tgz](https://root-forum.cern.ch/uploads/default/original/2X/0/05f5093505b0a104fe32b0c153b84060bf0a5917.tgz) (8.3 KB)

---

<div class="post-metadata">

**Author:** ![Zesp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/b5ac83/32.png) [@Zesp](https://root-forum.cern.ch/u/Zesp)\
**Post date:** [July 2, 2013, 7:04am UTC](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152/40 "2013-07-02T07:04:51Z")

</div>

Please note patch6.tgz is a terrible name since it is not meant for the master branch.  
It should be read patch-v5-34-00-patches.tgz.  
The names inside the archive are properly named.  
Cheers,  
Z

[Previous page](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152.md?page=1)

[Next page](https://root-forum.cern.ch/t/line-attributes-in-lego1-lego2/16152.md?page=3)
