seaborn

Seaborn: kdeplots with marginal histograms

荒凉一梦 提交于 2020-01-02 08:45:50
问题 I'm using a kdeplot to plot the densities of two bivariate distributions like this, where df_c and df_n are two Pandas DataFrames: f, ax = plt.subplots(figsize=(6, 6)) sns.kdeplot(df_c['attr1'], df_c['attr2'], ax=ax, cmap='Blues', shade_lowest=False) sns.kdeplot(df_n['attr1'], df_n['attr2'], ax=ax, cmap='Reds', shade_lowest=False) I would like to also include marginal histograms like those generated by jointplot (example plot). However, I cannot use jointplot (because it is appearantly not

Seaborn/Matplotlib Date Axis barplot minor-major tick formatting

荒凉一梦 提交于 2020-01-02 05:29:58
问题 I'm building a Seaborn barplot. The x-axis are dates, and the y-axis are integers. I'd like to format major/minor ticks for the dates. I'd like Mondays' ticks to be bold and a different color (ie, "major ticks"), with the rest of the week less bold. I have not been able to get major and minor tick formatting on the x-axis to work with Seaborn barplots. I'm stumped, and thus turning here for help. I'm starting with the stackoverflow example that answered this question: Pandas timeseries plot

Seaborn/Matplotlib Date Axis barplot minor-major tick formatting

眉间皱痕 提交于 2020-01-02 05:29:13
问题 I'm building a Seaborn barplot. The x-axis are dates, and the y-axis are integers. I'd like to format major/minor ticks for the dates. I'd like Mondays' ticks to be bold and a different color (ie, "major ticks"), with the rest of the week less bold. I have not been able to get major and minor tick formatting on the x-axis to work with Seaborn barplots. I'm stumped, and thus turning here for help. I'm starting with the stackoverflow example that answered this question: Pandas timeseries plot

Increase space between rows on FacetGrid plot

浪子不回头ぞ 提交于 2020-01-02 04:29:08
问题 I've the following code which creates the plot you can see in the picture: g = sns.FacetGrid(data, col="Provincia",col_wrap=6,size=2.5) g.map(sns.barplot, "Anio", "Diff"); g.set_axis_labels("Año", "Porcentaje de aumento"); for ax in g.axes.flat: _ = plt.setp(ax.get_yticklabels(), visible=True) _ = plt.setp(ax.get_xticklabels(), visible=False) _ = plt.setp(ax.get_xticklabels()[0], visible=True) _ = plt.setp(ax.get_xticklabels()[-1], visible=True) The problem, as you can see in the picture, is

Turn off error bars in Seaborn Bar Plot

末鹿安然 提交于 2020-01-02 02:17:33
问题 I'm using GridSpec in matplotlib to create a page that has 9 subplots. One of the subplots is a Seaborn bar plot created with the following code: import seaborn as sns sns.barplot(x=df['Time'], y=df['Volume_Count'], ax=ax7) Is there a way to turn off the vertical error bars of the bar plot? If not, is it possible to reduce the horizontal width of the bars? Thanks! 回答1: Have you tried the ci argument? According to the documentation: ci : float or None, optional Size of confidence intervals to

Using seaborn, how can I draw a line of my choice across my scatterplot?

China☆狼群 提交于 2020-01-02 01:07:33
问题 I want to be able to draw a line of my specification across a plot generated in seaborn. The plot I chose was JointGrid, but any scatterplot will do. I suspect that seaborn maybe doesn't make it easy to do this? Here is the code plotting the data (dataframes from the Iris dataset of petal length and petal width): import seaborn as sns iris = sns.load_dataset("iris") grid = sns.JointGrid(iris.petal_length, iris.petal_width, space=0, size=6, ratio=50) grid.plot_joint(plt.scatter, color="g") If

plot multiple columns on same graph seaborn

回眸只為那壹抹淺笑 提交于 2020-01-01 10:06:41
问题 I have a pandas dataFrame that I am plotting with seaborn: g = sns.FacetGrid(readCov, col='chr', col_wrap = 4, size=4) g.map(plt.scatter, 'pos', 'bergC9', hue = edgecolor='white') g.set(xlim= (0, 250000)) This works great and gives me a single graph for each 'chr' that is in the 'chr' column. However, I would like each graph to have multiple columns on it. Currently only one is displayed, the one called 'bergC9'. I want to put more columns on the same graph with different colors. Any ideas?

plot multiple columns on same graph seaborn

限于喜欢 提交于 2020-01-01 10:06:05
问题 I have a pandas dataFrame that I am plotting with seaborn: g = sns.FacetGrid(readCov, col='chr', col_wrap = 4, size=4) g.map(plt.scatter, 'pos', 'bergC9', hue = edgecolor='white') g.set(xlim= (0, 250000)) This works great and gives me a single graph for each 'chr' that is in the 'chr' column. However, I would like each graph to have multiple columns on it. Currently only one is displayed, the one called 'bergC9'. I want to put more columns on the same graph with different colors. Any ideas?

Repeating x axis labels for all facets using FacetGrid in seaborn

北城余情 提交于 2020-01-01 05:28:11
问题 I am working with the FacetGrid example presented here that results in the plot below. In my data set, there is quite a lot of plots, and it would be convenient to have the x axis labels repeated for each facet, not only at the bottom. For this example, the values 62, ..., 76 should be repeated for each of the A-J facets. 回答1: The answer by Bazingaa works for matplotlib version 2.0.2. For newer versions of matplotlib, using ax.tick_params() and setting labelbottom=True seems to work: for ax

Create “The Economist” style graphs from python

风流意气都作罢 提交于 2019-12-31 13:46:09
问题 Using python and marplotlib and a tool like seaborn, I'd like to create a graph like this one from The Economist (because I think the style is great.) It's a time series graph and the key things I'd like to reproduce are the horizontal grid lines with labels matched with a lower horizontal axis with tick marks. The different colored labels at either end of the grid lines would be a bonus, with the corresponding titles (left and right justified). The annotations would be a double bonus. I