Cara menggunakan matplotlib in python w3schools

Skip to main content

Python for MATLAB Users

Transition from MATLAB by learning some fundamental Python concepts, and diving into the NumPy and Matplotlib packages.

Related

SQL vs Python: Which Should You Learn?

In this article, we will cover the main features of Python and SQL, their main similarities and differences, and which one you should choose first to start your data science journey.

Javier Canales Luna

12 min

Text Data In Python Cheat Sheet

Welcome to our cheat sheet for working with text data in Python! We've compiled a list of the most useful functions and packages for cleaning, processing, and analyzing text data in Python, along with clear examples and explanations, so you'll have everything you need to know about working with text data in Python all in one place.

Python Sets and Set Theory Tutorial

Learn about Python sets: what they are, how to create them, when to use them, built-in functions and their relationship to set theory operations.

Pandas Tutorial: DataFrames in Python

Explore data analysis with Python. Pandas DataFrames make manipulating your data easy, from selecting or replacing columns and indices to reshaping your data.

See MoreSee More

Pada tutorial kali ini, kita akan mencoba membuat beberapa grafik dari data distribusi normal. Dalam Machine Learning, data dapat mencapai angka ribuan, atau bahkan jutaan.

Buka command prompt. Sebelum memulai, terlebih dahulu kita harus meng-install package matplotlib yang berfungsi untuk membuat grafik, dengan perintah sebagai berikut,

pip install matplotlib

Misalnya kita ingin membuat scatter plot menggunakan 1000 data yang berdistribusi normal secara random. Pada array pertama memiliki mean 5.0 dengan standar deviasi 1.0, sedangkan pada array kedua akan memiliki mean 10.0 dengan standar deviasi 2.0. Kita dapat menggunakan perintah berikut,

import numpy
import matplotlib.pyplot as plt

x = numpy.random.normal(5.0, 1.0, 1000)
y = numpy.random.normal(10.0, 2.0, 1000)

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

Salin script di atas dan letakkan pada notepad, lalu save dengan nama scatter.py dan misalnya di simpan dalam folder c://coba.

Untuk melihat grafik scatterplot yang akan dihasilkan, gunakan perintah berikut,

c:/coba>python scatter.py

Maka akan muncul hasil scatter plot seperti gambar berikut

Selanjutnya, kita akan mencoba membuat grafik histogram dengan perintah seperti berikut,

import numpy
import matplotlib.pyplot as plt
x = numpy.random.normal(5.0, 1.0, 1000)plt.hist(x, 100)
plt.show()

Salin pada notepad, misalkan kita simpan pada folder yang sama seperti tadi yaitu c://coba dengan nama hist.py. Setelah itu, dapat kita panggil grafik histogram dari data random dengan perintah seperti berikut,

Did you know that you can visualize your datasets using Python? πŸ“Š Make your datasets simpler to understand and analyze by visualizing them. By creating a beautiful and easy-to-read data visualization you can convey insightful information about the dataset. πŸ‘€ Matplotlib is an open-source graph plotting library in Python that allows you to create different types of graphs using your own data values to visualize your data in your preferred way. πŸ§‘πŸ’» Have you used Python before? Tell us about your favorite Python library in the comments below! 🐍 #w3schools #python #education #learning #data #programming #matplotlib #development

106 8 Komen

Suka Komen

Kongsi

  • Salin
  • LinkedIn
  • Facebook
  • Twitter

Khaled Ramo2bln

  • Laporkan komen ini

    Lapor

    Lapor

    Kembali Hantar

Thanks for sharing

Suka

Balas

1 Reaksi

Sergei Chernyahovsky

Looking for QA position | Web | Mobile | Desktop | Electron | REST API | Database | CI with Jenkins | Test Automation (Open for new connections;))

2bln

  • Laporkan komen ini

    Lapor

    Lapor

    Kembali Hantar

Very good tutorial site , every time i need to remember something fast, i use your site -> very clear explanations !

Suka

Balas

3 Reaksi 4 Reaksi

W3Schools.com2bln

  • Laporkan komen ini

    Lapor

    Lapor

    Kembali Hantar

You can follow our tutorial and learn how to make your own Pie Chart here! πŸ’š //www.w3schools.com/python/matplotlib_pie_charts.asp

Suka

Balas

7 Reaksi 8 Reaksi

RAHUL V

Associate software developer | Master Data Management | Reltio MDM certified

2bln

  • Laporkan komen ini

    Lapor

    Lapor

    Kembali Hantar

Interesting

Suka

Balas

1 Reaksi

πŸ”΄Ben Lopez BBA, CSSGB

πŸš€Web Developer, Data, Python, Java, SQL | Learning πŸ‡«πŸ‡·FrenchπŸ‡©πŸ‡ͺGerman | Community Manager | Content Creator | Digital Marketing | Social Media | Branding | Host | Lecturer | Project Collaborator | B2B | B2C | REMOTEπŸ’»

2bln

  • Laporkan komen ini

    Lapor

    Lapor

    Kembali Hantar

Morning W3Schools.com πŸ’šπŸ’šπŸ’š

Suka

Balas

4 Reaksi 5 Reaksi

Lihat lagi komen

Untuk melihat atau menambahkan komen, daftar masuk

W3Schools.com

468,556 pengikut

7j

  • Laporkan paparan ini

    Lapor

    Lapor

    Kembali Hantar

We are thrilled to announce the upcoming launch of the latest version of W3Schools Spaces. We've been working on this for a while now, and it's almost ready to be released! So get ready to sharpen and master your development skills. πŸŽ‰ The new version will allow you to practice frontend and backend coding, and create powerful web applications with backend support, all from your browser - No setup needed. In addition, it will allow you to bring your web applications to life with dynamic data and functionalities. βœ¨ W3Schools Spaces is suitable for developers of all skill levels and is designed to be efficient and user-friendly. Whether starting your coding journey or being an experienced developer, it will help you improve your skills and optimize your workflow. πŸ‘¨πŸ’» So soon, it will be possible for you to build the web application of your dreams, either from scratch or from our available templates. πŸ“š This is the release of the year, and we can't wait to share it with you! πŸ’š What would be your dream application to build? Let us know in the comments section below. πŸ‘‡πŸ» #dynamicwebsite #website #backendsupport #learning #programming #w3schools #Dynamicspaces

34

Suka Komen

Kongsi

  • Salin
  • LinkedIn
  • Facebook
  • Twitter

Untuk melihat atau menambahkan komen, daftar masuk

W3Schools.com

468,556 pengikut

1h

  • Laporkan paparan ini

    Lapor

    Lapor

    Kembali Hantar

Are you curious about how your audience interacts with your website? πŸ€” User analytics can give you valuable insights into behavior and preferences. It is the process of collecting, analyzing, and interpreting data about how users interact with a website or application. You can learn more about your user and improve your website and strategy by tracking user behaviors. πŸ“Š User analytics at W3Schools gives you information about the following:  πŸ“Locations  πŸ“Browser  πŸ“Operating System  πŸ“Device type  πŸ“Top files  Customize your website to your target audience and measure your website's progress using user analytics πŸ™ŒπŸ» Take advantage of the opportunity to understand and engage more with your audience - Start using user analytics at W3Schools Spaces today! πŸ’― Do you analyze your user's data? Tell us more about it in the comment section. πŸš¨ #w3schools #useranalytics #learning #programming #coding

29 2 Komen

Suka Komen

Kongsi

  • Salin
  • LinkedIn
  • Facebook
  • Twitter

Untuk melihat atau menambahkan komen, daftar masuk

W3Schools.com

468,556 pengikut

2h

  • Laporkan paparan ini

    Lapor

    Lapor

    Kembali Hantar

Web accessibility is all about being considerate. Keep in mind those who have physical difficulties with accessing web content! 🫢 The one thing you should never forget when working with web development is to make your web pages accessible. Making your web page accessible will help you assure a good user experience for all users, independent of their custom device settings, or disabilities. πŸ’š Use semantic elements to give your elements meaning, there are approximately 110 elements in HTML 5, of which only two elements have no built-in accessibility features. When working with web development, you should always check for the best suitable semantic elements for your content! ⚑️ Take consideration of your design, the contrast and size of your elements, and most importantly functionality. Make sure that every user will find a way to comfortably use your web page without any unnecessary confusion. 🧩 Learn more about the diversity of abilities and how to make your web pages suitable for all kinds of users! ✨ //lnkd.in/ePhUHA2a Have you or anyone you know had any difficulties using various web pages? Share your past experiences in the comments below! πŸ‘€ #w3schools #development #education #accessibility #programming #learning #webdevelopment #technology #code

70 8 Komen

Suka Komen

Kongsi

  • Salin
  • LinkedIn
  • Facebook
  • Twitter

Untuk melihat atau menambahkan komen, daftar masuk

W3Schools.com memaparkan semula ini

  • Laporkan paparan ini

    Lapor

    Lapor

    Kembali Hantar

Thomas Thorsell-Arntsen

CEO at W3Schools Network - We are hiring!

1mgu

πŸ‘‹ Hey everyone! We're excited to announce that we're working on an expansion for W3Schools Spaces that makes building with the backend a breeze. With this tool, you'll be able to build and deploy backend systems. But that's not all - our IDE also comes with a sleek, intuitive interface that makes it easy to navigate and customize to your workflow. Whether you're a seasoned backend developer or just starting, this tool will help you take your skills to the next level. We can't wait to share more details with you in the coming weeks.  Stay tuned! #backenddevelopment #IDE #developer

Suka Komen

Kongsi

  • Salin
  • LinkedIn
  • Facebook
  • Twitter

Untuk melihat atau menambahkan komen, daftar masuk

Thomas Thorsell-Arntsen

CEO at W3Schools Network - We are hiring!

1mgu

πŸ‘‹ Hey everyone! We're excited to announce that we're working on an expansion for W3Schools Spaces that makes building with the backend a breeze. With this tool, you'll be able to build and deploy backend systems. But that's not all - our IDE also comes with a sleek, intuitive interface that makes it easy to navigate and customize to your workflow. Whether you're a seasoned backend developer or just starting, this tool will help you take your skills to the next level. We can't wait to share more details with you in the coming weeks.  Stay tuned! #backenddevelopment #IDE #developer

W3Schools.com

468,556 pengikut

1mgu

  • Laporkan paparan ini

    Lapor

    Lapor

    Kembali Hantar

Have you ever had one of those days where you feel super powerful after debugging someone else code? πŸ˜Ž Debugging is the process of finding and fixing errors in your code. An essential skill for any programmer, as it allows you to identify problems with your code and find ways to fix them.πŸš€ Also, debugging is about poking and working with the code until you find the issue. And debugging other people's code is the ultimate test of patience and problem-solving skills.⚑️ It can be a time–consuming and frustrating process, but it is an essential part of the software development cycle. With practice, you will become more skilled at finding and fixing errors in your code.πŸŽ‰ Spending hours working on someone else's code trying to track down a pesky bug can take some time. But nothing is quite like the feeling of satisfaction and accomplishment when you finally solve the bug. β° Have you ever had an experience with debugging others' code? Tell us about it in the comment section! πŸ‘‡πŸ» #w3schools #debugging #programming #coding #bugs

511 24 Komen

Suka Komen

Kongsi

  • Salin
  • LinkedIn
  • Facebook
  • Twitter

Untuk melihat atau menambahkan komen, daftar masuk

W3Schools.com

468,556 pengikut

1mgu

  • Laporkan paparan ini

    Lapor

    Lapor

    Kembali Hantar

Sale alert! πŸš¨ Are you looking to start the year by upgrading your knowledge in programming and coding? Now is the perfect time to do it. We offer a whopping 60% discount on W3Schools Full Access programs. πŸš€ Full access gives you lifelong access to all W3Schools Courses and Certifications, including new courses we will add to the program. There is no deadline or expiration date, so bundle up now and start learning. πŸ“š Earn certifications to document your knowledge and improve your career. Take advantage of this time-limited opportunity and save money now!πŸ’Έ Happy learning, we believe in you guys! πŸ’š Check it out here: //lnkd.in/dpPBdJmr #w3schools #learning #sale #discount #coding #programming

22 1 Komen

Suka Komen

Kongsi

  • Salin
  • LinkedIn
  • Facebook
  • Twitter

Untuk melihat atau menambahkan komen, daftar masuk

W3Schools.com

468,556 pengikut

1mgu

  • Laporkan paparan ini

    Lapor

    Lapor

    Kembali Hantar

Got a project idea for a new website? Discover the differences between static and dynamic websites and find the best fit for your project! πŸ” Do you want to work with implementing beautiful front-end designs without doing any backend development? In that case, creating a static website is the perfect choice for your project. Static websites can have exciting functionalities, by using JavaScript you can make the website interactive and connect APIs to enhance the user experience. ✨ If your project requires an integrated database where you can store, edit and fetch data from, a dynamic website is a right choice! Dynamic websites are websites that have a backend environment within them, which can be used by the user to either input, edit, or request data through the front end of the website. 🧩 Your choice depends on what you expect the user to do on your website, if you want the user to simply have the access to your content, you might not need it to be any more advanced than a static website. ⚑️ If you would rather give the user more possibilities within the website, such as the ability to register and log in, or the ability to add their own content to your website in a simple and quick way, you should choose to create a dynamic website for your project! πŸ§‘πŸ’» Get started by creating a website in W3Schools Spaces and stay tuned for our upcoming release for Dynamic Spaces! πŸ‘€ #w3schools #website #static #dynamic #frontend #webdevelopment #programming #backend #fullstack #project #learning

Postingan terbaru

LIHAT SEMUA