# The figure is not fully displayed

**URL:** <https://discuss.flower.ai/t/the-figure-is-not-fully-displayed/769>\
**Category:** Flower Help - Beginners\
**Tags:** flower, datasets\
**Created:** [March 3, 2025, 8:27am UTC](https://discuss.flower.ai/t/the-figure-is-not-fully-displayed/769 "2025-03-03T08:27:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harrow](https://avatars.discourse-cdn.com/v4/letter/h/3da27b/32.png) [@harrow](https://discuss.flower.ai/u/harrow)\
**Post date:** [March 3, 2025, 8:27am UTC](https://discuss.flower.ai/t/the-figure-is-not-fully-displayed/769/1 "2025-03-03T08:27:41Z")

</div>

The figure is not fully displayed. When I was conducting the Visualize Label Distribution experiment([Visualize Label Distribution - Flower Datasets 0.5.0](https://flower.ai/docs/datasets/tutorial-visualize-label-distribution.html)), I found that the final result’s graph was not fully displayed. Why?  
Here is my code and the result of running it on pycharm.

 ![图片](https://europe1.discourse-cdn.com/flex013/uploads/flower/original/1X/2b0d281342c6f50b22c8ee71190826ac23b93cfe.png)

```auto
from flwr_datasets import FederatedDataset
from flwr_datasets.partitioner import DirichletPartitioner
from flwr_datasets.visualization import plot_label_distributions

fds = FederatedDataset(
    dataset='cifar10',
    cache_dir='./Datasets',
    partitioners={
        'train': DirichletPartitioner(
            num_partitions=10,
            partition_by='label',
            alpha=0.3,
            seed=42,
            min_partition_size=0,
        ),
    },
)

partitioner = fds.partitioners['train']
fig, ax, df = plot_label_distributions(
    partitioner,
    label_name='label',
    plot_type='bar',
    size_unit='absolute',
    partition_id_axis='x',
    legend=True,
    title="Per Partition Label Distribution",
    verbose_labels=True,
)
fig.show()
fig.savefig('label_distribution.png')

```

---

<div class="post-metadata">

**Author:** ![javier](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/javier/32/116_2.png) [@javier](https://discuss.flower.ai/u/javier)\
**Post date:** [March 3, 2025, 9:44am UTC](https://discuss.flower.ai/t/the-figure-is-not-fully-displayed/769/2 "2025-03-03T09:44:42Z")

</div>

Hello @harrow, you’ll need to slightly tweak your `fig.savefig()` line like this:

```python
fig.savefig('label_distribution.png', bbox_inches="tight")

```

In this way, the entire figure as displayed with the `fig.show()` will be saved to disk. Does it work for you?

---

<div class="post-metadata">

**Author:** ![harrow](https://avatars.discourse-cdn.com/v4/letter/h/3da27b/32.png) [@harrow](https://discuss.flower.ai/u/harrow)\
**Post date:** [March 4, 2025, 5:34am UTC](https://discuss.flower.ai/t/the-figure-is-not-fully-displayed/769/3 "2025-03-04T05:34:10Z")

</div>

It was indeed worked. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/flower/original/1X/bc7fe36843c391cbd0b4e8b6f48275961d356abc.png) [@system](https://discuss.flower.ai/u/system)\
**Post date:** [March 11, 2025, 5:35am UTC](https://discuss.flower.ai/t/the-figure-is-not-fully-displayed/769/4 "2025-03-11T05:35:01Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
