我正在尝试使用MathText在我的图例中加粗特定的字符串。单词是粗体的,但MathText不断删除特定字符。如何让MathText停止删除特定字符?我正在使用的字符串被附加到列表中,并在图例语句中使用。你知道吗
例如:
nameedit="Bacillus cereus"
#keeps removing the space
r"$\bf{" +nameedit+ r"}$"
#keeps removing the space
r"$\bf" +nameedit+ r"$"
#space removed and %) removed
r"$\bf" +nameedit+' ('+str(round(70/100*100))+'%)'+ r"$"
#does not print anything
r"$\bf{" +nameedit+' ('+str(round(70/100*100))+'%)'+ r"}$"
#Here is the legend statement
ax.legend(circlist,namelegend,bbox_to_anchor=(1,1),loc=2,fontsize=3.3,title='Top Ten Abundance')
如果正在使用的字符串不是有效的latex字符串,则它不能是有效的MathText字符串。你知道吗
为了在latex数学模式下创建空间,可以使用反斜杠-MathText也一样。你知道吗
%
符号是latex中的注释。与MathText相同。您需要转义注释符号以将其用作符号:\%
但是请注意,如果将文本全部加粗,则会得到完全相同的输出
相关问题 更多 >
编程相关推荐