I have made some graphs with matplotlib
with fitted curves. Usually, to print out the resulting parameters of these curve fits I put them in the label of your plotted curve like so:
plt.plot(x,yfit, label=fr”{popt[0]:.2f} $\pm$ {pcov[0]:.2f}”)
This prints the values very nicely inside the legend of the graph, and allows me to take advantage of LaTeX formatting and include symbols such as the plus/minus sign.
However, the curves I am fitting take up to 6 parameters and since I have several curves in the same graph, I just don’t have the space to print out all the results like this. What I would like is basically a method/python package that allows me to print the values as a table, with the option to format it like I would a LaTeX table. Ideally, it would be a package that allows me to create a LaTeX table, put then accept the input values similar to what I do when I call fr'{popt[0]}'
, so it would look something like this:
This is different from using the tabular
option, because I am not looking to just print a table that looks like python text. I want it to output as a LaTeX table (or within a .png image) whose formatting options I can have control over (namely so I can write in the headers, choose which values I place in each cell of the table, and insert LaTeX symbols).
I don't know if there is already a built in matplotlib option that has this, but I have so far searched and not found any.