ggplotly: problems with facet_grid/axes
未关闭
还没有人认领这个 Issue。
ggplotly
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
I'm trying to display some block-matrix-like plot, and there are a few regressions when converting from ggplot to ggplotly conversion (ranked by severity):
- degenerated (1 value) discrete axes are implicitly converted into continuous numeric axis centered around
1, original labels not displayed switch="both"andstrip.placement = "outside"options ignored (here it's important because with ggplot I am able to have sort-of 2-level hierarchy for X and Y axes, which ggplotly breaks)- some subplots with missing data are displayed (at 3x3 position), some don't (2x2 position)
- the margins for the X labels are too small (is the text rotation considered when calculating the necessary space?)
space="free"option ignored- within my shiny application the diagonal subplots miss the fill color. It's an important issue, but I cannot make a small reproducible example (screenshot attached).
ggplot2

ggplotly

ggplotly from Shiny app

The code
require(readr)
require(plotly)
require(ggplot2)
peakXpepmod.df <- read_tsv("CAPZA1_example.txt",
col_types = list("pepmod_id"="c", "peak_id"="c", "proteoform_id"="c", "pmgroup_id"="c")) %>%
dplyr::mutate(pepmod_id = factor(pepmod_id),
peak_id = factor(peak_id),
proteoform_id = factor(proteoform_id),
pmgroup_id = factor(pmgroup_id))
p <- ggplot(peakXpepmod.df) +
geom_point(aes(x = pepmod_id, y = peak_id,
color = proteoform_id), shape=15, size=8) +
geom_point(aes(x = pepmod_id, y = peak_id,
shape = pmgroup_id), size=5) +
scale_x_discrete("Pepmods") + scale_y_discrete("Peaks") +
theme( axis.line = element_line(colour = "gray80"),
axis.ticks = element_line(colour = "gray80"),
axis.text.x = element_text(angle = 90, hjust = 1),
strip.background = element_rect(colour="gray"),
strip.placement = "outside") +
facet_grid(proteoform_id ~ pmgroup_id, switch="both", scales = "free", space = "free")
# ggplot
p
# ggplotly
ggplotly(p)
The dataset
CAPZA1_example.txt
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
通过使用 CAPZA1_example.txt 运行所提供的 R 示例、将 p 与 ggplotly(p) 进行比较,并重点关注 facet_grid 转换,来复现该报告。没有指定项目文件或测试;完成意味着处理所列出的坐标轴、条带、缺失子图、边距、间距和填充颜色回归问题,并特别关注可以复现的情况。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 32/100