FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/examples/pyplots/pyplot_scales.py at master · abhiip/matplotlib.github.com · GitHub
abhiip
/
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
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
examples
/
pyplots
/
pyplot_scales.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (44 loc) · 1.22 KB
Breadcrumbs
matplotlib.github.com
/
examples
/
pyplots
/
pyplot_scales.py
Copy path
File metadata and controls
55 lines (44 loc) · 1.22 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
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
from
matplotlib
.
ticker
import
NullFormatter
# useful for `logit` scale
# Fixing random state for reproducibility
np
.
random
.
seed
(
19680801
)
# make up some data in the interval ]0, 1[
y
=
np
.
random
.
normal
(
loc
=
0.5
,
scale
=
0.4
,
size
=
1000
)
y
=
y
[(
y
>
0
)
&
(
y
<
1
)]
y
.
sort
()
x
=
np
.
arange
(
len
(
y
))
# plot with various axes scales
plt
.
figure
(
1
)
# linear
plt
.
subplot
(
221
)
plt
.
plot
(
x
,
y
)
plt
.
yscale
(
'linear'
)
plt
.
title
(
'linear'
)
plt
.
grid
(
True
)
# log
plt
.
subplot
(
222
)
plt
.
plot
(
x
,
y
)
plt
.
yscale
(
'log'
)
plt
.
title
(
'log'
)
plt
.
grid
(
True
)
# symmetric log
plt
.
subplot
(
223
)
plt
.
plot
(
x
,
y
-
y
.
mean
())
plt
.
yscale
(
'symlog'
,
linthreshy
=
0.01
)
plt
.
title
(
'symlog'
)
plt
.
grid
(
True
)
# logit
plt
.
subplot
(
224
)
plt
.
plot
(
x
,
y
)
plt
.
yscale
(
'logit'
)
plt
.
title
(
'logit'
)
plt
.
grid
(
True
)
# Format the minor tick labels of the y-axis into empty strings with
# `NullFormatter`, to avoid cumbering the axis with too many labels.
plt
.
gca
().
yaxis
.
set_minor_formatter
(
NullFormatter
())
# Adjust the subplot layout, because the logit one may take more space
# than usual, due to y-tick labels like "1 - 10^{-3}"
plt
.
subplots_adjust
(
top
=
0.92
,
bottom
=
0.08
,
left
=
0.10
,
right
=
0.95
,
hspace
=
0.25
,
wspace
=
0.35
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL