seaborn

How to increase the cell size for annotation in Seaborn heatmap

亡梦爱人 提交于 2019-12-13 02:18:59
问题 I'd like to plot 66x66 confusion matrix with min=0 and max=15075 (shared here). Since I'd like to annotate the cells, I am using annot=True . But I can't seem to fit the values in the cell even after trying approaches suggested in other stack overflow posts like this, this and this. This is my current code: from sklearn.metrics import confusion_matrix conf_mat = confusion_matrix(y_test, y_pred) # please load the data from the pastebin [link above][1] # get the tick label font size fontsize_pt

Seaborn heatmap to plotly failed

允我心安 提交于 2019-12-13 00:55:07
问题 I'm having plotly error when converting seaborn.heatmap figure to plotly. I'm doing that in jupyter notebook with following code: %matplotlib inline import numpy as np import seaborn as sns import matplotlib.pyplot as plt from plotly.offline import init_notebook_mode, iplot_mpl init_notebook_mode(connected=True) np.random.seed(2017) data = np.random.randn(10, 20) When I'm plotting it as static seaborn heatmap everything is alright: sns.heatmap(data) But when I'm trying to convert that object

Connecting non-adjacent data points in Seaborn pointplot

时间秒杀一切 提交于 2019-12-12 19:49:29
问题 I want to plot categorical plots with the Seaborn pointplot, but data points that are not adjacent are not connected with a line in the plot. I would like to interpolate between non adjacent points, and connect them in the same way as adjacent points are connected, how can I do this? An example: In the left and middle images, the blue and green points should be connected with a curve, respectively, but now they are separated into small parts. How can I plot the left and middle images just

How to use factorplot to annotate bars with categorical values or to plot 4 variables?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 18:22:02
问题 I have a dataframe that I want to plot. I have thought of 2 options (check the images). For OPTION 1, I need to annotate a categorical value (the "Elec"). For OPTION 2, I still need to use "factorplot", but I do not know how to fix the error I get. #CODE FOR THE DATAFRAME raw_data = {'Max_Acc': [90.71, 87.98, 92.62, 78.93, 73.69, 73.66, 72.29, 92.62, 94.17, 92.62, 83.81, 79.76, 74.40, 72.38], 'Stage': ['AWA', 'Rem', 'S1', 'S2', 'SWS', 'SX', 'ALL', 'AWA', 'Rem', 'S1', 'S2', 'SWS', 'SX', 'ALL']

Seaborn heatmap reducing cell size

こ雲淡風輕ζ 提交于 2019-12-12 17:21:35
问题 Is there any way to change cell size of Seaborn heatmap? I found this but I cannot get it work as expected. So, I have long text in y-axis labels. Since all of the texts are chopped off, I would like to shrink cell size of the heatmap much smaller. I don't need that big rectangle. (Highlighted just for example.) (I hid label names.) When I change the figure size by something like, plt.figure(figsize=(8, 6)) or figure.set_size_inches(12, 12) the cell gets bigger as well so the texts remain

Correlation matrix heatmap with multiple datasets that have matching columns

邮差的信 提交于 2019-12-12 16:14:19
问题 If we have three datasets: X = pd.DataFrame({"t":[1,2,3,4,5],"A":[34,12,78,84,26], "B":[54,87,35,25,82], "C":[56,78,0,14,13], "D":[0,23,72,56,14], "E":[78,12,31,0,34]}) Y = pd.DataFrame({"t":[1,2,3,4,5],"A":[45,24,65,65,65], "B":[45,87,65,52,12], "C":[98,52,32,32,12], "D":[0,23,1,365,53], "E":[24,12,65,3,65]}) Z = pd.DataFrame({"t":[1,2,3,4,5],"A":[14,96,25,2,25], "B":[47,7,5,58,34], "C":[85,45,65,53,53], "D":[3,35,12,56,236], "E":[68,10,45,46,85]}) Where "t" is an index. How could one output

FacetGrid Legend empty

爱⌒轻易说出口 提交于 2019-12-12 15:17:07
问题 I'm trying to create a seaborn FacetGrid to show the transition probabilities between clusters in some data I have. The data has a bunch of subjects and 4 clusters (so that each subject has 16 data points, one for each pair of old and new clusters). Because these are probabilities, all values that have the same old cluster (for each subject) sum to 1. I would like to show this data using a FacetGrid pointplot (or stacked barplot, but that doesn't seem possible with seaborn), such that each

Creating a boxplot FacetGrid in Seaborn for python

和自甴很熟 提交于 2019-12-12 14:52:09
问题 I'm trying to create a 4x4 FacetGrid in seaborn for 4 boxplots, each of which is split into 3 boxplots based on the iris species in the iris dataset. Currently, my code looks like this: sns.set(style="whitegrid") iris_vis = sns.load_dataset("iris") fig, axes = plt.subplots(2, 2) ax = sns.boxplot(x="Species", y="SepalLengthCm", data=iris, orient='v', ax=axes[0]) ax = sns.boxplot(x="Species", y="SepalWidthCm", data=iris, orient='v', ax=axes[1]) ax = sns.boxplot(x="Species", y="PetalLengthCm",

Plot table alongside sns.barplot

半世苍凉 提交于 2019-12-12 13:56:49
问题 #read data into dataframe con=pd.read_csv('testOutput.csv') ''' testOutput.csv looks like : Sample,Count sample1,99.9 sample2, 96.6 ''' ## set colours to increase with values sns.set(style="darkgrid") groupedvalues=con.groupby("Count").sum().reset_index() pal = sns.color_palette("Greens_d", len(groupedvalues)) rank = groupedvalues["Count"].argsort().argsort() #get summary stats of data summary=pd.DataFrame(con['Count'].describe()) #set limits maxLim=100 minLim=min(con['Count'])-0.1 #barplot

seaborn scatterplot datetime xaxis too wide

泄露秘密 提交于 2019-12-12 11:42:14
问题 I have this dataframe: pd.DataFrame({'Depth': {0: 0.2, 1: 0.4, 2: 0.4, 3: 0.4, 4: 0.4, 5: 0.4, 6: 0.6000000000000001, 7: 0.4, 8: 3.2, 9: 2.0}, 'DateTimeUTC': {0: Timestamp('2018-03-28 06:25:08'), 1: Timestamp('2018-03-28 06:25:49'), 2: Timestamp('2018-03-28 06:27:06'), 3: Timestamp('2018-03-28 06:32:11'), 4: Timestamp('2018-03-28 06:32:59'), 5: Timestamp('2018-03-28 06:34:02'), 6: Timestamp('2018-03-28 06:35:38'), 7: Timestamp('2018-03-28 06:37:04'), 8: Timestamp('2018-03-28 06:39:08'), 9: