How to create bubble chart in R?

How to create bubble chart in R?

How to create bubble chart in R?

This recipe helps you create bubble chart in R

Recipe Objective

How to create a bubble chart in R? A bubble chart is a variant of the scatter plot where we compare the relationship between two continuous variables with one additional variable of size, that is the size of each data point. A bubble chart is a two-dimensional data visualization chart that displays data in the form of circles (bubbles). A bubble chart takes three variables of the data, namely the size of the bubble, horizontal and vertical location of the data points. This recipe demonstrates an example of a bubble chart using ggplot.

Step 1 - Import necessary libraries

library("ggplot2") library("dplyr")

Step 1 - Define a dataframe

**Syntax for bubble plot is-ggplot (data, aes (x,y, size))+geom_point ()** where, data — the required data to plot bubble chart aes (x=data,y=data,size)) — the aes function — creates bubble from data to geom geom_point — the geometric object to be drawn — bubble

# define two variables data = data.frame (x_data =c(2,4,6,8,10,12), y_data = c(10,20,30,40,50,60)) print(data)

Step 2 - Plot a bubble chart

ggplot(data, aes(x=x_data, y=y_data, size = x_data,col=x_data)) +geom_point() # the size of bubble differs as value increases the size of the bubbles/circles increases.

Relevant Projects

Forecasting Business KPI's with Tensorflow and Python
In this machine learning project, you will use the video clip of an IPL match played between CSK and RCB to forecast key performance indicators like the number of appearances of a brand logo, the frames, and the shortest and longest area percentage in the video.

Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

Predict Macro Economic Trends using Kaggle Financial Dataset
In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

Build a Collaborative Filtering Recommender System in Python
Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

Inventory Demand Forecasting using Machine Learning in R
In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

Avocado Machine Learning Project Python for Price Prediction
In this ML Project, you will use the Avocado dataset to build a machine learning model to predict the average price of avocado which is continuous in nature based on region and varieties of avocado.

Machine Learning project for Retail Price Optimization
In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

Image Segmentation using Mask R-CNN with Tensorflow
In this Deep Learning Project on Image Segmentation Python, you will learn how to implement the Mask R-CNN model for early fire detection.

Demand prediction of driver availability using multistep time series analysis
In this supervised learning machine learning project, you will predict the availability of a driver in a specific area by using multi step time series analysis.

Churn Prediction in Telecom using Machine Learning in R
Estimating churners before they discontinue using a product or service is extremely important. In this ML project, you will develop a churn prediction model in telecom to predict customers who are most likely subject to churn.