matplotlib

Seaborn: Making barplot by group with asymmetrical custom error bars

北城以北 提交于 2021-02-07 04:01:51
问题 I have a Pandas dataframe that has a couple of group columns like below. gr1 grp2 variables lb m ub A A1 V1 1.00 1.50 2.5 A A2 V2 1.50 2.50 3.5 B A1 V1 3.50 14.50 30.5 B A2 V2 0.25 0.75 1.0 I am trying to get a separate sub-barplot for each variable in variables using FacetGrid . I am trying to build to the final plot that I need which looks like the below. This is what I have so far. g = sns.FacetGrid(df, col="variables", hue="grp1") g.map(sns.barplot, 'grp2', 'm', order=times) But

adding line plot to imshow and changing axis marker

不羁的心 提交于 2021-02-07 03:44:08
问题 I have made the attached plot using the following codes: a = 1 theta = np.linspace(0,2*np.pi,101) x = np.linspace(-3*a,3*a,1001, dtype='complex') y = np.linspace(-3*a,3*a,1001, dtype='complex') X,Y = np.meshgrid(x,y) # come manipulations with V # (same shape and type as X,Y) not shown here plt.subplot(1,2,1) plt.scatter(a*np.cos(theta), a*np.sin(theta)) plt.imshow(V.real) plt.colorbar() plt.subplot(1,2,2) plt.scatter(a*np.cos(theta), a*np.sin(theta)) plt.imshow(V.imag) plt.colorbar() What I

adding line plot to imshow and changing axis marker

两盒软妹~` 提交于 2021-02-07 03:43:43
问题 I have made the attached plot using the following codes: a = 1 theta = np.linspace(0,2*np.pi,101) x = np.linspace(-3*a,3*a,1001, dtype='complex') y = np.linspace(-3*a,3*a,1001, dtype='complex') X,Y = np.meshgrid(x,y) # come manipulations with V # (same shape and type as X,Y) not shown here plt.subplot(1,2,1) plt.scatter(a*np.cos(theta), a*np.sin(theta)) plt.imshow(V.real) plt.colorbar() plt.subplot(1,2,2) plt.scatter(a*np.cos(theta), a*np.sin(theta)) plt.imshow(V.imag) plt.colorbar() What I

tkinter with matplotlib

浪子不回头ぞ 提交于 2021-02-07 03:17:28
问题 I read it is possible to embed a pyplot in tkinter, but I'm having a problem: I need to display some frames, among which a pyplot in a frame of the main Tkinter window, and it has to react to my keypresses. According to http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html this works: #!/usr/bin/env python from Tkinter import * import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,

tkinter with matplotlib

。_饼干妹妹 提交于 2021-02-07 03:15:34
问题 I read it is possible to embed a pyplot in tkinter, but I'm having a problem: I need to display some frames, among which a pyplot in a frame of the main Tkinter window, and it has to react to my keypresses. According to http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html this works: #!/usr/bin/env python from Tkinter import * import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,

tkinter with matplotlib

青春壹個敷衍的年華 提交于 2021-02-07 03:09:34
问题 I read it is possible to embed a pyplot in tkinter, but I'm having a problem: I need to display some frames, among which a pyplot in a frame of the main Tkinter window, and it has to react to my keypresses. According to http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html this works: #!/usr/bin/env python from Tkinter import * import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,

tkinter with matplotlib

﹥>﹥吖頭↗ 提交于 2021-02-07 03:06:34
问题 I read it is possible to embed a pyplot in tkinter, but I'm having a problem: I need to display some frames, among which a pyplot in a frame of the main Tkinter window, and it has to react to my keypresses. According to http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html this works: #!/usr/bin/env python from Tkinter import * import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,

How to move legend to outside of a seaborn scatterplot?

删除回忆录丶 提交于 2021-02-07 01:35:05
问题 import matplotlib.pyplot as plt import seaborn as sns import pandas as pd sns.set(style="darkgrid") g = sns.scatterplot(x="Area", y="Rent/Sqft", hue="region", style="availability", data=df) When I run this I get the below plot. I want to move the legend outside of plot. I googled and tried the following g.legend(loc='right', bbox_to_anchor=(1.25, 0.5), ncol=1) plt.show() But I don't get any output. Moreover, I can't understand how the object plt is connected to my sns object I am using

How to move legend to outside of a seaborn scatterplot?

佐手、 提交于 2021-02-07 01:30:00
问题 import matplotlib.pyplot as plt import seaborn as sns import pandas as pd sns.set(style="darkgrid") g = sns.scatterplot(x="Area", y="Rent/Sqft", hue="region", style="availability", data=df) When I run this I get the below plot. I want to move the legend outside of plot. I googled and tried the following g.legend(loc='right', bbox_to_anchor=(1.25, 0.5), ncol=1) plt.show() But I don't get any output. Moreover, I can't understand how the object plt is connected to my sns object I am using

How to move legend to outside of a seaborn scatterplot?

泪湿孤枕 提交于 2021-02-07 01:27:03
问题 import matplotlib.pyplot as plt import seaborn as sns import pandas as pd sns.set(style="darkgrid") g = sns.scatterplot(x="Area", y="Rent/Sqft", hue="region", style="availability", data=df) When I run this I get the below plot. I want to move the legend outside of plot. I googled and tried the following g.legend(loc='right', bbox_to_anchor=(1.25, 0.5), ncol=1) plt.show() But I don't get any output. Moreover, I can't understand how the object plt is connected to my sns object I am using