15,659 questions
0
votes
0
answers
23
views
Plotly Choropleth not showing with Geopandas
I've seen this issue come up in other pages but none of their solutions worked for me.
import plotly.express as px
import geopandas as gpd
import cartopy.crs as ccrs
regions = gpd.read_file("...
1
vote
1
answer
50
views
problem on the x-axis of the graph, doesn't render the time
I am working on a dashboard using Shiny for Python and Plotly Express. I am trying to create a Gantt chart (using px.timeline) to visualize the operating periods of different boilers (ON/OFF states).
...
0
votes
2
answers
32
views
How to avoid Plotly (plotly.express.line) line chart creating zig-zag line?
I want to create line charts with plotly, my X axis is a year, y a value. Sometimes, the data is incomplete, i.e., some curves will have years missing or will start in different years than others.
It ...
0
votes
1
answer
77
views
set states to indicate on and off with timestamp
def prepare_dataframe(df):
# Map original CSV column names to internal aliases for easier access
df.rename(columns={
'Bomba Calor - Temperatura de Aire (°C)': 'temp_aire',
'...
Advice
0
votes
0
replies
46
views
List of paths and sizes to sunburst plot
I have the following data format:
foo0/bar0/a0/b0/c0 50
foo0/bar0/a0/b1 30
foo1/bar0/a0/b0 10
foo1/bar1 20
foo1/bar2/a0/b0/c0 20
foo1/bar2/a0/b0/c1 30
I'd like to create a sunburst plot out of this. ...
1
vote
1
answer
52
views
use of melt into a df for long to wide and df.loc
i'd like to know if there is another better way of using df_filtered_dates = df.loc[start_date:end_date] or of this way it's good, i'm using for filter dates between the dates i choose from ...
Best practices
0
votes
2
replies
71
views
Index timestamp shiny for python
def prepare_dataframe(df):
df.rename(columns={
'Bomba Calor - Temperatura de Aire (°C)': 'temp_aire',
'Bomba Calor - Temperatura Entrada (°C)': 'temp_entrada',
'Bomba Calor ...
6
votes
1
answer
91
views
How can I ensure legends take up the full width?
I am trying to customize the behavior of a horizontal legend in Plotly.js for varying viewport widths.
Minimal example:
<head>
<script src="https://cdn.plot.ly/plotly-latest.min.js&...
Advice
4
votes
4
replies
150
views
Ridgeplot with area charts in plotly (or any other free python library)
I'm trying to create a chart, that looks like a Ridgeplot (for examples see this and this), but has smoothed Area charts with a categorical x-axis as a basis.
Why standard Ridgeplot libraries don't ...
4
votes
1
answer
99
views
R Plotly: Highlight on hover and unhighlight on unhover
Using plotly in R, is it possible to highlight a point on hover (aka mouseover) and then unhighlight when the mouse moves away?
Using the plotly::highlight function, the off parameter has options &...
1
vote
1
answer
218
views
How can I render plotly plots without using plotlyOutput and renderPlotly?
I have a datatable that contains plots. Is there a way to just render it without having to use plotlyOutput and renderPlotly? In my real app the plots drawn will be dependent on context and I do not ...
1
vote
1
answer
64
views
Include plotly chart in DT rows R
I am searching to include plotly charts in a column of a DT table in R, similar to sparkline package.
I can't get the plotly objects to render. My current trials give empty column or having the html ...
1
vote
1
answer
45
views
Plotly/Dash rangeselector "All" button extends x-axis into future despite no data
I'm building a time series plot using Plotly with Dash, and I'm running into a frustrating issue with the x-axis.
Python Version: 3.10.16
Plotly Version : 6.0.0
Pandas Version : 2.2.3
My setup:
The ...
1
vote
0
answers
72
views
Prevent resetting graph when slider plotly barplot R
I would like to prevent plotly rerender the graph when we change the x-axis range by dates and when you deselect bars from the legend it should remain the same bars when it changed the x-axis. For ...
1
vote
1
answer
67
views
python plotly scatter ols trendline has a kink in it
I am using plotly express to model some data, and wanted to add a trendline = 'ols' to it.
when I do, I obtain a kink in the result
here is the code used:
d={'category': {63: 'test', 128: 'test', 192:...
2
votes
0
answers
45
views
Plotly Choropleth Map Using GeoJSON Not working in R Server
I am trying to plot a Plotly Choropleth Map Using GeoJSON in RStudio Server. Choropleth maps work in r on my local machine but when I try and plot them in RStudio Server the figure plots but the ...
2
votes
1
answer
90
views
Legend changes when converting ggplot2 plot to plotly while using multiple "aes labels" [duplicate]
I created a plot using ggplot2 with two different aesthetics for colour and shape. When I convert the ggplot2 plot to plotly via plotly::ggplotly() the different aes seem to create problems.
library(...
1
vote
1
answer
62
views
Plotly Subplots - Overlaying xaxis in a plot in a particular column
I'm using Plotly and making scatter plot subplots with a shared y-axis and different x-axes. I'd like to overlay two curves in the 4th column, but so far I have not found a way to do it. this is the ...
1
vote
1
answer
71
views
Add range to rangeslider in Plotly R
I would like to add an initial range to the rangeslider option in plotly r. Apparently, we could use the range argument for this based on the documentation. Here is a simple reproducible example:
...
1
vote
0
answers
118
views
Plotly - add dropdown list or buttons to OHLC / Candlestick graph
I have the following dataframe:
lst = [['10/01/2025 8:30:00', 2.74, 2.87, 2.60, 2.65, 14, 'SPXW251001P06590000', 'P', 6590],
['10/01/2025 8:31:00', 2.80, 2.80, 2.50, 2.53, 61, '...
1
vote
1
answer
74
views
Plotly R: Annotations showing fixed X values on hover despite recalculating closest points across subplots
I'm working with a Plotly figure in R that has 3 subplots sharing the same Y-axis (using subplot() with shareY = TRUE). I've implemented custom hover behavior using onRender() that:
Draws a ...
1
vote
1
answer
73
views
How can I change click the color/design of a point in a plotly plot when clicking on it?
I have a shiny app and want to create a plot where you can click on a single point. Then there a two things I want to happen:
I want to use standard shiny logic that shows some information regarding ...
2
votes
1
answer
72
views
Combine stacked bars with non-stacked bars as overlay in r plotly
How can I combine stacked bars with non-stacked bars as overlay, using plotly in r?
In order to have the traces stacked, I have to define the barmode as stacked in the layout argument. But how can I ...
1
vote
1
answer
55
views
How to order barplot by value and enforce legend order at the same time?
I'm trying to create a bar plot where my legend appears in a particular order (Asia, Europe, Africa). I also want the bar plot to be ordered by Value, another column in my dataframe.
To solve this, I ...
0
votes
0
answers
53
views
interactive matplotlib as webapplication
I am currently trying to create an interactive web-app to display and work with multi-graphs, ideally with streamlit. I have a first working version based on matplotlib (inspired by the netgraph ...
4
votes
1
answer
134
views
Why is editing the panel.border not working inside ggplotly wrapper?
I have been working on a shiny app for some time, last week I updated all of my packages when I downloaded a new version of RStudio. All of a sudden, existing shiny themes will work outside of ...
1
vote
1
answer
81
views
plotly write_image fails and hangs on Windows with python 3.11
We're currently unable to use plotly write_image. A stacktrace is thrown and the terminal completely hangs (it doesn't even respond to control + C). This is related to kaleido and I've seen a number ...
3
votes
1
answer
70
views
Plotly chloropleth of India not showing states properly (too small)
I am trying to create a choropleth of India that shows railway accident data. When I try to make run it a choropleth is created, but the states of India are too small and do not reflect their real ...
4
votes
2
answers
166
views
"X Unified" Hovermode and Show X Value
I'm working on a project using ggplotly() and am having trouble formatting my hover text. Specifically, I'm using the text aesthetic to format my tooltip, which works great. The problem I'm running ...
1
vote
0
answers
66
views
How to control line chart colors in plotly when lines are added via shiny::selectInput() [duplicate]
I want to display the life expectancy for various countries over time. The user can choose from multiple shiny::selectInput().
My problem is that the colors for the different countries change with the ...
2
votes
1
answer
116
views
Dropdown menus 'move' when clicked
I am trying to make a basic bar plot with filters using plotly. I have two dropdown menus, and when the window is resized and the dropdowns are clicked they 'move', or appear to move with the axis.
...
2
votes
1
answer
133
views
Implementing image axis labels with ggplot2 + plotly
My goal is to make a bar plot with images as axis labels, like this (screen 1). I also want plotly's chart annotations, but adding plotly to the program causes the axis labels to be interpreted as raw ...
0
votes
0
answers
70
views
plotly Dashboard refer to different plot
I have a question regarding how does Dashboard know which plot to display.
Sample code:
from dash import Dash, dcc, html, Input, Output
import plotly.express as px
import pandas as pd
# Sample data
...
2
votes
1
answer
136
views
Why are plots not all the same width when rendered in a datatable?
Have a look at the following DT::datatable containing plotly plots:
You can see that not all plots have the same width, which is not what I intend. I intend that they all take them the maximal ...
2
votes
1
answer
71
views
Fast plotly updating inside Jupyter
I am running a Jupyter notebook inside VSCode. I want to use plotly (or anything else, but I am trying this as a potential solution) to dynamically plot data as it is generated.
I tried to generate a ...
2
votes
1
answer
94
views
plotly cant plot scatter graphs anymore
I am using the update plotly version 6.3.0 and im trying to plot a simple stock close price in 1year period. The uploaded image is the graph output, how it can be seen its not right. Im also in ...
2
votes
1
answer
95
views
graph_objects.Surface axis tic spacing inconsistent on x and y
Given hemi.csv data of:
244,1000,1500,2000,2500,3000,3500,5000
0,14,18,-42,-72,-84,-86,-94,-119
12.5,277,231,185,139,144,150,161,158
25.1,416,394,370,348,361,374,404,396
37.6,483,587,633,653,566,585,...
2
votes
2
answers
139
views
Add horizontal line to barplot in plotly R including legend
I would like to create a barplot with a horizontal line in plotly R. There is an option to use add_segments like here. Unfortunately it doesn't display the full width of the graph and cuts of at the ...
3
votes
1
answer
113
views
Legend grouping not working with fig.add_shape
I’m using Plotly to create some subplots, where I have several vertical lines and shapes that I want to toggle at the same time. The vertical lines were plotted using traces, so the legendgroup worked ...
1
vote
1
answer
168
views
Spaghetti plots legend
I was trying to build a spaghetti plot: I have longitudinal data for several ID, and, due to some functionalities such has dropdown menus and legend filters, I decided to use plotly instead of ggplot2....
3
votes
0
answers
85
views
Force order in Plotly Treemap
I'm creating a treemap using plotly express. In timepoints I have three options: Time 1, Time 2 and Time 3. However I have less data in Time 2 than Time 3 (I have less visits and thus less instrument ...
0
votes
0
answers
97
views
Is using Quarto with Julia & Plotly (via Plots) broken?
I used to be able create HTML output from Quarto using Julia and Plotly to get semi-interactive figures.
But it does not work anymore and I am not able to figure out why. Here is an MWE.
_quarto.yml ...
3
votes
1
answer
116
views
How to avoid unintended "jaggedness" in 3D Plotly plots?
I’m using Plotly to plot a 3D dataset and the best-fit line to that dataset (Plotly version 6.2.0, Mac OS Monterey). When I plot the data in its original coordinates, the dataset and best-fit line ...
3
votes
1
answer
106
views
Unable to zoom or hover map using nested subplot()
My interactive dashboard where multiple Plotly objects including maps are displayed using nested subplot() in R:
library(digest)
library(sf)
library(jsonlite)
library(plotly)
library(ggplot2)
library(...
1
vote
0
answers
63
views
Reduce file size of multiple ggplotly graphs
I'm creating a document with a lot of ggplotly objects. This returns in a big file size. Apparently we could use the partial_bundle function to reduce the file size of plotly object. Unfortunately ...
0
votes
0
answers
65
views
Plotly chart not working correcly with HTMX call
I've added HTMX to my Django project, and after that my plotly chart started glitching.
I generate HTML for the chart with:
def get_chart(f, power, resolution):
import pandas as pd
...
2
votes
1
answer
84
views
How to specify a color for missing data in R plotly heatmaps using colorscale
I have a series of heatmaps I'm displaying using plotly in R. Some of those heatmaps have cells with missing data, and I'd like those cells to show up grey, with the rest of the cells colored with a ...
3
votes
1
answer
62
views
Can save Plotly image to Cloudinary?
Is it possible to write a Plotly chart directly into Cloudanary without first saving to a file?
So Plotly is something like this.
fig.write_image("fig1.png")
I want to upload the fig ...
4
votes
2
answers
76
views
Delta/Difference Histogram
Minimum working example:
import pandas as pd
import plotly.graph_objects as go
# Example data
data = {
"data-a": [10, 15, 10, 20, 25, 30, 15, 10, 20, 25],
"data-b": [12, ...
2
votes
1
answer
63
views
How do I filter a Sunburst Chart by clicking on one of the segments?
This question is adjacent to a previous question I asked about filtering a table by clicking on a bar segment. I'd like to do the same thing with a sunburst, but don't seem to be able to get the ...