Questions tagged [plot-annotations]

For questions related to labeling plot data points or bar labels.

156 questions
42
votes
1 answer

How to add bold annotated text to a plot

I want to make an annotated text in a plot using matplotlib. I have tried the following: a=10.0 font=matplotlib.font_manager.FontProperties() font.set_weight('bold') text(0,1,":.2f".format(a), fontproperties=font) I have also tried: a=10.0 …
simona
  • 2,009
  • 6
  • 29
  • 41
41
votes
5 answers

How to improve the label placement in scatter plot

I use matplotlib to plot a scatter chart: And label the bubble using a transparent box according to the tip at How to annotate point on a scatter automatically placed arrow Here is the code: if show_annote: for i in range(len(x)): …
bigbug
  • 55,954
  • 42
  • 77
  • 96
36
votes
4 answers

How to understand Seaborn's heatmap annotation format

I am looking for a way to show "0.0045" as "0.45%" on seaboarn's heatmap by specifying the fmt keyword: sns.heatmap(data, annot=True, fmt='??') However, I did not find a list of format to use. Searching between different examples, I have seen "d",…
Lisa
  • 4,126
  • 12
  • 42
  • 71
34
votes
3 answers

How to annotate point on a scatter automatically placed arrow

if I make a scatter plot with matplotlib: plt.scatter(randn(100),randn(100)) # set x, y lims plt.xlim([...]) plt.ylim([...]) I'd like to annotate a given point (x, y) with an arrow pointing to it and a label. I know this can be done with annotate,…
user248237
30
votes
2 answers

How to add a footnote under the x-axis of a plot

I couldn't find the right function to add a footnote in my plot. The footnote I want to have is something like an explanation of one item in the legend, but it is too long to put in the legend box. So, I'd like to add a ref number, e.g. [1], to the…
Flake
  • 4,377
  • 6
  • 30
  • 29
27
votes
1 answer

Annotate Subplots in a Figure with A, B, C

When submitting papers to scientific journals one quite frequently needs to enumerate the different subplots of a figure with A, B, ... . This sounds like a very common problem and I was trying to find an elegant way to do that automatically with…
fabee
  • 515
  • 1
  • 5
  • 14
22
votes
1 answer

Drawing brackets over plot

How would I go about if I wanted to draw brackets over some parts of my plot like this : At the moment I am adding them with powerpoint but I would like to do it entirely in python.
Anthony Lethuillier
  • 1,489
  • 4
  • 15
  • 33
21
votes
4 answers

Indicating the statistically significant difference in bar graph

I use a bar graph to indicate the data of each group. Some of these bars differ significantly from each other. How can I indicate the significant difference in the bar plot? import numpy as np import matplotlib.pyplot as plt menMeans = (5, 15, 30,…
imsc
  • 7,492
  • 7
  • 47
  • 69
19
votes
2 answers

How to display percentage above grouped bar chart

The following are the pandas dataframe and the bar chart generated from it: colors_list = ['#5cb85c','#5bc0de','#d9534f'] result.plot(kind='bar',figsize=(15,4),width = 0.8,color =…
raniphore
  • 386
  • 1
  • 2
  • 9
18
votes
3 answers

Seaborn Catplot set values over the bars

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',…
Sreeram TP
  • 11,346
  • 7
  • 54
  • 108
15
votes
4 answers

autoscale axes to include annotations

Does anyone know of an easy way to expand the plot area to include annotations? I have a figure where some labels are long and/or multiline strings, and rather than clipping these to the axes, I want to expand the axes to include the…
Tango
  • 151
  • 1
  • 3
14
votes
6 answers

Annotating ranges of data

How can I annotate a range of my data? E.g., say the data from x = 5 to x = 10 is larger than some cut-off, how could I indicate that on the graph. If I was annotating by hand, I would just draw a large bracket above the range and write my…
ari
  • 4,269
  • 5
  • 24
  • 33
13
votes
1 answer

How to insert non overlapping text

I am trying to insert power flow results in a network plot created with matplotlib. Some buses are so close that labelling the names along with power flow results is proving to be a big headache because text overlap is making some portions…
amaity
  • 267
  • 1
  • 3
  • 15
12
votes
1 answer

Remove annotation while keeping plot

I'm producing a series of scatterplots, where I keep most of the plot (besides the scatter plot) between each plot. This is done like so: Keeping map overlay between plots in matplotlib Now I want to add annotation to the plot: for j in…
bjornasm
  • 2,211
  • 7
  • 37
  • 62
12
votes
1 answer

How to add significance bars and asterisks to boxplots

I'm looking for suggestions on how to add significance bars between boxes on a box plot and also have asterisks representing significance. I am using seaborn to create plots and I couldn't find any common methods for accomplishing this. Nothing…
Chris
  • 1,150
  • 3
  • 13
  • 29
1
2
3
10 11