seaborn

Fill area of overlap between two normal distributions in seaborn / matplotlib

柔情痞子 提交于 2020-06-25 04:31:52
问题 I want to fill the area overlapping between two normal distributions. I've got the x min and max, but I can't figure out how to set the y boundaries. I've looked at the plt documentation and some examples. I think this related question and this one come close, but no luck. Here's what I have so far. import numpy as np import seaborn as sns import scipy.stats as stats import matplotlib.pyplot as plt pepe_calories = np.array([361, 291, 263, 284, 311, 284, 282, 228, 328, 263, 354, 302, 293, 254,

Installing seaborn on Docker Alpine

只愿长相守 提交于 2020-06-24 11:42:45
问题 I am trying to install seaborn with this Dockerfile: FROM alpine:latest RUN apk add --update python py-pip python-dev RUN pip install seaborn CMD python The error I get is related to numpy and scipy (required by seaborn ). It starts with: /tmp/easy_install-nvj61E/numpy-1.11.1/setup.py:327: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates and ends with File "numpy/core/setup.py", line 654, in get_mathlib_info RuntimeError: Broken

How to annotate a stacked bar chart with word count and column name?

泪湿孤枕 提交于 2020-06-23 03:30:25
问题 My question is about plotting in a stacked bar plot the words frequency rather than numbers with labels on the bar. Let's suppose that I have these words Date Text Count 01/01/2020 cura 25 destra 24 fino 18 guerra 13 americani 13 02/01/2020 italia 137 turismo 112 nuovi 109 pizza 84 moda 79 created by grouping by date and aggregating by Text , then selecting the top 5 ( head(5) ): Attempt: (my attempt: this generates a stacked plot, but colours and labels are not what I would like to expect)

Changing the size of seaborn pairplot markers

邮差的信 提交于 2020-06-22 11:24:28
问题 I'm trying to plot a seaborn.pairplot with small dots like this one: But I get one with the markers much bigger and I can't find how to change their size in the documentation. My pairplot looks like this: The code I'm using to plot is: sns.pairplot(df, diag_kind='kde') sns.plt.show() 回答1: Adding this should solve the issue - just worked for me plot_kws={"s": 3} 回答2: Just to clarify the above answer in that plot_kws = {"s":3} is a dictionary with size ("s") set to the value of 3. You can

Show xticks which are function of x-axis, not directly the data it self. Example with dates (pandas, matplotlib)

南楼画角 提交于 2020-06-17 15:52:28
问题 While working with seaborn, I tried to set x-ticks to be different from my data unsuccessfully. I'll give concrete example in a moment, but I also generalized my question. If there is a canonical answer to the general question that will be great. Is it possible to set x-ticks to be a function of the data what I used for plotting? When I can't plot function of data directly. Assume I've a method which receive x and returns f(x) . Is it possible to plot data by x , but showing f(x) in x axis?

Show xticks which are function of x-axis, not directly the data it self. Example with dates (pandas, matplotlib)

断了今生、忘了曾经 提交于 2020-06-17 15:51:42
问题 While working with seaborn, I tried to set x-ticks to be different from my data unsuccessfully. I'll give concrete example in a moment, but I also generalized my question. If there is a canonical answer to the general question that will be great. Is it possible to set x-ticks to be a function of the data what I used for plotting? When I can't plot function of data directly. Assume I've a method which receive x and returns f(x) . Is it possible to plot data by x , but showing f(x) in x axis?

Show xticks which are function of x-axis, not directly the data it self. Example with dates (pandas, matplotlib)

别等时光非礼了梦想. 提交于 2020-06-17 15:51:32
问题 While working with seaborn, I tried to set x-ticks to be different from my data unsuccessfully. I'll give concrete example in a moment, but I also generalized my question. If there is a canonical answer to the general question that will be great. Is it possible to set x-ticks to be a function of the data what I used for plotting? When I can't plot function of data directly. Assume I've a method which receive x and returns f(x) . Is it possible to plot data by x , but showing f(x) in x axis?

Seaborn KDEPlot - not enough variation in data?

别来无恙 提交于 2020-06-15 07:23:05
问题 I have a data frame containing ~900 rows; I'm trying to plot KDEplots for some of the columns. In some columns, a majority of the values are the same, minimum value. When I include too many of the minimum values, the KDEPlot abruptly stops showing the minimums. For example, the following includes 600 values, of which 450 are the minimum, and the plot looks fine: y = df.sort_values(by='col1', ascending=False)['col1'].values[:600] sb.kdeplot(y) But including 451 of the minimum values gives a

Setting font sizes of a seaborn plot

此生再无相见时 提交于 2020-06-13 08:10:08
问题 I'm struggling with setting the font sizes of a seaborn plot correctly. Setting the font size of the title works perfectly fine but unfortunately I didn't have any success yet regarding the font sizes of the axes and the legend. This is my code (using some dummy data): import matplotlib.pyplot as plt import pandas as pd import seaborn as sns df = pd.DataFrame() df['First PCA dimension'] = [1,2,3,4] df['Second PCA dimension'] = [0,5,5,7] df['Third PCA dimension'] = [1,2,6,4] df['Data points']

Setting font sizes of a seaborn plot

穿精又带淫゛_ 提交于 2020-06-13 08:06:29
问题 I'm struggling with setting the font sizes of a seaborn plot correctly. Setting the font size of the title works perfectly fine but unfortunately I didn't have any success yet regarding the font sizes of the axes and the legend. This is my code (using some dummy data): import matplotlib.pyplot as plt import pandas as pd import seaborn as sns df = pd.DataFrame() df['First PCA dimension'] = [1,2,3,4] df['Second PCA dimension'] = [0,5,5,7] df['Third PCA dimension'] = [1,2,6,4] df['Data points']