nschloe / tikzplotlib

:bar_chart: Save matplotlib figures as TikZ/PGFplots for smooth integration into LaTeX.
MIT License
2.39k stars 212 forks source link

saving sns.scatter should not have quadratically many lines in the number of datapoints #609

Open JasonGross opened 5 months ago

JasonGross commented 5 months ago
# %%
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()

# %%

image the LaTeX is very duplicative

% This file was created with tikzplotlib v0.10.1.
\begin{tikzpicture}

\definecolor{darkgray176}{RGB}{176,176,176}
\definecolor{lightgray204}{RGB}{204,204,204}

\begin{axis}[
legend cell align={left},
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=lightgray204},
tick align=outside,
tick pos=left,
x grid style={darkgray176},
xmin=-0.2, xmax=4.2,
xtick style={color=black},
y grid style={darkgray176},
ymin=0.108634885597327, ymax=0.963385044314606,
ytick style={color=black}
]
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\addplot [
  draw=white,
  forget plot,
  mark=*,
  only marks,
  scatter,
  scatter/@post marker code/.code={%
  \endscope
},
  scatter/@pre marker code/.code={%
  \expanded{%
  \noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
  \noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
  }%
  \scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
},
  visualization depends on={value \thisrow{draw} \as \drawcolor},
  visualization depends on={value \thisrow{fill} \as \fillcolor}
]
table{%
x  y  fill
0 0.166900652616445 31,119,180
1 0.310519444893574 31,119,180
2 0.250445182257495 31,119,180
3 0.851972920033725 31,119,180
4 0.593430866565577 31,119,180
0 0.615254119305117 255,127,14
1 0.827314445170793 255,127,14
2 0.833036340514083 255,127,14
3 0.764314200986509 255,127,14
4 0.802375273298304 255,127,14
0 0.701892517367249 44,160,44
1 0.299915142540434 44,160,44
2 0.524611426047987 44,160,44
3 0.924532764372912 44,160,44
4 0.167124324434725 44,160,44
0 0.816252579203425 214,39,40
1 0.626135610955266 214,39,40
2 0.770592531029476 214,39,40
3 0.168113984548311 214,39,40
4 0.147487165539022 214,39,40
};
\end{axis}

\end{tikzpicture}
JasonGross commented 5 months ago

Note that this results in TeX capacity being exceeded on my example (n=64)