Questions tagged [plot-annotations]

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

156 questions
2
votes
3 answers

How to annotate a stackplot or area plot

I was trying to plot an area graph with these values. y1=[26.8,24.97,25.69,24.07] y2=[21.74,19.58,20.7,21.09] y3=[13.1,12.45,12.75,10.79] y4=[9.38,8.18,8.79,6.75] y5=[12.1,10.13,10.76,8.03] y6=[4.33,3.73,3.78,3.75] df =…
fiona
  • 89
  • 7
2
votes
1 answer

How to annotate seaborn PairGrid diagonal with summary statistics

I'm trying to place statistics data about each parameter in diagonal of the plot by the following code: import matplotlib.pyplot as plt import seaborn as sns iris = sns.load_dataset('iris') def summary(x, **kwargs): x = pd.Series(x) …
Curious
  • 198
  • 7
2
votes
1 answer

How to add entire dataframe row as scatter plot annotation

I'm plotting two columns of a Pandas DataFrame on a scatterplot and I want each point to show all the row values of the DataFrame. I've looked at this post, and tried to do something similar with mplcursors: import pandas as pd from datetime import…
2
votes
1 answer

How to annotate with multiple columns using mplcursors

Below is code for a scatter plot annotated using mplcursors which uses two columns, labeling the points by a third column. How can two values from two columns from a single dataframe be selected for annotation text in a single text box? When instead…
2
votes
2 answers

Add a line to matplotlib annotations

I have a matplotlib plot where certain points get annotated. I have worked out how to do the annotations themselves, including arrows and everything. However, I need to add a line to each annotation, next to the text of the annotation. It should run…
VY_CMa
  • 145
  • 1
  • 9
2
votes
1 answer

How to annotate data points

I want to label each data point on my pyplot. I have two sets of data and I would like to label each data point with their value. This is my code: import matplotlib.pyplot as plt x_position = [1,6,2,7,4,5] y_position = [8,4,7,7,2,4] …
Marcus
  • 25
  • 1
  • 5
2
votes
1 answer

How to avoid scientific notation when annotating a seaborn heatmap

I have a dataframe that contains percentages. If I use seaborn to make a clusterplot somehow the number 100 is plotted as 1+e01. Is there any way to avoid this? I tried rounding the percentages before plotting them, but that does not affect the…
Private
  • 2,626
  • 1
  • 22
  • 39
2
votes
2 answers

How to add text to a 3d surface

I created rectangular prism with a parallelogram base using plot_surface. I need to add some text to one of surface. I tried ax.text(3, 0.5, 1, "red", (1, 1, 0), color='red'), but text is not visible over the surface. import matplotlib.pyplot as…
2
votes
1 answer

matplotlib animation: plot update issues

I am testing matplotlib animation of a plot with random data, I am experiencing the following issues: The axes ranges xlim, ylim are updated almost randomly, and when I switch between the program window and other windows. The annotations are shown…
AJN
  • 1,196
  • 2
  • 19
  • 47
2
votes
3 answers

Adding an annotation box to a matplotlib contour/heat map plot

I want generate a contour plot/heat map with a color bar and then add an annotation box. This figure is ugly, but gets at what I want: add_subplot() is not enough. If I try to put everything in the same subplot, the box gets covered up. I can…
bob.sacamento
  • 6,283
  • 10
  • 56
  • 115
1
vote
1 answer

How to put value over bars when creating many barplots with a loop

How can I put the value over the bars when creating many plots with a loop. The code I am using years = [twenty,twentyone,twentytwo,twentythree] for year in years: plt.ylim(0, 60) ax = sns.barplot(data=year, errorbar=None) …
1
vote
0 answers
1
vote
1 answer

Plotting country labels with cartopy

I am trying to create a map overview using cartopy, but for some reason cannot figure out how to plot the names of the countries shown on the map. My function looks like this: import matplotlib.pyplot as plt import cartopy.crs as ccrs import…
MateaMar
  • 25
  • 7
1
vote
1 answer

Dynamically resizing a plot to fit text annotations within the plot area

I am adding text annotations to points of a scatter plot as follows: I do not know the length of the text annotations in advance. The figure above shows that the text annotations extend beyond the plot area. I want to find the length of each text…
manujinda
  • 21
  • 4
1
vote
1 answer

How can I add a marker and number on hlines

I want to create a dashboard with 4 plots, with 2 hlines. f, axs = plt.subplots(2,2,figsize=(16,14)) x=lplt['pts'] y=lplt['time'] axs[0,1].hlines(y, xmin = 0 , xmax = lplt['pts'], color='g') axs[1,1].hlines(y, xmin = 0 , xmax = lplt['pts'],…