# Plotly R

**URL:** https://community.plotly.com/c/plotly-r-matlab-julia-net/r/9.md

[Latest](https://community.plotly.com/latest.md) · [Categories](https://community.plotly.com/categories.md) · [Tags](https://community.plotly.com/tags.md)

---

## [About the Plotly R category](https://community.plotly.com/t/about-the-plotly-r-category/578)

<div class="topic-metadata">

**Author:** [@jack](https://community.plotly.com/u/jack)\
**Replies:** 0

</div>

QA & discourse on the Plotly R library

---

## [How to achieve grouped/hierarchical x-axis labels in Plotly](https://community.plotly.com/t/how-to-achieve-grouped-hierarchical-x-axis-labels-in-plotly/93034)

<div class="topic-metadata">

**Author:** [@BelAu](https://community.plotly.com/u/BelAu)\
**Replies:** 0\
**Last updated:** [July 7, 2025, 2:45pm UTC](https://community.plotly.com/t/how-to-achieve-grouped-hierarchical-x-axis-labels-in-plotly/93034 "2025-07-07T14:45:41Z")

</div>

I’m building a dashboard in R Shiny using Plotly and I’m struggling to recreate a hierarchical x-axis structure. I want to reproduce something like this picture: But all I’m getting at the moment is this: Someone…

---

## [How to assign more than 6 different marker symbols in 3D scatter plot legend](https://community.plotly.com/t/how-to-assign-more-than-6-different-marker-symbols-in-3d-scatter-plot-legend/92764)

<div class="topic-metadata">

**Author:** [@Yunk8823](https://community.plotly.com/u/Yunk8823)\
**Replies:** 1\
**Last updated:** [June 18, 2025, 5:30am UTC](https://community.plotly.com/t/how-to-assign-more-than-6-different-marker-symbols-in-3d-scatter-plot-legend/92764 "2025-06-18T05:30:04Z")

</div>

Dear plot\_ly community, I am using Plotly in R on the following environment: • R version: 4.3.3 (2024-02-29) • RStudio version: 2023.06.2 Build 561 • OS: macOS 15.5 (24F74) on MacBook Pro M2 • Plotly package version…

---

## [Using hexadecimal codes to colour a scatterplot](https://community.plotly.com/t/using-hexadecimal-codes-to-colour-a-scatterplot/92161)

<div class="topic-metadata">

**Author:** [@anon78701386](https://community.plotly.com/u/anon78701386)\
**Replies:** 4\
**Last updated:** [May 6, 2025, 8:56am UTC](https://community.plotly.com/t/using-hexadecimal-codes-to-colour-a-scatterplot/92161 "2025-05-06T08:56:31Z")

</div>

Dear plot\_ly community, I am having trouble creating a scatterplot in which one of the traces has colours given as hexadecimal code. These codes are passed as a vector to the colors argument, as described in the documen…

---

## [Clipping Issue Between add\_surface() and add\_trace() (3D Polygon Contours Over Surface)](https://community.plotly.com/t/clipping-issue-between-add-surface-and-add-trace-3d-polygon-contours-over-surface/91802)

<div class="topic-metadata">

**Author:** [@elporico5\_5](https://community.plotly.com/u/elporico5_5)\
**Replies:** 0\
**Last updated:** [April 15, 2025, 12:22pm UTC](https://community.plotly.com/t/clipping-issue-between-add-surface-and-add-trace-3d-polygon-contours-over-surface/91802 "2025-04-15T12:22:58Z")

</div>

Hi everyone, I’m working on a 3D visualization in R using Plotly, where I display a terrain surface and want to overlay polygon contours from a .shp shapefile. Here’s how I generate the terrain : MNTPlotly \<- plot\_ly(…

---

## [Remove default colorscale legend when using a custom colorscale using two symbols](https://community.plotly.com/t/remove-default-colorscale-legend-when-using-a-custom-colorscale-using-two-symbols/90295)

<div class="topic-metadata">

**Author:** [@txema](https://community.plotly.com/u/txema)\
**Replies:** 1\
**Last updated:** [February 1, 2025, 6:49pm UTC](https://community.plotly.com/t/remove-default-colorscale-legend-when-using-a-custom-colorscale-using-two-symbols/90295 "2025-02-01T18:49:38Z")

</div>

Hi, I am trying to build an interactive plot that has “paired points”. Each point in a pair has a different shape/symbol. However, all points share the same (custom) color scale. I have a functional plot. However, for …

---

## [Multiple lines and filter](https://community.plotly.com/t/multiple-lines-and-filter/26723)

<div class="topic-metadata">

**Author:** [@unamourdeswann](https://community.plotly.com/u/unamourdeswann)\
**Replies:** 1\
**Last updated:** [January 29, 2025, 6:22pm UTC](https://community.plotly.com/t/multiple-lines-and-filter/26723 "2025-01-29T18:22:35Z")

</div>

I am trying to plot 3 types of data (A, B, C), and to filter them with respect to two time points (1, 2). Here is a minimum working example: set.seed(1234) data.frame(a = rep(c(1, 2), each = 6), b = rep(c(…

---

## [R Plotly - How to create 2 dropdown menus that both select a part of the data](https://community.plotly.com/t/r-plotly-how-to-create-2-dropdown-menus-that-both-select-a-part-of-the-data/37043)

<div class="topic-metadata">

**Author:** [@Elise\_P](https://community.plotly.com/u/Elise_P)\
**Replies:** 1\
**Last updated:** [January 25, 2025, 7:20pm UTC](https://community.plotly.com/t/r-plotly-how-to-create-2-dropdown-menus-that-both-select-a-part-of-the-data/37043 "2025-01-25T19:20:46Z")

</div>

I am creating an interactive barplot on Plotly (which shows the number of inhabitants - “POPULATION” - concerned by different levels of pollution - “POLLUTION”) . Here is an extract of my data : CITY TYPE\_POL…

---

## [Subplot shareX and shareY only work by column and row!](https://community.plotly.com/t/subplot-sharex-and-sharey-only-work-by-column-and-row/32532)

<div class="topic-metadata">

**Author:** [@edperalt](https://community.plotly.com/u/edperalt)\
**Replies:** 3\
**Last updated:** [December 13, 2024, 3:13pm UTC](https://community.plotly.com/t/subplot-sharex-and-sharey-only-work-by-column-and-row/32532 "2024-12-13T15:13:43Z")

</div>

I have 24 subplots split in 3 columns and 8 rows and I want to have a common X and Y axis, however in my 3 column and 8 rows scenario, the X is shared only by column(each column shares a different range of values) and th…

---

## [Looking for the structure/format of the list() structure used with plotly\_build() in R](https://community.plotly.com/t/looking-for-the-structure-format-of-the-list-structure-used-with-plotly-build-in-r/89304)

<div class="topic-metadata">

**Author:** [@verloc](https://community.plotly.com/u/verloc)\
**Replies:** 0\
**Last updated:** [December 10, 2024, 5:52pm UTC](https://community.plotly.com/t/looking-for-the-structure-format-of-the-list-structure-used-with-plotly-build-in-r/89304 "2024-12-10T17:52:16Z")

</div>

Hey all, My task is to generate multifaceted plots for an R/Shiny app. The data comes from various dataframes, so I was looking into generating the list() structure found here, in the “Figures as Lists” section. : T…

---

## [How to especify no NA omit?](https://community.plotly.com/t/how-to-especify-no-na-omit/87757)

<div class="topic-metadata">

**Author:** [@Doltrix](https://community.plotly.com/u/Doltrix)\
**Replies:** 1\
**Last updated:** [October 7, 2024, 8:52pm UTC](https://community.plotly.com/t/how-to-especify-no-na-omit/87757 "2024-10-07T20:52:22Z")

</div>

Greetings. A while ago I was using plotly for an application I am developing to display climatological time series. The problem I’m having is that while my data has a lot of gaps at the beginning, this is not reflected…

---

## [How to align multiple mesh3D plot side by side in Rmarkdown HTML output](https://community.plotly.com/t/how-to-align-multiple-mesh3d-plot-side-by-side-in-rmarkdown-html-output/63524)

<div class="topic-metadata">

**Author:** [@djangoc](https://community.plotly.com/u/djangoc)\
**Replies:** 1\
**Last updated:** [September 30, 2024, 8:42am UTC](https://community.plotly.com/t/how-to-align-multiple-mesh3d-plot-side-by-side-in-rmarkdown-html-output/63524 "2024-09-30T08:42:55Z")

</div>

Hello, I plotted 3 mesh3D plots by plotly in R and would like to put them side by side (one row or any layout) in Rmarkdown HTML output. I tried the subplot function but it merged all plots into one plotyly object/panel…

---

## [Scroll zoom in R Studio is buggy - axis scaling breaks when scrolling quickly](https://community.plotly.com/t/scroll-zoom-in-r-studio-is-buggy-axis-scaling-breaks-when-scrolling-quickly/66496)

<div class="topic-metadata">

**Author:** [@iwz](https://community.plotly.com/u/iwz)\
**Replies:** 2\
**Last updated:** [September 16, 2024, 3:37pm UTC](https://community.plotly.com/t/scroll-zoom-in-r-studio-is-buggy-axis-scaling-breaks-when-scrolling-quickly/66496 "2024-09-16T15:37:57Z")

</div>

I’m trying to plot with config(scrollZoom = TRUE) in an R Shiny app with RStudio, but the zooming performance is pretty bad, and when I zoom in and out repeatedly (usually with the touchpad, but I can make it happen with…

---

## [Scale\_color\_manual() labels not working](https://community.plotly.com/t/scale-color-manual-labels-not-working/85153)

<div class="topic-metadata">

**Author:** [@joannaling](https://community.plotly.com/u/joannaling)\
**Replies:** 0\
**Last updated:** [June 13, 2024, 5:26am UTC](https://community.plotly.com/t/scale-color-manual-labels-not-working/85153 "2024-06-13T05:26:48Z")

</div>

Hi, The scale\_color\_manual( labels= ) is not working when using plotly(). This can be seen even from the plotly . com example as circled below. scale\_manual (plotly.com) Regards, Joanna

---

## [Add a background image](https://community.plotly.com/t/add-a-background-image/2457)

<div class="topic-metadata">

**Author:** [@boubchat](https://community.plotly.com/u/boubchat)\
**Replies:** 2\
**Last updated:** [June 7, 2024, 9:24am UTC](https://community.plotly.com/t/add-a-background-image/2457 "2024-06-07T09:24:32Z")

</div>

Hello there ! I am a beginner in plotly (very nice package by the way, thank you very much for this great job) and I am completely stuck on a very simple problem. I try to embed a logo in my graph as here (https://pl…

---

## [Opacity issues while creating a 3D Scatterplot with plotly in R](https://community.plotly.com/t/opacity-issues-while-creating-a-3d-scatterplot-with-plotly-in-r/84202)

<div class="topic-metadata">

**Author:** [@Coribori](https://community.plotly.com/u/Coribori)\
**Replies:** 0\
**Last updated:** [May 2, 2024, 12:48pm UTC](https://community.plotly.com/t/opacity-issues-while-creating-a-3d-scatterplot-with-plotly-in-r/84202 "2024-05-02T12:48:41Z")

</div>

Hello everyone, I am trying to create a 3d scatterplot with the following script: # Create scatterplot for all data points scatterplot \<- plot\_ly(data = data2, x = ~A, y = ~B, z = ~C, color = ~Geschlecht, type = "scatt…

---

## [Why the kde2d 3D graph shows a small density not adding up to 100%?](https://community.plotly.com/t/why-the-kde2d-3d-graph-shows-a-small-density-not-adding-up-to-100/84034)

<div class="topic-metadata">

**Author:** [@Nursena](https://community.plotly.com/u/Nursena)\
**Replies:** 0\
**Last updated:** [April 25, 2024, 5:46pm UTC](https://community.plotly.com/t/why-the-kde2d-3d-graph-shows-a-small-density-not-adding-up-to-100/84034 "2024-04-25T17:46:31Z")

</div>

Hi, I created a 3D graph with plot\_ly in R. However, density on the z-axis is between 0-0.02 which means there is at most 2% of the data at pick points. Actually, 80% of the data has depression value below 10 and Ln inc…

---

## [R Shiny Plotly Animated Bubble chart - bubbles missing hover tag present](https://community.plotly.com/t/r-shiny-plotly-animated-bubble-chart-bubbles-missing-hover-tag-present/83848)

<div class="topic-metadata">

**Author:** [@jshy0001](https://community.plotly.com/u/jshy0001)\
**Replies:** 0\
**Last updated:** [April 17, 2024, 10:20am UTC](https://community.plotly.com/t/r-shiny-plotly-animated-bubble-chart-bubbles-missing-hover-tag-present/83848 "2024-04-17T10:20:46Z")

</div>

Hello, I am looking to get some assistance as to why some of my bubbles in my chart may be appearing and others are not, however the hover tags are still present where the bubbles should be. Some of the bubbles app…

---

## [Overlapping 3D Graphs using Subplot](https://community.plotly.com/t/overlapping-3d-graphs-using-subplot/83400)

<div class="topic-metadata">

**Author:** [@Svangorden](https://community.plotly.com/u/Svangorden)\
**Replies:** 1\
**Last updated:** [March 29, 2024, 11:24am UTC](https://community.plotly.com/t/overlapping-3d-graphs-using-subplot/83400 "2024-03-29T11:24:15Z")

</div>

I’m trying to display 13 different 3D plots in a single figure using subplot, but all the plots are overlapping one another. My code: # custom grid style axx \<- list( gridcolor='rgb(255, 255, 255)', zerolinecolor='…

---

## [R Plotly sankey diagram blank, no error messages](https://community.plotly.com/t/r-plotly-sankey-diagram-blank-no-error-messages/82625)

<div class="topic-metadata">

**Author:** [@kbarker](https://community.plotly.com/u/kbarker)\
**Replies:** 0\
**Last updated:** [February 27, 2024, 8:21pm UTC](https://community.plotly.com/t/r-plotly-sankey-diagram-blank-no-error-messages/82625 "2024-02-27T20:21:21Z")

</div>

Hello all, Hoping someone can help me out, as I’m out of things to try. I have seen a similar thread with Python, but haven’t found a fix with R. Basically I run my code and everything seems fine, no error codes, and th…

---

## [R plotly 3D graph does not show negative values on y axis](https://community.plotly.com/t/r-plotly-3d-graph-does-not-show-negative-values-on-y-axis/82579)

<div class="topic-metadata">

**Author:** [@Nursena](https://community.plotly.com/u/Nursena)\
**Replies:** 0\
**Last updated:** [February 26, 2024, 1:29pm UTC](https://community.plotly.com/t/r-plotly-3d-graph-does-not-show-negative-values-on-y-axis/82579 "2024-02-26T13:29:32Z")

</div>

Hi, I am trying to create a 3D with plotly in R. Variable Y includes both positive and negative values. However, when I run the following code negative values does not appear on the y-axis as attached. How can I modify …

---

## [Is the 'minor' attribue of the axis working properly in R?](https://community.plotly.com/t/is-the-minor-attribue-of-the-axis-working-properly-in-r/70799)

<div class="topic-metadata">

**Author:** [@2stndard](https://community.plotly.com/u/2stndard)\
**Replies:** 1\
**Last updated:** [February 19, 2024, 7:55pm UTC](https://community.plotly.com/t/is-the-minor-attribue-of-the-axis-working-properly-in-r/70799 "2024-02-19T19:55:42Z")

</div>

I think ‘minor’ attribure is not working properly. Right?? In the R code below, the minor grid line is not visible. plot\_ly() |\> add\_trace(type = ‘scatter’, mode = ‘markers’, x = c(10, 20, 30), y = c(10, 20, 30)) |\> …

---

## [Autorangeoptions for range of x-axis do not work](https://community.plotly.com/t/autorangeoptions-for-range-of-x-axis-do-not-work/81743)

<div class="topic-metadata">

**Author:** [@leon.loepp](https://community.plotly.com/u/leon.loepp)\
**Replies:** 0\
**Last updated:** [January 20, 2024, 7:41pm UTC](https://community.plotly.com/t/autorangeoptions-for-range-of-x-axis-do-not-work/81743 "2024-01-20T19:41:55Z")

</div>

Hey, I am trying to implement autorange for my x-axis in plotly (R). However, the automatic range should never take values beyond the following range for the x axis: \[2, 4\]. If the user wants to see values outside of th…

---

## [Configure Plotly download plot button with Shiny](https://community.plotly.com/t/configure-plotly-download-plot-button-with-shiny/81635)

<div class="topic-metadata">

**Author:** [@santimoira](https://community.plotly.com/u/santimoira)\
**Replies:** 0\
**Last updated:** [January 16, 2024, 3:04pm UTC](https://community.plotly.com/t/configure-plotly-download-plot-button-with-shiny/81635 "2024-01-16T15:04:12Z")

</div>

I’m trying to configure the download plot button to output an image in ‘svg’ format. I’m working on a shiny app with R. I render the plot using renderPlotly() function after the following occurs: user selects parameter…

---

## [Trying to add a png/jpg image to a 3D surface graph (R)](https://community.plotly.com/t/trying-to-add-a-png-jpg-image-to-a-3d-surface-graph-r/4192)

<div class="topic-metadata">

**Author:** [@renegademonkey](https://community.plotly.com/u/renegademonkey)\
**Replies:** 6\
**Last updated:** [December 27, 2023, 1:12pm UTC](https://community.plotly.com/t/trying-to-add-a-png-jpg-image-to-a-3d-surface-graph-r/4192 "2023-12-27T13:12:58Z")

</div>

Hi there, I am plotting a 3D surface image (similar to the volcano data example): plot\_ly(z = ~volcano) %\>% add\_surface() The only difference is that my data is related to geographical coordinates (on the x and y a…

---

## [Lazy loading for ggplotly in R](https://community.plotly.com/t/lazy-loading-for-ggplotly-in-r/80194)

<div class="topic-metadata">

**Author:** [@netraam](https://community.plotly.com/u/netraam)\
**Replies:** 1\
**Last updated:** [December 27, 2023, 6:24am UTC](https://community.plotly.com/t/lazy-loading-for-ggplotly-in-r/80194 "2023-12-27T06:24:49Z")

</div>

Dear Plotly community members, I am using the ggplotly function in R which automatically converts ggplot objects to a plotly object. Specifically, I include these plots in a self-contained Markdown/Quarto HTML document.…

---

## [Need Help on Using Dropdown to Filter](https://community.plotly.com/t/need-help-on-using-dropdown-to-filter/6596)

<div class="topic-metadata">

**Author:** [@papuha](https://community.plotly.com/u/papuha)\
**Replies:** 3\
**Last updated:** [December 15, 2023, 2:36pm UTC](https://community.plotly.com/t/need-help-on-using-dropdown-to-filter/6596 "2023-12-15T14:36:35Z")

</div>

Hi, I am trying to create a scatterplot that uses dropdown for filtering. library(plotly) plot\_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, mode = 'markers', visible = T) %\>% layout( title = "…

---

## [R plotly get legend show color but not split](https://community.plotly.com/t/r-plotly-get-legend-show-color-but-not-split/80937)

<div class="topic-metadata">

**Author:** [@Joy](https://community.plotly.com/u/Joy)\
**Replies:** 0\
**Last updated:** [December 14, 2023, 3:25pm UTC](https://community.plotly.com/t/r-plotly-get-legend-show-color-but-not-split/80937 "2023-12-14T15:25:27Z")

</div>

My plotly lines are split by the interaction of two groups, and colored by another group. It is working except the legend still show all the interactions, which is unnecessary. I am currently using the code below: dt%\>%…

---

## [Fillpattern not working?](https://community.plotly.com/t/fillpattern-not-working/80748)

<div class="topic-metadata">

**Author:** [@dcomputing](https://community.plotly.com/u/dcomputing)\
**Replies:** 0\
**Last updated:** [December 7, 2023, 10:13am UTC](https://community.plotly.com/t/fillpattern-not-working/80748 "2023-12-07T10:13:27Z")

</div>

Hi all, I’m trying to use add\_segments to overlay a shading pattern on top of certain existing segments but despite the nice list of attributes reported, fillpattern and even line get ignored. Sample list of parameters…

---

## [Copy data in selection from box select, lasso select, or tooltip hover to clipboard](https://community.plotly.com/t/copy-data-in-selection-from-box-select-lasso-select-or-tooltip-hover-to-clipboard/52648)

<div class="topic-metadata">

**Author:** [@MGoldman](https://community.plotly.com/u/MGoldman)\
**Replies:** 1\
**Last updated:** [December 5, 2023, 2:44am UTC](https://community.plotly.com/t/copy-data-in-selection-from-box-select-lasso-select-or-tooltip-hover-to-clipboard/52648 "2023-12-05T02:44:05Z")

</div>

Is there a way to copy the data from a box select or lasso select or tooltip hover to the clipboard? I haven’t found an argument to do this. I am using the ggplotly function to generate a plotly graph from a ggplot2 obje…

[Next page](https://community.plotly.com/c/plotly-r-matlab-julia-net/r/9.md?page=1)
