Basic Plotting With Seaborn
Basic Plotting With Seaborn
Scatter plots are effective for visualizing the relationship between two
continuous variables. Seaborn simplifies the process of creating scatter
plots with the scatterplot() function. Let's consider an example:
# Sample data
import pandas as pd
data = pd.DataFrame({'X': [1, 2, 3, 4, 5], 'Y': [2,
3, 5, 7, 11]})
Output
1|Page
b. Line Plots with Seaborn
Line plots are effective for visualizing trends in data. Seaborn simplifies
the creation of line plots using the lineplot() function. Consider the
following example:
Output:
Output:
2|Page
Utilizing Seaborn's Simplified API (Application Programming Interface)
import pandas as pd
student_data = pd.DataFrame(data)
Output:
3|Page
b. Scatter Plot using sns.relplot: Now let’s make a Scatter plot using the
data named student_data.
Output:
4|Page
indicating that a scatter plot should be created. You can make other
plots like Line Plot and Categorical Plot using sns.relplot by changing
the value in the kind parameter.
5|Page
c. Visualizing Example Datasets: Seaborn's plotting functions can be
applied directly to the loaded example datasets. This simplifies the
process of creating informative visualizations for data analysis and
interpretation.
6|Page