seaborn

seaborn or matplotlib line chart, line color depending on variable

情到浓时终转凉″ 提交于 2019-12-12 02:47:25
问题 I have a pandas dataframe with three columns, Date (timestamp), Color ('red' or 'blue') and Value (int). I am currently getting a line chart from it with the following code: import matplotlib.pyplot as plt import pandas as pd Dates=['01/01/2014','02/01/2014','03/01/2014','04/01/2014','05/01/2014','06/01/2014','07/01/2014'] Values=[3,4,6,5,4,5,4] Colors=['red','red','blue','blue','blue','red','red'] df=pd.DataFrame({'Dates':Dates,'Values':Values,'Colors':Colors}) df['Dates']=pd.to_datetime(df[

Edgecolor of violinplot in Seaborn is not determined by the hue

天涯浪子 提交于 2019-12-12 02:23:00
问题 I have created a violinplot substantially similar to one in the Seaborn gallery: import seaborn as sns sns.set(style="whitegrid", palette="pastel", color_codes=True) tips = sns.load_dataset("tips") sns.violinplot(x="day", y="total_bill", hue="sex", data=tips, split=True, inner="quart", palette={"Male": "b", "Female": "y"}) sns.despine(left=True) However, I have been unable to vary the edgecolor by hue ("Male" and "Female" in the example above). A previous answer on Stack Exchange solved this

How to flip axes on seaborn tsplot plot?

十年热恋 提交于 2019-12-12 02:16:07
问题 I have data with various measurements and depth associated with those measurements. I am able to plot the data with the shaded error bounds as the y axis and depth as the x axis. However, I want the data with the error bounds to be on the x axis and depth on the y. Is there a way to tell tsplot to use the data parameter as the x axis and depth as the y or to flip the axes? Basically I want to turn this into this with all the proper axes formatting as it would if you simply transposed an array

How to increase the font size of the legend in my Seaborn FactorPlot/FacetGrid?

旧时模样 提交于 2019-12-12 01:03:13
问题 The instructions from this question don't work for Seaborn FacetPlots. Would it be possible to get the method to do the same? 回答1: As in the linked answer you may use setp to set the properties (in this case the fontsize of the legend). The only difference to the linked question is that you need to do that for each axes of the FacetGrid g = FacetGrid( ... ) for ax in g.axes.flat: plt.setp(ax.get_legend().get_texts(), fontsize=22) # for legend text plt.setp(ax.get_legend().get_title(),

Is there any way to get just the mini boxplot from a seaborn violinplot?

孤街浪徒 提交于 2019-12-11 19:06:36
问题 I'm trying to draw a very long series of boxplots. I like the aesthetic of the miniature boxplots drawn inside violinplot (controlled via the "inner" parameter to seaborn.violinplot). Does anyone know of an easy way to draw just this mini boxplot without the rest of the violinplot? Thanks! 回答1: The violins are PolyCollection objects. You could remove all PolyCollection s from the axes. This would make sense if the axes only contain the violin plots and not any other PolyCollection s in

Plot CDF with confidence interval using Seaborn

南楼画角 提交于 2019-12-11 18:46:33
问题 I'm trying to plot a CDF from multiple simulation runs using Seaborn . I created a very simple code to emulate my results: import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df1 = pd.DataFrame({'A':np.random.randint(0, 100, 1000)}) df2 = pd.DataFrame({'A':np.random.randint(0, 100, 1000)}) df3 = pd.DataFrame({'A':np.random.randint(0, 100, 1000)}) f, ax = plt.subplots(figsize=(8, 8)) ax = sns.kdeplot(df1['A'], cumulative=True) ax = sns.kdeplot(df2['A'],

Plotting d orbital diagrams using matplotlib (or seaborn)

落爺英雄遲暮 提交于 2019-12-11 18:33:33
问题 guys, I'm a chemist and I've finished an experiment that gave me the energies of a metal d orbitals. It is relatively easy to get the correct proportion of energies in Excel 1 and use a drawing program like Inkscape to draw the diagram for molecular orbitals (like I did with this one below 2) but I’d love to use python to get a beautiful diagram that considers the energies of my orbitals like we see in the books. My first attempt using seaborn and swarmplot is obviously too far from the

Not able to resolve issue(HTTP error 404) with seaborn.load_dataset function [duplicate]

你说的曾经没有我的故事 提交于 2019-12-11 18:05:22
问题 This question already has answers here : Pass proxy to Seaborn (2 answers) Why do i get HTTP400 error when i am plotting graphs in python? (1 answer) Closed 5 months ago . I used below code to use a dataset from my own github account(Disclaimer: Dataset used from some other location & name modified to keep in my github account). import seaborn as sns df = sns.load_dataset('https://github.com/vishalkrsinha/Python/blob/Data/FiveYearData.csv') But, it gives me the error as below(Traceback). I

Seaborn jointplot show annotation

限于喜欢 提交于 2019-12-11 17:40:39
问题 I have plotted a jointplot of two variables. I have passed values to the annot_kws argument but nothing is showing in my plot. import numpy as np import seaborn as sns d1 = np.random.normal(10,1,100) d2 = np.random.gamma(1,2,100) col1 = sns.color_palette()[0] col2 = sns.color_palette()[1] col3 = sns.color_palette()[2] def hexbin_jointplot_sns(d1, d2, col1, col2, bins='log'): """ """ jp = sns.jointplot(d1, d2, kind="hex", annot_kws=dict(stat="r"), joint_kws=dict(bins=bins)) # plot the 1:1 line

How can I integrate Seaborn plot into Tkinter GUI

孤街醉人 提交于 2019-12-11 16:39:38
问题 I am trying to plot using Seaborn in Tkinter. My approaches so far were different variations of this and I could not get it to work. I tried the matplotlib.use("Agg"), which works fine one the normal Matplotlib graphs on the page but doesn't seem to work on the Seaborn plots matplotlib.use("TkAgg") # 'Agg' doesnt work either from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import seaborn as sns import tkinter as tk def graphspage(): pf = tk.Tk() pf.geometry("1000x800") ###