File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ lines.linewidth: 33
Original file line number Diff line number Diff line change 1+ import os
2+
3+ import matplotlib as mpl
4+ mpl .rc ('text' , usetex = False )
5+ mpl .rc ('lines' , linewidth = 22 )
6+
7+ fname = os .path .abspath (os .path .dirname (__file__ )) + os .sep + 'mpl.rc'
8+
9+ def test_rcparams ():
10+
11+ usetex = mpl .rcParams ['text.usetex' ]
12+ linewidth = mpl .rcParams ['lines.linewidth' ]
13+
14+ # test context given dictionary
15+ with mpl .rc_context (rc = {'text.usetex' : not usetex }):
16+ assert mpl .rcParams ['text.usetex' ] == (not usetex )
17+ assert mpl .rcParams ['text.usetex' ] == usetex
18+
19+ # test context given filename (mpl.rc sets linewdith to 33)
20+ with mpl .rc_context (fname = fname ):
21+ assert mpl .rcParams ['lines.linewidth' ] == 33
22+ assert mpl .rcParams ['lines.linewidth' ] == linewidth
23+
24+ # test context given filename and dictionary
25+ with mpl .rc_context (fname = fname , rc = {'lines.linewidth' : 44 }):
26+ assert mpl .rcParams ['lines.linewidth' ] == 44
27+ assert mpl .rcParams ['lines.linewidth' ] == linewidth
28+
29+ # test rc_file
30+ mpl .rc_file (fname )
31+ assert mpl .rcParams ['lines.linewidth' ] == 33
32+
33+
34+ if __name__ == '__main__' :
35+ test_rcparams ()
You can’t perform that action at this time.
0 commit comments