seaborn

Axis ticks in histogram of times in matplotlib/seaborn

人盡茶涼 提交于 2021-01-07 03:01:24
问题 I've got a df with messages from a WhatsApp chat, the sender and the corresponding time in datetime format. Time Sender Message 2020-12-21 22:23:00 Sender 1 "..." 2020-12-21 22:26:00 Sender 2 "..." 2020-12-21 22:35:00 Sender 1 "..." I can plot the histogram with sns.histplot(df["Time"], bins=48) But now the ticks on the x-axis don't make much sense. I end up with 30 ticks even though it should be 24 and also the ticks all contain the whole date plus the time where I would want only the time

How do I change y-axis limits in seaborn histogram?

╄→гoц情女王★ 提交于 2021-01-07 01:59:40
问题 I have highly imbalanced raw data, which looks like: df Index Branch 1 10000 2 200 ... 1000 1 ... 10000 1 And if I run: import seaborn as sns sns.distplot(df['Branch'], bins=1000) The outcome looks like this: Is there any chance to fix the maximum of the y-value in the visualization to 0.06? And to adjust the x-value to 1000 or something. 回答1: seaborn uses matplotlib under the hood so you can just import matplotlib.pyplot as plt import seaborn as sns sns.distplot(df['Branch'], bins=1000) plt

Unnormalized histogram plots in Seaborn are not centered on X-axis

守給你的承諾、 提交于 2021-01-07 01:36:13
问题 I am graphing the number of occurrences that a value occurs in two different datasets. One plot (plot 1) graphs perfectly, the bars are right above the numbers on the x-axis. On the second plot (plot 2), there should be two bars, one above the 1 x-axis value and the other above the 2 x-axis value, but both bars are thick and squashed between 1 and 2on the x-axis. How do I get the second graph to look like the first graph? This is the code that I used in Jupyter notebook to generate both plots

Unnormalized histogram plots in Seaborn are not centered on X-axis

妖精的绣舞 提交于 2021-01-07 01:33:50
问题 I am graphing the number of occurrences that a value occurs in two different datasets. One plot (plot 1) graphs perfectly, the bars are right above the numbers on the x-axis. On the second plot (plot 2), there should be two bars, one above the 1 x-axis value and the other above the 2 x-axis value, but both bars are thick and squashed between 1 and 2on the x-axis. How do I get the second graph to look like the first graph? This is the code that I used in Jupyter notebook to generate both plots

Add a normal distribution to seaborn 2D histogram

爱⌒轻易说出口 提交于 2021-01-07 01:24:01
问题 Is it possible to take a histogram from seaborn and add a normal distribution? Say I had something like this scatter plot and histogram from the documentation. import seaborn as sns penguins = sns.load_dataset("penguins") sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm"); plt.savefig('deletethis.png', bbox_inches='tight') Can i superimpose a distribution on the sides like the image below? import matplotlib.pyplot as plt import numpy as np from scipy.stats import norm x = np

Grouped boxplot with 2 y axes, 2 plotted variables per x tick

旧街凉风 提交于 2021-01-05 12:14:04
问题 I am trying to make a boxplot of an 18 year record of monthly rainfall and flood frequency. i.e. each x tick is the month, and each x tick is associated with two boxplots, one of the rainfall and one of the flood frequency. So far I have managed to plot these using seaborn (see following code and image), however I do not know how to create the boxplot with two y axes, which I need because the scales for each variable differ. The data looks like this (largest value of flood_freq in the dataset

Grouped boxplot with 2 y axes, 2 plotted variables per x tick

假装没事ソ 提交于 2021-01-05 12:07:46
问题 I am trying to make a boxplot of an 18 year record of monthly rainfall and flood frequency. i.e. each x tick is the month, and each x tick is associated with two boxplots, one of the rainfall and one of the flood frequency. So far I have managed to plot these using seaborn (see following code and image), however I do not know how to create the boxplot with two y axes, which I need because the scales for each variable differ. The data looks like this (largest value of flood_freq in the dataset

How to add data labels to seaborn barplot?

徘徊边缘 提交于 2021-01-05 06:40:14
问题 I have the following code to produce a bar plot in seaborn import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD')) print(df): A B C D 0 15 21 13 5 1 14 94 99 14 2 11 11 13 69 3 27 90 37 6 4 51 93 92 24 .. .. .. .. .. 95 45 40 85 62 96 44 48 61 43 97 39 66 72 72 98 51 97 17 32 99 51 42 29 15 probbins = [0,10,20,30,40,50,60,70,80,90,100] df['Groups'] = pd.cut(df['D'],bins=probbins) plt.figure

Add density curve on the histogram

蓝咒 提交于 2021-01-04 06:42:27
问题 I am able to make histogram in python but I am unable to add density curve , I see many code which are using different ways to add density curve on histogram but I am not sure how to get on my code I have added density = true but not able to get density curve on histogram df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD')) X=df['A'] hist, bins = np.histogram(X, bins=10,density=True) width = 0.7 * (bins[1] - bins[0]) center = (bins[:-1] + bins[1:]) / 2 plt.bar(center, hist, align=

Add density curve on the histogram

早过忘川 提交于 2021-01-04 06:41:49
问题 I am able to make histogram in python but I am unable to add density curve , I see many code which are using different ways to add density curve on histogram but I am not sure how to get on my code I have added density = true but not able to get density curve on histogram df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD')) X=df['A'] hist, bins = np.histogram(X, bins=10,density=True) width = 0.7 * (bins[1] - bins[0]) center = (bins[:-1] + bins[1:]) / 2 plt.bar(center, hist, align=