Displaying of values on barchartHow to get values above the bars on a seaborn countplot grouped using “melt”How to create barplot with facet and add labels with seabornAnnotate pandas Bar plot with reference to another columnHow do I sort a list of dictionaries by a value of the dictionary?How to get the ASCII value of a character?How do I sort a dictionary by value?Why can't Python parse this JSON data?Python/Matplotlib - Colorbar Range and Display ValuesSelect rows from a DataFrame based on values in a column in pandasPlotting two columns of dataFrame in seabornPython Matplotlib - how to set values on y axis in barchartPandas bar plot with both categorical and numerical dataSymbol colour in legend in errorbar plot does not correspond to colour on figure
Installing Windows to flash UEFI/ BIOS, then reinstalling Ubuntu
What modifiers are added to the attack and damage rolls of this unique longbow from Waterdeep: Dragon Heist?
Is it possible to represent any positive integer with a sum of arbitrarily many distinct powers of 3, 5, and 7?
What is the prop for Thor's hammer (Mjölnir) made of?
The oceans and the moon
Doesn't the speed of light limit imply the same electron can be annihilated twice?
How much can I judge a company based on a phone screening?
What should I do if actually I found a serious flaw in someone's PhD thesis and an article derived from that PhD thesis?
Why does Japan use the same type of AC power outlet as the US?
How do I call a 6-digit Australian phone number with a US-based mobile phone?
Did Pope Urban II issue the papal bull "terra nullius" in 1095?
Why did IBM make the PC BIOS source code public?
How to not forget things?
How can God warn people of the upcoming rapture without disrupting society?
Is Thieves' Cant a language?
Align rightarrow in table
Is there a fallacy about "appeal to 'big words'"?
Illustrator - SVG make thinner path
Output the list of musical notes
Bringing Power Supplies on Plane?
Cycle of actions and voice signals on a multipitch climb
Would the USA be eligible to join the European Union?
Is there any way I will not use l'Hôpital's rule here?
How to prevent criminal gangs from making/buying guns?
Displaying of values on barchart
How to get values above the bars on a seaborn countplot grouped using “melt”How to create barplot with facet and add labels with seabornAnnotate pandas Bar plot with reference to another columnHow do I sort a list of dictionaries by a value of the dictionary?How to get the ASCII value of a character?How do I sort a dictionary by value?Why can't Python parse this JSON data?Python/Matplotlib - Colorbar Range and Display ValuesSelect rows from a DataFrame based on values in a column in pandasPlotting two columns of dataFrame in seabornPython Matplotlib - how to set values on y axis in barchartPandas bar plot with both categorical and numerical dataSymbol colour in legend in errorbar plot does not correspond to colour on figure
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've found a couple of similar postings to this topic. But they wasn't helpful for me.
I'm relatively new to Python and Seaborn.
This is my Code:
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
I'm just trying to display the values from the y_axis on top of every bar.
python bar-chart seaborn
add a comment |
I've found a couple of similar postings to this topic. But they wasn't helpful for me.
I'm relatively new to Python and Seaborn.
This is my Code:
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
I'm just trying to display the values from the y_axis on top of every bar.
python bar-chart seaborn
add a comment |
I've found a couple of similar postings to this topic. But they wasn't helpful for me.
I'm relatively new to Python and Seaborn.
This is my Code:
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
I'm just trying to display the values from the y_axis on top of every bar.
python bar-chart seaborn
I've found a couple of similar postings to this topic. But they wasn't helpful for me.
I'm relatively new to Python and Seaborn.
This is my Code:
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
I'm just trying to display the values from the y_axis on top of every bar.
python bar-chart seaborn
python bar-chart seaborn
asked Aug 29 '17 at 19:29
user6875132
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Loop through the patches and annotate the bars.
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
ax=g
#annotate axis = seaborn axis
for p in ax.patches:
ax.annotate("%.2f" % p.get_height(), (p.get_x() + p.get_width() / 2., p.get_height()),
ha='center', va='center', fontsize=11, color='gray', xytext=(0, 20),
textcoords='offset points')
_ = g.set_ylim(0,120) #To make space for the annotations
Output:

Thanks a lot. It works.
– user6875132
Aug 31 '17 at 17:51
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45946970%2fdisplaying-of-values-on-barchart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Loop through the patches and annotate the bars.
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
ax=g
#annotate axis = seaborn axis
for p in ax.patches:
ax.annotate("%.2f" % p.get_height(), (p.get_x() + p.get_width() / 2., p.get_height()),
ha='center', va='center', fontsize=11, color='gray', xytext=(0, 20),
textcoords='offset points')
_ = g.set_ylim(0,120) #To make space for the annotations
Output:

Thanks a lot. It works.
– user6875132
Aug 31 '17 at 17:51
add a comment |
Loop through the patches and annotate the bars.
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
ax=g
#annotate axis = seaborn axis
for p in ax.patches:
ax.annotate("%.2f" % p.get_height(), (p.get_x() + p.get_width() / 2., p.get_height()),
ha='center', va='center', fontsize=11, color='gray', xytext=(0, 20),
textcoords='offset points')
_ = g.set_ylim(0,120) #To make space for the annotations
Output:

Thanks a lot. It works.
– user6875132
Aug 31 '17 at 17:51
add a comment |
Loop through the patches and annotate the bars.
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
ax=g
#annotate axis = seaborn axis
for p in ax.patches:
ax.annotate("%.2f" % p.get_height(), (p.get_x() + p.get_width() / 2., p.get_height()),
ha='center', va='center', fontsize=11, color='gray', xytext=(0, 20),
textcoords='offset points')
_ = g.set_ylim(0,120) #To make space for the annotations
Output:

Loop through the patches and annotate the bars.
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
x_axis = ["A", "B","C","D","E","F"]
y_axis = [78.5, 79.6, 81.6, 75.4, 78.3, 79.6]
plt.ylabel('Accuracy')
plt.title('Accuracy of Classifier')
g=sns.barplot(x_axis, y_axis, color="red")
ax=g
#annotate axis = seaborn axis
for p in ax.patches:
ax.annotate("%.2f" % p.get_height(), (p.get_x() + p.get_width() / 2., p.get_height()),
ha='center', va='center', fontsize=11, color='gray', xytext=(0, 20),
textcoords='offset points')
_ = g.set_ylim(0,120) #To make space for the annotations
Output:

answered Aug 29 '17 at 19:43
Scott BostonScott Boston
66.4k7 gold badges40 silver badges64 bronze badges
66.4k7 gold badges40 silver badges64 bronze badges
Thanks a lot. It works.
– user6875132
Aug 31 '17 at 17:51
add a comment |
Thanks a lot. It works.
– user6875132
Aug 31 '17 at 17:51
Thanks a lot. It works.
– user6875132
Aug 31 '17 at 17:51
Thanks a lot. It works.
– user6875132
Aug 31 '17 at 17:51
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45946970%2fdisplaying-of-values-on-barchart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown