Documentation style guide#
This guide contains best practices for the language and formatting of Matplotlib documentation.
See also
For more information about contributing, see the Writing documentation section.
Expository language#
For explanatory writing, the following guidelines are for clear and concise language use.
Terminology#
There are several key terms in Matplotlib that are standards for reliability and consistency in documentation. They are not interchangeable.
Term |
Description |
Correct |
Incorrect |
---|---|---|---|
Matplotlib working space for programming. |
|
||
Subplots within Figure. Contains plot elements and is responsible for plotting and configuring additional details. |
|
|
|
Broad variety of Matplotlib objects that display visuals. |
|
||
Human-readable single dimensional object of reference marks containing ticks, tick labels, spines, and edges. |
|
||
Explicit, Object Oriented Programming (OOP) |
Explicit approach of programming in Matplotlib. |
|
|
Implicit,
|
Implicit approach of
programming in Matplotlib
with |
|
|
Grammar#
Subject#
Use second-person imperative sentences for directed instructions specifying an action. Second-person pronouns are for individual-specific contexts and possessive reference.
Correct |
Incorrect |
---|---|
Install Matplotlib from the source
directory using the Python |
You can install Matplotlib from the source directory. You can find additional support if you are having trouble with your installation. |
Tense#
Use present simple tense for explanations. Avoid future tense and other modal or auxiliary verbs when possible.
Correct |
Incorrect |
---|---|
The fundamental ideas behind Matplotlib for visualization involve taking data and transforming it through functions and methods. |
Matplotlib will take data and transform it through functions and methods. They can generate many kinds of visuals. These will be the fundamentals for using Matplotlib. |
Voice#
Write in active sentences. Passive voice is best for situations or conditions related to warning prompts.
Correct |
Incorrect |
---|---|
The function |
The graph is generated by the
|
An error message is returned by the function if there are no arguments. |
You will see an error message from the function if there are no arguments. |
Sentence structure#
Write with short sentences using Subject-Verb-Object order regularly. Limit coordinating conjunctions in sentences. Avoid pronoun references and subordinating conjunctive phrases.
Correct |
Incorrect |
---|---|
The |
The |
The |
The |
The implicit approach is a convenient shortcut for generating simple plots. |
Users that wish to have convenient shortcuts for generating plots use the implicit approach. |
Formatting#
The following guidelines specify how to incorporate code and use appropriate formatting for Matplotlib documentation.
Code#
Matplotlib is a Python library and follows the same standards for documentation.
Outputs#
When generating visuals with Matplotlib using .py
files in examples,
display the visual with matplotlib.pyplot.show
to display the visual.
Keep the documentation clear of Python output lines.
Correct |
Incorrect |
---|---|
plt.plot([1, 2, 3], [1, 2, 3])
plt.show()
|
plt.plot([1, 2, 3], [1, 2, 3])
|
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3])
fig.show()
|
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3])
|
reStructuredText#
Matplotlib uses reStructuredText Markup for documentation. Sphinx helps to transform these documents into appropriate formats for accessibility and visibility.
Lists#
Bulleted lists are for items that do not require sequencing. Numbered lists are exclusively for performing actions in a determined order.
Correct |
Incorrect |
---|---|
The example uses three graphs. |
The example uses three graphs. |
|
|
These four steps help to get started using Matplotlib. |
The following steps are important to get started using Matplotlib. |
|
|
Tables#
Use ASCII tables with reStructuredText standards in organizing content. Markdown tables and the csv-table directive are not accepted.
Correct |
Incorrect |
||||
---|---|---|---|---|---|
|
| Correct | Incorrect |
| ------- | --------- |
| OK | Not OK |
|
||||
+----------+----------+
| Correct | Incorrect|
+==========+==========+
| OK | Not OK |
+----------+----------+
|
.. csv-table::
:header: "correct", "incorrect"
:widths: 10, 10
"OK ", "Not OK"
|
||||
=========== ===========
Correct Incorrect
=========== ===========
OK Not OK
=========== ===========
|
Additional resources#
This style guide is not a comprehensive standard. For a more thorough reference of how to contribute to documentation, see the links below. These resources contain common best practices for writing documentation.
Comments#
Examples of Python code have comments before or on the same line.
Correct
Incorrect