Merge lp:~ma5dev/madanalysis5/v1.9_py3 into lp:~ma5dev/madanalysis5/v1.9_beta

Proposed by Jack Y. Araz
Status: Merged
Merged at revision: 150
Proposed branch: lp:~ma5dev/madanalysis5/v1.9_py3
Merge into: lp:~ma5dev/madanalysis5/v1.9_beta
Diff against target: 75 lines (+39/-15)
2 files modified
madanalysis/layout/merging_plots.py (+20/-8)
madanalysis/layout/plotflow.py (+19/-7)
To merge this branch: bzr merge lp:~ma5dev/madanalysis5/v1.9_py3
Reviewer Review Type Date Requested Status
Benjamin Fuks Approve
Review via email: mp+400320@code.launchpad.net

Commit message

matplotlib update: normed -> density

Description of the change

Bug fix for matplotlib. `normed` option is deprecated in the recent versions of matplotlib.

Additional note: this change will break the compatibility with the older versions of matplotlib. There are 3 things we can do 1) check the version and act accordingly 2) use try 3) don't care about older versions and make matplotlib available if it's above certain version.

To post a comment you must log in.
lp:~ma5dev/madanalysis5/v1.9_py3 updated
151. By Jack Y. Araz

support both versions of matplotlib

Revision history for this message
Jack Y. Araz (jackaraz) wrote :

both versions of matplotlib are supported

Revision history for this message
Benjamin Fuks (fuks) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'madanalysis/layout/merging_plots.py'
2--- madanalysis/layout/merging_plots.py 2020-09-29 12:04:57 +0000
3+++ madanalysis/layout/merging_plots.py 2021-03-29 12:23:14 +0000
4@@ -460,14 +460,26 @@
5 outputPy.write(' label=\'Sum\', ')
6 else:
7 outputPy.write(' label=\''+str(ind-1)+'-jet sample\', ')
8- outputPy.write('rwidth=0.8,\\\n'+\
9- ' color='+linecolor+', '+\
10- 'edgecolor='+linecolor+', '+\
11- 'linewidth=1, '+\
12- 'linestyle='+linestyle+',\\\n'+\
13- ' bottom=None, '+\
14- 'cumulative=False, normed=False, ' +\
15- 'align="mid", orientation="vertical")\n\n')
16+ try:
17+ import matplotlib.pyplot as plt
18+ plt.hist([0],normed=True)
19+ outputPy.write('rwidth=0.8,\\\n'+\
20+ ' color='+linecolor+', '+\
21+ 'edgecolor='+linecolor+', '+\
22+ 'linewidth=1, '+\
23+ 'linestyle='+linestyle+',\\\n'+\
24+ ' bottom=None, '+\
25+ 'cumulative=False, normed=False, ' +\
26+ 'align="mid", orientation="vertical")\n\n')
27+ except:
28+ outputPy.write('rwidth=0.8,\\\n'+\
29+ ' color='+linecolor+', '+\
30+ 'edgecolor='+linecolor+', '+\
31+ 'linewidth=1, '+\
32+ 'linestyle='+linestyle+',\\\n'+\
33+ ' bottom=None, '+\
34+ 'cumulative=False, density=False, ' +\
35+ 'align="mid", orientation="vertical")\n\n')
36
37 # Setting X axis label
38 axis_titleX = "log10(DJR"+str(ind)+")"
39
40=== modified file 'madanalysis/layout/plotflow.py'
41--- madanalysis/layout/plotflow.py 2020-09-29 12:04:57 +0000
42+++ madanalysis/layout/plotflow.py 2021-03-29 12:23:14 +0000
43@@ -802,13 +802,25 @@
44 ' label='+mytitle+', ')
45 if ntot!=0:
46 outputPy.write('histtype='+filledmode+', ')
47- outputPy.write( 'rwidth='+str(rWidth)+',\\\n'+\
48- ' color='+mybackcolor+', '+\
49- 'edgecolor='+mylinecolor+', '+\
50- 'linewidth='+str(mylinewidth)+', '+\
51- 'linestyle='+mylinestyle+',\\\n'+\
52- ' bottom=None, '+\
53- 'cumulative=False, normed=False, align="mid", orientation="vertical")\n\n')
54+ try:
55+ import matplotlib.pyplot as plt
56+ plt.hist([0],normed=True)
57+ outputPy.write( 'rwidth='+str(rWidth)+',\\\n'+\
58+ ' color='+mybackcolor+', '+\
59+ 'edgecolor='+mylinecolor+', '+\
60+ 'linewidth='+str(mylinewidth)+', '+\
61+ 'linestyle='+mylinestyle+',\\\n'+\
62+ ' bottom=None, '+\
63+ 'cumulative=False, normed=False, align="mid", orientation="vertical")\n\n')
64+ except:
65+ outputPy.write( 'rwidth='+str(rWidth)+',\\\n'+\
66+ ' color='+mybackcolor+', '+\
67+ 'edgecolor='+mylinecolor+', '+\
68+ 'linewidth='+str(mylinewidth)+', '+\
69+ 'linestyle='+mylinestyle+',\\\n'+\
70+ ' bottom=None, '+\
71+ 'cumulative=False, density=False, align="mid",'+\
72+ ' orientation="vertical")\n\n')
73 outputPy.write('\n')
74
75 # Label

Subscribers

People subscribed via source and target branches

to all changes: