seaborn

Limit the range of x in seaborn distplot KDE estimation

﹥>﹥吖頭↗ 提交于 2021-02-06 10:45:44
问题 Suppose we have an array with numbers between 0 and 1: arr=np.array([ 0. , 0. , 0. , 0. , 0.6934264 , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.6934264 , 0. , 0.6934264 , 0. , 0. , 0. , 0. , 0.251463 , 0. , 0. , 0. , 0.87104906, 0.251463 , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.48419626, 0. , 0. , 0. , 0. , 0. , 0.87104906, 0. , 0. , 0.251463 , 0.48419626, 0. , 0.251463 , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.251463 , 0. , 0.35524532, 0. , 0. , 0. , 0. , 0. , 0.251463 , 0.251463 ,

Adjust y-axis in Seaborn multiplot

喜夏-厌秋 提交于 2021-02-05 11:24:52
问题 I'm plotting a CSV file from my simulation results. The plot has three graphs in the same figure fig, axes = plt.subplots(nrows=1, ncols=3, figsize=(24, 6)) . However, for comparison purposes I want the y-axis in all graphs starting at zero and the ending at a specific value. I tried the solution mentioned here from the Seaborn author. I don't get any errors, but the solution also does not work for me. Here's my script: import pandas as pd import matplotlib.pyplot as plt import seaborn as sns

How to pass RGBA color into Seaborn PairGrid

安稳与你 提交于 2021-02-05 09:28:05
问题 I have defined a PairGrid function, which works fine grid = sns.PairGrid(data= df, vars = ['sugarpercent', 'pricepercent', 'winpercent'], size = 3) # Map the plots to the locations grid = grid.map_upper(plt.scatter, color = 'darkred') grid = grid.map_upper(corr) grid = grid.map_upper(sns.regplot, line_kws={'color': 'darkred'}, lowess=True) However, I want to use RGBA (12, 50, 196, 0.6) instead of darkred for both scatter and regplot function. I tried to replace the tuple 'color': (12, 50, 196

Catplot with Seaborn, side by side

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-05 08:41:54
问题 I'm using this code below to plot a catplot with Seaborn. Its working ok. sns.catplot(data=df_gol, x='MODALIDADE_DO_VOO', y='VALOR',row='DESTINO', kind='box',height=3, aspect=1, color='red') But I am getting each box-plot stacked. I'd like to plot it side by side. How can I do that? My DF (df_gol) has these values: Column DESTINO - ['JPA', 'FOR', 'SSA', 'AJU'] Column MODALIDADE_DO_VOO - ['Direto', '1 parada'] Columns VALOR is float type I've been looking for some examples but I didn't

Catplot with Seaborn, side by side

北城余情 提交于 2021-02-05 08:38:09
问题 I'm using this code below to plot a catplot with Seaborn. Its working ok. sns.catplot(data=df_gol, x='MODALIDADE_DO_VOO', y='VALOR',row='DESTINO', kind='box',height=3, aspect=1, color='red') But I am getting each box-plot stacked. I'd like to plot it side by side. How can I do that? My DF (df_gol) has these values: Column DESTINO - ['JPA', 'FOR', 'SSA', 'AJU'] Column MODALIDADE_DO_VOO - ['Direto', '1 parada'] Columns VALOR is float type I've been looking for some examples but I didn't

Retention heatmap in plotly

社会主义新天地 提交于 2021-02-05 08:28:12
问题 For convenience, I transfer the retention graph from Seaborn to Plotly, so that I can apply shapes to it later. The plotly library seems to be suitable for this.graph_objects, but I don't understand how to pass DataFrame data. import pandas as pd import numpy as np import seaborn as sns import plotly as ply import matplotlib.pyplot as plt import plotly.graph_objects as go df=pd.DataFrame(index=['01.2020','02.2020','03.2020','04.2020','05.2020','06.2020'], data={0:[1,1,1,1,1,1], 1:[0.58, 0.88,

Retention heatmap in plotly

人盡茶涼 提交于 2021-02-05 08:28:08
问题 For convenience, I transfer the retention graph from Seaborn to Plotly, so that I can apply shapes to it later. The plotly library seems to be suitable for this.graph_objects, but I don't understand how to pass DataFrame data. import pandas as pd import numpy as np import seaborn as sns import plotly as ply import matplotlib.pyplot as plt import plotly.graph_objects as go df=pd.DataFrame(index=['01.2020','02.2020','03.2020','04.2020','05.2020','06.2020'], data={0:[1,1,1,1,1,1], 1:[0.58, 0.88,

PYTHON: How do I use BeautifulSoup to parse a table into a pandas dataframe

本小妞迷上赌 提交于 2021-02-05 08:01:07
问题 I am trying to scrape the CDC website for the data of the last 7 days reported cases for COVID-19. https://covid.cdc.gov/covid-data-tracker/#cases_casesinlast7days I've tried to find the table, by name, id, class, and it always returns as none type. When I print the data scraped, I cant manually locate the table in the html either. Not sure what I'm doing wrong here. Once the data is imported, I need to populate a pandas dataframe to later use for graphing purposes, and export the data table

PYTHON: How do I use BeautifulSoup to parse a table into a pandas dataframe

烈酒焚心 提交于 2021-02-05 08:00:47
问题 I am trying to scrape the CDC website for the data of the last 7 days reported cases for COVID-19. https://covid.cdc.gov/covid-data-tracker/#cases_casesinlast7days I've tried to find the table, by name, id, class, and it always returns as none type. When I print the data scraped, I cant manually locate the table in the html either. Not sure what I'm doing wrong here. Once the data is imported, I need to populate a pandas dataframe to later use for graphing purposes, and export the data table

Seaborn Confusion Matrix (heatmap) 2 color schemes (correct diagonal vs wrong rest)

谁说我不能喝 提交于 2021-02-04 16:43:12
问题 Background In a confusion matrix, the diagonal represents the cases that the predicted label matches the correct label. So the diagonal is good, while all other cells are bad. To clarify what is good and what is bad in a CM for non-experts, I want to give the diagonal a different color than the rest. I want to achieve this with Python & Seaborn . Basically I'm trying to achieve what this question does in R (ggplot2 Heatmap 2 Different Color Schemes - Confusion Matrix: Matches in Different