jupyter
jupytext
kernelspec
language_info
plotly
notebook_metadata_filter
text_representation
all
extension
format_name
format_version
jupytext_version
.md
markdown
1.1
1.1.7
display_name
language
name
Python 3
python
python3
codemirror_mode
file_extension
mimetype
name
nbconvert_exporter
pygments_lexer
version
.py
text/x-python
python
python
ipython3
3.7.2
description
display_as
language
layout
name
order
page_type
permalink
thumbnail
How to design figures with multiple chart types in python.
file_settings
python
base
Multiple Chart Types
16
u-guide
python/graphing-multiple-chart-types/
thumbnail/multiple-chart-type.jpg
Line Chart and a Bar Chart
import plotly .graph_objects as go
fig = go .Figure ()
fig .add_trace (
go .Scatter (
x = [0 , 1 , 2 , 3 , 4 , 5 ],
y = [1.5 , 1 , 1.3 , 0.7 , 0.8 , 0.9 ]
))
fig .add_trace (
go .Bar (
x = [0 , 1 , 2 , 3 , 4 , 5 ],
y = [1 , 0.5 , 0.7 , - 1.2 , 0.3 , 0.4 ]
))
fig .show ()
A Contour and Scatter Plot of the Method of Steepest Descent
import plotly .graph_objects as go
# Load data
import json
import six .moves .urllib
response = six .moves .urllib .request .urlopen (
"https://raw-hub.myxuebi.top/plotly/datasets/master/steepest.json" )
data = json .load (response )
# Create figure
fig = go .Figure ()
fig .add_trace (
go .Contour (
z = data ["contour_z" ][0 ],
y = data ["contour_y" ][0 ],
x = data ["contour_x" ][0 ],
ncontours = 30 ,
showscale = False
)
)
fig .add_trace (
go .Scatter (
x = data ["trace_x" ],
y = data ["trace_y" ],
mode = "markers+lines" ,
name = "steepest" ,
line = dict (
color = "black"
)
)
)
fig .show ()
See https://plotly.com/python/reference/ for more information and attribute options!