seaborn

Runtimeerror: cannot get window extent w/o renderer with seaborn

冷暖自知 提交于 2019-12-22 08:25:12
问题 So I'm trying to get some stuff running with seaborn (specifically this example) However when I run on normal ipython I get the runtime error listed in the title. It seems like a backend issue but I don't experience this with any other plotting utilities. Even stranger, if I run in the ipython notebook I no longer experience that error. I can certainly work with in the notebook for now and avoid problems but it's concerning that this happens in a terminal. 回答1: This seems to be an issue with

How to make Pareto Chart in python?

你。 提交于 2019-12-22 00:19:19
问题 Pareto is very popular diagarm in Excel and Tableu. In excel we can easily draw a Pareto diagram but I found no easy way to draw the diagram in Python. I have a pandas dataframe like this: import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt df = pd.DataFrame({'country': [177.0, 7.0, 4.0, 2.0, 2.0, 1.0, 1.0, 1.0]}) df.index = ['USA', 'Canada', 'Russia', 'UK', 'Belgium', 'Mexico', 'Germany', 'Denmark'] print(df) country USA 177.0 Canada 7.0 Russia 4.0 UK

How to iteratively populate matplotlib gridspec with a multipart seaborn plot? [duplicate]

最后都变了- 提交于 2019-12-21 23:21:28
问题 This question already has answers here : How to plot multiple Seaborn Jointplot in Subplot (2 answers) Closed 2 years ago . Some minimal code of what I'm working on. Some parameters may seem redundant, but I didn't bother removing all of them. import matplotlib import matplotlib.gridspec as gridspec matplotlib.use("macosx") import matplotlib.pyplot as plt import pandas as pd import seaborn as sns def plot_overlaid_2d_hist(data, plot_axis_x, plot_axis_y, plot_axis_x_lab, plot_axis_y_lab, group

How to plot regression line on hexbins with Seaborn?

放肆的年华 提交于 2019-12-21 17:17:57
问题 I've finally managed to wrangle my hexbin distribution plot into something almost pretty. import seaborn as sns x = req.apply_clicks y = req.reqs_wordcount sns.jointplot(x, y, kind="hex", color="#5d5d60", joint_kws={'gridsize':40, 'bins':'log'}) But I'm hoping to overlay a regression line on top of it, and can't figure out how to do so. For instance, the regression line seems to occupy the marginal plot when I add regplot to the code: x = req.apply_clicks y = req.reqs_wordcount z = sns

Is It possible to integrate Python Seaborn with plotly

送分小仙女□ 提交于 2019-12-21 12:56:17
问题 I am looking for some guidance in python seaborn for plot.ly. Is it possible to have seaborn graphs on plot.ly ? Any example or tutorial available ? Please help. Thanks in advance. 回答1: Seaborn is based on matplotlib, and Plotly converts the matplotlib figures it can (where mpl figure obejcts expose sufficient information to make the conversion. Here are the mpl conversion docs: https://plot.ly/matplotlib/) Full coverage won't be available until mpl 2.0 release, when mpl figure objects are

Plot multiple DataFrame columns in Seaborn FacetGrid

别说谁变了你拦得住时间么 提交于 2019-12-21 04:21:15
问题 I am using the following code import seaborn as sns g = sns.FacetGrid(dataframe, col='A', hue='A') g.map(plt.plot, 'X', 'Y1') plt.show() to make a seaborn facet plot like this: Now I would like to add another row to this plot with a different variable, call it Y2, on the y axis. The result should look similar to vertically stacking the two plots obtained by g = sns.FacetGrid(dataframe, col='A', hue='A') g.map(plt.plot, 'X', 'Y1') plt.show() g = sns.FacetGrid(dataframe, col='A', hue='A') g.map

五分钟入门数据可视化

时光毁灭记忆、已成空白 提交于 2019-12-21 04:20:02
在数据科学中,有多种工具可以进行可视化。在本文中,我(毛利)展示了使用Python来实现的各种可视化图表。 Matplotlib是Python中最常用的可视化工具之一,可以非常方便地创建海量类型的2D图表和一些基本的3D图表。 主要的可视化视图 比较:比较数据间各类别的关系,或者是它们随着时间的变化趋势,比如折线图; 联系:查看两个或两个以上变量之间的关系,比如散点图; 构成:每个部分占整体的百分比,或者是随着时间的百分比变化,比如饼图; 分布:关注单个变量,或者多个变量的分布情况,比如直方图。 单变量可视化视图: 一次值关注一个变量。如我们一次只关注身高变量,来看身高的取值分布,而暂时忽略其他变量。 多变量可视化视图: 可以让一张图同时查看两个以上的变量,比如“身高”和“年龄”,你可以理解是同一个人的两个参数,这样在同一张图中可以看到每个人的“身高”和“年龄”的取值,从而分析出这两个变量之前是否存在某种联系。 离散变量和连续变量: 离散变量是指其数值只能用自然数或整数单位计算的则为离散变量. 例如,企业个数,职工人数,设备台数等,只能按计量单位数计数,这种变量的数值一般用计数方法取得. 反之,在一定区间内可以任意取值的变量叫连续变量,其数值是连续不断的,相邻两个数值可作无限分割,即可取无限个数值. 针对离散变量我们可以使用常见的条形图和饼图完成数据的可视化工作,那么

Plotting multiple boxplots in seaborn?

China☆狼群 提交于 2019-12-21 04:12:23
问题 I want to plot boxplots using seaborn in pandas because it is a nicer way to visualize data, but I am not too familiar with it. I have three dataframes that are different metrics, and I want to compare the different metrics. I will loop through the file paths to access them. for path in paths: df = pd.read_csv(path) The dfs for each of the metrics are separate and look something like this (where the .... indicates filled in data values). 1, 2, 3, 4, 5 are the column names and indicate

Dot-boxplots from DataFrames

依然范特西╮ 提交于 2019-12-21 03:57:12
问题 Dataframes in Pandas have a boxplot method, but is there any way to create dot-boxplots in Pandas, or otherwise with seaborn? By a dot-boxplot, I mean a boxplot that shows the actual data points (or a relevant sample of them) inside the plot, e.g. like the example below (obtained in R). 回答1: For a more precise answer related to OP's question (with Pandas): import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.DataFrame({ "A":np.random.normal(0.8,0.2,20), "B":np

Customize the axis label in seaborn jointplot

狂风中的少年 提交于 2019-12-21 03:45:48
问题 I seem to have got stuck at a relatively simple problem but couldn't fix it after searching for last hour and after lot of experimenting. I have two numpy arrays x and y and I am using seaborn's jointplot to plot them: sns.jointplot(x, y) Now I want to label the xaxis and yaxis as "X-axis label" and "Y-axis label" respectively. If I use plt.xlabel , the labels goes to the marginal distribution. How can I make them appear on the joint axes? 回答1: sns.jointplot returns a JointGrid object, which