Invisible Matplotlib Annotations

Currently, I just add some points to the graph and add annotation for each specific point. However, with each attempt, only a subset of annotations appears on the screen. Other annotations are there through debugs and fingerprints, but for some reason they are simply not visible. Is there something I'm doing wrong?

import matplotlib.pyplot as plt self.fig = plt.figure() self.ax = self.fig.add_subplot(111, projection='polar') li = [[0.2, 1], [0.4, 1], [0.6, 1], [0.8, 1], [1, 1]] for x,y in li: point, = self.ax.plot(x, y, marker='o', color='r', markersize=12) annotation = self.ax.annotate("Comment goes here", xy=(x,y), xycoords='data', xytext=(x,y), textcoords='data' ) self.fig.canvas.draw() 

After some debugging, it seems that removing projection='polar' fixes the problem and all annotations appear. Is there anything specific with polar graphs that will trigger buggy annotations?

Edit: Actually, I could simplify this problem. I tried a simplified version of the program and it worked. I am working on an existing structure built on top of matplotlib and gtk +, so there might be some other hidden issue that I don't know about.

Edit2: I traced this problem. It seems that in my update function, if I set ylim for the graph (radius) to 1 (which coincides with all points), then some of the annotations disappear. I don’t know why, but it works if I leave only il.

+2
source share
1 answer

enter image description here

There is no playback for me on matplotlib.__version__ 1.3.x, all of your annotations are displayed in the specified positions.

+2
source

All Articles