Black Lives Matter. Please consider donating to Black Girls Code today.

Setting a Mid-range on Y-axis Line Chart

Hello I am trying to do a plotly chart in python. I was wondering if there is a way to specify a middle range on the Y-axis.

For example:

if we have a Time Series with values ranging from 100 - 10 000, is there a way to set the scale of the Y axis to start from 100, end in 10 000 and the middle of the scale to be at 1000? Please find attached an example picture done in excel.

Hi siskos32, do you mean smth like this:

import plotly.graph_objs as go
import numpy as np

x = np.linspace(1,10,100)
y = np.exp(x)

data = [go.Scatter(x=x,y=y)]
layout = dict(title='f(x) = e^x',
    xaxis=dict(title='x'), 
    yaxis=dict(title='f(x)', type='log', range=[2,4]))
#layout = dict()
fig = go.FigureWidget(data=data, layout=layout)

fig
1 Like

type=‘log’ solved it for me. Thanks!