Closed AlbaVidal closed 6 years ago
Matplotlib version?
(You may have to update matplotlib)
I did it yesterday and it did not work either... version 1.5.1
Can't be 1.5.1 the updated version, the newest version is 2.1.0
The error
TypeError: __init__() got an unexpected keyword argument 'gridspec_kw'
arises from a call to the matplotlib method
fig, axs_ = plt.subplots(n_outer, n_ranges, gridspec_kw = {'height_ratios':[3, 1]})
which suggests that in your version of matplotlib the subplots
method doesn't recognize the keyword gridspec_kw
Now with version 2.1.0 I still find an error:
Traceback (most recent call last):
File "/Users/alba/Library/Python/2.7/bin/pyp_beagle", line 11, in <module>
load_entry_point('pyp-beagle==0.5.6', 'console_scripts', 'pyp_beagle')()
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/pyp_beagle/command_line.py", line 228, in main
my_spectrum.plot_marginal(ID, file_names[i])
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/pyp_beagle/beagle_spectra.py", line 398, in plot_marginal
fig, axs_ = plt.subplots(n_outer, n_ranges, gridspec_kw = {'height_ratios':[3, 1]})
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/matplotlib/pyplot.py", line 1182, in subplots
gridspec_kw=gridspec_kw)
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/matplotlib/figure.py", line 1169, in subplots
gs = GridSpec(nrows, ncols, **gridspec_kw)
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/matplotlib/gridspec.py", line 203, in __init__
height_ratios=height_ratios)
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/matplotlib/gridspec.py", line 45, in __init__
self.set_height_ratios(height_ratios)
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/matplotlib/gridspec.py", line 74, in set_height_ratios
raise ValueError('Expected the given number of height ratios to '
ValueError: Expected the given number of height ratios to match the number of rows of the grid
You can try and edit the offending line in the PyP-BEAGLE source code
File "/Users/alba/Library/Python/2.7/lib/python/site-packages/pyp_beagle/beagle_spectra.py", line 398, in plot_marginal
fig, axs_ = plt.subplots(n_outer, n_ranges, gridspec_kw = {'height_ratios':[3, 1]})
otherwise I'll do it when I find some time.
In the meantime you can use it without the show-residual
option
Hi Jacopo and Alba, we are finding exactly the same problem here in Rome when trying to plot the spectrum, did you find any solution?
We tried to edit the relevant line in beagle_spectra.py but with no success.
When we try with --show-residual we also get an error message:
beagle@node4:/node4/data1/beagle/BEAGLE-general$ pyp_beagle -r /node4/data1/beagle/BEAGLE-general/results/fit_VANDELS_CDFS006520_allparam_speconly --plot-marginal --show-residual Traceback (most recent call last): File "/usr/local/bin/pyp_beagle", line 9, in
load_entry_point('pyp-beagle==0.5.6', 'console_scripts', 'pyp_beagle')() File "/usr/local/lib/python2.7/dist-packages/pyp_beagle/command_line.py", line 228, in main my_spectrum.plot_marginal(ID, file_names[i]) File "/usr/local/lib/python2.7/dist-packages/pyp_beagle/beagle_spectra.py", line 401, in plotmarginal axs = axs[0,:] IndexError: too many indices for array
Hi Marco, do you manage to produce the plots without the show-residual option? Did you try with matplotlib 2.x.x?
Hi, we have matplotlib 2.1.0, we tried both with and without --show-residual but we get error messages (the one I posted and the one identical to Alba's)
Hi Marco, I have also tried several things without success so far with this pyp_beagle version so I am plotting the spectra with a previous version script that I modified as a temporary solution. The error in my case arises only when updating to the last version, so it works (of course, not with all the options as in the last version) with the previous ones.
You get this error
ValueError: Expected the given number of height ratios to match the number of rows of the grid
right?
@MarcoCast79 @AlbaVidal I need more details, as I cannot reproduce any error with matplotlib 2.1.0.
Can you both check your version by running ipython, then from the ipython shell
import matplotlib
matplotlib.__version__
Hi Jacopo, I get 2.1.0. I have also updated conda, anaconda and all the packages again just in case but I still find the same error.
Ok, that was a bit confusing, here we really are talking about two different errors, one that appears when using --show-residual
and one that appears without the option.
In the future, please, open different issues for different errors.
Alba: the error without using the --show-residual
option should be now (in ver 0.5.7) fixed
Marco: I still cannot reproduce the error you get with the --show-residual
option
Hi Jacopo, now I am able to plot a marginal plot with the options:
--wl-units ang --wl-range 3845 3915 4075 4125 4325 4385 4845 4880 4940 5030 5860 5895 6525 6620 6700 6750 --wl-rest --log-flux --show-residual --plot-line-labels --draw-steps
without getting any error. There is still a little error to fix when not using the wl-range
option but this seems easy to fix. Thanks a lot!
Hi I have updated to the newest version of pyp_beagle and just running a simple test like:
I get the following error: