Scatter Plot

It is used to reveal a pattern in the plotted data. To plot a scatter plot using the scatter() function. Below is the Julia program to plot a scatter plot:

Julia




# Julia program to plot a 
# scatter plot
  
# Importing Module
using PyPlot;
  
# Defining values for the axes
x = [5, 7, 8, 7, 2, 17, 2, 9
     4, 11, 12, 9, 6]
y = [99, 86, 87, 88, 111, 86
     103, 87, 94, 78, 77, 85, 86]
  
# Plotting scatter plot
scatter(x, y, color = "red");
  
# Setting title for the scatter plot
# and labels for the axes
title("A simple Scatter Plot");
xlabel("This is X-Axis");
ylabel("This is Y-Axis");
  
PyPlot.show();


Output:

 

Explanation: Here also, inside of the scatter() function, the variables are passed alongside another argument color which is used to define the color of each dot of the scatter plot.

Julia – Working with Matplotlib’s Pyplot Class

Data visualization is the process of representing the available data diagrammatically. There are packages that can be installed to visualize the data in Julia. Here, PyPlot class of the Matplotlib Module in Julia will be used for plotting.

To install the PyPlot package in Julia, the Matplotlib package of Python must be installed on the user’s device. Using the Pkg command we will install PyPlot in Julia Command-Line. Open the Julia terminal and type the following command:

using Pkg;

Pkg.add(“PyPlot”);

 

Similar Reads

Line Chart

Two 1-D arrays will be provided as input to the plot() function to plot a simple line chart. Below is the Julia program to plot a Line chart:...

Bar Chart

...

Scatter Plot

...

Pie Chart

A simple bar graph can be used to compare two things or represent changes over time or represent the relationship between two items. To plot a bar chart we will use the bar() function and pass the variables/values we want to plot. Below is the Julia program to plot a bar chart:...