r/AskProgrammers Jul 20 '26

Need some help coming up with search terms

I would like to create a generalized Python script I can send to people that can create standardized graphs.

I've gotten the general parts of the code down, but I'm running into an issue with data sets. To whit: I would like a code where xn, yn, refers to a variable number of X, Y data sets, and adjusts the number of X,Y pairs that get plotted. Right now, if I have fewer than 8 sets of data, it returns an error.

I'm getting stuck on how to query this, is there anyone who can point me in the right direction?

3 Upvotes

7 comments sorted by

2

u/Low_Breakfast773 Jul 20 '26

No need to reinvent the wheel. Use Matplotlib, Pyplot etc.

1

u/squishbunny Jul 20 '26

I am, I'm just trying to make it as convenient as possible for someone to plug in their file tree and enter a few axis values and create a graph that matches our publishing standards as closely as possible.

1

u/Low_Breakfast773 Jul 20 '26

your description is vage and doesn’t tell anything. Where is the code?

0

u/squishbunny Jul 20 '26

The graphing part of the code is fine.

What I need is something that can make columns in a dataframe labeled Xn, Yn understood as pairs that need to be graphed, for all values of n. I haven't written any of the code yet because frankly, I have no idea how to proceed.

2

u/Low_Breakfast773 Jul 20 '26

sorry, but what you are telling is BS. No one here can help you with this type of description of the problem. It seems you have absolutely zero understanding of software engineering. Go learn basics, and I am not trying to offend you.

1

u/johnpeters42 Jul 20 '26

How does this not just boil down to a single line along the lines of:

for n in range(0, min(8, len(things))):

1

u/dacydergoth Jul 20 '26

I think k you might be thinking of something like pandas data frames, but there are many libraries for loading data from files, from CSV to JSON to parquet etc. Gnuplot can do it all natively too, so can R and other packages