Skip to content Skip to sidebar Skip to footer

Showing Z Value As An Annotation When Z Value Is >0.85 Tripcolor Matplotlib

I have problem similar to tripcolor demo example. I have lon,lat , z values which i am plotting using Tripcolor i want to show annotation as lon value,lat value and z value at par

Solution 1:

Voila, but in my opinion, you are trying to annotate way too much.

Adding the following snippet, yields the image below:

indices, = np.where(zfaces > 0.8)
for idx in indices:
    xx, yy, zz = xmid[idx], ymid[idx], zfaces[idx]
    ax3.annotate(f'x={xx:.2f}\ny={yy:.2f}\nz={zz:.2f}', (xx, yy),
                 horizontalalignment='center',
                 verticalalignment='center',
                 fontsize='xx-small',
                 color='black')

enter image description here

Here is a slightly better option:

indices, = np.where(zfaces > 0.8)
for idx in indices:
    xx, yy, zz = xmid[idx], ymid[idx], zfaces[idx]
    ax3.annotate(f'{zz:.2f}', (xx, yy),
                 horizontalalignment='center',
                 verticalalignment='center',
                 fontsize='xx-small',
                 color='white')

enter image description here

Post a Comment for "Showing Z Value As An Annotation When Z Value Is >0.85 Tripcolor Matplotlib"