LoslegenKostenlos loslegen

Add Max Temperatures

The Australian Bureau Of Meteorology really enjoyed the plot you created for them but requested an edit.

They would like you to add the absolute maximum temperature to the plot created before. That is the highest temperature experienced anywhere in Sydney on that day.

A combined_fig has already been created for you, and a temp_syd_max DataFrame has been provided.

Your task is to add this new line chart to the existing plot.

Diese Übung ist Teil des Kurses

Introduction to Data Visualization with Plotly in Python

Kurs anzeigen

Anleitung zur Übung

  • Create a new line chart of the absolute Max temperature called abs_max_line_fig.
  • Add it to the existing combined_fig and show the new plot.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Figure already created for you
combined_fig = Figure(data=[*daily_temp_fig.data, *monthly_avg_fig.data])

# Create a new line chart
abs_max_line_fig = px.____(temp_syd_max, x='Date', y='Max', color_discrete_sequence=['orange'])

# Add the new trace
combined_fig.____(____.data[0])

# Add a title
combined_fig.update_layout(title='Sydney Temperature Analysis')

# Show the combined figure
combined_fig.show()
Code bearbeiten und ausführen