FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/examples/mplot3d/hist3d_demo.py at master · gitj/matplotlib · GitHub
gitj
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
examples
/
mplot3d
/
hist3d_demo.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (17 loc) · 568 Bytes
Breadcrumbs
matplotlib
/
examples
/
mplot3d
/
hist3d_demo.py
Copy path
File metadata and controls
23 lines (17 loc) · 568 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
from
mpl_toolkits
.
mplot3d
import
Axes3D
import
matplotlib
.
pyplot
as
plt
import
numpy
as
np
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
111
,
projection
=
'3d'
)
x
,
y
=
np
.
random
.
rand
(
2
,
100
)
*
4
hist
,
xedges
,
yedges
=
np
.
histogram2d
(
x
,
y
,
bins
=
4
)
elements
=
(
len
(
xedges
)
-
1
)
*
(
len
(
yedges
)
-
1
)
xpos
,
ypos
=
np
.
meshgrid
(
xedges
[:
-
1
]
+
0.25
,
yedges
[:
-
1
]
+
0.25
)
xpos
=
xpos
.
flatten
()
ypos
=
ypos
.
flatten
()
zpos
=
np
.
zeros
(
elements
)
dx
=
0.5
*
np
.
ones_like
(
zpos
)
dy
=
dx
.
copy
()
dz
=
hist
.
flatten
()
ax
.
bar3d
(
xpos
,
ypos
,
zpos
,
dx
,
dy
,
dz
,
color
=
'b'
,
zsort
=
'average'
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL