Im trying to plot a bar plot in plotly that is representing net-gains (will have positive and negative bar values). But somewhat the negative values in the y-axis are being represented in gibberish. I tried several things, including using update_layout
function, but nothing seems to work. Im using the make_subplots
function because i want to plot multiple viz on one figure.
Im using databricks for this code.
Attaching my code and viz output:
net_gains = pd.DataFrame()
net_gains["general_net_gain"] = [-2,2,-1,2]
fig = plotly.subplots.make_subplots(rows=1, cols=1)
fig.add_bar(x=net_gains.index, y=net_gains["general_net_gain"], row=1, col=1)
fig.update_layout(height=400,width=500,showlegend=True)
[![Viz output][1]][1]
AIMPED
January 25, 2023, 9:40pm
2
HI @harrykane welcome to the forums.
I canโt reproduce this and never have seen this before. Did you find a way to solve it?
AIMPED
January 26, 2023, 9:51am
3
Hi, seems that you are not the only one with this issue:
Hi @jmmease this code works really good for me apart from one issue. I see that if I put negative values for x-axis or y-axis, it comes with some absurd prefix like รฤร^รโ60 for -60.
Could you please suggest a solution for this.
Thanks
Nitin
[Screenshot 2023-01-26 at 9.18.17 AM]
Which plotly version are you using?
@adamschroeder
@adamschroeder im using 5.12.0 plotly version
hi @harrykane
Iโm not able to recreate your issue either. Iโm using plotly 5.12.0, and Iโve tried this code:
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly
fig = plotly.subplots.make_subplots(rows=1, cols=1)
fig.add_bar(x=[1, 2, 3], y=[-4, 5, -6],
row=1, col=1
)
fig.update_layout(height=600, width=800)
fig.show()
which makes this:
Iโve also tried this code:
from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig = make_subplots(rows=1, cols=2)
fig.add_trace(
go.Scatter(x=[1, 2, 3], y=[-4, 5, -6]),
row=1, col=1
)
fig.add_trace(
go.Scatter(x=[20, 30, 40], y=[50, -60, 70]),
row=1, col=2
)
fig.update_layout(height=600, width=800, title_text="Side By Side Subplots")
fig.show()
Can you please share a sample of your data and full code that was used to create the problematic charts.