Could TScatter support fixed size without auto scatter size


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


Hi all, I need to plot a set of Graph with TScatter, I need to set all Graphs with the same scatter.
the TScatter seems to auto scatter the marker size when drawing.
further more, some of my TScatter has only 1 points, how can I set the size.
code like below

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

void scatter5()
{
	const int n = 2;
	double x[2] = {0,10};
	double y[2] = {0,10};
	double c[2] = {1874.1, 1888};
	double s[2] = {2,10};// change the size here
	TScatter * s1 = new TScatter(n, x, y, c, s);
	s1->SetMarkerStyle(kFullCircle);
	s1->SetMarkerSize(1);
	s1->SetMaxMarkerSize(3); //set auto scatter drawing size
	s1->SetMinMarkerSize(1);
	//s1->SetScale(2);
	s1->Print();
	new TCanvas();
	auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
	s1->Draw("P");
}

What do you mean ? the “same scatter” ?

I’ve multi TScatters, I need to draw them with same scatter marker size,
for example scatter[1] has size {1, 2}, scatter[2] has marker size{2, 4},
but when I draw them, they auto scatter and looks like the same.
I want to set scatter[2] points larger than scatter[1]

Simply do not specify the marker size:

void scatter5()
{
   const int n = 2;
   double x[2] = {0,10};
   double y[2] = {0,10};
   double c[2] = {1874.1, 1888};
   TScatter * s1 = new TScatter(n, x, y, c);
   s1->SetMarkerStyle(kFullCircle);
   s1->SetMarkerSize(1);
   s1->SetMaxMarkerSize(3); //set auto scatter drawing size
   s1->SetMinMarkerSize(1);
   new TCanvas();
   auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
   s1->Draw();
}

I need.
picture 1

{
   const int n = 2;
   double x[2] = {0,10};
   double y[2] = {0,10};
   double c[2] = {1874.1, 1888};
   double s[2] = {1,2};
   TScatter * s1 = new TScatter(n, x, y, c);
   s1->SetMarkerStyle(kFullCircle);
   s1->SetMaxMarkerSize(2);
   s1->SetMinMarkerSize(1);
}

and picture2

{
   const int n = 2;
   double x[2] = {0,10};
   double y[2] = {0,10};
   double c[2] = {1874.1, 1888};
   double s[2] = {2,4};
   TScatter * s1 = new TScatter(n, x, y, c);
   s1->SetMarkerStyle(kFullCircle);
   s1->SetMaxMarkerSize(4); //must change this to set it larger than picture 1
   s1->SetMinMarkerSize(2);
}

I must change with SetMaxMarkerSize and SetMinMarkerSize .
Or the pic1 and pic2 looks like the same, because the Scatter will auto scatter the size of each marker.
can I set the feature OFF.

If the marker size is not specify in an array as the 4th variable, the markers are drawn with the value given by SetMarkerSize:

void scatter5()
{
   const int n = 2;
   double x[2] = {0,10};
   double y[2] = {0,10};
   double c[2] = {1874.1, 1888};
   TScatter * s1 = new TScatter(n, x, y, c);
   s1->SetMarkerStyle(kFullCircle);
   s1->SetMarkerSize(5);
   new TCanvas();
   auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
   s1->Draw();
}

Sorry for not describing clearly.
I mean I need the picture like below

	{
		c1->cd(1);
		const int n = 2;
		double x[2] = {0,10};
		double y[2] = {0,10};
		double c[2] = {1874.1, 1888};
		double s[2] = {2,4};// change the size here
		TScatter * s1 = new TScatter(n, x, y, c, s);
		s1->SetMarkerStyle(kFullCircle);
		s1->SetMaxMarkerSize(4);
		s1->SetMinMarkerSize(2);
		auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
		s1->Draw("P");
	}
	{
		c1->cd(2);
		const int n = 2;
		double x[2] = {0,10};
		double y[2] = {0,10};
		double c[2] = {1874.1, 1888};
		double s[2] = {1,2};// change the size here
		TScatter * s1 = new TScatter(n, x, y, c, s);
		s1->SetMarkerStyle(kFullCircle);
		s1->SetMaxMarkerSize(2);
// I must set one-by-one each picture.
		s1->SetMinMarkerSize(1);
		auto hf =  gPad->DrawFrame(-80, -80, 80, 80);
		s1->Draw("P");
	}

If I don’t set SetMaxMarkerSize, the drawing will auto scatter with max and min.
so what I want is to disable the auto scatter feature. without calculate the max and min size one-by-one.

So you have the marker size as 4th variable for both plots. In that case, the size of the marker will go from SetMinMarkerSize to SetMaxMarkerSize… that’s the marker size dynamic like you have the color dynamic as the color map for the colors. The value you give in the size array will be mapped on this integer range.

I found the problem of my code, it was a misunderstanding for me.
but if I use compiled code with ROOT, it shows some errors.
I create a new topic.

I am looking sate this other post

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