Legend display for bubble sizes in geom_point

オープン
#943 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

ファイル、テスト、コードのエントリーポイントについては何も言及されていません。まず、サイズを var1 にマッピングした、提供されている plotnine geom_point の例を再現し、次にその連続サイズ用の凡例がどのように設定されているかを調べてください。凡例で入れ子になった円を表示しつつ、マッピングされたサイズのラベルを維持できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Extensions

Hello - thanks again for your great work to implement ggplot2 functionality in Python!

My question is about an enhancement to the legend created when drawing a geom_point() plot with a size mapped to a continuous variable. Here's a minimal demo example:

import polars as pl
import plotnine as p9
import numpy as np

rng = np.random.default_rng(12345)
n=150

df = pl.DataFrame({
    "x": 10 * rng.random(size=n),
    "y": 5 * rng.random(size=n),
    "var1": 100 * rng.random(size=n),
})

(
    p9.ggplot(df, p9.aes("x", "y", size="var1"))
    + p9.geom_point(color='black', fill='white')
)

which creates the following plot with point sizes mapped to var1.

Image

All good so far, but I'd like to show the legend entries as nested circles, rather than the conventional stacked style as shown on the plot. The nested style is not only aesthetically pleasing but makes the relative sizes easier to compare. I have seen this style of legend used in The Economist and The Wall Street Journal as well as other publications. (see example below)

Image

Not sure if ggplot2 offers this out of the box, but think this would be a nice feature!

Thanks

主要言語
Python
スター
4.8k
フォーク
269
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

has2k1/plotnine のほかの issue

has2k1/plotnine の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。