<jupyter_start><jupyter_text>Text in Matplotlib Plots Matplotlib has extensive text support, including support for mathematical expressions, truetype support for raster and vector outputs, newline separated text with arbitrary rotations, and unicode support.Because it embeds fonts directly in output documents, e.g., for postscript or PDF, what you see on the screen is what you get in the hardcopy. FreeType support produces very nice, antialiased fonts, that look good even at small raster sizes. Matplotlib includes its own matplotlib.font_manager (thanks to Paul Barrett), which implements a cross platform, W3C compliant font finding algorithm.The user has a great deal of control over text properties (font size, font weight, text location and color, etc.) with sensible defaults set in the rc file. And significantly, for those interested in mathematical or scientific figures, Matplotlib implements a large number of TeX math symbols and commands, supporting mathematical expressions anywhere in your figure. extensive 广泛的   sensible 明智的  significantly 值得注目的    Basic text commandsThe following commands are used to create text in the pyplot interface and the object-oriented API:pyplot API | OO API | description-----------|--------|------------text | text | Add text at an arbitrary location of the Axes.annotate | annotate | Add an annotation, with an optional arrow, at an arbitrary location of the Axes.xlabel | set_xlabel | Add a label to the Axes's x-axis.ylabel | set_ylabel | Add a label to the Axes's y-axis.title | set_title | Add a title to the Axes.figtext | text | Add text at an arbitrary location of the Figure.suptitle | suptitle | Add a title to the Figure.All of these functions create and return a Text instance, which can be configured with a variety of font and other properties. The example below shows all of these commands in action, and more detail is provided in the sections that follow.<jupyter_code>import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
fig.subplots_adjust(top=0.85)
# Set both x- and y-axis limits to [0, 10] instead of default [0, 1]
ax.axis([0, 10, 0, 10])
ax.text(3, 8, 'boxed italics text in data coords', style='italic',
        verticalalignment='bottom',
        bbox={'facecolor': 'red', 'alpha': 0.5, 'pad': 10})
fig
# Set titles for the figure and the subplot respectively
fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold')
ax.set_title('axes title')

ax.set_xlabel('xlabel')
ax.set_ylabel('ylabel')

ax.text(3, 8, 'boxed italics text in data coords', style='italic',
        bbox={'facecolor': 'red', 'alpha': 0.5, 'pad': 10})

ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)

ax.text(3, 2, 'unicode: Institut für Festkörperphysik')

ax.text(0.95, 0.01, 'colored text in axes coords',
        verticalalignment='bottom', horizontalalignment='right',
        transform=ax.transAxes,
        color='green', fontsize=15)

ax.plot([2], [1], 'o')
ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
            arrowprops=dict(facecolor='black', shrink=0.05))<jupyter_output><empty_output><jupyter_text>Text对象支持FreeType，其mod:font_manager遵从W3C字体发现算法，包含font size, weight, location, color等多种属性，属性支持rc配置文件，mathtext也是支持的。matplotlib提供了一批被称为基础文本命令的方法，比如Figure.suptitleFigure的title没有明确的title对象与之对应，也没有类似文本框的上层对象，LayoutBox有些相似但也不完全相同。title是由Text对象来表示的。由于实现简单，带来的复杂问题是title受figura布局影响的效果。<jupyter_code>from IPython.display import SVG, HTML<jupyter_output><empty_output><jupyter_text>[如何使用pygal在ipython notebook上作图](https://my.oschina.net/jastme/blog/491526)  [Interactive Pygal charts render in Jupyter Notebooks](https://stackoverflow.com/questions/53049003/interactive-pygal-charts-render-in-jupyter-notebooks)  [pygal.js](https://github.com/Kozea/pygal.js)<jupyter_code>import pygal
bar_chart = pygal.Bar()
bar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55])
SVG(bar_chart.render())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10550342378899315, 'fraction_numerical': 0.021810803956378393, 'mean_word_length': 5.290271132376396, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '238069', 'license': 'MIT', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1316, 'n_words': 423, 'path': 'Tutorials_Text_Text in Matplotlib Plots.ipynb', 'repo_name': 'darkeggler/data_visualization_notebooks', 'size': '3943'}