go.Candlestick showing a second smaller graph not requested

I am trying to plot some graphs with plotly and, after several times having the wrong graph, i backed to the basics and tried to plot an example from the plotly web, but the same error appears:
I get a second small graph that noone asked for.
This is my code:

import plotly.plotly as py
import plotly.graph_objs as go

import pandas_datareader as web
from datetime import datetime
import fix_yahoo_finance as yf

yf.pdr_override()

df = web.DataReader("aapl", 'robinhood').reset_index()

trace = go.Candlestick(x=df.Date,
                       open=df.Open,
                       high=df.High,
                       low=df.Low,
                       close=df.Close)
data = [trace]
py.plot(data, filename='simple_candlestick')

I just changed the source (morningstar is down) and used the offline version instead of the live program, but the error still appeared if I used the web anyways, so It does not matter.

The sad part is I get this graph:


As you can see, that is not what I wanted, and in the web example this is what appears:


Lacking a second useless graph.

Am I doing something wrong?

Thanks! :slight_smile:

Hi @verdi07,

The second graph below is called a rangeslider (See https://plot.ly/python/range-slider/) and you can click and drag the handles (white rectangles) to zoom and pan the figure above. It looks like this feature is enabled by default now for the candlestick trace (and perhaps it wasn’t on by default when those docs were generated).

You can disable it by setting the layout.xaxis.rangeslider.visible property to False.

import plotly.plotly as py
import plotly.graph_objs as go

import pandas_datareader as web
from datetime import datetime
import fix_yahoo_finance as yf

yf.pdr_override()

df = web.DataReader("aapl", 'robinhood').reset_index()

trace = go.Candlestick(x=df.Date,
                       open=df.Open,
                       high=df.High,
                       low=df.Low,
                       close=df.Close)
data = [trace]
layout = {'xaxis': {'rangeslider': {'visible': False}}}
figure = {'data': data, 'layout': layout}
py.plot(figure, filename='simple_candlestick')

Hope that helps!
-Jon

2 Likes

Ok, that worked.
This might be sad but I dontΒ΄t think I’ve ever loved someone more than I love you right now.

1 Like