I am in the process of writing a python script that will (1) obtain a list of y-values for each subplot to plot against a common set of x-values, (2) make each of these subplots a scatter-plot and put it in the appropriate location in the subplot grid, and (3) complete these tasks for different sizes of subplot grids. What I mean by the third statement is this: the test case I'm using results in an array of 64 plots, 8 rows and 8 columns. I would like for the code to be able to handle any size array (roughly between 50 and 80 plots) for various grid dimensions without me having to go back in each time I run the code and say "Okay, here's the number of rows and columns I need."
Right now, I'm using an exec command to obtain the y-values, and that's working fine. I'm able to make each of the subplots and get it to populate the grid, but only if I type everything in by hand (64 times of doing the same thing is just dumb, so I know there's got to be a way to automate this).
Could anyone suggest a way in which this might be accomplished? I cannot provide data or my code, as this is research material and is not mine to release. Please excuse me if this question is very basic or is something that I should be able to determine from existing documentation. I am very new to programming, and could use a little guidance!
If you are going to use Python, you will want to take a stroll through the Python Tutorial to learn the the language and data structures available to you, there is good instructional material online, you might want to consider some of the computer science 101 courses that use Python - MIT OCW, edX, How To Think Like A Computer Scientist...
Without knowing the full details, I imagine it could be something like this which is a mixture of real code and pseudocode:
list(), append(), while, divmod(), len(), if, for, enumerate() are all Python statements, methods, or built-in functions.
A useful function for things like this is
plt.subplots(nrows, ncols)
which will return an array (a numpy object array) of subplots on a regular grid.As an example: