Regarding the canvas and plotting of graphs

whenever i try to plot a graph in root it looks like this. I ran a slit code which was on root primer and got this
ROOT Version: 6.26/10
Platform: Ubuntu 22
Compiler: Not Provided


Really weird, can you post the macro you are running ? and also the command you type to run it ?

I am using the sample fnslit code that is written in the root primer,

// Example drawing the interference pattern of light
// falling on a grid with n slits and ratio r of slit
// width over distance between slits.

auto pi = TMath::Pi();

// function code in C
double single(double *x, double *par) {
  return pow(sin(pi*par[0]*x[0])/(pi*par[0]*x[0]),2);
}

double nslit0(double *x,double *par){
  return pow(sin(pi*par[1]*x[0])/sin(pi*x[0]),2);
}

double nslit(double *x, double *par){
  return single(x,par) * nslit0(x,par);
}

// This is the main program
void slits() {
  float r,ns;

  // request user input
  cout << "slit width / g ? ";
  scanf("%f",&r);
  cout << "# of slits? ";
  scanf("%f",&ns);
  cout <<"interference pattern for "<< ns
       <<" slits, width/distance: "<<r<<endl;

  // define function and set options
  TF1 *Fnslit  = new TF1("Fnslit",nslit,-5.001,5.,2);
  Fnslit->SetNpx(500);

  // set parameters, as read in above
  Fnslit->SetParameter(0,r);
  Fnslit->SetParameter(1,ns);

  // draw the interference pattern for a grid with n slits
  Fnslit->Draw();
}


In your first post I find: *Platform:* Ubuntu 22
In your last post I find that you try to use ROOT built with: “c++ (Ubuntu ... 20.04 ...) 9.4.0”.
They will not play together.

You need ROOT binaries built for your system / compiler.