seaborn

Combining two heat maps in seaborn

亡梦爱人 提交于 2020-12-29 04:18:47
问题 I have 2 data tables with the dimensions 4x25 . Each table is from a different point in time, but has exactly the same meta data, in essence the same column and row headers. Given the large number of columns, I thought it best to represent this using a heatmap using the seaborn library for Python . However, I need to include both tables in the same plot. I am able to create a single heatmap representing a single data table as so. df = pd.DataFrame(raw_data) ax = sns.heatmap(df) ax.set

Unable to show legend in seaborn distplot

本秂侑毒 提交于 2020-12-29 02:11:01
问题 I am new to plotting in python and trying following code to plot distribution in seaborn but unable to see the legend, i.e., test_label1 and test_label1 on the plot. import matplotlib.pylab as plt import seaborn as sns import numpy as np plt.figure("Test Plots") lst1 = list(np.random.rand(10)) lst2 = list(np.random.rand(10)) sns.distplot(lst1, label='test_label1', color="0.25") sns.distplot(lst2, label='test_label2', color="0.25") plt.show() 回答1: As you have already labelled your plots using

Unable to show legend in seaborn distplot

社会主义新天地 提交于 2020-12-29 01:59:41
问题 I am new to plotting in python and trying following code to plot distribution in seaborn but unable to see the legend, i.e., test_label1 and test_label1 on the plot. import matplotlib.pylab as plt import seaborn as sns import numpy as np plt.figure("Test Plots") lst1 = list(np.random.rand(10)) lst2 = list(np.random.rand(10)) sns.distplot(lst1, label='test_label1', color="0.25") sns.distplot(lst2, label='test_label2', color="0.25") plt.show() 回答1: As you have already labelled your plots using

Unable to show legend in seaborn distplot

喜夏-厌秋 提交于 2020-12-29 01:59:07
问题 I am new to plotting in python and trying following code to plot distribution in seaborn but unable to see the legend, i.e., test_label1 and test_label1 on the plot. import matplotlib.pylab as plt import seaborn as sns import numpy as np plt.figure("Test Plots") lst1 = list(np.random.rand(10)) lst2 = list(np.random.rand(10)) sns.distplot(lst1, label='test_label1', color="0.25") sns.distplot(lst2, label='test_label2', color="0.25") plt.show() 回答1: As you have already labelled your plots using

Unable to show legend in seaborn distplot

北城余情 提交于 2020-12-29 01:58:07
问题 I am new to plotting in python and trying following code to plot distribution in seaborn but unable to see the legend, i.e., test_label1 and test_label1 on the plot. import matplotlib.pylab as plt import seaborn as sns import numpy as np plt.figure("Test Plots") lst1 = list(np.random.rand(10)) lst2 = list(np.random.rand(10)) sns.distplot(lst1, label='test_label1', color="0.25") sns.distplot(lst2, label='test_label2', color="0.25") plt.show() 回答1: As you have already labelled your plots using

Histogram with Boxplot above in Python

荒凉一梦 提交于 2020-12-27 08:31:44
问题 Hi I wanted to draw a histogram with a boxplot appearing the top of the histogram showing the Q1,Q2 and Q3 as well as the outliers. Example phone is below. (I am using Python and Pandas) I have checked several examples using matplotlib.pyplot but hardly came out with a good example. And I also wanted to have the histogram curve appearing like in the image below. I also tried seaborn and it provided me the shape line along with the histogram but didnt find a way to incorporate with boxpot

Histogram with Boxplot above in Python

我是研究僧i 提交于 2020-12-27 08:30:54
问题 Hi I wanted to draw a histogram with a boxplot appearing the top of the histogram showing the Q1,Q2 and Q3 as well as the outliers. Example phone is below. (I am using Python and Pandas) I have checked several examples using matplotlib.pyplot but hardly came out with a good example. And I also wanted to have the histogram curve appearing like in the image below. I also tried seaborn and it provided me the shape line along with the histogram but didnt find a way to incorporate with boxpot

seaborn relplot: how to control the location of the legend and add title

旧街凉风 提交于 2020-12-25 04:16:08
问题 For python relplot, how to control the location of legend and add a plot title? I tried plt.title('title') but it doesn't work. import seaborn as sns dots = sns.load_dataset("dots") # Plot the lines on two facets sns.relplot(x="time", y="firing_rate", hue="coherence", size="choice", col="align", size_order=["T1", "T2"], height=5, aspect=.75, facet_kws=dict(sharex=False), kind="line", legend="full", data=dots) 回答1: A typical way of changing the location of a legend in matplotlib is to use the

Label axes on Seaborn Barplot

纵饮孤独 提交于 2020-12-23 18:34:33
问题 I'm trying to use my own labels for a Seaborn barplot with the following code: import pandas as pd import seaborn as sns fake = pd.DataFrame({'cat': ['red', 'green', 'blue'], 'val': [1, 2, 3]}) fig = sns.barplot(x = 'val', y = 'cat', data = fake, color = 'black') fig.set_axis_labels('Colors', 'Values') However, I get an error that: AttributeError: 'AxesSubplot' object has no attribute 'set_axis_labels' What gives? 回答1: Seaborn's barplot returns an axis-object (not a figure). This means you

How to add title to seaborn boxplot

谁说胖子不能爱 提交于 2020-12-21 05:34:59
问题 Seems pretty Googleable but haven't been able to find something online that works. I've tried both sns.boxplot('Day', 'Count', data= gg).title('lalala') and sns.boxplot('Day', 'Count', data= gg).suptitle('lalala') . None worked. I think it might be because I'm also working with matplotlib. 回答1: Seaborn box plot returns a matplotlib axes instance. Unlike pyplot itself, which has a method plt.title() , the corresponding argument for an axes is ax.set_title() . Therefore you need to call sns