TScatter Drawing nothing with legacy cocoa?


root develop
Info in : ROOT: Rint, ver: 6.29/01,
build time: 20230731 2159, tversion 1150


the code like below

#include <TCanvas.h>
#include <TScatter.h>

void scatter6()
{
	TCanvas * c1 = new TCanvas();
	c1->Divide(3);
	{
		c1->cd(1);
		const int n = 1;
		double x[1] = {-15.75};
		double y[1] = {-57.75};
		double c[1] = {14691.8};
		double s[1] = {1.36173};// change the size here
		TScatter * s1 = new TScatter(n, x, y, c, s);
		s1->SetMarkerStyle(kFullCircle);
		s1->SetMarkerColor(kBlue);
		s1->SetMaxMarkerSize(1.36);
		s1->SetMinMarkerSize(1.46);
		auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
		s1->Draw("P");
	}
	{
		c1->cd(2);
		const int n = 2;
		double x[2] = {-15.75, 0};
		double y[2] = {-57.75, 0};
		double c[2] = {14691.8, 1.1};
		double s[2] = {1.36173, 3.3};// change the size here
		TScatter * s1 = new TScatter(n, x, y, c, s);
		s1->SetMarkerStyle(kFullCircle);
		s1->SetMarkerColor(kBlue);
		s1->SetMaxMarkerSize(1.36);
		s1->SetMinMarkerSize(4.4);
		auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
		s1->Draw("P");
	}
	{
		c1->cd(3);
		const int n = 2;
		double x[2] = {-15.75, 0};
		double y[2] = {-57.75, 0};
		double c[2] = {14691.8, 1.1};
		double s[2] = {1.36173, 1.36173};// change the size here
		TScatter * s1 = new TScatter(n, x, y, c, s);
		s1->SetMarkerStyle(kFullCircle);
		s1->SetMarkerColor(kBlue);
		s1->SetMaxMarkerSize(1.36);
		s1->SetMinMarkerSize(4.4);
		auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
		s1->Draw("P");
	}
}

If I use default root --web=on
it show fine,

but if I use root --web=off or try to compile with root in my own project.
the fig1 and fig3 show nothing


it seems the old cocoa cannot find the correct range of size of markers.
Is that a bug or
How can I compile my own project with TScatter root?

It might be because you have only one point or 2 equal. That’s a bug. I am on it.

It does not help to change it, but note you set the Max Marker Size smaller than the Min one.

The bug is now fixed by this PR

I cleaned up a bit your code. Now it is:

void scatter6()
{
   auto C = new TCanvas();
   C->Divide(3,1);
   {
      C->cd(1)->SetGrid();
      const int n = 1;
      double x[n] = {-15.75};
      double y[n] = {-57.75};
      double c[n] = {14691.8};
      double s[n] = {1.36173};
      auto S = new TScatter(n, x, y, c, s);
      S->SetMarkerStyle(kFullCircle);
      S->SetMinMarkerSize(1.36);
      S->SetMaxMarkerSize(1.46);
      gPad->DrawFrame(-80, -80, 80, 80);
      S->Draw();
   }
   {
      C->cd(2)->SetGrid();
      const int n = 2;
      double x[n] = {-15.75, 0};
      double y[n] = {-57.75, 0};
      double c[n] = {14691.8, 1.1};
      double s[n] = {1.36173, 3.3};
      auto S = new TScatter(n, x, y, c, s);
      S->SetMarkerStyle(kFullCircle);
      S->SetMinMarkerSize(1.36);
      S->SetMaxMarkerSize(4.4);
      gPad->DrawFrame(-80, -80, 80, 80);
      S->Draw();
   }
   {
      C->cd(3)->SetGrid();
      const int n = 2;
      double x[n] = {-15.75, 0};
      double y[n] = {-57.75, 0};
      double c[n] = {14691.8, 1.1};
      double s[n] = {1.36173, 1.36173};
      auto S = new TScatter(n, x, y, c, s);
      S->SetMarkerStyle(kFullCircle);
      S->SetMinMarkerSize(1.36);
      S->SetMaxMarkerSize(4.4);
      gPad->DrawFrame(-80, -80, 80, 80);
      S->Draw();
   }
}

and it gives (with non-web root):

Thanks to have seen this problem !

thanks
By the way, if I choose to build my program with ROOT,
Does it always use the old cocoa library for plotting?

Cocoa is there but the default when you isnatll the master version is now Web. You should turn it off if you always want Cocoa. Details here: Interactive, web-based canvas is now the default in ROOT - ROOT

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.