plotly / plotly/plotly.R

Italicizing strip.text with ggplotly

Open
#1,812 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Free Y Axis example and compare the ggplot object p with the ggplotly result fig, focusing on how facet strip text styling is converted. Reproduce the missing italic styling for the y-axis facet labels; done means ggplotly preserves the italic face while retaining the larger strip text.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.