seaborn

Individual axes limits for pairplot in python

自作多情 提交于 2020-08-27 09:28:18
问题 I'm fairly new to python and I'm trying to figure out how to set limits for individual axes for a pairplot. I know that using pairplot.set(xlim=(0,100), ylim = (0,100)) will set all the axes in a pairplot to go from 0 to 100, but some of my variables range from 0 to 300000 while others range from 0 80. I'm trying to avoid the auto scale feature because I'm removing some data occasionally but want to keep the context of the original set. I get something like below for example example 回答1: You

Reordering the high-level clusters from seaborn clustermap results

不想你离开。 提交于 2020-08-25 03:50:50
问题 Is there a way to get from a to b in the following figure with scripting? I am using seaborn.clustermap() to get to a (i.e. the order of the rows are preserved. However, columns order change only at second highest level). I was wondering whether it is possible to use the seaborn.matrix.ClusterGrid that is returned by seaborn.clustermap() , modify it and plot the modified results. b P.S. The reason I am asking this is that the order has a meaning (first comes blue, next green, and finally red)

Reordering the high-level clusters from seaborn clustermap results

拥有回忆 提交于 2020-08-25 03:50:36
问题 Is there a way to get from a to b in the following figure with scripting? I am using seaborn.clustermap() to get to a (i.e. the order of the rows are preserved. However, columns order change only at second highest level). I was wondering whether it is possible to use the seaborn.matrix.ClusterGrid that is returned by seaborn.clustermap() , modify it and plot the modified results. b P.S. The reason I am asking this is that the order has a meaning (first comes blue, next green, and finally red)

One horizontal colorbar for seaborn heatmaps subplots and Annot Issue with xticklabels

自闭症网瘾萝莉.ら 提交于 2020-08-25 03:48:18
问题 I tried to write multiple heatmaps in one figure. I wrote the below code and I have two questions. (1) I want the data value in each cell and I don't need the axis labels for each picture. Therefore, I set xticklabels, yticklables, and annot; but they were not reflected in the figure. How should I do? (2) Can I rotate the color bar? I need one horizontal color bar for this fifure. I use Python 3.5.2 in Ubuntu 14.04.5 LTS. import matplotlib.pyplot as plt import seaborn as sns import pandas as

Plotting seaborn heatmap on top of a background picture

懵懂的女人 提交于 2020-08-24 06:34:18
问题 I am creating a heatmap through seaborn in Jupyter to display the amount of people that would choose a certain coordinate point. I currently have the heatmap created with the following code cm = metrics.confusion_matrix(yVals, xVals) fig, ax = plt.subplots(figsize=(10,10)) sns.heatmap(cm, annot=True, fmt="0.3f", linewidth=0.5, cbar=False, cmap="Reds", square=True, ax=ax) plt.show() Here's a link to the picture as well if needed to see how it looks. My questions are how could I plot this

How to color `matplotlib` scatterplot using a continuous value [`seaborn` color palettes?]

£可爱£侵袭症+ 提交于 2020-08-22 09:31:51
问题 I have a scatterplot and I want to color it based on another value (naively assigned to np.random.random() in this case). Is there a way to use seaborn to map a continuous value (not directly associated with the data being plotted) for each point to a value along a continuous gradient in seaborn ? Here's my code to generate the data: import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import load_iris from sklearn.preprocessing import StandardScaler

Customizing annotation with Seaborn's FacetGrid

*爱你&永不变心* 提交于 2020-08-21 06:08:25
问题 I'm trying to customize some figures with the Seaborn module in Python, but I haven't had luck creating custom labels or annotations. I've got some code that generates the following figure: plot = sns.FacetGrid(data = data, col = 'bot', margin_titles = True).set_titles('Human', 'Bot') bins = np.linspace(0, 2000, 15) plot = plot.map(plt.hist, 'friends_count', color = 'black', lw = 0, bins = bins) plot.set_axis_labels('Number Following', 'Count') sns.despine(left = True, bottom = True) I'd like

Customizing annotation with Seaborn's FacetGrid

自闭症网瘾萝莉.ら 提交于 2020-08-21 06:08:01
问题 I'm trying to customize some figures with the Seaborn module in Python, but I haven't had luck creating custom labels or annotations. I've got some code that generates the following figure: plot = sns.FacetGrid(data = data, col = 'bot', margin_titles = True).set_titles('Human', 'Bot') bins = np.linspace(0, 2000, 15) plot = plot.map(plt.hist, 'friends_count', color = 'black', lw = 0, bins = bins) plot.set_axis_labels('Number Following', 'Count') sns.despine(left = True, bottom = True) I'd like

Move legend outside figure in seaborn tsplot

那年仲夏 提交于 2020-08-20 18:04:28
问题 I would like to create a time series plot using seaborn.tsplot like in this example from tsplot documentation, but with the legend moved to the right, outside the figure. Based on the lines 339-340 in seaborn's timeseries.py, it looks like seaborn.tsplot currently doesn't allow direct control of legend placement: if legend: ax.legend(loc=0, title=legend_name) Is there a matplotlib workaround? I'm using seaborn 0.6-dev. 回答1: Indeed, seaborn doesn't handle legends well so far. You can use plt

格式化2

空扰寡人 提交于 2020-08-20 08:13:14
import seaborn import pandas excel =pandas.read_excel(r ' E:\pandas练习\成绩单.xlsx ' ) color_map =seaborn.light_palette( ' green ' ,as_cmap= True) a=excel.style.background_gradient(color_map,subset =[ ' test_1 ' , ' test_2 ' , ' test_3 ' ]) a.to_excel() 来源: oschina 链接: https://my.oschina.net/u/4356468/blog/4357977