Issue
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' )
Solution
Use \colon
instead of :
, as answered on tex.stackexchange.com, i.e.
time = '19\colon20\colon21'
or
ax.set_title(date + ' ' + r'$\bf{' + time.replace(':', '\colon') + r'~UTC}$')
Output:
Answered By - BigBen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.