C/C++ Why isn't my code producing a graph with a log scale in C++?

  • Thread starter Thread starter lavster
  • Start date Start date
  • Tags Tags
    C++ Scale
AI Thread Summary
The discussion revolves around a coding issue related to displaying a graph with a logarithmic scale using the ROOT framework from CERN. The user successfully generates the desired graph but struggles to implement the log scale despite trying various methods. The provided code snippet indicates that the user is attempting to set the y-axis to a logarithmic scale with the command `c->SetLogy(1)`, but it does not seem to work as expected. Other participants clarify that the functions being used are part of the ROOT package, not standard C++. They suggest checking the ROOT documentation and forums for further assistance, emphasizing the importance of understanding the specific library being utilized.
lavster
Messages
213
Reaction score
0
can someone tell me what is wrong with my code. i get the graph that i want but not with the log scale... i have tried multiple methods. this is the last one i tried (its part of a canvas which is split into quadrants)

TH1F* h3 = (TH1F*) inputfile3 -> Get("pdg");
c->cd(3);
h3->GetXaxis()->SetTitle("pdg code (high)");
h3->Draw();

c->Modified();
c->Update();
c->SetLogy(1);
c->Modified();

and then onto other quadrant...

thanks :)
 
Technology news on Phys.org
Which library or package are these from? They're not part of the standard C++ language.
 
sorry i don't quite understand your question (my understanding of comp is very limited). ROOT? and I've called them the histograms from another .C macros thing

thanks
 
I did a Google search for some of the function names. You're using the ROOT package from CERN. They have a whole website about ROOT:

http://root.cern.ch/drupal/

It includes a forum, where you might try asking your question if you can't find your answer in the documentation or a FAQ:

http://root.cern.ch/phpBB3/
 
Last edited:
ill have a look - cheers!
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top