# %%
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm.auto import tqdm
import tikzplotlib
# Generate scatter plot figures for different n (1 to 64)
lengths = []
ns = range(1, 65)
for n in tqdm(ns):
# Create random 4xn array
data = np.random.rand(4, n)
# Create scatter plot
fig, ax = plt.subplots()
sns.scatterplot({str(i): d for i, d in enumerate(data)}, ax=ax)
# Get TikZ/PGFPlots code
tikz_code = tikzplotlib.get_tikz_code(fig)
if n == 5: print(tikz_code)
lengths.append(len(tikz_code))
# Close the figure
plt.close(fig)
# %%
# Plot the results
plt.figure(figsize=(10, 5))
plt.plot(ns, lengths, marker='o')
plt.title('Length of TikZ Code vs. n')
plt.xlabel('n')
plt.ylabel('Length of TikZ Code')
plt.grid(True)
plt.show()
# %%
the LaTeX is very duplicative