plotly.figure_factory
.create_ohlc¶
-
plotly.figure_factory.
create_ohlc
(open, high, low, close, dates=None, direction='both', **kwargs)¶ deprecated, use instead the plotly.graph_objects trace
plotly.graph_objects.Ohlc
- Parameters
open ((list)) – opening values
high ((list)) – high values
low ((list)) – low values
close ((list)) – closing
dates ((list)) – list of datetime objects. Default: None
direction ((string)) – direction can be ‘increasing’, ‘decreasing’, or ‘both’. When the direction is ‘increasing’, the returned figure consists of all units where the close value is greater than the corresponding open value, and when the direction is ‘decreasing’, the returned figure consists of all units where the close value is less than or equal to the corresponding open value. When the direction is ‘both’, both increasing and decreasing units are returned. Default: ‘both’
kwargs – kwargs passed through plotly.graph_objects.Scatter. These kwargs describe other attributes about the ohlc Scatter trace such as the color or the legend name. For more information on valid kwargs call help(plotly.graph_objects.Scatter)
- Rtype (dict)
returns a representation of an ohlc chart figure.
Example 1: Simple OHLC chart from a Pandas DataFrame
>>> from plotly.figure_factory import create_ohlc >>> from datetime import datetime
>>> import pandas as pd >>> df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv') >>> fig = create_ohlc(df['AAPL.Open'], df['AAPL.High'], df['AAPL.Low'], df['AAPL.Close'], dates=df.index) >>> fig.show()