Allow to use a non fixed axes formatter
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
まず plotnine/_mpl/ticker.py の固定 formatter と、それが plotnine/facets/facet.py からどのように適用されるかを読みます。ggplot の描画フローと、plot.draw()、plot.show()、および figure が公開する axes の相互作用を追跡します。これにより、ユーザーは AutoLocator や EngFormatter などの Matplotlib の locator と formatter を適用でき、monkey-patching で ggplot を変更せずに、ズーム時に ticks が適切に更新されるようにします。
索引モデルが issue の本文から書いたものです。
説明
Hello,
I am a Python user that came from using plain Matplotlib (not an R user switching to Python). I noticed today that if I take e.g this plot:
And zoom in:
The x & y ticks are fixed! I tried to figure out from reading the code whether I can change this, and I encountered this in plotnine's code:
Which is used here:
I am not sure whether the graphics grammar allows modifying this behavior, but I won't mind doing it via Matplotlib's native functions. However, that turned out to be hard and frustrating, as plot.draw() returns a figure, but I can't modify the axes of it. Here's something I tried:
from matplotlib.ticker import (
EngFormatter,
AutoLocator,
)
for ax in plot.draw(show=False).axes:
ax.xaxis.set_major_locator(AutoLocator())
ax.yaxis.set_major_locator(AutoLocator())
ax.xaxis.set_major_formatter(EngFormatter())
ax.yaxis.set_major_formatter(EngFormatter())
plot.show() # Also tried `matplotlib.pyplot.show()` here too.
And it doesn't show anything. As a side note, this made me wonder: What is the benefit in returning the figure if it cannot be manipulated afterwards with plain-old Matplotlib? This is related of course to:
Anyway, I managed to workaround this with the following ugly monkey-patching of ggplot class:
from matplotlib.ticker import (
EngFormatter,
AutoLocator,
)
ggplot_original__draw_breaks_and_labels = ggplot._draw_breaks_and_labels
def ggplot__draw_breaks_and_labels_with_my_ax_manipulation(self):
ggplot_original__draw_breaks_and_labels(self)
for ax in self.axs:
ax.xaxis.set_major_formatter(EngFormatter(unit="Hz"))
ax.yaxis.set_major_formatter(EngFormatter(unit="Hz"))
ax.xaxis.set_major_locator(AutoLocator())
ax.yaxis.set_major_locator(AutoLocator())
ggplot._draw_breaks_and_labels = ggplot__draw_breaks_and_labels_with_my_ax_manipulation
Not sure why the ticks are located in fixed positions just due to the major_formatter set above, but for sure the AutoLocator is needed too.
- 主要言語
- Python
- スター
- 4.8k
- フォーク
- 260
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
has2k1/plotnine のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
Enhancement
難易度 3/5 半日 初心者へのやさしさ 55/100
has2k1/plotnine#1141 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Discussion
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
has2k1/plotnine#1047 · コメント 15 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Documentation Plot Composition Question
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
has2k1/plotnine#1036 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Installation Plot Composition
難易度 1/5 1時間未満 初心者へのやさしさ 20/100
has2k1/plotnine#1031 · リアクション 11 件 ·
メンテナーはふだん 1 日以内に返信
has2k1/plotnine の issue をすべて見る
似ている issue
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mealie-recipes/mealie#9117 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
freelawproject/courtlistener#8406 ·
メンテナーはふだん 2 日以内に返信
-
good first issue help wanted level 1 wocs
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
GianlucaBave/murmury#49 ·
メンテナーはふだん 1 日以内に返信
-
regression skipped skipped_bmg
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
intel/torch-xpu-ops#6142 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
good first issue help wanted python up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
andrewsiah/agentswarm-data-tasks#122 ·
メンテナーはふだん 1 日以内に返信