Re: [ROOT] FillStyle bug workaround?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 18 2001 - 17:21:24 MEST


Hi Stephen,

First of all, many thanks to many people who confirmed to me
the problem or non problem with ghostview depending on the ghostview versions
and options settings.

I will investigate what can be done with these special fill styles.

Rene Brun

Stephen Bailey wrote:
> 
> Hello.
> 
> If I turn anti-aliasing off in ghostview, the file displays
> fine (thanks, Urs).  It would be nice if ROOT could output
> Postscript that would work with ghostview even with
> anti-aliasing.  I'm using ghostview 3.5.8 on Fermi/Redhat
> Linux 6.1.  I attached a .ps file with the problem.
> 
> The printing problem I had turned out to actually be a
> display problem of TBox (or whatever TLegend uses to display
> the boxes).  The following script demonstrates the problem.
> If you add a TLegend entry for a histogram with a pattern,
> the TLegend displays the wrong box, but the .ps file comes
> out correct (other than the anti-aliasing problem).  It turns
> out that on the screen the TLegend is drawing a box with
> the desired FillStyle in black on a background of the FillColor
> instead of drawing the FillStyle in the FillColor like the
> histogram does.  I thought I had gotten around this with an
> extra histogram for the TLegend, but then it does the "right"
> thing in the .ps file and it doesn't print what I want.
> 
> {
> TCanvas* c1 = new TCanvas("c1", "", 300, 300);
> 
> TH1F h1("h1", "", 50, -5, 5);
> TH1F h2("h2", "", 50, -5, 5);
> TH1F h3("h3", "", 50, -5, 5);
> TH1F h4("h4", "", 50, -5, 5);
> 
> h1.SetFillColor(5);  h2.SetFillColor(10); h3.SetFillColor(1);
> 
> h3.SetFillStyle(3004);
> 
> h4.SetFillColor(10);
> h4.SetFillStyle(3004);
> 
> h1.FillRandom("gaus", 5000);
> h2.FillRandom("gaus", 2000);
> h3.FillRandom("gaus", 1000);
> 
> // Use h4 instead of h1 to have the legend match h1 on the screen,
> // but it doesn't match in the .ps file.  Using h1 in the legend
> // appears wrong on the screen, but is right in the .ps file
> // (except that you have to turn anti-aliasing off in ghostview)
> TLegend legend(0.6, 0.8, 1.0, 1.0);
> legend.AddEntry(&h1, "Test 1", "f");
> //legend.AddEntry(&h4, "Test 1", "f");
> legend.AddEntry(&h2, "Test 2", "f");
> legend.AddEntry(&h3, "Test 3", "f");
> 
> h1.Draw();
> h2.Draw("same");
> h3.Draw("same");
> legend.Draw();
> 
> c1->Print("temp.ps");
> }
> 
> Thanks.
> 
> Stephen
> 
> On Wed, 18 Apr 2001, Rene Brun wrote:
> 
> > Hi Stephen,
> >
> > I cannot reproduce this problem.
> >
> > can you visualize the file temp.ps in attachment with your ghostview ?
> >
> > can you print the file ?
> >
> > Anybody else observing the same problem ?
> >
> > Rene Brun
> >
> > Stephen Bailey wrote:
> > >
> > > Help!
> > >
> > > I need to make some black and white plots which use
> > > various patterns to differentiate histograms instead
> > > of using different fill colors.  Apparently there is
> > > a bug in the use of fill styles which creates bogus
> > > postscript output.  The effect varies from hanging ghostview
> > > to simply not printing the pattern right.  Below is
> > > a script which demonstrates the problem.  I'm running
> > > 2.25/03 on Linux, but I also tried a similar script
> > > on 3.00/05.  Does anyone have a suggested workaround
> > > for getting good postscript output for black and white
> > > histograms which use fill patterns?
> > >
> > > Thanks.
> > >
> > > Stephen
> > >
> > > {
> > > TCanvas* c1 = new TCanvas("c1", "", 300, 300);
> > >
> > > TH1F h1("h1", "", 50, -5, 5);
> > > TH1F h2("h2", "", 50, -5, 5);
> > >
> > > h1.SetFillColor(1); h2.SetFillColor(1);
> > > h1.SetFillStyle(3004);
> > > h2.SetFillStyle(3005);
> > >
> > > h1.FillRandom("gaus", 2000);
> > > h2.FillRandom("gaus", 1000);
> > >
> > > h1.Draw();
> > > h2.Draw("same");
> > >
> > > c1->Print("temp.ps");
> > > }
> >
> 
>   --------------------------------------------------------------------------------
> 
>                  Name: temp.ps
>    temp.ps       Type: Postscript Document (APPLICATION/PostScript)
>              Encoding: BASE64



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET