Python Scikit-learn: Draw a scatterplot, then add a joint density estimate to describe individual distributions on the same plot between Sepal length and Sepal width
Python Machine learning Iris Visualization: Exercise-11 with Solution
Write a Python program to draw a scatterplot, then add a joint density estimate to describe individual distributions on the same plot between Sepal length and Sepal width.
Sample Solution:
Python Code:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
iris = pd.read_csv("iris.csv")
sns.jointplot("SepalLengthCm", "SepalWidthCm", data=iris, color="b").plot_joint(sns.kdeplot, zorder=0, n_levels=6)
plt.show()
Sample Output:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to create a joinplot and add regression and kernel density fits using “reg” to describe individual distributions on the same plot between Sepal length and Sepal width.
Next: Write a Python program to create a joinplot using “kde” to describe individual distributions on the same plot between Sepal length and Sepal width and use ‘+’ sign as marker.
What is the difficulty level of this exercise?
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/machine-learning/scikit-learn/iris/python-machine-learning-scikit-learn-iris-visualization-exercise-11.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics