Mathtext rendering fails with Matplotlib 3.11: glyph tuples now contain six fields
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
調査の方向性
Start by tracing how mplcairo handles MathTextParser("path").parse(...).glyphs and compare its expected tuples with Matplotlib 3.11's six-field tuples. Use the reproducer to confirm the rendering failure, then check both canvas drawing and MultiPage PDF output. Done means the mathtext annotation renders and multipage saving succeeds with Matplotlib 3.11.
索引モデルが issue の本文から書いたものです。
説明
Bug summary
Rendering a figure containing mathtext with mplcairo 0.6.1 and
Matplotlib 3.11.2 fails with a C++ type-casting error. This also
affects saving such figures with mplcairo.multipage.MultiPage.
Reproducer
import matplotlib
matplotlib.use("module://mplcairo.base")
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2])
ax.annotate(r"$\sigma_f=1.4\times 10^{-8}$", (1, 1))
fig.canvas.draw()
Actual result
RuntimeError: Unable to cast Python instance of type <class 'tuple'>
to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or
compile in debug mode for details)
Expected result
The figure renders with the mathtext annotation.
Likely cause
Matplotlib 3.11 added a glyph index to each tuple in
MathTextParser("path").parse(...).glyphs. The tuples now contain:
(font, fontsize, character_code, glyph_index, x, y)
The mplcairo renderer appears to cast each tuple to the previous
five-field form. Matplotlib documents the change here:
As a local experiment, adapting the parser result to remove the added
glyph-index field allowed both canvas rendering and multipage PDF
output to complete. This was a compatibility experiment, not a
tested upstream patch.
Environment
Python: 3.15.2
Matplotlib: 3.11.2
mplcairo: 0.6.1
Fedora Linux 45
- 主要言語
- C++
- スター
- 120
- フォーク
- 23
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
matplotlib/mplcairo のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
matplotlib/mplcairo#55 · コメント 18 件 ·
-
workaround for low dpi when rasterizing (pcolormesh saved as pdf)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
matplotlib/mplcairo#19 · コメント 5 件 ·
matplotlib/mplcairo の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
simnJS/AnyPS5#735 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:tests kind:test
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
? - Needs Triage bot_watch bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/cudf-spark-jni#5594 ·
メンテナーはふだん 1 日以内に返信
-
Branch-master
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TrinityCore/TrinityCore#32177 ·
メンテナーはふだん 10 日以内に返信