FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/3.2.2/api/dates_api-1.py at main · matplotlib/matplotlib.github.com · GitHub
matplotlib
/
matplotlib.github.com
Public
Notifications
You must be signed in to change notification settings
Fork
62
Star
29
Code
Issues
1
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
3.2.2
/
api
/
dates_api-1.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
18 lines (15 loc) · 527 Bytes
Breadcrumbs
matplotlib.github.com
/
3.2.2
/
api
/
dates_api-1.py
Copy path
File metadata and controls
18 lines (15 loc) · 527 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
import
datetime
import
matplotlib
.
dates
as
mdates
base
=
datetime
.
datetime
(
2005
,
2
,
1
)
dates
=
np
.
array
([
base
+
datetime
.
timedelta
(
hours
=
(
2
*
i
))
for
i
in
range
(
732
)])
N
=
len
(
dates
)
np
.
random
.
seed
(
19680801
)
y
=
np
.
cumsum
(
np
.
random
.
randn
(
N
))
fig
,
ax
=
plt
.
subplots
(
constrained_layout
=
True
)
locator
=
mdates
.
AutoDateLocator
()
formatter
=
mdates
.
ConciseDateFormatter
(
locator
)
ax
.
xaxis
.
set_major_locator
(
locator
)
ax
.
xaxis
.
set_major_formatter
(
formatter
)
ax
.
plot
(
dates
,
y
)
ax
.
set_title
(
'Concise Date Formatter'
)
Back
|
FazBrowse Home
|
New Git URL