2

Chapter 1 of "Machine Learning - A Probabilistic Perspective" by Kevin Patrick Murphy gives this figure (fig_1),

enter image description here

and says

this is a pairwise scatter plot on iris dataset. The diagonal plots the marginal histograms of the 4 features.

This post, gives this figure (fig_2) to illustrate "marginal histograms".

enter image description here

I am trying to plot a histogram by using the approach that plotted out fig_2, with first feature of iris dataset, that is, sepal length.

Here is the code,

import matplotlib.pyplot as plt
from sklearn import datasets
import seaborn as sns; 
sns.set(style="white", color_codes=True)
iris = datasets.load_iris()
_ = plt.hist(iris.data[:,0], bins = 11)

which plotted out this figure (fig_3.)

enter image description here

Which looks different to the top left in fig_1.

I've searched whole site and got this and this, none of them gives explanation what a marginal histograms is.

How to plot a marginal histogram correctly? Why is my plot different to the one in a textbook?

yaojp
  • 461
  • 2
  • 11
  • @Glen_b I've updated the OP, would you please take a loot at it? – yaojp Sep 26 '19 at 06:14
  • I put it on hold to protect it while you edited. You sound like you're done, so I've reopened. – Glen_b Sep 26 '19 at 06:26
  • A marginal histogram is a histogram of the data. That's all there is to it. Whether and how you can plot them is a matter of consulting your software documentation. – whuber Sep 27 '19 at 15:05
  • @whuber Is "marginal histograms" a canonical term? – yaojp Sep 27 '19 at 15:24
  • Can you then now please make a reasonable title, please? – kjetil b halvorsen Sep 27 '19 at 17:42
  • "Marginal" is a [standard term](https://en.wikipedia.org/wiki/Marginal_distribution) for focusing on a single univariate component of a multivariate distribution. Thus, "marginal histograms" are histograms of the individual variables. – whuber Sep 27 '19 at 17:50

0 Answers0