Allow stacked bars for data containing negative y-values in `type_barplot()`

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
67/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
r

調査の方向性

type_barplot() と警告で示されている settings$type_data() の経路から始め、負の y 値を使用した積み上げ棒グラフの例を再現します。負の値によって beside モードが強制され、警告なしで結果が積み上げ動作を維持する仕組みを、ggplot2 の例と一致するように追跡します。

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

説明

When plotting a stacked bar chart with negative values, tinyplot doesn't stack them the way ggplot2 does for example. Currently for data that contains negative y-values the following warning is shown:

Warning message:
In settings$type_data(settings, ...) :
  'beside' must be TRUE if there are negative 'y' values

and the bars are put beside. For some data it would make sense to show the bars stacked even if some values are negative (e.g. balances like below):

rm(list = ls())

library(tinyplot)
library(worldbank)
library(ggplot2)

df <- wb_data(
  indicator = c("BN.GSR.GNFS.CD", "BN.GSR.FCTY.CD", "BN.TRF.CURR.CD"),
  country = "US"
)

# tinyplot
plt(
  value ~ date | indicator_id,
  data = df,
  type = "barplot"
)

# ggplot2
ggplot(df, aes(fill=indicator_id, y=value, x=date)) + 
  geom_bar(position="stack", stat="identity")
主要言語
R
スター
430
フォーク
24
平均マージ
14時間 17分
マージ済み PR(30日)
8

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

grantmcdermott/tinyplot のほかの issue

grantmcdermott/tinyplot の issue をすべて見る

似ている issue

R の issue をもっと見る

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

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