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

git-of-theseus-stack-plot cohorts.json fails if using matplotlib 3 #66

Open
calda opened this issue Sep 26, 2018 · 3 comments
Open

git-of-theseus-stack-plot cohorts.json fails if using matplotlib 3 #66

calda opened this issue Sep 26, 2018 · 3 comments

Comments

@calda
Copy link

calda commented Sep 26, 2018

Running git-of-theseus-stack-plot cohorts.json fails on the public release of macOS Mojave, running Python 3.7. On the other hand, git-of-theseus-survival-plot survival.json works just fine.

I'm getting a traceback with a TypeError:

$ git-of-theseus-stack-plot cohorts.json

Traceback (most recent call last):
  File "/usr/local/bin/git-of-theseus-stack-plot", line 11, in <module>
    sys.exit(stack_plot_cmdline())
  File "/usr/local/lib/python3.7/site-packages/git_of_theseus/stack_plot.py", line 79, in stack_plot_cmdline
    stack_plot(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/git_of_theseus/stack_plot.py", line 56, in stack_plot
    pyplot.stackplot(ts, numpy.array(y), labels=labels, colors=colors)
  File "/usr/local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2836, in stackplot
    return gca().stackplot(x=x, *args, data=data, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/matplotlib/__init__.py", line 1785, in inner
    return func(ax, *args, **kwargs)
TypeError: stackplot() got multiple values for argument 'x'

And here is my cohorts.json:

{"y": [[2467, 3052, 3488, 3506, 3907, 4333, 2194, 2190, 2190, 2168, 2045, 2045, 1879, 1846, 1830, 1830, 1800, 1685, 1685, 1655, 1585, 1393, 1393, 1372, 1371, 1314, 1313, 1284, 1284, 1284, 1250, 1222, 1222, 1222, 1108, 1108, 1048, 802], [0, 0, 0, 0, 0, 0, 1282, 1337, 1337, 1496, 10367, 10948, 12419, 13469, 13642, 13859, 14026, 14467, 14471, 14727, 10163, 10957, 10976, 10961, 10940, 10874, 10833, 9934, 9931, 9931, 9894, 9660, 9650, 9611, 9219, 9219, 9082, 8748], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, 270, 755, 796, 1699, 1841, 1927, 2862, 4569, 4809, 5699, 6711, 6711, 7238, 7986]], "ts": ["2016-05-12T22:25:54", "2016-05-20T03:55:10", "2016-05-27T17:38:18", "2016-06-19T19:13:41", "2016-06-26T22:07:09", "2016-12-02T04:42:04", "2017-02-09T06:51:20", "2017-02-22T06:59:31", "2017-03-06T04:11:52", "2017-03-19T00:37:59", "2017-07-20T05:51:33", "2017-07-27T06:11:32", "2017-08-03T07:47:49", "2017-08-11T06:37:24", "2017-08-19T01:51:04", "2017-08-28T01:37:28", "2017-09-05T01:58:38", "2017-09-12T21:15:10", "2017-09-24T19:15:07", "2017-10-30T22:17:18", "2017-12-09T19:18:28", "2017-12-17T01:55:34", "2017-12-24T04:43:51", "2018-01-03T22:42:32", "2018-03-09T02:20:24", "2018-03-19T08:01:01", "2018-04-08T03:12:46", "2018-04-18T04:21:10", "2018-05-13T22:51:15", "2018-05-25T17:14:02", "2018-06-04T01:12:04", "2018-06-11T02:17:21", "2018-06-18T09:20:56", "2018-07-09T06:13:45", "2018-07-23T07:42:13", "2018-08-04T05:20:25", "2018-09-17T13:01:48", "2018-09-26T11:40:21"], "labels": ["Code added in 2016", "Code added in 2017", "Code added in 2018"]}

Let me know if there's any other information that would help!

@erikbern
Copy link
Owner

sounds like some python 3.7 issue

i guess we could add py37 to travis and see if it reproduces

@linusg
Copy link

linusg commented Sep 28, 2018

Same here with Python 3.6.4 and matplotlib 3.0.0. I believe this is due to some (recent?) change in matplotlib, because when I

pip uninstall -y matplotlib && pip install -y matplotlib==2

the tool will happily create the requested plot!

$ ls -l stack_plot.png
ls: cannot access 'stack_plot.png': No such file or directory
$ git-of-theseus-stack-plot authors.json
$ ls -l stack_plot.png 
-rw-rw-r-- 1 linus linus 24890 Sep 28 09:25 stack_plot.png

@calda
Copy link
Author

calda commented Sep 28, 2018

It does work correctly using matplotlib 2.2.3!

@calda calda changed the title git-of-theseus-stack-plot cohorts.json fails on macOS Mojave with Python 3.7 git-of-theseus-stack-plot cohorts.json fails if using matplotlib 3 Sep 28, 2018
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

3 participants