# Reduce font size for TMVA Gui correlation matrices?

**URL:** <https://root-forum.cern.ch/t/reduce-font-size-for-tmva-gui-correlation-matrices/31703>\
**Category:** TMVA\
**Created:** [November 21, 2018, 10:00am UTC](https://root-forum.cern.ch/t/reduce-font-size-for-tmva-gui-correlation-matrices/31703 "2018-11-21T10:00:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![afray](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@afray](https://root-forum.cern.ch/u/afray)\
**Post date:** [November 21, 2018, 10:00am UTC](https://root-forum.cern.ch/t/reduce-font-size-for-tmva-gui-correlation-matrices/31703/1 "2018-11-21T10:00:51Z")

</div>

Hi all,

Is there a simple way to reduce the axis label and bin text size on the correlation matrices created by the TMVA Gui? If I train a BDT with a large number of variables, when I plot the variable correlation matrices, the labels overlap on the x-axis, and the bin labels overlap adjacent bins.

I’ve tried writing my own script to produce the correlation matrices but in my TMVA.root file, the TH2F CorrelationMatrixB looks to be empty by default - I presume it is filled with correlation coefficients by a script separate to correlation.cxx, but I’m not sure which one. If you could point me to that, that would also help 🙂

Cheers,  
Antony

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [November 21, 2018, 3:17pm UTC](https://root-forum.cern.ch/t/reduce-font-size-for-tmva-gui-correlation-matrices/31703/2 "2018-11-21T15:17:30Z")

</div>

Hi,

As you deduced, the data of the matrix is not stored with the ROOT file, but is dynamically filled by correlation.cxx.

To change the look of the plot you can do this (in a script or interactive session):

```auto
TString datasetname = "<name>";
TString filepath = "/path/to/TMVA.root";
TString isRegression = false; // If classification
TMVA::correlations(datasetname, filepath, isRegression, true, true);
TCanvas & c = *dynamic_cast<TCanvas *>(gROOT->FindObject("CorrelationMatrixS"));
TH2F & h2 = *(TH2F *)c.GetPrimitive("CorrelationMatrixS")

// TODO: Change size of labels

c.Draw();

```

Note that the canvas and the contained histogram has the same name `CorrelationMatrixS` and `CorrelationMatrixB` for classification and `CorrelationMatrix` for regression.

Using this it should be fairly straight forward to change what you want. Please let me know if you need some more help.

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![afray](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@afray](https://root-forum.cern.ch/u/afray)\
**Post date:** [November 22, 2018, 2:30pm UTC](https://root-forum.cern.ch/t/reduce-font-size-for-tmva-gui-correlation-matrices/31703/3 "2018-11-22T14:30:02Z")

</div>

That’s worked perfectly, thank you very much!

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [November 22, 2018, 4:15pm UTC](https://root-forum.cern.ch/t/reduce-font-size-for-tmva-gui-correlation-matrices/31703/4 "2018-11-22T16:15:54Z")

</div>

Hi, please mark the post as solved to help other wondering about similar things 🙂

Cheers,  
Kim
