Ethan Merritt - 2021-07-09

I put an answer to your original question on stackoverflow.

The GPVAL_TERM_* variables provide a user-visible view of various internal state variables but they will not help you for this purpose. Gnuplot has no way of knowing where TeX will place the generated text, so it has no relevant internal state to export.