3The `
TScatter` 
class in 
PyROOT can be used to create and visualize scatter plots dynamically. By integrating with NumPy, it allows efficient 
data management and customization.
 
    72. **
Visual Customization**: Adjust marker styles, 
colors, and titles to tailor the visualization.
 
    83. **Canvas 
Layout Control**: Configure canvas margins to ensure that titles and axes are displayed without clipping.
 
    94. **Exporting Plots**: 
Save scatter plots in various formats (e.g., `.png`, `.pdf`) 
for further use.
 
   12Below is 
a Python example demonstrating the use of `
TScatter`:
 
   18# Create a TCanvas and configure margins
 
   19canvas = ROOT.TCanvas("c1", 
"Scatter Plot Example", 800, 600)
 
   20# Margins (left, right, bottom, top) to adjust the canvas layout and prevent clipping of titles or axis labels.
 
   23# Define the number of data points 
   26# Generate arrays for x, y coordinates and optional metadata 
   27x = 100*
np.random.rand(
n)
 
   28y = 200*
np.random.rand(
n)
 
   29c = 300*
np.random.rand(
n)  # Optional: 
Color or other metadata
 
   30s = 400*
np.random.rand(
n)  # Optional: 
Size or other metadata
 
   32# Create a TScatter object with the data 
   33scatter = 
ROOT.TScatter(
n, 
x, 
y, 
c, s)
 
   35# Customize the plot's appearance 
   36scatter.SetMarkerStyle(20) # Set marker 
style 
   37scatter.SetMarkerColor(4)  # Set marker color
 
   38scatter.SetTitle(
"Scatter plot title;X title;Y title;Z title")  # Set 
plot and axis titles
 
   39scatter.GetZaxis().SetTitleSize(0.04)  # Modify the title 
size 
   40scatter.GetZaxis().SetTitleOffset(1.0)  # Adjust the z-axis title 
offset 
   42# Draw the scatter plot 
   43scatter.Draw(
"AP")  # 
"A" for Axis, 
"P" for Points
 
   45# Save the scatter plot to a file 
   46canvas.SaveAs(
"scatter_plot_example.png")
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
winID h TVirtualViewer3D TVirtualGLPainter char TVirtualGLPainter plot
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
 
A TScatter is able to draw four variables scatter plot on a single plot.
 
void SetMargin(Double_t)
Set the margin around the plot in %.
 
RooCmdArg Color(TColorNumber color)
 
RooCmdArg Layout(double xmin, double xmax=0.99, double ymin=0.95)
 
RooCmdArg Save(bool flag=true)