- Matplotlib - Transforms
- Matplotlib - Working with Images
- Mathematical Expressions
- Matplotlib - Working With Text
- Matplotlib - 3D Surface plot
- Matplotlib - 3D Wireframe plot
- Matplotlib - 3D Contour Plot
- Three-dimensional Plotting
- Matplotlib - Violin Plot
- Matplotlib - Box Plot
- Matplotlib - Quiver Plot
- Matplotlib - Contour Plot
- Matplotlib - Scatter Plot
- Matplotlib - Pie Chart
- Matplotlib - Histogram
- Matplotlib - Bar Plot
- Matplotlib - Twin Axes
- Setting Ticks and Tick Labels
- Matplotlib - Setting Limits
- Matplotlib - Formatting Axes
- Matplotlib - Grids
- Matplotlib - Subplot2grid() Function
- Matplotlib - Subplots() Function
- Matplotlib - Multiplots
- Matplotlib - Axes Class
- Matplotlib - Figure Class
- Object-oriented Interface
- Matplotlib - PyLab module
- Matplotlib - Simple Plot
- Matplotlib - Pyplot API
- Matplotlib - Jupyter Notebook
- Matplotlib - Anaconda distribution
- Matplotlib - Environment Setup
- Matplotlib - Introduction
- Matplotlib - Home
Matplotlib Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Matplotpb - Working With Text
Matplotpb has extensive text support, including support for mathematical expressions, TrueType support for raster and vector outputs, newpne separated text with arbitrary rotations, and unicode support. Matplotpb includes its own matplotpb.font_manager which implements a cross platform, W3C comppant font finding algorithm.
The user has a great deal of control over text properties (font size, font weight, text location and color, etc.). Matplotpb implements a large number of TeX math symbols and commands.
The following pst of commands are used to create text in the Pyplot interface −
text | Add text at an arbitrary location of the Axes. |
annotate | Add an annotation, with an optional arrow, at an arbitrary location of theAxes. |
xlabel | Add a label to the Axes’s x-axis. |
ylabel | Add a label to the Axes’s y-axis. |
title | Add a title to the Axes. |
figtext | Add text at an arbitrary location of the Figure. |
suptitle | Add a title to the Figure. |
All of these functions create and return a matplotpb.text.Text() instance.
Following scripts demonstrate the use of some of the above functions −
import matplotpb.pyplot as plt fig = plt.figure() ax = fig.add_axes([0,0,1,1]) ax.set_title( axes title ) ax.set_xlabel( xlabel ) ax.set_ylabel( ylabel ) ax.text(3, 8, boxed itapcs text in data coords , style= itapc , bbox = { facecolor : red }) ax.text(2, 6, r an equation: $E = mc^2$ , fontsize = 15) ax.text(4, 0.05, colored text in axes coords , verticalapgnment = bottom , 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)) ax.axis([0, 10, 0, 10]) plt.show()
The above pne of code will generate the following output −
Advertisements