FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/mpl_examples/api/mathtext_asarray.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
/
mpl_examples
/
api
/
mathtext_asarray.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (22 loc) · 825 Bytes
Breadcrumbs
matplotlib.github.com
/
mpl_examples
/
api
/
mathtext_asarray.py
Copy path
File metadata and controls
28 lines (22 loc) · 825 Bytes
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
"""
===============================
A mathtext image as numpy array
===============================
This example shows how to make images from LaTeX strings.
"""
import
matplotlib
.
mathtext
as
mathtext
import
matplotlib
.
pyplot
as
plt
import
matplotlib
matplotlib
.
rc
(
'image'
,
origin
=
'upper'
)
parser
=
mathtext
.
MathTextParser
(
"Bitmap"
)
parser
.
to_png
(
'test2.png'
,
r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} '
r'y\right)\right]$'
,
color
=
'green'
,
fontsize
=
14
,
dpi
=
100
)
rgba1
,
depth1
=
parser
.
to_rgba
(
r'IQ: $\sigma_i=15$'
,
color
=
'blue'
,
fontsize
=
20
,
dpi
=
200
)
rgba2
,
depth2
=
parser
.
to_rgba
(
r'some other string'
,
color
=
'red'
,
fontsize
=
20
,
dpi
=
200
)
fig
=
plt
.
figure
()
fig
.
figimage
(
rgba1
.
astype
(
float
)
/
255.
,
100
,
100
)
fig
.
figimage
(
rgba2
.
astype
(
float
)
/
255.
,
100
,
300
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL