-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(wyh): plot function #59
Conversation
Codecov Report
@@ Coverage Diff @@
## main #59 +/- ##
==========================================
+ Coverage 88.96% 88.98% +0.02%
==========================================
Files 351 353 +2
Lines 26125 26168 +43
==========================================
+ Hits 23242 23286 +44
+ Misses 2883 2882 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR can be merged after solving these comments
ding/utils/plot.py
Outdated
plt.ylabel(ylabel) | ||
plt.title(title) | ||
plt.savefig(pth) | ||
plt.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove plt.show
, it will lead to error in server.
ding/utils/tests/test_plot.py
Outdated
def test_plot(): | ||
rewards1 = np.array([0, 0.1,0,0.2,0.4,0.5,0.6,0.9,0.9,0.9]) | ||
rewards2 = np.array([0, 0,0.1,0.4,0.5,0.5,0.55,0.8,0.9,1]) | ||
rewards=np.concatenate((rewards1,rewards2)) # 合并数组 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use English comment in code
ding/utils/tests/test_plot.py
Outdated
data1['y']=rewards | ||
data1['label']='line1' | ||
|
||
rewards3 = np.array([random.random() for _ in range(10)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use np.random.random
here
ding/utils/plot.py
Outdated
""" | ||
sns.set(style="darkgrid", font_scale=1.5) | ||
for nowdata in data: | ||
for k,v in nowdata.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace this loop with step, value, label = nowdata['x'], nowdata['y'], nowdata['label']
ding/utils/plot.py
Outdated
@@ -0,0 +1,33 @@ | |||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename this file to plot_helper.py
ding/utils/plot.py
Outdated
import numpy as np | ||
import matplotlib as mpl | ||
import matplotlib.pyplot as plt | ||
import seaborn as sns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add seaborn in setup.py
, and remember it whenever you import some new packages
* fix(wyh): plot function * fix(wyh): plot function pytest * fix(wyh):plot function modify comments * feature(wyh):plot style Co-authored-by: weiyuhong <weiyuhong@sensetime.com>
* fix(wyh): plot function * fix(wyh): plot function pytest * fix(wyh):plot function modify comments * feature(wyh):plot style Co-authored-by: weiyuhong <weiyuhong@sensetime.com>
Description
增加了plot绘图函数
Related Issue
TODO
Check List