For questions related to labeling plot data points or bar labels.
Questions tagged [plot-annotations]
156 questions
0
votes
0 answers
Formatting text labels in seaborn.objects
Formatting of the so.Text() mapping doesn't seem to have an effect on text labels. In the example below, I am trying to format using the text= scale such that the text labels are rounded to 1dp and are suffixed with "%". The numbers on the bars…

some3128
- 1,430
- 1
- 2
- 8
0
votes
1 answer
How to correct overlapped annotation for bar plots in for-loop
I'm trying to make bar plot with many bars.
I want make code easier to use with varios data.
I make 'for' loop to iters columns in dataframe, bars looks fine, but some annotations is overlapped.
I think I need correct this loop:
for (month, value),…

John Doe
- 95
- 6
0
votes
0 answers
bar labels are not aligned with the corresponding bar
This is my script to display with Seaborn a barplot Stacked:
# Initialize the plot
sns.set(style="whitegrid")
fig, ax = plt.subplots(figsize=(20,12))
# Create the stacked bar chart
sns.barplot(data=df_sorted, y='SalesRepFullName',…

Simon GIS
- 1,045
- 2
- 18
- 37
0
votes
1 answer
How can I rotate the autpct in a pie plot if labels are already rotated?
I plotted a pie chart and rotate the labels:
import pandas as pd
import matplotlib.pyplot as plt
data = { 'T1': [1,1,1,1,1,2,2,2,2,2, 1,1,1,1,1, 2,2,2,2,2, 1,1,1,1,1, 2,2,2,2],
'T2':['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',…

Kajette
- 47
- 4
0
votes
2 answers
How do I add a percentage to a countplot?
I need to show a percentage for my bar graph. However I am not sure how to do it.
sns.set_style('whitegrid')
sns.countplot(y='type',data=df,palette='colorblind')
plt.xlabel('Count')
plt.ylabel('Type')
plt.title('Movie Type in Disney+')
plt.show()

EyeOfIlum
- 23
- 4
0
votes
1 answer
How can I display custom values over grouped bars?
I have a barplot with this values in a dict for the C/C):
{'Country Name': {0: 'United States',
1: 'United States',
2: 'United States',
3: 'United States',
4: 'Russian Federation',
5: 'Russian Federation',
6: 'Russian Federation',
7:…

Rocheteau
- 43
- 7
0
votes
1 answer
Modify a bar plot into a staked plot keeping the original values
I have a pandas DataFrame containing the percentage of students that have a certain skill in each subject stratified according to their gender
iterables = [['Above basic','Basic','Low'], ['Female','Male']]
index =…

gabboshow
- 5,359
- 12
- 48
- 98
0
votes
1 answer
How to add bar value annotations in jointgrid margins
How can bar labels be added to the tops of bars in the x and y margins of a seaborn.joinplot or sns.JointGrid?
How can matplotlib.pyplot.bar_label, as shown in How to add value labels on a bar chart, be applied to the bars in the margins?
import…

Trenton McKinney
- 56,955
- 33
- 144
- 158
0
votes
1 answer
How to draw a rectangle on a circular barplot using matplotlib
I am trying to draw a rectangle on a circular barplot generated by matplotlib. There are numerous tutorials online but they only cover regular 2D plots, the same code creates circles in circular bar plots rather than rectangles.
This is what I am…

csg
- 8,096
- 3
- 14
- 38
0
votes
1 answer
Annotate each FacetGrid subplot using custom df (or list) using a func
Consider the following data and FacetGrid:
d = {'SITE':['A', 'B', 'C', 'C', 'A'], 'VF':[0.00, 0.78, 0.99, 1.00, 0.50],'TYPE':['typeA', 'typeA', 'typeB', 'typeC', 'typeD']}
new_df = pd.DataFrame(data=d)
with sns.axes_style("white"):
g =…

Novice
- 1,101
- 4
- 18
- 30
0
votes
1 answer
Text annotations in matplotlib on next line (linebreak) using '\n' give a square box instead of a line break
I tried to create text annotations in matplotlib using \n, on the plot instead of a line break it is showing a square box
"Fault location:" + str(sc) + "\nI_sc=" + str(fault)
I wanted to Fault location and I_sc in separate line like
Fault…

Unni
- 61
- 3
0
votes
2 answers
Is there a way to put the data in front of a label?
It seems that the labels in Matplotlib always are shown on the most top overlay, covering the data behind it.
Example:
The plot has 2 text annotations in red.
The bottom one is overlayed by a gray "Meteo" text.
Is there a way to move the red…

CacO3
- 66
- 5
0
votes
1 answer
Adjust text positions and remove some part of the pie chart
I try to produce a nested pie chart as an example below. However, the text position looks not as beautiful as it should be. I want to adjust the text positions in the inner pie chart as fit inside the pie part (best along in red line, but if it is…

Tuyen
- 977
- 1
- 8
- 23
0
votes
1 answer
How to avoid text being upside down after rotation
I am trying to place labels on an image with Matplotlib. I need to place labels in eight octilinear directions around a node, for which I am currently using the text function with rotation mode anchor.
However, with some angles, e.g. 180°, the label…

Sepo98
- 3
- 2
0
votes
2 answers
Rotate marker annotations
I'd like to rotate text / labels for each (x,y) scatterplot points.
Here's my dataframe:
import pandas as pd
import seaborn sns
df1 = pd.DataFrame({"one": [1,2,3,5,6,7,8],
"two": [3,6,4,3,8,2,5],
…

kms
- 1,810
- 1
- 41
- 92