@diodelass ROOT would support this. Eg, one might save a TGraph. The result is effectively a gzipped binary list of (x,y,value) tuples. ROOT's a big software dependency to take on. If you are working in Python then "uproot" is a smaller, compatible package. Big caveat that ROOT's format popularity is fairly minimal outside particle/nuclear physics world.
Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.