ROOT
v6-36
Reference Guide
Loading...
Searching...
No Matches
gr006_scatter.py
Go to the documentation of this file.
1
## \file
2
## \ingroup tutorial_graphs
3
## \notebook
4
## \preview Draw a scatter plot for 4 variables, mapped to: x, y, marker colour and marker size.
5
##
6
## TScatter is available since ROOT v.6.30. See the [TScatter documentation](https://root.cern/doc/master/classTScatter.html)
7
##
8
## \macro_image
9
## \macro_code
10
## \author Olivier Couet, Jamie Gooding
11
12
import
numpy
as
np
13
import
ROOT
14
15
canvas =
ROOT.TCanvas
()
16
canvas.SetRightMargin
(0.14)
17
ROOT.gStyle.SetPalette
(
ROOT.kBird
, 0, 0.6)
# define a transparent palette
18
19
n = 175
20
21
x =
np.array
([])
22
y =
np.array
([])
23
c =
np.array
([])
24
s =
np.array
([])
25
26
# Define four random data sets
27
r =
ROOT.TRandom
()
28
for
i
in
range
(n):
29
x =
np.append
(x, 100 *
r.Rndm
(i))
30
y =
np.append
(y, 200 *
r.Rndm
(i))
31
c =
np.append
(c, 300 *
r.Rndm
(i))
32
s =
np.append
(s, 400 *
r.Rndm
(i))
33
34
scatter =
ROOT.TScatter
(n, x, y, c, s)
35
scatter.SetMarkerStyle
(20)
36
scatter.SetTitle
(
"Scatter plot titleX titleY titleZ title"
)
37
scatter.GetXaxis
().SetRangeUser(20.0, 90.0)
38
scatter.GetYaxis
().SetRangeUser(55.0, 90.0)
39
scatter.GetZaxis
().SetRangeUser(10.0, 200.0)
40
scatter.Draw
(
"A"
)
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
tutorials
visualisation
graphs
gr006_scatter.py
ROOT v6-36 - Reference Guide Generated on Wed Aug 20 2025 04:40:04 (GVA Time) using Doxygen 1.10.0