I have the following code where I'm trying to assign a python array A to gnuplot array B but, I'm not able to iterate over the python array. How do I do this?
import subprocess
proc = subprocess.Popen(['gnuplot','-p'],
shell=True,
stdin=subprocess.PIPE,
encoding='utf8'
)
A = [1, 2, 3]
proc.communicate(
f"""
array B[3]
do for [i=1:3] {{ B[i] = {A[2]} }}
print B
"""
)
The above program prints : [3,3,3]. I'm expecting to print [1,2,3]. (Essentially I've to access the i from the gnuplot in python)
Gnuplot version 5.2 patchlevel 2
Python version 3.6.9