# The center (x and y axis) of my 2D cartesian graph color not changing accordingly in Plotly?

I have this code that makes a 2D cartesian graph and I came across a strange problem. While the quadrant shapes color is changing according to the code, the ones under #AXIS are not changing to black and remaining white, even though im using the same fig.add_shape function, and specifying a black color. It still… Read More The center (x and y axis) of my 2D cartesian graph color not changing accordingly in Plotly?

# How to add time frame for candle using plotly library in Python?

I want to add a time frame for candlestick on a chart using plotly library. Is there a way to do that without iterating through data and taking every 4th tick (for 4h chart) and calculating high and low in between and all the calculations done in the background? data = requests.get(url).json() date = []… Read More How to add time frame for candle using plotly library in Python?

# How can I convert Plotly graph to a PNG image

I have this Plotly graph, and I’m trying to save it as a png or JPEG file import plotly.graph_objects as go import numpy as np np.random.seed(1) N = 100 x = np.random.rand(N) y = np.random.rand(N) colors = np.random.rand(N) sz = np.random.rand(N) * 30 fig = go.Figure() fig.add_trace(go.Scatter( x=x, y=y, mode="markers", marker=go.scatter.Marker( size=sz, color=colors, opacity=0.6, colorscale="Viridis"… Read More How can I convert Plotly graph to a PNG image

# Why I can't change colors of px.scatter?

I am combined px.scatter and px.lines, but can’t change the color_continuous_scale of px.scatter, and also color_continuous_midpoint. Could someone help me, please? import plotly.graph_objs as go import plotly.express as px import pandas as pd def to_pd(a, b, c): p = pd.DataFrame({"Date": a, "Cost": b, ‘Color’: c}) return p fig1 = px.line(x=[1,2,3],y=[10,8,20]) a = [1,2,3,4,5,6] b =… Read More Why I can't change colors of px.scatter?

# Plotly hover data and hover text

My input: df=(pd.DataFrame({‘label_color’:[‘white’,’white’,’cyan’,’cyan’,’cyan’,’cyan’,’white’,’white’], ‘label_quality’:[‘white’,’white’,’red’,’green’,’green’,’red’,’white’,’white’], ‘label’:[‘foo’,’foo’,’foo’,’foo’,’foo’,’foo’,’foo’,’foo’]})) My code: df[‘color_value’] = 1 df[‘quality_value’] = 1 fig = px.bar(df, y=[‘color_value’,’quality_value’], x=[1]*len(df), orientation=’h’, barmode=’group’, template=’plotly_white’, hover_data=[df.index.values,df.label]) fig.data[0][‘marker’][‘color’] = df[‘label_color’].tolist() fig.data[1][‘marker’][‘color’] = df[‘label_quality’].tolist() fig.update_traces(marker_line_color=’rgb(8,48,107)’) fig.update_layout(showlegend=False, yaxis_title=’foo’, xaxis_title=”) fig.show() My output: . As you can see, I create some custom plot within bar chart. And now I try make some "glitter",… Read More Plotly hover data and hover text