FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/pyplots/make.py at master · phobson/matplotlib.github.com · GitHub
phobson
/
matplotlib.github.com
Public
forked from
matplotlib/matplotlib.github.com
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
pyplots
/
make.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
75 lines (59 loc) · 1.96 KB
Breadcrumbs
matplotlib.github.com
/
pyplots
/
make.py
Copy path
File metadata and controls
executable file
·
75 lines (59 loc) · 1.96 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
from
__future__
import
print_function
import
sys
,
os
,
glob
import
matplotlib
import
IPython
.
Shell
#matplotlib.rcdefaults()
matplotlib
.
use
(
'Agg'
)
mplshell
=
IPython
.
Shell
.
MatplotlibShell
(
'mpl'
)
formats
=
[(
'png'
,
100
),
(
'hires.png'
,
200
),
(
'pdf'
,
72
)]
def
figs
():
print
(
'making figs'
)
import
matplotlib
.
pyplot
as
plt
for
fname
in
glob
.
glob
(
'*.py'
):
if
fname
.
split
(
'/'
)[
-
1
]
==
__file__
.
split
(
'/'
)[
-
1
]:
continue
basename
,
ext
=
os
.
path
.
splitext
(
fname
)
imagefiles
=
dict
([(
'%s.%s'
%
(
basename
,
format
),
dpi
)
for
format
,
dpi
in
formats
])
all_exists
=
True
for
imagefile
in
imagefiles
:
if
not
os
.
path
.
exists
(
imagefile
):
all_exists
=
False
break
if
all_exists
:
print
(
' already have %s'
%
fname
)
else
:
print
(
' building %s'
%
fname
)
plt
.
close
(
'all'
)
# we need to clear between runs
mplshell
.
magic_run
(
basename
)
for
imagefile
,
dpi
in
imagefiles
.
iteritems
():
# todo: this will get called even if the run script
# fails and exits, thus creating a stub pdf and png
# iles preventing them from getting built successfully
# later
plt
.
savefig
(
imagefile
,
dpi
=
dpi
)
print
(
'all figures made'
)
def
clean
():
patterns
=
([
'#*'
,
'*~'
,
'*pyc'
]
+
[
'*.%s'
%
format
for
format
,
dpi
in
formats
])
for
pattern
in
patterns
:
for
fname
in
glob
.
glob
(
pattern
):
os
.
remove
(
fname
)
print
(
'all clean'
)
def
all
():
figs
()
funcd
=
{
'figs'
:
figs
,
'clean'
:
clean
,
'all'
:
all
,
}
if
len
(
sys
.
argv
)
>
1
:
for
arg
in
sys
.
argv
[
1
:]:
func
=
funcd
.
get
(
arg
)
if
func
is
None
:
raise
SystemExit
(
'Do not know how to handle %s; valid args are'
%
(
arg
,
funcd
.
keys
()))
func
()
else
:
all
()
Back
|
FazBrowse Home
|
New Git URL