MAIF / shapash

🔅 Shapash: User-friendly Explainability and Interpretability to Develop Reliable and Transparent Machine Learning Models
https://maif.github.io/shapash/
Apache License 2.0
2.73k stars 334 forks source link

Dynamic Title Height Adjustment for Feature Importance Plot #607

Closed guillaume-vignal closed 1 week ago

guillaume-vignal commented 1 week ago

Fixes: #606

Description:
This PR introduces the adjust_title_height function to dynamically position the title in feature importance plots based on the specified figure height. This adjustment helps prevent title overlap with the plot content when custom figure heights are used.

Changes Made:

How It Works:

The function calculates the title’s height relative to a default figure height of 500 pixels using the formula:

1 - 0.1 * 500 / figure_height

The resulting value positions the title proportionally higher for smaller figures and closer to the plot for larger figures, ensuring adaptability for various figure sizes.

Steps to Test:

  1. Create a feature importance plot and set different figure heights.
  2. Observe that the title adjusts its position based on the figure height, reducing overlap with the plot content.