Menu

[r881]: / trunk / htdocs / examples / zorder_demo.py  Maximize  Restore  History

Download this file

32 lines (23 with data), 720 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
"""
The default drawing order for axes is patches, lines, text. This
order is determined by the zorder attribute. The following default
are set
Artist Z-order
Patch / PatchCollection 1
Line2D / LineCollection 2
Text 3
You can change the order for individual artists by setting the zorder.
In the fist subplot below, the lines are drawn above the patch
collection from the scatter, which is the default.
In the subplot below, the order is reversed
"""
from pylab import *
x = rand(20); y = rand(20)
subplot(211)
plot(x, y, 'r', lw=3)
scatter(x,y,s=120)
subplot(212)
plot(x, y, 'r', zorder=1, lw=3)
scatter(x,y,s=120, zorder=2)
show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.