Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plot second axis plotly

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

# Create figure with secondary y-axis
fig = make_subplots(specs=[[{"secondary_y": True}]])

# Add traces
fig.add_trace(
    go.Scatter(x=[1, 2, 3], y=[40, 50, 60], name="yaxis data"),
    secondary_y=False,
)

fig.add_trace(
    go.Scatter(x=[2, 3, 4], y=[4, 5, 6], name="yaxis2 data"),
    secondary_y=True,
)

# Add figure title
fig.update_layout(
    title_text="Double Y Axis Example"
)

# Set x-axis title
fig.update_xaxes(title_text="xaxis title")

# Set y-axes titles
fig.update_yaxes(title_text="<b>primary</b> yaxis title", secondary_y=False)
fig.update_yaxes(title_text="<b>secondary</b> yaxis title", secondary_y=True)

fig.show()
Comment

PREVIOUS NEXT
Code Example
Python :: STATIC_ROOT 
Python :: get title beautifulsoup 
Python :: plot using matplotlib 
Python :: pandas filter with given value 
Python :: python infinity 
Python :: otp generation in python 
Python :: saving model in pytorch 
Python :: how to get the current line number in python 
Python :: How to load .mat file and convert it to .csv file? 
Python :: async sleep python 
Python :: python flatten array of arrays 
Python :: creating a pandas df 
Python :: python get list memory size 
Python :: python add string and int 
Python :: add new keys to a dictionary python 
Python :: how to get key of a particular value in dictionary python using index 
Python :: pandas length of dataframe 
Python :: hex to rgb python 
Python :: flask python use specified port 
Python :: python pathlib create directory if not exists 
Python :: python series to list of string 
Python :: numpy delete column 
Python :: only keep rows of a dataframe based on a column value 
Python :: add column to existing numpy array 
Python :: how do i turn a tensor into a numpy array 
Python :: how to read numbers in csv files python 
Python :: check if a list contains any item from another list python 
Python :: python cast list to float 
Python :: cd in python 
Python :: levenshtein distance 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =