plotly / plotly/plotly.R

Translate plotmath expressions

Open
#571 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have 2 issues using function ggplotly in R:


Question 1 What are the ways to keep R plotmath expressions while converting ggplot2 plots to plotly format using function ggplotly?

Now the expressions are converted to [object Object] as in this example below:

library(ggplot2)
library(plotly)

qplot(mpg, wt, data = mtcars) +
    ggtitle(expression(bar(x) == sum(frac(x[i], n), i==1, n)))

enter image description here

ggplotly()

enter image description here


Question 2

How to get rid of double labels in the legend of plotly graph and make them look like in ggplot2 graph? I.e. how to get 6 in stead of (6,6):

qplot(mpg, wt, data = mtcars, colour = as.factor(cyl), fill = as.factor(cyl))

enter image description here

ggplotly()

enter image description here

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 by reproducing both reported examples with ggplot2 and ggplotly: the plotmath title becomes [object Object], and the legend shows duplicated values such as (6,6). Trace how ggplotly converts plotmath expressions and combined colour/fill scales, then verify that expressions render correctly and legend entries match the ggplot2 result.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.