# Gibberish / malformed negative y-axis values in plotly charts in python

**URL:** <https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [January 25, 2023, 1:23pm UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924 "2023-01-25T13:23:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![harrykane](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@harrykane](https://community.plotly.com/u/harrykane)\
**Post date:** [January 25, 2023, 1:23pm UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924/1 "2023-01-25T13:23:39Z")

</div>

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:

```auto
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]

![Screen Shot 2023-01-25 at 14.46.44](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/a/a/aa4adf92e7bae9f83554e1be64b1d2c36782e727.png)

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [January 25, 2023, 9:40pm UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924/2 "2023-01-25T21:40:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [January 26, 2023, 9:51am UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924/3 "2023-01-26T09:51:11Z")

</div>

Hi, seems that you are not the only one with this issue:

> [@Hyperlink to markers on map](https://community.plotly.com/t/hyperlink-to-markers-on-map/17858/19):
>
> 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

Which plotly version are you using?

@adamschroeder

---

<div class="post-metadata">

**Author:** ![harrykane](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@harrykane](https://community.plotly.com/u/harrykane)\
**Post date:** [January 26, 2023, 10:24am UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924/4 "2023-01-26T10:24:53Z")

</div>

@adamschroeder im using 5.12.0 plotly version

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [January 27, 2023, 8:29am UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924/5 "2023-01-27T08:29:13Z")

</div>

hi @harrykane  
I’m not able to recreate your issue either. I’m using plotly 5.12.0, and I’ve tried this code:

```auto
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:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/b/7/b7547fc4e9bf521377d4a76e4284531bd2ef9506.png)

I’ve also tried this code:

```auto
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()

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/c/f/cf1ede4f162f5ec00e8bb040b785a7ff25170f3c.png)

**Can you please share a sample of your data and full code that was used to create the problematic charts.**

---

<div class="post-metadata">

**Author:** ![valankar](https://avatars.discourse-cdn.com/v4/letter/v/43a26b/32.png) [@valankar](https://community.plotly.com/u/valankar)\
**Post date:** [March 20, 2023, 4:08pm UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924/6 "2023-03-20T16:08:56Z")

</div>

The following code duplicates the problem for me:

```auto
#!/usr/bin/env python3
"""Test negative bug."""

from plotly.subplots import make_subplots

fig = 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=400, width=500, showlegend=True)

with open('web/negative.html', 'w', encoding='utf-8') as index_file:
    index_file.write(fig.to_html(full_html=False))

```

This results in:

![neg](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/5/f/5f894143998322d17ef779478a402a904285e6c5.jpeg)

When I change to `full_html=True`, it works properly:

![pos](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/6/e/6eb0594703d02f7a16ef8a4f370fc69716c9afcd.jpeg)

This seems to be a recent bug because it worked fine before I upgraded Plotly. I’m using this version from conda-forge:

`plotly 5.13.1 pyhd8ed1ab_0 conda-forge`

---

<div class="post-metadata">

**Author:** ![valankar](https://avatars.discourse-cdn.com/v4/letter/v/43a26b/32.png) [@valankar](https://community.plotly.com/u/valankar)\
**Post date:** [March 21, 2023, 7:13am UTC](https://community.plotly.com/t/gibberish-malformed-negative-y-axis-values-in-plotly-charts-in-python/71924/7 "2023-03-21T07:13:54Z")

</div>

I’ve reported this as a bug in:

[Gibberish / malformed / strange negative y-axis values · Issue #4118 · plotly/plotly.py (github.com)](https://github.com/plotly/plotly.py/issues/4118)
