plotly / plotly/plotly.R

Italicizing strip.text with ggplotly

未关闭
#1,812 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

I've been trying to get the labels on a faceted grid to be italicized on the y-axis and can't seem to make it to happen.

Here I'll use the "Free Y Axis" example of a faceted grid as written by Plotly:
https://plotly.com/ggplot2/facet_grid/

The only change I've made to this code is make the strip text for both axes larger and the y-axis text italicized in the ggplot theme().

library(reshape2)
library(ggplot2)
library(plotly)

p <- ggplot(tips, aes(x=total_bill)) + geom_histogram(binwidth=2,colour="white")

# With panels that have the same scaling, but different range (and therefore different physical sizes)
p <- p + facet_grid(sex ~ smoker, scales="free", space="free") +
               theme(strip.text.x = element_text(size = 13),
               strip.text.y = element_text(size = 13,face = "italic"))

p

fig <- ggplotly(p)

fig

The plot produced by ggplot (p) looks like this, with the y-axis facet labels in italics:
image

The plot produced by ggplotly (fig) looks like this:
itali example plotly

Any clarification if I'm missing something would be appreciated. Thank you!

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从提供的 Free Y Axis 示例开始,比较 ggplot 对象 p 与 ggplotly 结果 fig,重点关注 facet strip 文本样式是如何转换的。重新实现 y 轴 facet 标签缺失的斜体样式;当 ggplotly 在保留较大 strip 文本的同时保留斜体字形时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。