Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

candle stick with volume plotly

import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots

# data
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')


# Create subplots and mention plot grid size
fig = make_subplots(rows=2, cols=1, shared_xaxes=True, 
               vertical_spacing=0.03, subplot_titles=('OHLC', 'Volume'), 
               row_width=[0.2, 0.7])

# Plot OHLC on 1st row
fig.add_trace(go.Candlestick(x=df["Date"], open=df["AAPL.Open"], high=df["AAPL.High"],
                low=df["AAPL.Low"], close=df["AAPL.Close"], name="OHLC"), 
                row=1, col=1
)

# Bar trace for volumes on 2nd row without legend
fig.add_trace(go.Bar(x=df['Date'], y=df['AAPL.Volume'], showlegend=False), row=2, col=1)

# Do not show OHLC's rangeslider plot 
fig.update(layout_xaxis_rangeslider_visible=False)
fig.show()
Comment

PREVIOUS NEXT
Code Example
Python :: loops with variables that count 
Python :: ex: python arraay 
Python :: how to put 2 code n 1 line in python 
Python :: korozif 
Python :: python tupel from string 
Python :: django.db.utils.IntegrityError: column contains null values 
Python :: geopandas plot fullscreen 
Python :: hexing floats 
Python :: how to make an app like word in python 
Python :: python Hewwo wowwd 
Python :: python open file partially 
Python :: pandas 3d set camara cords 
Python :: How to get values in each cluster 
Python :: dont limit padnas jupyter 
Python :: pandas perform action on column 
Python :: convert from python code to c++ code 
Python :: pd datetime 
Python :: python convert string to raw string 
Python :: python move 
Python :: python combine if statements 
Python :: python code to press a key 
Python :: get member by id discord py 
Python :: check how many letters in a string python 
Python :: padding figures in python 
Python :: python3 list directories 
Python :: python schema 
Python :: py convert binary to int 
Python :: typing racer 
Python :: create a list of the keys in python dictionary 
Python :: adding an item to list in python 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =