You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The High Low function introduced in the MSLP 1000-500mb Thickness plotting example is a wonderful touch to Python graphics. I thought maybe adding a black outline to the text would help it pop a bit more.
ex:
With matplotlib.patheffects and outline_effect = [patheffects.withStroke(linewidth=2.5, foreground='black')]
I also added an ax argument to the code so it could be imported as an external library and plot to the current axes.
import numpy as np
from matplotlib import patheffects
from scipy.ndimage.filters import maximum_filter, minimum_filter
outline_effect = [patheffects.withStroke(linewidth=2.5, foreground='black')]
mxy, mxx = np.where(data_ext == data)
#print(mxy,mxx)
for i in range(len(mxy)):
A = ax.text(lon[mxy[i], mxx[i]], lat[mxy[i], mxx[i]], symbol, color=color, size=24,
clip_on=True, horizontalalignment='center', verticalalignment='center',
transform=transform)
A.set_path_effects(outline_effect)
B = ax.text(lon[mxy[i], mxx[i]], lat[mxy[i], mxx[i]]-0.66,
str(np.int(data[mxy[i], mxx[i]])),
color=color, size=12, clip_on=True, fontweight='bold',
horizontalalignment='center', verticalalignment='top', transform=transform)
B.set_path_effects(outline_effect)
Since adding an outline pushes the pressures too close to the symbol I gave it some space, there's probably a more accepted way but this worked for me in my case.
I would make a suggestion for the Hi/Low feature. The red colour does show well with the black highlight but it is hard to read the dark blue colour and black highlight. I would suggest a lighter blue colour with the black highlight to make easier to read.
The High Low function introduced in the MSLP 1000-500mb Thickness plotting example is a wonderful touch to Python graphics. I thought maybe adding a black outline to the text would help it pop a bit more.
ex:
With
matplotlib.patheffects
andoutline_effect = [patheffects.withStroke(linewidth=2.5, foreground='black')]
I also added an
ax
argument to the code so it could be imported as an external library and plot to the current axes.Since adding an outline pushes the pressures too close to the symbol I gave it some space, there's probably a more accepted way but this worked for me in my case.
Thought I would pass my 2 cents on!
Sample Image:
Source code for my HiLo
The text was updated successfully, but these errors were encountered: