Issue
I use matplotlib to create a figure with 4 sub-plots in it.
I would like to split one of my title of a subplot, such that each line would be in the centered with respect to subplot.
I tried
import matplotlib.pylab as plt
fig = plt.figure(num=0,figsize=(8.27, 11.69), dpi=300)
ax = fig.add_subplot(2, 2, 1)
ax.set_title(r'Normalized occupied \\ Neighbors')
and what I get is that Neighbors
is indented to the left side.
How could I correct this?
Solution
I get the correct alignment when I format the string this way:
import matplotlib.pylab as plt
fig = plt.figure()#num=0,figsize=(8.27, 11.69), dpi=300)
ax = fig.add_subplot(2, 2, 1)
ax.set_title('Normalized occupied \n Neighbors')
plt.show()
Answered By - Yann
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.