Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
model_mvp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
decision-science
model_mvp
Commits
e1f75aa1
Commit
e1f75aa1
authored
Apr 04, 2019
by
linfang.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
折线图
parent
0c209f31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
drawplot.py
data/graph/drawplot.py
+39
-0
No files found.
data/graph/drawplot.py
0 → 100644
View file @
e1f75aa1
from
pyplotz.pyplotz
import
PyplotZ
from
pyplotz.pyplotz
import
plt
plt
.
rc
(
'figure'
,
figsize
=
(
8
,
6
))
font_options
=
{
'weight'
:
'bold'
,
'size'
:
'14'
}
plt
.
rc
(
'font'
,
**
font_options
)
def
draw_lineplot
(
df
,
x
,
y
,
hue
=
''
,
title
=
''
):
'''
:param df: dataframe
:param x: 横坐标
:param y: 纵坐标
:param hue: 分类
:param title:
:return:fig
'''
pltz
=
PyplotZ
()
pltz
.
enable_chinese
()
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
1
,
1
,
1
)
if
hue
!=
''
:
for
type
in
df
[
hue
]
.
unique
()
.
tolist
():
# == 画图
tmp
=
df
[
df
[
hue
]
==
type
]
plt
.
plot
(
tmp
[
x
],
tmp
[
y
],
linestyle
=
'dashed'
,
marker
=
'o'
,
label
=
type
)
else
:
plt
.
plot
(
df
[
x
],
df
[
y
],
linestyle
=
'dashed'
,
marker
=
'o'
)
pltz
.
xticks
(
range
(
len
(
df
[
x
]
.
unique
()
.
tolist
())),
df
[
x
]
.
unique
()
.
tolist
())
pltz
.
xlabel
(
x
)
pltz
.
ylabel
(
y
)
pltz
.
title
(
title
)
pltz
.
legend
()
plt
.
grid
()
plt
.
show
()
return
fig
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment