Skip to main content

Python Advanced- scatter plot with MatplotLib

Have you tried drawing your first pyplot? If not then please see my previous post about this.
Let's move ahead and learn about the matplotlib scatter plot

Before plotting a plot we need data to plot. So here we are taking an example of cars data in csv format which you can download here cars data 
If you face any issue while downloading the file, comment me your email so that I can share the same directly.

Since the cars data is in csv format we need to first read the data with the help of pandas library as below-

The data will be looked look as below-

Since data is too long we need solid information from the data to plot so run Correlation & then run Covariance to find the most correlated variable to MPG-



Final cleaning of the cars data-

See now we have info to plot then let's plot it as given below-

Looks very cool right. Let's plot another one -

Key Note-Boxplots are great when you have a numeric column that you want to compare across different categories. When you want to visualize two numeric columns, scatter plots are ideal.

Please try above plotting in your notebook and comment if you face any issue.

Comments

Popular posts from this blog

How to use opencv-python with Darknet's YOLOv4?

Another post starts with you beautiful people 😊 Thank you all for messaging me your doubts about Darknet's YOLOv4. I am very happy to see in a very short amount of time my lovely aspiring data scientists have learned a state of the art object detection and recognition technique. If you are new to my blog and to computer vision then please check my following blog posts one by one- Setup Darknet's YOLOv4 Train custom dataset with YOLOv4 Create production-ready API of YOLOv4 model Create a web app for your YOLOv4 model Since now we have learned to use YOLOv4 built on Darknet's framework. In this post, I am going to share with you how can you use your trained YOLOv4 model with another awesome computer vision and machine learning software library-  OpenCV  and of course with Python 🐍. Yes, the Python wrapper of OpenCV library has just released it's latest version with support of YOLOv4 which you can install in your system using below command- pip install opencv-pyt...

How can I make a simple ChatBot?

Another post starts with you beautiful people! It has been a long time of posting a new post. But my friends in this period I was not sitting  where I got a chance to work with chatbot and classification related machine learning problem. So in this post I am going to share all about chatbot- from where I have learned? What I have learned? And how can you build your first bot? Quite interesting right! Chatbot is a program that can conduct an intelligent conversation based on user's input. Since chatbot is a new thing to me also, I first searched- is there any Python library available to start with this? And like always Python has helped me this time also. There is a Python library available with name as  ChatterBot   which is nothing but a machine learning conversational dialog engine. And yes that is all I want to start my learning because I always prefer inbuilt Python library to start my learning journey and once I learn this then only I move ahead for another...

Case Study::Decision Trees & Random Forests::Machine Learning::Kaggle

Another post starts with you beautiful people! I am very happy that you have enjoyed my previous post about  Decision Tree and Random Forest and a lot of aspiring data scientists like You have asked me questions like tell a case study and how to apply our knowledge to a competition like in Kaggle? So here I am! In this exercise we will work on a great dataset- Titanic disaster which we have studied in one of my earlier post. I suggest you to do a quick revision of that post here-  Let me revise Titanic disaster   and submit our prediction to  Kaggle . When the Titanic sank, 1502 of the 2224 passengers and crew were killed. One of the main reasons for this high level of casualties was the lack of lifeboats on this self-proclaimed "unsinkable" ship. In this course, we will learn how to apply machine learning techniques to predict a passenger's chance of surviving. Let's start with loading in the training and testing set into our Python environment. We will...