Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d932b8

Browse files
committed
Alpha/Artist color explanation changes
black/white string format update
1 parent 61c5f0b commit 2d932b8

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

tutorials/colors/colors.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
| characters | |
2121
+--------------------------------------+--------------------------------------+
2222
| String representation of float value | - ``'0.8'`` as light gray |
23-
| in closed interval ``[0, 1]``, | |
24-
| inclusive for gray level | |
23+
| in closed interval ``[0, 1]`` for | - ``'0'`` as black |
24+
| black and white, respectively. | - ``'1'`` as white |
2525
+--------------------------------------+--------------------------------------+
2626
| Single character shorthand notation | - ``'b'`` as blue |
2727
| for shades of colors | - ``'g'`` as green |
@@ -62,16 +62,24 @@
6262
"Red", "Green", and "Blue" are the intensities of those colors. In combination,
6363
they represent the colorspace.
6464
65-
"Alpha" depends on the ``zorder`` of the Artist. Matplotlib draws higher
66-
``zorder`` Artists on top of lower Artists. "Alpha" determines
67-
whether the lower Artist is covered by the higher.
65+
Matplotlib composes Artists based on ``zorder`` and then by the order added to
66+
an Axes. The alpha for an Artist controls how the RGB color of the new Artist
67+
combines with RGB colors already on the Axes.
6868
69-
If the previous RGB of a pixel is ``RGBold`` and the RGB of the pixel of the
70-
added Artist is ``RGBnew`` with Alpha ``alpha``, then the RGB of the pixel
71-
updates to: ``RGB = RGBOld * (1 - Alpha) + RGBnew * Alpha``.
69+
The two Artists combine with alpha compositing. Matplotlib uses the equation
70+
below to compute the result of blending a new Artist.
71+
72+
::
73+
74+
RGB_{new} = RGB_{below} * (1 - \\alpha) + RGB_{artist} * \\alpha
7275
7376
Alpha of 1 indicates the new Artist completely covers the previous color.
74-
Alpha of 0 indicates that pixel of the Artist is transparent.
77+
Alpha of 0 for top color is not visible; however, it contributes to blending
78+
for intermediate values as the cumulative result of all previous Artists.
79+
80+
.. note::
81+
82+
Re-ordering Artists is not commutative in Matplotlib.
7583
7684
.. seealso::
7785

0 commit comments

Comments
 (0)