Moments Engine Not Plotting At All
Closed this issue · 3 comments
Original report by Anonymous.
Good Afternoon!
I've been trying to run GADMA on some snail populations and I am having trouble plotting the final figure using the moments engine. After it finished running GADMA, GADMA has been using demes to plot the final figures, which is fine and all, but I wanted to compare it against the moments figures.
I get the following TypeError for moments once GADMA finishes running:
TypeError: got an unexpected keyword argument 'figsize'
When I try and redraw the moments figure using
python best_logLL_model_moments_code.py
I get the following error:
Model log likelihood (LL(model, data)): -788.4043636345097
Optimal value of theta: 235.7913500894567
Size of ancestral population: 235
Traceback (most recent call last):
File "/home/sad0046/2bRAD/bellacrenata-cochliaris/GADMA/E_coc_GADMA/GADMA_Take2/best_logLL_model_moments_code.py", line 41, in <module>
moments.ModelPlot.plot_model(gen_mod,
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/site-packages/moments/ModelPlot.py", line 423, in plot_model
plt.savefig(save_file, **fig_kwargs)
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/site-packages/matplotlib/pyplot.py", line 942, in savefig
res = fig.savefig(*args, **kwargs)
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/site-packages/matplotlib/figure.py", line 3272, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/site-packages/matplotlib/backend_bases.py", line 2338, in print_figure
result = print_method(
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/site-packages/matplotlib/backend_bases.py", line 2204, in <lambda>
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/site-packages/matplotlib/_api/deprecation.py", line 385, in wrapper
arguments = signature.bind(*inner_args, **inner_kwargs).arguments
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/inspect.py", line 3179, in bind
return self._bind(args, kwargs)
File "/home/sad0046/miniconda3/envs/gadmatake2/lib/python3.10/inspect.py", line 3168, in _bind
raise TypeError(
TypeError: got an unexpected keyword argument 'figsize'
I've tried creating two separate conda environments. One using python 3.8 and one using python 3.10 and I keep getting the same error. I'm using a Linux server at school.
Is there a recommended python version for running GADMA, which would solve this issue?
Or is there a particular version of maybe matplotlib I should be running?
Any help would be greatly appreciated!
Original comment by Aaron Ragsdale (Bitbucket: aragsdale, GitHub: apragsdale).
Hi - this error is due to the moments.ModelPlot.plot_model()
function not taking the argument figsize
. You can check the function doc-string to see all available arguments for that function. If you try using that function without that argument, does it plot the model as expected?
In general, with the demes model plotting features, using demesdraw
, we will no longer be adding updates to the moments model plotting features, and recommend using demes
and demesdraw
.
Original comment by Samantha Donohoo (Bitbucket: [Samantha Donohoo](https://bitbucket.org/Samantha Donohoo), ).
It worked! Removing the argument figsize
from the moments.ModelPlot.plot_model()
cleared it up perfectly!
I’ve been looking in the wrong script files trying to figure it out. I thought for some reason it was an issue with matplotlib or something with python.
You and your comment are greatly appreciated!
Thank you again!
Note: I realized I wasn’t signed in when I made the issue. If I need to claim it or something to mark is as closed I can totally do that.
Original comment by Aaron Ragsdale (Bitbucket: aragsdale, GitHub: apragsdale).
Great! Glad that was able to solve it.
No problem, I can mark this as resolved. Thanks for the question.