seaborn

Error while drawing animation of seaborn heatmap for 3D volume

人走茶凉 提交于 2020-07-15 07:51:41
问题 Trying to visualize the cross-correlation between two volumes, img_3D, and mask_3D, using Seaborn heatmap , and animation from Matplotlib to visualize the 3D cross-correlation result as a progressive animation of 2D images, but I was facing an error, can you please tell me how to get rid of this error, and visualize the heatmaps correctly? Thanks in advance. Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in _

Make seaborn show a colorbar instead of a legend when using hue in a bar plot?

落爺英雄遲暮 提交于 2020-07-15 07:08:11
问题 Let's say I want to make a bar plot where the hue of the bars represents some continuous quantity. e.g. import seaborn as sns titanic = sns.load_dataset("titanic") g = titanic.groupby('pclass') survival_rates = g['survived'].mean() n = g.size() ax = sns.barplot(x=n.index, y=n, hue=survival_rates, palette='Reds', dodge=False, ) ax.set_ylabel('n passengers') The legend here is kind of silly, and gets even worse the more bars I plot. What would make most sense is a colorbar (such as are used

Why has seaborn/matplotlib filled below the line in this lineplot in my jupyter notebook?

寵の児 提交于 2020-07-14 12:39:49
问题 I don't know why my plot looks like this: I only want to display lines with no fill. Code below. Note this also happens if I run in Spyder or cmd. import matplotlib.pyplot as plt import seaborn as sns df_ard= pd.read_csv(pathx, parse_dates=['Date'] ) plt.figure(figsize=(15,8)) sns.lineplot(x="Date", y='As', hue="Location", data=df_ard, palette='bright') 回答1: This is an educated guess, since you don't provide your data (see Minimal, Complete, and Verifiable example), but I believe the shading

Why has seaborn/matplotlib filled below the line in this lineplot in my jupyter notebook?

房东的猫 提交于 2020-07-14 12:38:11
问题 I don't know why my plot looks like this: I only want to display lines with no fill. Code below. Note this also happens if I run in Spyder or cmd. import matplotlib.pyplot as plt import seaborn as sns df_ard= pd.read_csv(pathx, parse_dates=['Date'] ) plt.figure(figsize=(15,8)) sns.lineplot(x="Date", y='As', hue="Location", data=df_ard, palette='bright') 回答1: This is an educated guess, since you don't provide your data (see Minimal, Complete, and Verifiable example), but I believe the shading

How does distplot calculate the kde curve?

穿精又带淫゛_ 提交于 2020-07-10 03:38:25
问题 I'm using seaborn for plotting data. Everything is fine until my mentor asked me how the plot is made in the following code for example. import numpy as np import seaborn as sns import matplotlib.pyplot as plt x = np.random.normal(size=100) sns.distplot(x) plt.show() The result of this code is: My questions: 1- How does distplot manage to plot this? 2- Why starts the plot at -3 and ends at 4 ? 3- Is there any parametric function or any specific mathematical function that distplot uses to plot

How to set legend marker size and alpha?

假装没事ソ 提交于 2020-07-08 09:25:11
问题 I have a seaborn scatter plot ( lmplot ) with over 10K points. In order to perceive all the data, it works better when the plot size is larger (making the markers relatively small) and the alpha on the markers is low. However, this makes the markers on the legend difficult to distinguish. How does one set the marker size and marker alpha in Seaborn? I see that g._legend has a markersize attribute, but directly setting it doesn't do anything. Example import numpy as np import pandas as pd

Seaborn catplot combined with PairGrid

大兔子大兔子 提交于 2020-07-06 13:55:46
问题 I am playing with the Titanic dataset, and trying to produce a pair plot of numeric variables against categorical variables. I can use Seaborn's catplot to graph a plot of one numeric variable against one categorical variable: import seaborn as sns sns.catplot(data=train, x='Fare', y='Sex') However, if I try to use PairGrid to graph numeric variables against categorical variables: x_vars = ['Fare'] y_vars = ['Sex'] g = sns.PairGrid(train, x_vars=x_vars, y_vars=y_vars) g.map(sns.catplot) It

Seaborn catplot combined with PairGrid

早过忘川 提交于 2020-07-06 13:55:18
问题 I am playing with the Titanic dataset, and trying to produce a pair plot of numeric variables against categorical variables. I can use Seaborn's catplot to graph a plot of one numeric variable against one categorical variable: import seaborn as sns sns.catplot(data=train, x='Fare', y='Sex') However, if I try to use PairGrid to graph numeric variables against categorical variables: x_vars = ['Fare'] y_vars = ['Sex'] g = sns.PairGrid(train, x_vars=x_vars, y_vars=y_vars) g.map(sns.catplot) It

Heatmap from columns in pandas dataframe

我们两清 提交于 2020-07-06 11:51:35
问题 I try to generate a heatmap from a pandas dataframe by days and hours of the day (X-> days, Y->hours). The result should be something like this: the data source is a table in postgres: id | created_at ---------+------------------------ 2558145 | 2017-03-02 11:31:15+01 2558146 | 2017-03-02 11:31:46+01 2558147 | 2017-03-02 11:32:28+01 2558148 | 2017-03-02 11:32:57+01 .... here is my code the regroup the data by hour. import pandas as pd from sqlalchemy import create_engine engine = create

seaborn multiple variables group bar plot

六眼飞鱼酱① 提交于 2020-07-05 10:33:33
问题 I have pandas dataframe, one index(datetime) and three variables(int) date A B C 2017-09-05 25 261 31 2017-09-06 261 1519 151 2017-09-07 188 1545 144 2017-09-08 200 2110 232 2017-09-09 292 2391 325 I can create grouped bar plot with basic pandas plot. df.plot(kind='bar', legend=False) However, I want to display in Seaborn or other libraries to improve my skills. I found very close answer(Pandas: how to draw a bar plot with two categories and four series each?). In its suggested answer, it has