Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fastNLO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
qcd-public
fastNLO
Commits
690e179e
Commit
690e179e
authored
2 years ago
by
Klaus Rabbertz
Browse files
Options
Downloads
Patches
Plain Diff
Fix for issue when using matplotlib > 3.2.x
parent
05c00d8a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/plotting/fastnnlo_pdfunc.py
+6
-6
6 additions, 6 deletions
tools/plotting/fastnnlo_pdfunc.py
tools/plotting/fastnnlo_scaleunc.py
+8
-5
8 additions, 5 deletions
tools/plotting/fastnnlo_scaleunc.py
with
14 additions
and
11 deletions
tools/plotting/fastnnlo_pdfunc.py
+
6
−
6
View file @
690e179e
...
...
@@ -179,8 +179,8 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_pdf_unc, abs_pdf_unc, dxsr_cn, nost
# else: ax1.set_xscale('linear')
# if logy: ax1.set_yscale('log', nonposy='clip')
# else: ax1.set_yscale('linear')
ax1
.
set_xscale
(
'
log
'
,
nonposx
=
'
clip
'
)
ax1
.
set_yscale
(
'
log
'
,
nonposy
=
'
clip
'
)
ax1
.
set_xscale
(
'
log
'
,
nonposx
=
'
clip
'
)
# Will become nonpositive= in matplotlib 3.3.x
ax1
.
set_yscale
(
'
log
'
,
nonposy
=
'
clip
'
)
# Will become nonpositive= in matplotlib 3.3.x
# Set label on x axis on coupled axis from lower plot
# ax1.set_xlabel(r'%s' %xlabel, horizontalalignment='right', x=1.0, verticalalignment='top', y=1.0)
ax1
.
set_ylabel
(
r
'
%s
'
%
ylabel
,
horizontalalignment
=
'
right
'
,
x
=
1.0
,
...
...
@@ -214,7 +214,7 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_pdf_unc, abs_pdf_unc, dxsr_cn, nost
elif
nostat
:
yerror
=
abs
(
abs_pdf_unc
[
pdf_index
,
ord_index
,
:,
:])
ax1
.
errorbar
(
x_axis
*
shift
,
xs_all
[
pdf_index
,
ord_index
,
:],
yerr
=
yerror
,
elinewidth
=
1
,
linewidth
=
1.0
,
ms
=
6
,
marker
=
_symbols
[
pdf_index
],
color
=
_colors
[
pdf_index
],
fmt
=
'
.
'
,
label
=
pdf
)
elinewidth
=
1
,
linewidth
=
1.0
,
ms
=
6
,
marker
=
_symbols
[
pdf_index
],
color
=
_colors
[
pdf_index
],
label
=
pdf
)
ax1
.
fill_between
(
x_axis
*
shift
,
xs_all
[
pdf_index
,
ord_index
,
:]
+
xs_all
[
0
,
ord_index
,
:]
*
rel_pdf_unc
[
pdf_index
,
ord_index
,
2
,
:],
xs_all
[
pdf_index
,
ord_index
,
:]
+
xs_all
[
0
,
ord_index
,
:]
*
rel_pdf_unc
[
pdf_index
,
ord_index
,
1
,
:],
...
...
@@ -228,8 +228,8 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_pdf_unc, abs_pdf_unc, dxsr_cn, nost
ax2
.
set_xlim
(
left
=
xmin
,
right
=
xmax
)
# ax2.set_ylim(0.85, 1.15)
# ax2.get_xaxis().set_minor_formatter(axfmt)
ax2
.
set_yscale
(
'
linear
'
,
nonposy
=
'
clip
'
)
# ax2.set_yscale('log', nonposy='clip')
ax2
.
set_yscale
(
'
linear
'
)
# ax2.set_yscale('log', nonposy='clip')
# Will become nonpositive= in matplotlib 3.3.x
ax2
.
set_xlabel
(
r
'
%s
'
%
xlabel
,
horizontalalignment
=
'
right
'
,
x
=
1.0
,
verticalalignment
=
'
top
'
,
y
=
1.0
)
ax2
.
set_ylabel
(
r
'
Ratio to ref. PDF
'
,
horizontalalignment
=
'
center
'
,
x
=
1.0
,
verticalalignment
=
'
top
'
,
y
=
0.5
,
rotation
=
90
,
labelpad
=
24
)
ax2
.
axhline
(
y
=
1
,
xmin
=
0
,
xmax
=
1
,
color
=
'
k
'
,
linestyle
=
'
dotted
'
,
linewidth
=
1.6
,
alpha
=
0.2
)
...
...
@@ -256,7 +256,7 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_pdf_unc, abs_pdf_unc, dxsr_cn, nost
yerror
=
np
.
multiply
(
xs_all
[
pdf_index
,
ord_index
,
:],
dxsr_cn
[
ord_index
,
:])
ax2
.
errorbar
(
x_axis
,
xs_all
[
pdf_index
,
ord_index
,
:]
/
xs_all
[
0
,
ord_index
,
:],
yerr
=
yerror
/
xs_all
[
0
,
ord_index
,
:],
barsabove
=
True
,
elinewidth
=
1
,
linewidth
=
1.0
,
ms
=
mymksize
,
marker
=
mymarker
,
color
=
_colors
[
pdf_index
],
fmt
=
'
.
'
,
label
=
pdf
)
elinewidth
=
1
,
linewidth
=
1.0
,
ms
=
mymksize
,
marker
=
mymarker
,
color
=
_colors
[
pdf_index
],
label
=
pdf
)
ax2
.
fill_between
(
x_axis
,
(
xs_all
[
pdf_index
,
ord_index
,
:]
*
(
1
+
rel_pdf_unc
[
pdf_index
,
ord_index
,
2
,
:])
/
xs_all
[
0
,
ord_index
,
:]),
(
xs_all
[
pdf_index
,
ord_index
,
:]
*
(
1
+
rel_pdf_unc
[
pdf_index
,
ord_index
,
1
,
:])
/
xs_all
[
0
,
ord_index
,
:]),
...
...
This diff is collapsed.
Click to expand it.
tools/plotting/fastnnlo_scaleunc.py
+
8
−
5
View file @
690e179e
...
...
@@ -154,8 +154,10 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_scale_unc, abs_scale_unc, dxsr_cn,
# axfmt = LogFormatter(labelOnlyBase=False, minor_thresholds=(2, 0.4))
# ax1.get_xaxis().set_minor_formatter(axfmt)
# ax1.get_xaxis().set_minor_formatter(NullFormatter())
ax1
.
set_xscale
(
'
log
'
,
nonposx
=
'
clip
'
)
ax1
.
set_yscale
(
'
log
'
,
nonposy
=
'
clip
'
)
# ax1.set_xscale('log', nonposx='clip')
# ax1.set_yscale('log', nonposy='clip')
ax1
.
set_xscale
(
'
log
'
,
nonposx
=
'
clip
'
)
# Will become nonpositive= in matplotlib 3.3.x
ax1
.
set_yscale
(
'
log
'
,
nonposy
=
'
clip
'
)
# Will become nonpositive= in matplotlib 3.3.x
# Set label on x axis on coupled axis from lower plot
# ax1.set_xlabel(r'%s' %xlabel, horizontalalignment='right', x=1.0, verticalalignment='top', y=1.0)
ax1
.
set_ylabel
(
r
'
%s
'
%
ylabel
,
horizontalalignment
=
'
right
'
,
x
=
1.0
,
...
...
@@ -189,7 +191,7 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_scale_unc, abs_scale_unc, dxsr_cn,
else
:
yerror
=
abs
(
abs_scale_unc
[
xs_index
])
ax1
.
errorbar
(
x_axis
*
shift
,
xs_all
[
xs_index
],
yerr
=
yerror
,
elinewidth
=
1
,
linewidth
=
0.0
,
ms
=
6
,
marker
=
_order_symbol
[
order_item
],
color
=
_order_color
[
order_item
],
fmt
=
'
.
'
,
label
=
order_item
)
ms
=
6
,
marker
=
_order_symbol
[
order_item
],
color
=
_order_color
[
order_item
],
label
=
order_item
)
ax1
.
fill_between
(
x_axis
*
shift
,
xs_all
[
xs_index
]
+
xs_all
[
xs_index
]
*
rel_scale_unc
[
xs_index
,
2
,
:],
xs_all
[
xs_index
]
+
xs_all
[
xs_index
]
*
rel_scale_unc
[
xs_index
,
1
,
:],
color
=
_order_color
[
order_item
],
hatch
=
_hatches
[
xs_index
],
alpha
=
0.30
)
ax1
.
legend
(
fontsize
=
10
,
numpoints
=
1
)
...
...
@@ -201,7 +203,8 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_scale_unc, abs_scale_unc, dxsr_cn,
# Set common x axis bounds for both
ax2
.
set_xlim
(
left
=
xmin
,
right
=
xmax
)
# ax2.set_xbound(lower=xmin, upper=xmax)
ax2
.
set_yscale
(
'
linear
'
,
nonposy
=
'
clip
'
)
# ax2.set_yscale('linear', nonposy='clip') # Will become nonpositive= in matplotlib 3.3.x
ax2
.
set_yscale
(
'
linear
'
)
ax2
.
set_xlabel
(
r
'
%s
'
%
xlabel
,
horizontalalignment
=
'
right
'
,
x
=
1.0
,
verticalalignment
=
'
top
'
,
y
=
1.0
)
ax2
.
set_ylabel
(
r
'
Ratio to %s
'
%
order_list
[
0
],
horizontalalignment
=
'
center
'
,
x
=
1.0
,
verticalalignment
=
'
top
'
,
y
=
0.5
,
rotation
=
90
,
labelpad
=
24
)
# ax2.legend(fontsize=10, numpoints=1)
...
...
@@ -232,7 +235,7 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_scale_unc, abs_scale_unc, dxsr_cn,
xs_all
[
xs_index
,
:],
dxsr_cn
[
xs_index
,
:])
ordernames
+=
'
_%s
'
%
item
ax2
.
errorbar
(
x_axis
,
xs_all
[
xs_index
]
/
xs_all
[
0
],
yerr
=
yerror
/
xs_all
[
0
],
barsabove
=
True
,
elinewidth
=
1
,
linewidth
=
0.0
,
ms
=
mymksize
,
marker
=
mymarker
,
color
=
_order_color
[
item
],
fmt
=
'
.
'
,
label
=
item
)
ms
=
mymksize
,
marker
=
mymarker
,
color
=
_order_color
[
item
],
label
=
item
)
ax2
.
fill_between
(
x_axis
,
(
xs_all
[
xs_index
]
*
(
1
+
rel_scale_unc
[
xs_index
,
2
,
:])
/
xs_all
[
0
]),
(
xs_all
[
xs_index
]
*
(
1
+
rel_scale_unc
[
xs_index
,
1
,
:])
/
xs_all
[
0
]),
color
=
_order_color
[
item
],
hatch
=
_hatches
[
xs_index
],
alpha
=
0.30
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment