Python Forum
Not able to update y2 axis scale in plotly
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not able to update y2 axis scale in plotly
#1
Hi,
Could you please help me updating the scale for y_2 axis
fig.update_yaxes(tickvals=[0.0,0.5,0.75,1.0,1.25,1.5,1.75,1.8,1.9,2.0,2.5,3.0,4.0,4.5,5.0,5.25,5.5,6.0],secondary_y=True)
This line isn't working

Code :
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.add_trace(go.Bar(
x=final['Build_date'],
y=final['First Year Trips'],
name='First Year Trips',
marker_color='Blue'
))
fig.add_trace(go.Bar(
x=final['Build_date'],
y=final['Build_Count'],
name='Build_Count',
marker_color='lightsalmon'
))
fig.add_trace(go.Bar(
x=final['Build_date'],
y=final['ZeroTripChassis'],
name='ZeroTripChassis',
marker_color='yellow'
))

fig.add_trace(
go.Scatter(x=final['Build_date'], y=final['Rolling_Avg'], name="12M Rolling Average of First Year Trips/Truck."),
secondary_y=True,
)

fig.update_yaxes(tickvals=[0.0,0.5,0.75,1.0,1.25,1.5,1.75,1.8,1.9,2.0,2.5,3.0,4.0,4.5,5.0,5.25,5.5,6.0],secondary_y=True)

fig.update_layout(barmode='group', xaxis_tickangle=-45)
fig.update_yaxes(title_text="Count", secondary_y=False)
fig.update_yaxes(title_text="Trips", secondary_y=True)
fig.show()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to properly scale text in postscript conversion to pdf? philipbergwerf 3 1,084 Nov-07-2022, 01:30 PM
Last Post: philipbergwerf
  binning_endpoints ->plotly Luis_liverpool 0 808 Aug-09-2022, 10:13 AM
Last Post: Luis_liverpool
  KeyError: 0 when trying to dedupe and match records at scale Catalytic 1 2,109 Apr-07-2022, 06:34 PM
Last Post: deanhystad
  Sample labels from excel file in order to put them on x-axis and y-axis of a plot hobbyist 11 4,232 Sep-14-2021, 08:29 AM
Last Post: hobbyist
  plotly expression problem Visiting 2 1,963 May-16-2021, 12:28 AM
Last Post: Visiting
  Matplotlib scale julienhofmann 0 1,782 Apr-04-2021, 08:50 AM
Last Post: julienhofmann
Question Python + Google Sheet | Best way to update specific cells in a single Update()? Vokofe 1 2,627 Dec-16-2020, 05:26 AM
Last Post: Vokofe
  Difference Between Figure Axis and Sub Plot Axis in MatplotLib JoeDainton123 2 2,426 Aug-21-2020, 10:17 PM
Last Post: JoeDainton123
  Plotly library with AIX 6.X / 7.X ? HK2432 0 1,439 Jan-14-2020, 06:04 PM
Last Post: HK2432
  Change the scale on a Matplotlib Interactive Graph khatharsis 0 2,806 Oct-13-2019, 06:14 AM
Last Post: khatharsis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020