BaşlayınÜcretsiz Başlayın

Adding axis labels and titles

It is important to add labels to your plot so it's clear to other people what information it is trying to convey. In this exercise, you will add labels to the plot you created in the last one.

Bu egzersiz

Introduction to Python for Finance

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Add the following labels:
    • x-axis: 'Days'
    • y-axis: 'Prices, $'
    • title: 'Company Stock Prices Over Time'

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

import matplotlib.pyplot as plt

# Plot price as a function of time
plt.plot(days, prices, color="red", linestyle="--")

# Add x and y labels
____('Days')
____('Prices, $')

# Add plot title
____('Company Stock Prices Over Time')

# Show plot
plt.show()
Kodu Düzenle ve Çalıştır