#! /usr/bin/env python3

# This Python script was auto-generated using YODA v2.1.3.
# Analysis object: /ATLAS_2020_I1790256/d01-x01-y01
# Timestamp: 24-07-2026 (20:52:01)

import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use('Agg') # comment out for interactive use
import os
import numpy as np
from numpy import nan, inf

plotDir = os.path.split(os.path.realpath(__file__))[0]
if 'YODA_USER_PLOT_PATH' in globals():
    plot_outdir = globals()['YODA_USER_PLOT_PATH']
else:
    plot_outdir = plotDir

#plot style
plt.style.use(os.path.join(plotDir, '../default.mplstyle'))
# plot metadata
figW, figH = plt.rcParams['figure.figsize']
ax_xLabel = r'$\ln (R/\Delta R)$'
ax_yLabel = r'$\ln (1/z)$'
ax_zLabel = r''
ax_title  = r'$\frac{1}{N_\mathrm{jets}}\frac{\mathrm{d}^2 N_\mathrm{emissions}}{\mathrm{d}\ln (R/\Delta R) d\ln (1/z)}$'
ax_xScale = 'linear'
ax_yScale = 'linear'
ax_zScale = 'linear'
xLims = (0.43300000000000005, 4.33)
yLims = (0.693147, 5.96)
zLims = (9.845365e-05, 1.012746)

# Adjust canvas width and height
canvasW = 10
canvasH = 10
figW *= canvasW/10.
figH *= canvasH/9.

# Create figure and axis objects
fig, ax = plt.subplots(1, 1)

# Set figure margins
plt.subplots_adjust(
    left   = 1.0 * plt.rcParams['figure.subplot.left'],
    right  = 1.0 * plt.rcParams['figure.subplot.right'],
    top    = 1.0 * plt.rcParams['figure.subplot.top'],
    bottom = 1.0 * plt.rcParams['figure.subplot.bottom'])


# Color map: curve index -> color
colors = {0: '#EE3311', 1: '#3366FF', 2: '#109618', 3: '#FF9900', 4: '#990099'}


# the numerical data is stored in a separate file
dataf = dict()
exec(open(os.path.split(__file__)[0] + '/d01-x01-y01__data.py').read(), dataf)

legend_handles = dict() # keep track of handles for the legend
# reference data in main panel
cmap = 'cividis'
xbin_cent = np.unique(dataf['xpoints'])
ybin_cent = np.unique(dataf['ypoints'])
X, Y = np.meshgrid(xbin_cent, ybin_cent)
Z = np.array(dataf['zpoints']).reshape(X.shape)
pc = ax.pcolormesh(X, Y, Z, cmap=cmap, shading='auto',
                   vmin=zLims[0], vmax=zLims[1])
cbar = fig.colorbar(pc, orientation='vertical', ax=ax, pad=0.01)
cbar.set_label(ax_zLabel)


ax.set_xlabel(ax_xLabel)
ax.set_ylabel(ax_yLabel, loc='top')
ax.set_title(ax_title, loc='left')
ax.set_xscale(ax_xScale)
ax.set_yscale(ax_yScale)
ax.set_xlim(xLims)
ax.set_ylim(yLims)

# tick formatting
plt.rcParams['xtick.top'] = True
plt.rcParams['ytick.right'] = True
plt.savefig(os.path.join(plot_outdir, 'd01-x01-y01.pdf'), format='PDF')
plt.savefig(os.path.join(plot_outdir, 'd01-x01-y01.png'), format='PNG')

plt.close(fig)