import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ff.mplstyle')

I = [0.06, 0.1, 0.15, 0.21, 0.28, 0.35, 0.43, 0.5, 0.58, 0.65, 0.73, 0.81, 0.89, 0.96, 1.04, 1.11, 1.19, 1.27, 1.34] # mV
U = [320, 415, 490, 536, 557, 567, 573, 579, 583, 587, 590, 593, 595, 598, 600, 602, 604, 606, 607] # mA

fig, axes = plt.subplots(2, 1, figsize=(5, 8), sharex=True, gridspec_kw=dict(hspace=0.05))
ax1, ax2 = axes

ax1.scatter(U, I)
ax1.set_title('ВАХ полупроводникового диода')
ax1.set_ylabel('I, мА')
ax1.set_ylim(ymin=0, ymax=1.4)

I = np.array(I)
ax2.scatter(U, np.log(I))
ax2.set_xlabel('U, мВ')
ax2.set_ylabel('ln I/I$_0$')
ax2.set_xlim(xmin=300, xmax=650)
ax2.set_ylim(-3, 0.5)

fig.savefig('example_4_multipleaxes.pdf', bbox_inches='tight')
