Hello,
To give different colors to the several distributions in one canvass I used 
myhist->SetLineWidth(3);
and the header files I have are
#include
#include <TH1F.h>
#include <TCanvas.h>
#include <TFile.h>
#include “TStyle.h”
#include “TLegend.h”
#include “TLatex.h”
#include “TLine.h”
#include “TGraph.h”
#include “TGraphErrors.h”
#include “TPave.h”
#include “TPaveText.h”
#include “TROOT.h”
#include “TString.h”
Whey then colors are not changing?
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
couet
2
myhist->SetLineWidth(3);
changes the histogram line width, not the file color. To change the color do:
myhist->SetLineColor(kRed);
1 Like
Yes I got it . Thanks.
By using SetLineColor only color of Legend line is changes not the distributions color. What should I do for that?
couet
4
myhist->SetFillColor(kRed);
1 Like
Colors of distributions are not changing maybe I need specific header file? In the message above colors are changing but for legends only.
couet
6
root [0] auto h = new TH1F("h","h",100,-4,4)
root [1] h->SetFillColor(kRed)
root [2] h->FillRandom("gaus");
root [3] h->Draw()
1 Like
couet
8
can you show me your code ?
Now I am not getting that error anymore because “-” was used two times but now still colors are not changing.
couet
11
Well, kBlack
works for me. Can you post here a small macro reproducing your problem ?
1 Like
couet
12
Please post the reproducer here. Note that what you send me privately does not work. I do not have the root files the macro is using.
1 Like
I solved my that problem about colors.
system
Closed
14
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.