# Marker size according to data points

**URL:** <https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949>\
**Category:** Newbie\
**Created:** [February 12, 2020, 7:46pm UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949 "2020-02-12T19:46:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wellatiger](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wellatiger/32/15619_2.png) [@wellatiger](https://root-forum.cern.ch/u/wellatiger)\
**Post date:** [February 12, 2020, 7:46pm UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949/1 "2020-02-12T19:46:46Z")

</div>

Dear experts,

Is it possible to draw a graph where the each data point has a different size!?  
As can be done in pyplot scatter plot.

[pyplot|662x500](https://root-forum.cern.ch/uploads/short-url/2xrRGpU1d9SiYAjE57IiIhMxLC1.png)

Thank you in advance,

* * *

---

<div class="post-metadata">

**Author:** ![pamputt](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pamputt/32/12526_2.png) [@pamputt](https://root-forum.cern.ch/u/pamputt)\
**Post date:** [February 12, 2020, 8:53pm UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949/2 "2020-02-12T20:53:47Z")

</div>

To achieve such plot, I would say you should define a TMultigraph that includes several TGraph. Each TGraph with a SetMarkerSize with a different value. I did not try but it should work.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [February 13, 2020, 9:13am UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949/3 "2020-02-13T09:13:54Z")

</div>

ROOT is fexlible enough to produce easily a such plot with a simple macro.  
In [graphsizemarker.C](https://root-forum.cern.ch/uploads/short-url/kVurC4QB0yqROm92pbMVgfZEAQr.C) (503 Bytes) I wrote a small generic function doing that. You can copy and use it in your code.

 ![39](https://root-forum.cern.ch/uploads/default/original/3X/6/5/65565e6d2697cda33aa8d2784abf32896e72a1f7.jpeg)

---

<div class="post-metadata">

**Author:** ![wellatiger](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wellatiger/32/15619_2.png) [@wellatiger](https://root-forum.cern.ch/u/wellatiger)\
**Post date:** [February 13, 2020, 9:40am UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949/4 "2020-02-13T09:40:39Z")

</div>

Many thanks for the suggestion and the code

---

<div class="post-metadata">

**Author:** ![OSchaile](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/o/e495f1/32.png) [@OSchaile](https://root-forum.cern.ch/u/OSchaile)\
**Post date:** [February 13, 2020, 11:00am UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949/5 "2020-02-13T11:00:55Z")

</div>

Hi,  
in case you want to profit of a real TGraph (fitting etc)  
you can do the att trick:  
[graph\_var\_points.C](https://root-forum.cern.ch/uploads/short-url/nrpVIBbMatN6CLtzrfzSDuEB4lV.C) (678 Bytes)  
Draw an invisible graph and overlay with markers of your choice.

Otto

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [February 13, 2020, 12:13pm UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949/6 "2020-02-13T12:13:29Z")

</div>

Thanks Otto. This one makes it a bit more modular. [graph\_var\_points.C](https://root-forum.cern.ch/uploads/short-url/q0LzHPVdZk7Be3CKmLHSo6cYogG.C) (883 Bytes)

 ![20](https://root-forum.cern.ch/uploads/default/original/3X/c/9/c9ded44c2f87fa3aa32ef820a448df57581cc3ae.jpeg)

---

<div class="post-metadata">

**Author:** ![wellatiger](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wellatiger/32/15619_2.png) [@wellatiger](https://root-forum.cern.ch/u/wellatiger)\
**Post date:** [February 13, 2020, 7:09pm UTC](https://root-forum.cern.ch/t/marker-size-according-to-data-points/37949/7 "2020-02-13T19:09:40Z")

</div>

Interesting, Many thanks
