plotly / plotly/plotly.R

xaxis/yaxis in layout of subplots does only apply to first subplot instead of all subplots

Open
#2,137 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

In https://plotly.com/r/subplots/#customizing-subplot-axes it is described, that xaxis/yaxis apply to all axis in the subplots.

After a figure with subplots is created using the subplot function, its axis properties (title, font, range, grid style, etc.) can be customized using the xaxis and yaxis graph object figure methods. By default, these methods apply to all of the x axes or y axes in the figure. The row and col arguments can be used to control which axes are targeted by the update.

As it can be seen at the example, it only aplies to the first subplot. A shorter example with the use of ggplotly is provided below. There the layout only works for the first row and first column.

ggplot(data = mtcars, aes(x = hp, y = mpg, color = am)) +
  geom_point() +
  facet_grid(cyl ~ gear, labeller = label_both) +
  theme_light()
ggplotly() %>% layout(xaxis = list(tickmode = "auto"), yaxis = list(tickmode = "auto"))

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 documented subplot-axis behavior and reproduce the issue using the provided ggplot2, facet_grid, ggplotly(), and layout() example. Trace how xaxis and yaxis layout updates are applied, then verify that the updates affect every subplot axis rather than only the first row and column.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.