plot-annotations

Add ONLY the total values on top of stacked bars

Add ONLY the total values on top of stacked bars Question: I am working with the following bar plot: And I would like to add only the total amount of each index on top of the bars, like this: However, when I use the following code, I only get parts of the stacks of each …

Total answers: 1

Adding Comma to Bar Labels

Adding Comma to Bar Labels Question: I have been using the ax.bar_label method to add data values to the bar graphs. The numbers are huge such as 143858918. How can I add commas to the data values using the ax.bar_label method? I do know how to add commas using the annotate method but if it …

Total answers: 1

How to make a horizontal stacked bar plot of values as percentage

How to make a horizontal stacked bar plot of values as percentage Question: I have a list of 0,1 in dataframe. How can I plot a percentage of bar plot in pandas or matplotlib, that would have in the legend 1,0 and written annotation of percentage of the 1,0 compare to the whole list? import …

Total answers: 1

How to add multiple data labels in a bar chart

How to add multiple data labels in a bar chart Question: I have two grouped bar charts of value changes between cases for two systems among 3 groups as below. Here I was able to add data labels to the bars using the code below (figure produced attached) What I want to do is on …

Total answers: 1

How to add multiple annotations to a bar plot

How to add multiple annotations to a bar plot Question: I would like to add percent values – in addition to counts – to my pandas bar plot. However, I am not able to do so. My code is shown below and thus far I can get count values to display. Can somebody please help …

Total answers: 1

Matplotlib pie chart: Show both value and percentage

Show both value and percentage on a pie chart Question: Here’s my current code values = pd.Series([False, False, True, True]) v_counts = values.value_counts() fig = plt.figure() plt.pie(v_counts, labels=v_counts.index, autopct=’%.4f’, shadow=True); Currently, it shows only the percentage (using autopct) I’d like to present both the percentage and the actual value (I don’t mind about the position) …

Total answers: 2

Add label values to bar chart and line chart

Add label values to bar chart and line chart Question: I have created a bar chart and a line chart using two different y-axes for the following dataframe. import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame({‘DXC’:[‘T1’, ‘H1’, ‘HP’, ‘T1_or_H1_or_HP’], ‘Count’: [2485, 5595, 3091, 9933], ‘percent’:[1.06, 2.39, 1.31, 4.23]}) DXC Count percent 0 …

Total answers: 2

How to calculate percent by row and annotate 100 percent stacked bars

How to calculate percent by row and annotate 100 percent stacked bars Question: I need help adding the percent distribution of the total (no decimals) in each section of a stacked bar plot in pandas created from a crosstab in a dataframe. Here is sample data: data = { ‘Name’:[‘Alisa’,’Bobby’,’Bobby’,’Alisa’,’Bobby’,’Alisa’, ‘Alisa’,’Bobby’,’Bobby’,’Alisa’,’Bobby’,’Alisa’], ‘Exam’:[‘Semester 1′,’Semester 1′,’Semester 1’,’Semester …

Total answers: 2

Seaborn Catplot set values over the bars

Seaborn Catplot set values over the bars Question: I plotted a catplot in seaborn like this import seaborn as sns import pandas as pd data = {‘year’: [2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015], ‘geo_name’: [‘Michigan’, ‘Michigan’, ‘Michigan’, ‘Michigan’, ‘Washtenaw County, MI’, …

Total answers: 3

Python PieChart (is it possible to do CallOut labels)

Python PieChart (is it possible to do CallOut labels) Question: Is there any examples of doing CallOut Labels with Python, Matplotlib etc Image source Something like above with a line and the label pointing from outside the pie chart.. cannot see any possible examples of it being done with Mathplotlib…. can this be done with …

Total answers: 1