plotly / plotly/plotly.R

Add support for captions and subtitles

Open
#799 12 comments 19 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This example shows the difference between ggplot and ggplotly objects regarding the use of "labs".
Source: R for Data Science

library(ggplot2)
library(plotly)
p<-ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(color = class)) +
  geom_smooth(se = FALSE) +
  labs(
    title = "Fuel efficiency generally decreases with engine size",
    subtitle = "Two seaters (sports cars) are an exception because of their light weight",
    caption = "Data from fueleconomy.gov"
  );
p  # This is ok, a ggplot2 object
g <- ggplotly(p)
g  #  "labs()" Just showing title (centered) and  subtilte & caption are not even showing up

labs() OK
image

labs() not ok
image

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

No implementation file or test is named. Reproduce the supplied ggplot2 and ggplotly example first, then trace the conversion path for labs(); done means the resulting plot displays both the subtitle and caption as shown in the source ggplot.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.