To plot the y-axis in log scale and the x-axis in linear scale, you can uncomment the
// gPad->SetLogy()
line in my code. You will get an error running this, as you will be asking ROOT to plot the log of a negative number, which is incalculable with real numbers only. (TMath::Log(-1) = nan)
Here is an example that generates a plot of a function of my own choosing in semi-log axes. The values that I am plotting are always positive, which allows the log scale to work, as all points in the plot have mathematically-real numerical values.
void codeForTHESCIENTIST(){
TCanvas *c = new TCanvas();
double_t x;
double_t L = 50;
TF1* f1 = new TF1("f1", "TMath::Exp(-1.*x + 15) + TMath::Exp(-.05*x)", 0, 50);
f1->SetParameter(0, L);
f1->SetLineColor(kBlue+2);
f1->SetTitle("Title; X-axis; Y-axis");
f1->Draw();
gPad->SetLogy();
}
I believe the glitch you mention is that the axis tick-marks are overlapping, leading to the appearance of a solid black bar. Notice how the range is some ~300 orders of magnitude. I’d recommend setting a smaller range of the y-axis that you’re most interested in, so you aren’t squishing the axis tick-marks together.