W3Schools.com (2024)

Create Labels for a Plot

With Pyplot, you can use the xlabel() and ylabel() functions to set a label for the x- and y-axis.

Example

Add labels to the x- and y-axis:

import numpy as np
import matplotlib.pyplot as plt

x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330])

plt.plot(x, y)

plt.xlabel("Average Pulse")
plt.ylabel("Calorie Burnage")

plt.show()

Result:

W3Schools.com (1)

Try it Yourself »

Create a Title for a Plot

With Pyplot, you can use the title() function to set a title for the plot.

Example

Add a plot title and labels for the x- and y-axis:

import numpy as np
import matplotlib.pyplot as plt

x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330])

plt.plot(x, y)

plt.title("Sports Watch Data")
plt.xlabel("Average Pulse")
plt.ylabel("Calorie Burnage")

plt.show()

Result:

W3Schools.com (2)

Try it Yourself »

Set Font Properties for Title and Labels

You can use the fontdict parameter inxlabel(), ylabel(), and title() to set font properties for the title and labels.

Example

Set font properties for the title and labels:

import numpy as np
import matplotlib.pyplot as plt

x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330])

font1 = {'family':'serif','color':'blue','size':20}
font2 = {'family':'serif','color':'darkred','size':15}

plt.title("Sports Watch Data", fontdict = font1)
plt.xlabel("Average Pulse", fontdict = font2)
plt.ylabel("Calorie Burnage", fontdict = font2)

plt.plot(x, y)
plt.show()

Result:

W3Schools.com (3)

Try it Yourself »

Position the Title

You can use the loc parameter intitle() to position the title.

Legal values are: 'left', 'right', and 'center'. Default value is 'center'.

Example

Position the title to the left:

import numpy as np
import matplotlib.pyplot as plt

x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330])

plt.title("Sports Watch Data", loc = 'left')
plt.xlabel("Average Pulse")
plt.ylabel("Calorie Burnage")

plt.plot(x, y)
plt.show()

Result:

W3Schools.com (4)

Try it Yourself »


W3schools Pathfinder

Track your progress - it's free!

W3Schools.com (2024)

FAQs

Why avoid W3Schools? ›

Nobody denies that W3Schools is a terrible place to learn how to program. Their examples are outdated, insecure, and don't really explain why things work in a certain way. Their tutorials are optimized for copy & paste, and God knows how many security bugs in the wild are due to somebody copying W3Schools.

Is W3Schools outdated? ›

They are not outdated but they are providing basic knowledge. You will get basic knowledge by reading on w3school and it is good for beginners. For advance you have to check each langauge official site and go through documents and their tutorials.

How reliable is W3Schools? ›

Online reviews of W3Schools are generally positive, with most users recommending it as a resource for beginners. In general, Sitejabber reviewers felt that W3Schools was a great free resource for beginners learning HTML, CSS, and JavaScript.

Is W3Schools bootcamp worth it? ›

The course material, timely and aligned with industry standards, has equipped me with relevant skills for the ever-evolving tech landscape. Enrolling in the W3C Bootcamp is a decision I don't regret, and I would wholeheartedly recommend this to anyone aiming to elevate their skills in web development.

Why do people dislike W3Schools? ›

A bit simplistic, and MDN is better, but its not bad. W3 has a bad reputation because, at least a long while ago, it was rife with blatantly false or misleading information. There's literally working code demos for everything on the site that's front-end or client-side.

Is W3Schools certification legit? ›

W3Schools is Trusted by Top Companies

Our certificates are recognized and valued by companies looking to employ skilled developers.

Which is better W3Schools or Codecademy? ›

Of the two, Codecademy has a simpler structure. You can easily find the topic you want and start learning. Its fixed pricing plans are also easier to understand. In addition, the biggest issue with W3Schools is the ads that keep popping up as you learn.

Who is behind W3Schools? ›

It is run by Refsnes Data in Norway. It has an online text editor called TryIt Editor, and readers can edit examples and run the code in a test environment.

Is W3Schools enough for SQL? ›

Basically the title. Not only Select Star SQL misses many basic SQL operations, but its explanations are both unnecessarily complicated and miss lots of details. On top of that you spend half of your time reading about the executions in the US.

Can I get a job with W3Schools certificate? ›

Web Design Certification

Becoming certified by W3Schools is great proof to show to employers and makes your resume stand out among other candidates.

Is W3Schools enough to learn HTML? ›

Yes. Because HTML is so basic it's like learning to speak your native language before even learning how to read and write it. W3Schools has enough before you move on to real web development.

How does W3school make money? ›

Through ads : through ads alone they will earn alot in w3schools. They would earn nearly 1–2lacks per day in ads alone. Through donation:. Many people who completed their courses in w3schools, after few years , they would donate some money for the growth of the site .

How much does W3Schools cost? ›

Both My Learning and W3Schools Public Profile are completely free of charge, however there are available upgrade plans that can enhance your learning experience.

How popular is W3Schools? ›

The largest web developer site on the internet.
  • 3 billion pages displayed each year.
  • 70 million visitors each month.

Which is better, Codecademy or W3Schools? ›

Of the two, Codecademy has a simpler structure. You can easily find the topic you want and start learning. Its fixed pricing plans are also easier to understand. In addition, the biggest issue with W3Schools is the ads that keep popping up as you learn.

Is W3Schools a good place to learn SQL? ›

W3schools is the complete opposite: lots of clearly structured lessons with clear examples and straightforward explanations. Perhaps that's the best resource to learn SQL currently available.

Is W3Schools good for kids? ›

W3Schools is a free educational website for learning coding online that's great for more advanced coders. For students in middle school and high school, W3Schools is a great resource for coding tutorials in multiple languages. Students can get detailed information on coding topics in an easy-to-digest format.

Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 6168

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.