Uncategorized

python matplotlib: strange blank spaces around colon when using bold text


Just want to produce a plot with date and time in the title, but with the time being formatted bold. When executing the minimal example below, blank spaces appear around the colons in the title.

How do I get rid of those blanks?

import matplotlib.pyplot as plt
date="2023/22/12"
time="19:20:21"
fig, ax = plt.subplots()
plt.title( date + '  ' + r'$\bf{' + time + r'~UTC}$' )
plt.savefig( 'colon_title_test.png' )

plot produced with the minimal example



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *