Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the pork chop test to run under Python 3.7.3 and Matplotlib 3.1.1 #20

Open
OrbitalMechanic opened this issue Nov 23, 2019 · 3 comments

Comments

@OrbitalMechanic
Copy link

OrbitalMechanic commented Nov 23, 2019

I am attempting to run the pork_chop.py test. I'm running Python 3.7.3 and Matplotlib 3.1.1 in the current Anaconda distribution.

Now the first issue encountered had to do with the removal of get_axes() from Matplolib. Commit 9288ba8 referenced in cphyc/matplotlib-label-lines#1 showed me that replacing line.get_axes() with line.axes would solve that problem, and it did. A copy of the modified code has been attached to this note. Now I have a different problem.

Presently, when I run pork_chop.py I get the following error message.

(base) Samuels-Mac-Pro:pork_chop user$ python3 pork_chop.py
Traceback (most recent call last):
  File "pork_chop.py", line 229, in <module>
    draw_all_flight_time_lines()
  File "pork_chop.py", line 155, in draw_all_flight_time_lines
    draw_flight_time_line(t0[:,np.size(t0,1)/4],tf[:,np.size(t0,1)/4],'r')
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
(base) Samuels-Mac-Pro:pork_chop user$ python3

Any suggestions?

Please advise.

Sam Dupree.

pork_chop.py.txt

@jacobwilliams
Copy link
Owner

I guess they changed something in python or matplotlib? It used to work. I'll try to take a look when I get a chance.

@OrbitalMechanic
Copy link
Author

Taking a deeper dive into the issue I cited, I found on https://stackoverflow.com/questions/34952651/only-integers-slices-ellipsis-numpy-newaxis-none-and-intege that the problem can be caused by expressions such as np.size(t0,1)/4 result in a float type as opposed to an int. So I replaced statement like np.size(t0,1)/4) with int(np.size(t0,1)/4)) (lines 155 thru 158 in pork_chop.py), the program now works.

A text file containing the modified version of pork_chop.py is attached to this note.

Hope this helps.
Sam Dupree.

pork_chop.py-2.txt

@jacobwilliams
Copy link
Owner

jacobwilliams commented May 21, 2023

Note: in their infinite wisdom, matplotlib also changed their reference epoch in 3.3, so that would also need to be updated, or the dates on the axes will be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants