Skip to main content
100%

Proposed way to set label-sizes for datamapplot with pylabeladjust.

✓ Published0🌍 Public
MMNoichl
Last edited Apr 27, 2024
Created on Apr 27, 2024

This example shows a proposed method for scaling label text size and weight in a datamapplot visualization. It first wraps long labels using `textwrap.fill` for readability, then maps a count column to font sizes between 3 and 28 points using `MinMaxScaler` from scikit-learn, applying a 0.9 power rescaling to compress the range. Additionally, it sets labels to bold when their count exceeds the 80th percentile, using NumPy's `percentile`. The code relies on pandas for DataFrame manipulation and requires a pre-existing data frame with 'label' and 'count' columns.

AI-generated description

Similar vizzes