seaborn

seaborn scatterplot marker size for ALL markers

时间秒杀一切 提交于 2021-02-07 11:13:29
问题 I can't find out anywhere how to change the marker size on seaborn scatterplots. There is a size option listed in the documentation but it is only for when you want variable size across points. I want the same size for all points but larger than the default! I tried making a new column of integers in my dataframe and set that as the size, but it looks like the actual value doesn't matter, it changes the marker size on a relative basis, so in this case all the markers were still the same size

python's seaborn jointplot, different colors for each histograms

倖福魔咒の 提交于 2021-02-07 08:35:58
问题 I would like to change the colors for each histogram in a jointplot, created with seaborn. I managed to change the color for both plots using marginal_kws, but how can I set a color for one histogram each? (e. g. red and green histogram) A minimal example of my jointplot: import seaborn as sns import matplotlib.pyplot as plt import numpy as np x, y = np.random.multivariate_normal([2, 3], [[0.3, 0], [0, 0.5]], 1000).T with sns.axes_style("white"): g = sns.jointplot(x=x, y=y, kind="hex", stat

Python seaborn catplot - How do I change the y-axis scale to percentage

倾然丶 夕夏残阳落幕 提交于 2021-02-07 08:23:22
问题 In the figure the y-axis labels are in decimals from (0 to 1) i.e (0.1, 0.2, 0.4 etc). How can I convert this into a % format (10%, 20%, 40% etc). Just 10, 20, 40 also will do. Thanks, John g = sns.catplot(x="who", y="survived", col="class", ... data=titanic, saturation=.5, ... kind="bar", ci=None, aspect=.6) 回答1: You may use a PercentFormatter on the axes of the grid. import seaborn as sns import matplotlib.pyplot as plt from matplotlib.ticker import PercentFormatter titanic = sns.load

Python seaborn catplot - How do I change the y-axis scale to percentage

狂风中的少年 提交于 2021-02-07 08:19:54
问题 In the figure the y-axis labels are in decimals from (0 to 1) i.e (0.1, 0.2, 0.4 etc). How can I convert this into a % format (10%, 20%, 40% etc). Just 10, 20, 40 also will do. Thanks, John g = sns.catplot(x="who", y="survived", col="class", ... data=titanic, saturation=.5, ... kind="bar", ci=None, aspect=.6) 回答1: You may use a PercentFormatter on the axes of the grid. import seaborn as sns import matplotlib.pyplot as plt from matplotlib.ticker import PercentFormatter titanic = sns.load

Passing datetime-like object to seaborn.lmplot

狂风中的少年 提交于 2021-02-07 06:51:17
问题 I am trying to do a plot of values over time using seaborn linear model plot but I get the error TypeError: invalid type promotion I have read that it is not possible to plot pandas date objects, but that seems really strange given seaborn requires you pass a pandas DataFrame to the plots. Below is a simple example. Does anyone know how I can get this to work? import pandas as pd import seaborn as sns; sns.set(color_codes=True) import matplotlib.pyplot as plt date = ['1975-12-03','2008-08-20'

Seaborn jointplot group colour coding (for both scatter and density plots)

我是研究僧i 提交于 2021-02-07 06:34:23
问题 I would like to use sns.jointplot to visualise the association between X and Y in the presence of two groups. However, in tips = sns.load_dataset("tips") sns.jointplot("total_bill", "tip", data=tips) there is no "hue" option as in other sns plots such as sns.scatterplot. How could one assign different colours for different groups (e.g. hue="smoker") in both the scatter plot, as well as the two overlapping density plots. In R this could be done by creating a scatter plot with two marginal

'Could not interpret input' error with Seaborn when plotting groupbys

眉间皱痕 提交于 2021-02-07 05:20:15
问题 Say I have this dataframe d = { 'Path' : ['abc', 'abc', 'ghi','ghi', 'jkl','jkl'], 'Detail' : ['foo', 'bar', 'bar','foo','foo','foo'], 'Program': ['prog1','prog1','prog1','prog2','prog3','prog3'], 'Value' : [30, 20, 10, 40, 40, 50], 'Field' : [50, 70, 10, 20, 30, 30] } df = DataFrame(d) df.set_index(['Path', 'Detail'], inplace=True) df Field Program Value Path Detail abc foo 50 prog1 30 bar 70 prog1 20 ghi bar 10 prog1 10 foo 20 prog2 40 jkl foo 30 prog3 40 foo 30 prog3 50 I can aggregate it

'Could not interpret input' error with Seaborn when plotting groupbys

对着背影说爱祢 提交于 2021-02-07 05:19:19
问题 Say I have this dataframe d = { 'Path' : ['abc', 'abc', 'ghi','ghi', 'jkl','jkl'], 'Detail' : ['foo', 'bar', 'bar','foo','foo','foo'], 'Program': ['prog1','prog1','prog1','prog2','prog3','prog3'], 'Value' : [30, 20, 10, 40, 40, 50], 'Field' : [50, 70, 10, 20, 30, 30] } df = DataFrame(d) df.set_index(['Path', 'Detail'], inplace=True) df Field Program Value Path Detail abc foo 50 prog1 30 bar 70 prog1 20 ghi bar 10 prog1 10 foo 20 prog2 40 jkl foo 30 prog3 40 foo 30 prog3 50 I can aggregate it

Annotated heatmap with multiple color schemes

时光怂恿深爱的人放手 提交于 2021-02-07 04:18:46
问题 I have the following dataframe and would like to differentiate the minor decimal differences in each "step" with a different color scheme in a heatmap. Sample data: Sample Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8 A 64.847 54.821 20.897 39.733 23.257 74.942 75.945 B 64.885 54.767 20.828 39.613 23.093 74.963 75.928 C 65.036 54.772 20.939 39.835 23.283 74.944 75.871 D 64.869 54.740 21.039 39.889 23.322 74.925 75.894 E 64.911 54.730 20.858 39.608 23.101 74.956 75.930 F 64.838 54.749 20

Annotated heatmap with multiple color schemes

眉间皱痕 提交于 2021-02-07 04:17:17
问题 I have the following dataframe and would like to differentiate the minor decimal differences in each "step" with a different color scheme in a heatmap. Sample data: Sample Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8 A 64.847 54.821 20.897 39.733 23.257 74.942 75.945 B 64.885 54.767 20.828 39.613 23.093 74.963 75.928 C 65.036 54.772 20.939 39.835 23.283 74.944 75.871 D 64.869 54.740 21.039 39.889 23.322 74.925 75.894 E 64.911 54.730 20.858 39.608 23.101 74.956 75.930 F 64.838 54.749 20