seaborn

Unable to use seaborn.countplot

烂漫一生 提交于 2019-12-24 00:38:06
问题 I'm trying to plot some graphs using the latest version of Pycharm as a Python IDE. As an interpreter, I'm using Anaconda with Python 3.4.3-0. I have installed using conda install the news version of pandas (0.17.0), seaborn (0.6.0), numpy (1.10.1), matplotlib (1.4.3), ipython (4.0.1) Inside the nesarc_pds.csv I have this: IDNUM,S1Q2I 39191,1 39787,1 40082,1 40189,1 40226,1 40637,1 41306,1 41627,1 41710,1 42113,1 42120,1 42720,1 42909,1 43092,1 7,2 15,2 25,2 40,2 46,2 49,2 57,2 63,2 68,2 100

Density plot using seaborn

余生颓废 提交于 2019-12-23 18:52:03
问题 I'm trying to make a density plot of the hourly demand: data The 'hr' means different hours, 'cnt' means demand. I know how to make a density plot such as: sns.kdeplot(bike['hr']) However, this only works when the demand for different hours is unknown. Thus I can count each hour as its demand. Now I know the demand count of each hour, how I can make a density plot of such data? 回答1: A density plot aims to show an estimate of a distribution. To make a graph showing the density of hourly demand

How to widen boxes in Seaborn boxplot?

爷,独闯天下 提交于 2019-12-23 13:07:08
问题 I'm trying to make a grouped boxplot using Seaborn (Reference), and the boxes are all incredibly narrow -- too narrow to see the grouping colors. g = seaborn.factorplot("project_code",y="num_mutations",hue="organ", data=grouped_donor, kind="box", aspect=3) If I zoom in, or stretch the graphic several times the width of my screen, I can see the boxes, but obviously this isn't useful as a standard graphic. This appears to be a function of my amount of data; if I plot only the first 500 points

Is it possible to annotate a seaborn violin plot with number of observations in each group?

本秂侑毒 提交于 2019-12-23 10:16:06
问题 I would like to annotate my violin plot with the number of observations in each group. So the question is essentially the same as this one, except: python instead of R, seaborn instead of ggplot, and violin plots instead of boxplots Lets take this example from Seaborn API documentation: import seaborn as sns sns.set_style("whitegrid") tips = sns.load_dataset("tips") ax = sns.violinplot(x="day", y="total_bill", data=tips) I'd like to have n=62, n=19, n=87, and n=76 on top of the violins. Is

Rescale axis on Seaborn JointGrid KDE marginal plots

旧城冷巷雨未停 提交于 2019-12-23 05:39:08
问题 I'm trying to create a seaborn JointGrid object with scatter+contours in the joint_plot and KDEs in the marginals. This gets me pretty close, but the y-axis marginal doesn't scale appropriately. What's the best way to manually rescale the marginal axes? Thanks in advance! f = p.figure() ax = f.add_subplot(111) g = sns.JointGrid(xdata, ydata, xlim=(0,1), ylim=(0,1)) g.plot_joint(sns.kdeplot, shade=True, cmap="Greys", n_levels=10) g.plot_joint(p.scatter, color='#e74c3c', s=1.5) g.plot_marginals

Seaborn scatter plot with missing points in the figure

大城市里の小女人 提交于 2019-12-23 04:48:34
问题 I would like to visualize the selection frame I have got from my data frame df . I can not understand why seaborn seems to have some problems plotting the class named car . In the figure I obtain there are two black dots and a white one referring to this class instead of 3 blue dots as the legend reports. Actually, if I remove this class I get the same problem in another one. Do you know why? Thanks in advance. Here my code: import pandas as pd import numpy as np import random from matplotlib

Changing width of heatmap in Seaborn to compensate for font size reduction

╄→гoц情女王★ 提交于 2019-12-23 03:18:20
问题 I have a sentence like say Hey I am feeling pretty boring today and the day is dull too I pass it through the openai sentiment code which gives me some neuron weights which can be equal or little greater then number of words. Neuron weights are [ 0.01258736, 0.03544582, 0.08490616, 0.09010842, 0.07180552, 0.07271874, 0.08906463, 0.09690772, 0.10281454, 0.08131664, 0.08315734, 0.0790544 , 0.07770097, 0.07302617, 0.07329235, 0.06856266, 0.07642639, 0.08199468, 0.09079508, 0.09539193, 0.09061056

Joining points in multi-series seaborn pointplot

霸气de小男生 提交于 2019-12-23 00:51:48
问题 i am having some trouble with a seaborn pointplot. I am to plot the Temperature vs. growth rate of four kinds of bacteria, so that each type has its own graph, but all four are in the same plot. The thing is, i cannot connect the individual points, i can only get the individual points. My code: import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats, integrate import matplotlib.pyplot as plt import matplotlib.ticker as ticker import seaborn as sns

Giving Custom inter quartile range for Boxplot in Matplotlib

自古美人都是妖i 提交于 2019-12-22 09:24:11
问题 The Matplotlib or Seaborn box plot gives the interquartile range between the 25th percentile and 75th percentile. Is there a way to give custom interquartile range for the Boxplot ? I need to get the box plot such that the interquartile range is between 10th percentile and 90th percentile. Looked up on google and other sources, came to know about getting custom whiskers on the box plot but not custom interquartile range. Hoping would get some useful solutions here. 回答1: Yes, it is possible to

Boxplot with multiindex

三世轮回 提交于 2019-12-22 08:53:19
问题 Let's say i have a Dataframe with columns as Multiindex. For example: a = pd.DataFrame(index=range(10), columns=pd.MultiIndex.from_product( iterables=[['2000', '2010'], ['a', 'b']], names=['Year', 'Text']), data=np.random.randn(10,4)) I'd like to make a boxplot that groups by the Year. Like the hue arg on seaborn boxplots. I wondered if there was an easy way to achieve that in either pandas/seaborn/matplotlib. I feel an unstacking could do the trick but I can't get it to work. 回答1: Use stack