bar-chart

Plot horizontal bars using seaborn.objects interface (v0.12)

Plot horizontal bars using seaborn.objects interface (v0.12) Question: In the original API, barplot provided an orient parameter to swap bar orientation: import pandas as pd, numpy as np, seaborn as sns df = pd.DataFrame(data=np.random.randint(10, size=(3, 5)), columns=[*"abcde"]) # a b c d e # 0 8 6 5 2 3 # 1 0 0 0 …

Total answers: 1

Combine Binned barplot with lineplot

Combine Binned barplot with lineplot Question: I’d like to represent two datasets on the same plot, one as a line as one as a binned barplot. I can do each individually: tobar = pd.melt(pd.DataFrame(np.random.randn(1000).cumsum())) tobar["bins"] = pd.qcut(tobar.index, 20) bp = sns.barplot(data=tobar, x="bins", y="value") toline = pd.melt(pd.DataFrame(np.random.randn(1000).cumsum())) lp = sns.lineplot(data=toline, x=toline.index, y="value") But when I try …

Total answers: 1

How to plot labels in alphabetical orders with coulour-gradient in python?

How to plot labels in alphabetical orders with coulour-gradient in python? Question: I want to plot labels "nutrition_grade_fr" in alphabetical orders with coulour-gradient in python. Here is the code for my graph but it does not show the labels in alphabetical order nor with the corresponding hue: import seaborn as sns import matplotlib.pyplot as plt …

Total answers: 1

How make stacked bar chart from dataframe in python

How make stacked bar chart from dataframe in python Question: I have the following dataframe: Color Level Proportion ————————————- 0 Blue 1 0.1 1 Blue 2 0.3 2 Blue 3 0.6 3 Red 1 0.2 4 Red 2 0.5 5 Red 3 0.3 Here I have 2 color categories, where each color category has 3 …

Total answers: 2

Matplotlib bar semilogy not show full y labels

Matplotlib bar semilogy not show full y labels Question: How to show y labels on below figure?. Matplotlib cut some y labels. fig, ax = plt.subplots(1,1,figsize = (8,5)) sumsqrt_data ={‘PI-ZN’ : PI_ZN, ‘PI-CHR’ : PI_CHR, ‘PI-AMIGO’ : PI_AMIGO, ‘PI-IMC’ : PI_IMC, ‘PI-SIMC’ : PI_SIMC} courses = list([‘PI-ZN’, ‘PI-CHR’, ‘PI-AMIGO’, ‘PI-IMC’, ‘PI-SIMC’]) values = list([9975.229678280088, 16002.075925234263, …

Total answers: 1

How to make a bar plot using seaborn library

How to make a bar plot using seaborn library Question: I am trying to make a bar plot on my airline satisfaction data project, I am trying to compare Gender vs. satisfaction answers. I tried the code below in python with sea-born library. I tried plotting both but keep getting DataFrame object has no attribute …

Total answers: 1

How to set xlim in seaborn barplot?

How to set xlim in seaborn barplot? Question: I have created a barplot for given days of the year and the number of people born on this given day (figure a). I want to set the x-axes in my seaborn barplot to xlim = (0,365) to show the whole year. But, once I use ax.set_xlim(0,365) …

Total answers: 1

How can I add error bars with min and max value to grouped barplot?

How can I add error bars with min and max value to grouped barplot? Question: How can I add an error bar with a specific minimum and maximum value on the orange bars only. This is my code now import matplotlib.pyplot as plt import numpy as np # Enter my SiC2 data sic2_AGB = np.array([3.7e-7, …

Total answers: 1