Skip to main content

All Questions

Tagged with
1 vote
1 answer
29 views

Showing or saving only the legend of a plotly figure

Given a plotly figure with traces and a legend, is there a way to only show the legend without any of the plot content? My use case for this: I'm exporting several images with the same legend. Instead ...
william_grisaitis's user avatar
0 votes
1 answer
53 views

Add size legend to plotly.express.scatter_mapbox

I have a visualization done using plotly.express.scatter_mapbox. It basically shows the different institutions on the Saudi Arabia map. These institutions are marked by small circles that are color ...
Kareem's user avatar
  • 1
0 votes
1 answer
40 views

How to prevent hiding plotly chart bar on chart legend click

How to prevent hiding plotly chart bar on chart legend click in an angular application. <plotly-plot [divId]="graph.selectedGraph.name" [data]="graph.selectedGraph....
vijesh's user avatar
  • 1,163
0 votes
1 answer
40 views

How to reverse legend order without affecting bar order in Plotly R? [duplicate]

I am creating a stacked bar chart using Plotly in R, and the order of the items in the legend is the reverse of the order that I want. library(dplyr) library(plotly) library(forcats) set.seed(1) df &...
Ernest Au's user avatar
0 votes
0 answers
41 views

R's plotly ggplotly removing legend from a geom_point

I'm generating a simple geom_point plot with R ggplot2: library(dplyr) library(ggplot2) set.seed(1) df <- matrix(runif(16, 0, 10), nrow = 4, ncol = 4, dimnames = list(paste0("R", 1:4), ...
dan's user avatar
  • 6,242
1 vote
1 answer
105 views

How to customize the legend order for a 3D scatter plot?

I'm trying to generate a 3D scatter plot and the shapes of markers correspond to 'Treatment' (IC, IT, YS), whilst, the colors correspond to 'Time' (0, 2, 4, 6, 12, 24, 48, 72). Everything went well ...
SIV0625TriX's user avatar
0 votes
0 answers
26 views

Entrywidth argument not working in R plotly

I am trying to make an interactive plot with the plotly package. The legend needs to be next to the image and have a certain width. I now have the issue that the default appears to be that the legend ...
Bramminator's user avatar
0 votes
1 answer
40 views

Change layout of legend2 in plotly

How to change layout of legend2 with fig.update_layout()? import plotly.express as px import pandas as pd numbers = pd.DataFrame([[1,2,3,4], [2,3,4,5], [5,7,8,8]]) asdf = px.line(numbers) asdf = asdf....
Václav Bočan's user avatar
1 vote
2 answers
60 views

Unwanted characters in GGPlot 2 legend entries for stacked area chart

Good day, I need to prepare a graph showing the proportions of the various biomass components, but it is showing ,1 after each component in the legend in R, Ggplot2. I only want to see the list of ...
Otto_P's user avatar
  • 11
1 vote
1 answer
80 views

plotly title_side position not working properly

I'm greenhand with Python plots but I was trying to do a PCA for different human populations; while I'm still working on the actual data, the main issue I'm having with visualizations in Python, as ...
Matteo's user avatar
  • 209
0 votes
0 answers
21 views

plotly express legend not responsive to any attempt at adjustment (including complete removal)

I am doing a visualization for a paper im writing about differences in specific stances between men and women. In order to do this, i want to create a plotly figure with 4 subplots. This worked great, ...
GuyBecker's user avatar
1 vote
0 answers
18 views

Legend repeatition for scatter subplots in poltly express

I have a dataframe and I have plotted four different columns of the dataframe each with a 5th column and colour them based on a 6th categorical column as subplots in the same figure. I want to have ...
Alexandra Payne's user avatar
0 votes
1 answer
57 views

Legend and labels for Plotly express line graph

I want to draw a three graphs on one x-y axes using Plotly.express. I've read a CSV file of monthly returns using pandas, and have a pandas dataframe containing four series: Date, IRA, MSCI and SnP. I ...
The Buggser's user avatar
0 votes
0 answers
53 views

Imshow Plotly colour toggling using legend

I'm currently working on a data visualisation using Plotly in Python, and I've hit a bit of a roadblock. I have a 2D array representing image data, and I'm using plotly.express.imshow to display it. ...
Vitto Titto's user avatar
0 votes
0 answers
32 views

Placement of plotly legend labels

Plotly places legend labels to the right of their respective "boxes" by default. If possible, I would like to place the labels below the boxes. I have produced a plotly figure with ...
soran hajo dahl's user avatar
0 votes
0 answers
108 views

Python plotly animated scatter plot, show all colours on the legend

Hi all, I have a plotly animated chart where the colour of the chart changes based on a discreet value in the "Vol" column. However the legend on the left only shows one colour on the chart ...
user2461546's user avatar
0 votes
2 answers
289 views

How to fix the legend of plotly 3D scatter plots in Python?

I am trying to create some 3D scatter plots using plotly in Python. I have a data frame with some personality traits and cluster labels, and I want to plot the TSNE embeddings for each trait using ...
DavidS's user avatar
  • 77
1 vote
1 answer
199 views

how to manage legend_tracegroupgap for different row_heights in subplots in plotly?

i found this example code for subplot with legend at each subplot. i changed it by adding row_heights and now the legend do not fit to the subplots. import pandas as pd import plotly.express as px df ...
Alex's user avatar
  • 1,081
1 vote
0 answers
56 views

Add a legend in plotly button graph

With plotly in R, I want to use the buttons to change the data. I've almost managed to make the graph I wanted, except that the legend doesn't appear. I tried adding name = ~B but it doesn't work the ...
nimliug's user avatar
  • 411
0 votes
1 answer
293 views

Legend doesn't show up in Plotly Express line subplots

There are several answers for showing the legend if you're using plotly.graph_objs. I'm only using plotly_express though, and can't get the legend to show up when using several subplots. I have the ...
Jakob's user avatar
  • 843
0 votes
1 answer
76 views

Related to legends for subplots in plotly

I have created the 4 subplots with the legends showing on right sideWhen I create subplots in plotly , legends are created either in right side or in the bottom of all subplots. But how can I get ...
Rajesh Koyi's user avatar
1 vote
1 answer
250 views

How to make the legend appear in a stacked bar chart with `plotly` in R

I want to make a stacked bar chart with a slider in plotly. I took inspiration from the plotly website. I can't manage to insert the legend, maybe because I didn't use the legendgroup argument ...
Julien's user avatar
  • 1,664
0 votes
1 answer
62 views

Is there a way to set the color of plotly legend items?

I want to visualize multiple boolean arrays using Scatter traces with timestamps as x and the array-index as y. The values should be visualized using the colors. However, what I do not like is that ...
KrawallKurt's user avatar
3 votes
1 answer
198 views

A legend marker for each unique texture in the same bar trace, with Plotly Graph Objects in Python

I have the following code as example: x=[1,2,3,4] y=[2,2,4,3] colors = ["blue","blue","orange","blue"] textures = ["","","x","...
33fred33's user avatar
0 votes
1 answer
175 views

Plot multiple y-axis and colors but a single x-axis

I'm trying to plot 4 types of data on a single graph using plotly. they all share the x-axis but one of them has a different y-axis to it, I want to plot the first few categories which share the x and ...
Tomer Gigi's user avatar
1 vote
1 answer
132 views

legendrank in R plotly - bug or user error?

I encountered unwanted behaviour using plotly (4.10.1) in R with regards to the order that legends appear. I have raised a formal issue at https://github.com/plotly/plotly.R/issues/2233 ; however I ...
Nir Graham's user avatar
  • 4,767
6 votes
3 answers
1k views

plotly drops grouped legend (by color, by symbol) when converted from ggplot

I don't quite understand why the legend disappeared when I converted a plot made by ggplot to plotly using ggplotly. The plotly help page did not have any information. I don't think their examples ...
Tung's user avatar
  • 27.8k
1 vote
1 answer
5k views

How to change the size of legend box in Plotly?

It is my code below: import plotly.graph_objects as go fig = go.Figure() for i in range(100): fig.add_trace(go.Scatter( x=[1,2], y=[1,2], name = f'{i}'*20, ...
ChienHua's user avatar
2 votes
1 answer
91 views

Show single legend for grouped 3D lines in R plotly

The default behavior of plotly is to automagically add several legends when the data is grouped by a variable. In my case, I would like set only one legend despite the group. Is this possible at all? ...
SavedByJESUS's user avatar
  • 3,304
1 vote
0 answers
201 views

Make legend horizontal and reduce the size in Plotly Dash

I am trying to make the attached legend horizontal and smaller in size but it's not working. Also if you see the Plot is hidden below the legend. (Some states are not visible) How can I set that to ...
Himanshu Joshi's user avatar
2 votes
1 answer
457 views

Need legend to communicate color for plotly graph go.Heatmap

I'm having a bit of trouble trying to figure out how to have the legend indicate color for my plotly graph objects heatmap. The legend only needs to communicate the graph colors and what they mean. ...
IDK's user avatar
  • 161
0 votes
1 answer
1k views

Fixed margin for legend in Plotly Python

I have a dynamic size of plot in plotly, depending on number of bars: I use such parametrization for legend position: fig.update_layout( bargap=0.1, barmode='stack', yaxis={ ...
Владислав Черкасов's user avatar
0 votes
1 answer
453 views

Combine entries in a single legend from Plotly subplots - python

The following plots two separate scatterplots using Plotly. I want to combine the points from each subplot into a single legend. However, if I plot the figure as is, there are some duplicate entries. ...
jonboy's user avatar
  • 348
0 votes
1 answer
1k views

Include legend for go.scattermapbox subplot figure - Plotly

The following figure produces two subplots using scattermapbox in Plotly. I've included a function that assigns a specific color to each unique category. This all works fine but I'm hoping to include ...
jonboy's user avatar
  • 348
1 vote
1 answer
749 views

How can I copy text from a single legend entry in plotly graphic?

I'm trying to select the text of a single entry/trace from a plotly plot. By default, text is not selectable at all from my plot, which I generated like this: In my R Markdown script, an R code chunk ...
Henrik's user avatar
  • 33
1 vote
1 answer
160 views

Keep colours the same between facetted plots / subplots

Following the R plotly documentation, facetting happens by splitting a dataset on 1 variable, and then applying the same plot function on each split, and finally combining the plots using subplot. If ...
Olsgaard's user avatar
  • 1,438
3 votes
0 answers
249 views

Plotly legend marker opacity and spacing

Is it possible to access the symbols in a legend? I would like to set their opacity to a higher value than the opacity of my trace markers, and ideally I would like to make them tighter (in the sense ...
Tim Kirkwood's user avatar
1 vote
0 answers
173 views

Plot a list of matrices as plotly subplots with shared traces

Spoiler: This post is related to this one, but I am looking for an automated way to solve the following problem: I want to plot a list of matrices, where each matrix is plotted as a subplot. The ...
Johannes Wiesner's user avatar
3 votes
1 answer
726 views

ggplot legend disappears when using ggplotly()

I am trying to keep a legend which is generated when I use ggplot, but upon applying plotly the legend disappears. Here is my code: ggplotchange <- ggplot(data = map.world1, aes(x = long, y = lat, ...
Conor's user avatar
  • 63
1 vote
0 answers
189 views

Plotly graph legend groups feature is different when using fig.show() and Flask

I am developing a Flask application and a graph I am plotting with Plotly needs groups in the legend. I followed this answer to achieve what I wanted. It works well when showing the graph with 'fig....
Nicolas Loucheu's user avatar
2 votes
1 answer
1k views

Bubble size legend with Python Plotly

I have created a bubble graph with Python Plotly. In the example below, the size of the bubble represents the size of the population for different countries. I would like to add the bubble size in the ...
Jérémy's user avatar
1 vote
1 answer
1k views

Plotly Custom Legend

I have a plotly plot which looks like this: The Code I am using is below: fig = make_subplots(specs=[[{"secondary_y": True}]]) fig.add_trace(go.Scatter( x = pf['Timestamp'], y = pf['Price_A'...
Imran's user avatar
  • 71
-1 votes
1 answer
242 views

Add labels to lines plotly

I needed some help labeling some overlaying lines in plotly. I have a dataframe that consists of the following columns: df$date = c("2014-09-30","2016-03-31","2016-03-31")...
nfalesit's user avatar
  • 115
4 votes
2 answers
14k views

How can I put different legends to subplots in plotly?

I am still designing what kind of plot with subplots I want to do but when we see the example in the documentation Multiple Subplots with Titles we have from plotly.subplots import make_subplots ...
KansaiRobot's user avatar
  • 9,103
1 vote
1 answer
4k views

R+Plotly: Customize Legend Entries

I must be having trouble with less than a one liner, but have a look at the snippet below: I cannot the legend option to enter the text that I want in the legend as the name of the species (say, &...
larry77's user avatar
  • 1,461
1 vote
1 answer
51 views

I cannot add source to this chart, nor can I remove legend title

I have created a simple interactive chart, of Brazil bank NPLs (no longer interactive as saved as a png) using the below code, but need to refine the aesthetics a bit more to exclude the legend title (...
vgall's user avatar
  • 11
1 vote
1 answer
926 views

Python Plotly object with legend for different marker_color

I want to add a legend for each marker_color on my second trace below but I can't figure out how to make it happen through the graph objects. Any idea? import plotly.graph_objects as go fig = go....
Ad D's user avatar
  • 191
0 votes
1 answer
234 views

How to reverse scale on legend in plotly?

I am using plotly on python. I have a legend which is a colour scale 0-100%. Currently 100 is at the top and 0 at the bottom. I want 100 to be the bottom and 0 the top. Is this possible?
nabzzzz's user avatar
  • 21
2 votes
1 answer
872 views

Plot_ly in R: How to include a colorbar, symbols and the size of markers in a legend?

I have a scatter plot with data points at the coodinates "test_Xn" & "test_Yn". Additional informations about those data points is stored in the columns "Item_1", &...
Finn Jonas's user avatar
2 votes
1 answer
754 views

How to customize plotly legend order?

I want to change the ordering of legend in my boxplot from 1-12, or perhaps even renaming them to Jan, Feb, etc. Any idea how could I do it? def make_box_plot(data, xdata, ydata, title, legend): ...
David L.E's user avatar
  • 105

15 30 50 per page