seaborn.distplot() has been DEPRECATED in seaborn 0.11 and is replaced with the following: displot(), a figure-level function with a similar flexibility over the kind of plot to draw. This is a FacetGrid, and does not have the ax parameter, so it will not work with matplotlib.pyplot.subplots. histplot(), an axes-level function for plotting histograms, including with kernel density smoothing. This does have the ax parameter, so it will work with matplotlib.pyplot.subplots.
<code class="python">import seaborn as sns import matplotlib.pyplot as plt # load data penguins = sns.load_dataset("penguins", cache=False) # select the columns to be plotted cols = ['bill_length_mm', 'bill_depth_mm'] # create the figure and axes fig, axes = plt.subplots(1, 2) axes = axes.ravel() # flattening the array makes indexing easier for col, ax in zip(cols, axes): sns.histplot(data=penguins[col], kde=True, stat='density', ax=ax) fig.tight_layout() plt.show()</code>
<code class="python"># list of dataframe lod = [df1, df2, df3] # create one dataframe with a new 'source' column to use for row, col, or hue df = pd.concat((d.assign(source=f'df{i}') for i, d in enumerate(lod, 1)), ignore_index=True)</code>
위 내용은 정의된 Matplotlib 하위 플롯 내에서 Seaborn 플롯을 플롯하는 방법은 무엇입니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!