matplotlib / matplotlib/matplotlib

[Bug]: Log scaled barplots in PDF result in infinite rectangles

未關閉
#28,175 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

backend: pdf
主要語言
Python
星號
23.2k
分支
8.5k
平均合併
1 天 6 小時
30 天內合併 PR
66

描述

### Bug summary

When saving log scaled barplots as PDFs, the bars get saved as rectangles with infinite size.
Log_scale_barplot

### Code for reproduction

```Python
import matplotlib.pyplot as plt
import numpy as np

categories = ['A', 'B', 'C', 'D', 'E']
values = [800, 1200, 2000, 3000, 5000]

plt.bar(categories, values)
plt.yscale('log')
plt.savefig('Log_scale_barplot.pdf')
```

### Actual outcome

Rectangles with infinite size

### Expected outcome

Rectangles size capped at axis

### Additional information

_No response_

### Operating system

Linux, OS/X

### Matplotlib Version

3.8.4

### Matplotlib Backend

_No response_

### Python version

_No response_

### Jupyter version

_No response_

### Installation

None

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,使用 Matplotlib 的 PDF 儲存路徑執行提供的 Python 重現程式碼,並檢查 PDF 繪製期間如何處理對數縮放的長條矩形。將產生的矩形與預期的座標軸邊界進行比較,然後新增回歸測試,表明其大小會被限制在座標軸範圍內,而不會變成無限大。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
data-visualization
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。