Skip to content
Snippets Groups Projects
Commit 690e179e authored by Klaus Rabbertz's avatar Klaus Rabbertz
Browse files

Fix for issue when using matplotlib > 3.2.x

parent 05c00d8a
Branches
Tags
No related merge requests found
......@@ -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, :]),
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment