seaborn

How can I plot subplots with nested plot arrowed at a specific point?

只谈情不闲聊 提交于 2021-02-20 04:05:40
问题 I saw this chart in a paper and need to reproduce it. How can I plot a figure like this in Python? Note that: I suspect bigger subplots are perhaps drawn using seaborn or using matplotlib's subplot The smaller plots are POINTING at a specific part of the curve in the bigger plots. 回答1: One strategy can be using mpl_toolkits.axes_grid1.inset_locator , as suggested in the answer to this question: How to overlay one pyplot figure on another I have made a quick example: import matplotlib.pyplot

Multiple x labels on Pyplot

大城市里の小女人 提交于 2021-02-19 07:30:47
问题 Below is my code for a line graph. I would like another x label under the current one (so I can show the days of the week). import matplotlib.pyplot as plt import pandas as pd import seaborn as sns;sns.set() sns.set() data = pd.read_csv("123.csv") data['DAY']=["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"] plt.figure(figsize=(15,8)) plt.plot('DAY','SWST',data=data,linewidth=2,color="k"

How to display multiple annotations in Seaborn Heatmap cells?

让人想犯罪 __ 提交于 2021-02-19 01:52:08
问题 I want seaborn heatmap to display multiple values in each cell of the heatmap. Here is a manual example of what I want to see, just to be clear: data = np.array([[0.000000,0.000000],[-0.231049,0.000000],[-0.231049,0.000000]]) labels = np.array([['A\nExtra Stuff','B'],['C','D'],['E','F']]) fig, ax = plt.subplots() ax = sns.heatmap(data, annot = labels, fmt = '') Here as an example to get seaborn.heat to display flightsRoundUp values in the cells. import matplotlib.pyplot as plt import seaborn

How can I make seaborn distribution subplots in a loop?

混江龙づ霸主 提交于 2021-02-19 01:16:49
问题 I have a 5D array called data for i in range(10): sns.distplot(data[i,0,0,0], hist=False) But I want to make them inside subplots instead. How can I do it? Tried this: plt.rc('figure', figsize=(4, 4)) fig=plt.figure() fig, ax = plt.subplots(ncols=4, nrows=3) for i in range(10): ax[i].sns.distplot(data[i,0,0,0], hist=False) plt.show() This obviously doesn't work. 回答1: You would want to use the ax argument of the seaborn distplot function to supply an existing axes to it. Looping can be

How can I make seaborn distribution subplots in a loop?

和自甴很熟 提交于 2021-02-19 01:14:26
问题 I have a 5D array called data for i in range(10): sns.distplot(data[i,0,0,0], hist=False) But I want to make them inside subplots instead. How can I do it? Tried this: plt.rc('figure', figsize=(4, 4)) fig=plt.figure() fig, ax = plt.subplots(ncols=4, nrows=3) for i in range(10): ax[i].sns.distplot(data[i,0,0,0], hist=False) plt.show() This obviously doesn't work. 回答1: You would want to use the ax argument of the seaborn distplot function to supply an existing axes to it. Looping can be

Vertical alignment of y-axis ticks on Seaborn heatmap

非 Y 不嫁゛ 提交于 2021-02-18 16:41:10
问题 I'm plotting a Seaborn heatmap and I want to center the y-axis tick labels, but can't find a way to do this. 'va' text property doesn't seem to be available on yticks() . Considering the following image I'd like to align the days of the week to the center of the row of squares Code to generate this graph: import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt #Generate dummy data startDate = '2017-11-25' dateList = pd.date_range(startDate, periods=365)

Seaborn PairGrid: show axes labels for each subplot

痞子三分冷 提交于 2021-02-18 07:00:28
问题 Is there a way that I can easily add the axes labels for each of the subplots in Seaborn pair plot? This is related to this question but instead of adding the tick labels I want to add the axes labels as the pairplot I am having is 9*9 and I dont want to scroll down every time to check the column name. I was hoping that it would be some thing easy like for ax in g.axes.flat: _ = plt.setp(ax.get_ylabels(), visible=True) _ = plt.setp(ax.get_xlabels(), visible=True) 回答1: You first need to get

How to label a seaborn contour plot

梦想与她 提交于 2021-02-18 05:32:58
问题 So I'm using seaborn to make a kdeplot with sns.kdeplot(x, y, ax=plt.gca(), cmap="coolwarm") . I can change the levels with the levels kwarg but I want to be able to label the contours as well. In matplotlib you would simply do plt.clabel(CS, CS.levels, inline=True) but seaborn doesn't return the contour collection CS . How would I do this? Or do I just have to do it all from scratch myself? Edit: Is there maybe a way to make a wrapper which will also return CS? I can't see how though... 回答1:

Seaborn: How to increase the font size of the labels on the axes?

余生颓废 提交于 2021-02-17 05:59:09
问题 Here's how I plot the heat map: sns.heatmap(table, annot=True, fmt='g', annot_kws={'size':24}) The thing is, size set only the font size of the numbers inside the heatmap. Which parameter I should use in annot_kws to set the font size of the labels on the axes? Thanks 回答1: You cannot change those directly in the call to heatmap , but you can instruct matplotlib to change the font size either in plt.rcParams directly, or using a context manager: uniform_data = np.random.rand(10, 12) plt.figure

Seaborn: How to increase the font size of the labels on the axes?

你。 提交于 2021-02-17 05:59:06
问题 Here's how I plot the heat map: sns.heatmap(table, annot=True, fmt='g', annot_kws={'size':24}) The thing is, size set only the font size of the numbers inside the heatmap. Which parameter I should use in annot_kws to set the font size of the labels on the axes? Thanks 回答1: You cannot change those directly in the call to heatmap , but you can instruct matplotlib to change the font size either in plt.rcParams directly, or using a context manager: uniform_data = np.random.rand(10, 12) plt.figure