seaborn

change font size of facet titles using seaborn facetgrid heatmap

二次信任 提交于 2019-12-19 09:29:11
问题 Note: this is a different question than "How can I change the font size using seaborn FacetGrid?". The methods suggested there do not work when using a heatmap inside a facetgrid. How can I change the font size of the facet titles when plotting heatmaps inside a facetgrid? The code below tries two methods, passing fontsize= to set_titles() and wrapping the whole thing in a plotting context. As far as I can tell, neither seems to have any effect on facet titles when using heatmap, although the

Python, Seaborn FacetGrid change titles

余生颓废 提交于 2019-12-19 00:09:12
问题 I am trying to create a FacetGrid in Seaborn My code is currently: g = sns.FacetGrid(df_reduced, col="ActualExternal", margin_titles=True) bins = np.linspace(0, 100, 20) g.map(plt.hist, "ActualDepth", color="steelblue", bins=bins, width=4.5) This gives my the Figure Now, instead of "ActualExternal =0.0" and "ActualExternal =1.0" I would like the titles "Internal" and "External" And, instead of "ActualDepth" I would like the xlabel to say "Percentage Depth" Finally, I would like to add a

how to set width on seaborn barplot

旧城冷巷雨未停 提交于 2019-12-18 16:54:45
问题 I would like to set the width of each bar on the barplot based on the number of times the column chrom has a particular value. I am setting width bars to be a list of occurrences: list_counts = plot_data.groupby('chrom')['gene'].count() widthbars = list_counts.tolist() Plotting the barplot as: ax = sns.barplot(x = plot_data['chrom'], y = plot_data['dummy'], width=widthbars) This gives me an error: TypeError: bar() got multiple values for keyword argument 'width' Is the width variable being

The `hue` parameter in Seaborn.relplot() skips an integer when given numerical data?

送分小仙女□ 提交于 2019-12-18 15:54:50
问题 The hue parameter skips one integer. d = {'column1':[1,2,3,4,5], 'column2':[2,4,5,2,3], 'cluster':[0,1,2,3,4]} df = pd.DataFrame(data=d) sns.relplot(x='column2', y='column1', hue='cluster', data=df) Python 2.7 Seaborn 0.9.0 Ubuntu 16.04 LTS 回答1: "Full" legend If the hue is in numeric format, seaborn will assume that it represents some continuous quantity and will decide to display what it thinks is a representative sample along the color dimension. You can circumvent this by using legend=

Timeseries plot with min/max shading using Seaborn

拥有回忆 提交于 2019-12-18 12:36:51
问题 I am trying to create a 3-line time series plot based on the following data , in a Week x Overload graph, where each Cluster is a different line. I have multiple observations for each (Cluster, Week) pair (5 for each atm, will have 1000). I would like the points on the line to be the average Overload value for that specific (Cluster, Week) pair, and the band be the min/max values of it. Currently using the following bit of code to plot it, but I'm not getting any lines, as I don't know what

Barplot colored according a colormap?

一世执手 提交于 2019-12-18 12:36:33
问题 First of all, I'm pretty new to colors in Matplotlib or Seaborn. My purpose is to create a barplot with bars coloured according to a custom palette. Something like this, but with my custom palette (see below, a palette with red, orange, green and blue): I have created my custom sequential palette using the LinearSegmentedColormap method, but I'm not able to use it in a simple plt.barplot() . Sure it's not difficult, but I can't see the way. I created the palette using the function below, got

Pandas Dataframe to Seaborn Grouped Barchart

痴心易碎 提交于 2019-12-18 12:32:11
问题 I have the following dataframe which I have obtained from a larger dataframe which lists the worst 10 "Benchmark Returns" and their corresponding portfolio returns and dates: I've managed to create a Seaborn bar plot which lists Benchmark Returns against their corresponding dates with this script: import pandas as pd import seaborn as sns df = pd.read_csv('L:\\My Documents\\Desktop\\Data NEW.csv', parse_dates = True) df = df.nsmallest(10, columns = 'Benchmark Returns') df = df[['Date',

Discrete legend in seaborn heatmap plot

心不动则不痛 提交于 2019-12-18 12:21:13
问题 I am using the data present here to construct this heat map using seaborn and pandas. The input csv file is here: https://www.dropbox.com/s/5jc1vr6u8j7058v/LUH2_trans_matrix.csv?dl=0 Code: import pandas import seaborn.apionly as sns # Read in csv file df_trans = pandas.read_csv('LUH2_trans_matrix.csv') sns.set(font_scale=0.8) cmap = sns.cubehelix_palette(start=2.8, rot=.1, light=0.9, as_cmap=True) cmap.set_under('gray') # 0 values in activity matrix are shown in gray (inactive transitions) df

Discrete legend in seaborn heatmap plot

馋奶兔 提交于 2019-12-18 12:20:04
问题 I am using the data present here to construct this heat map using seaborn and pandas. The input csv file is here: https://www.dropbox.com/s/5jc1vr6u8j7058v/LUH2_trans_matrix.csv?dl=0 Code: import pandas import seaborn.apionly as sns # Read in csv file df_trans = pandas.read_csv('LUH2_trans_matrix.csv') sns.set(font_scale=0.8) cmap = sns.cubehelix_palette(start=2.8, rot=.1, light=0.9, as_cmap=True) cmap.set_under('gray') # 0 values in activity matrix are shown in gray (inactive transitions) df

Displaying of values on barchart

本秂侑毒 提交于 2019-12-18 07:07:02
问题 I've found a couple of similar postings to this topic. But they wasn't helpful for me. I'm relatively new to Python and Seaborn. This is my Code: import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline x_axis = ["A", "B","C","D","E","F"] y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6] plt.ylabel('Accuracy') plt.title('Accuracy of Classifier') g=sns.barplot(x_axis, y_axis, color="red") I'm just trying to display the values from the y_axis on top of every bar. 回答1: Loop through