olgabot / prettyplotlib

Painlessly create beautiful matplotlib plots.
olgabot.github.io/prettyplotlib
MIT License
1.69k stars 148 forks source link

PPL makes no difference to colour scheme - IPython 2.0.0 / Python 3.4 / PPL 0.1.7 / MPL 1.3.1 #54

Closed andrewclegg closed 10 years ago

andrewclegg commented 10 years ago

I have a notebook started with --pylab inline and a script that looks like this:

import prettyplotlib as ppl

np.random.seed(12)

fig, ax = plt.subplots(1)

ppl.hist(ax, np.random.randn(1000))

But the output seems to render using the default matplotlib colours:

screen shot 2014-04-19 at 11 35 54

Am I doing something wrong, or is there a version incompatibility somewhere?

This is on Ubuntu 12.04, Python 3.4, and here is the output of pip --list:

beautifulsoup4 (4.2.1) Bottleneck (0.8.0) brewer2mpl (1.4) Cython (0.20.1) deap (1.0.1) distribute (0.6.49) docutils (0.11) fastcluster (1.1.13) ipython (2.0.0) Jinja2 (2.7.2) lxml (3.3.5) MarkupSafe (0.21) matplotlib (1.3.1) nose (1.3.1) numexpr (2.4) numpy (1.8.1) numpydoc (0.5.dev) pandas (0.13.1) patsy (0.2.1) pip (1.5.4) prettyplotlib (0.1.7) psycopg2 (2.5.2) Pygments (1.6) pymc (3.0) pyparsing (2.0.2) python-dateutil (2.2) pytz (2014.2) pyzmq (14.1.1) scikit-learn (0.15-git) scipy (0.13.3) seaborn (0.3) setuptools (0.6c11) six (1.6.1) Sphinx (1.2.2) statsmodels (0.6.0) sympy (0.7.5) tables (3.1.1) Theano (0.6.0) tornado (3.2)

llimllib commented 10 years ago

I get the same result with python 2.7.6 and the rest of the libs at the same version

alvaroribas commented 10 years ago

Same problem with python 2.7.5 and matplotlib 1.2.1

olgabot commented 10 years ago

This is very strange... I'm looking into this

Sent from my mobile device. On Apr 19, 2014 3:41 AM, "Andrew Clegg" notifications@github.com wrote:

I have a notebook started with --pylab inline and a script that looks like this:

import prettyplotlib as ppl np.random.seed(12) fig, ax = plt.subplots(1) ppl.hist(ax, np.random.randn(1000))

But the output seems to render using the default matplotlib colours:

[image: screen shot 2014-04-19 at 11 35 54]https://cloud.githubusercontent.com/assets/578186/2748208/e93e6c92-c7ae-11e3-931c-88f6488b0c1e.png

Am I doing something wrong, or is there a version incompatibility somewhere?

This is on Ubuntu 12.04, Python 3.4, and here is the output of pip --list:

beautifulsoup4 (4.2.1) Bottleneck (0.8.0) brewer2mpl (1.4) Cython (0.20.1) deap (1.0.1) distribute (0.6.49) docutils (0.11) fastcluster (1.1.13) ipython (2.0.0) Jinja2 (2.7.2) lxml (3.3.5) MarkupSafe (0.21) matplotlib (1.3.1) nose (1.3.1) numexpr (2.4) numpy (1.8.1) numpydoc (0.5.dev) pandas (0.13.1) patsy (0.2.1) pip (1.5.4) prettyplotlib (0.1.7) psycopg2 (2.5.2) Pygments (1.6) pymc (3.0) pyparsing (2.0.2) python-dateutil (2.2) pytz (2014.2) pyzmq (14.1.1) scikit-learn (0.15-git) scipy (0.13.3) seaborn (0.3) setuptools (0.6c11) six (1.6.1) Sphinx (1.2.2) statsmodels (0.6.0) sympy (0.7.5) tables (3.1.1) Theano (0.6.0) tornado (3.2)

— Reply to this email directly or view it on GitHubhttps://github.com/olgabot/prettyplotlib/issues/54 .

olgabot commented 10 years ago

If the colors aren't working for you, can you try running the tests?

cd prettyplotlib cd tests for py in $(ls test_*.py); do python $py ; done

alvaroribas commented 10 years ago

Uh, awful output. Here is the result:

[alvaro@tests]$ for py in $(ls test_*.py); do python $py ; done Traceback (most recent call last): File "test_bar.py", line 8, in import six ImportError: No module named six Traceback (most recent call last): File "test_barh.py", line 8, in import six ImportError: No module named six /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py:247: UserWarning: test module run as script. guessing baseline image locations warnings.warn('test module run as script. guessing baseline image locations')

F

FAIL: main.test_boxplot.test

Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(_self.arg) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 39, in failer result = f(_args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 158, in do_test '(RMS %(rms).3f)'%err) ImageComparisonFailure: images not close: /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_boxplot/boxplot.png vs. /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_boxplot/boxplot-expected.png (RMS 51.677)


Ran 1 test in 0.454s

FAILED (failures=1)

E

ERROR: test suite for <class 'main.test_plot'>

Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/suite.py", line 208, in run self.setUp() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp self.setupContext(ancestor) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext try_run(context, names) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/util.py", line 478, in try_run return func() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 101, in setup_class cls._func() File "test_eventplot.py", line 15, in test_plot ppl.eventplot(events, alpha=alpha) File "build/bdist.macosx-10.8-x86_64/egg/prettyplotlib/_eventplot.py", line 26, in eventplot event_collections = ax.eventplot(_args, *_kwargs) AttributeError: 'AxesSubplot' object has no attribute 'eventplot'


Ran 0 tests in 0.037s

FAILED (errors=1) /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py:247: UserWarning: test module run as script. guessing baseline image locations warnings.warn('test module run as script. guessing baseline image locations')

.

Ran 1 test in 0.345s

OK /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py:247: UserWarning: test module run as script. guessing baseline image locations warnings.warn('test module run as script. guessing baseline image locations')

F

FAIL: main.test_legend.test

Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(_self.arg) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 39, in failer result = f(_args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 158, in do_test '(RMS %(rms).3f)'%err) ImageComparisonFailure: images not close: /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_legend/legend.png vs. /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_legend/legend-expected.png (RMS 107.512)


Ran 1 test in 0.823s

FAILED (failures=1) Traceback (most recent call last): File "test_pcolormesh.py", line 11, in import six ImportError: No module named six /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py:247: UserWarning: test module run as script. guessing baseline image locations warnings.warn('test module run as script. guessing baseline image locations')

F

FAIL: main.test_plot.test

Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(_self.arg) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 39, in failer result = f(_args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 158, in do_test '(RMS %(rms).3f)'%err) ImageComparisonFailure: images not close: /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_plot/plot.png vs. /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_plot/plot-expected.png (RMS 102.363)


Ran 1 test in 0.441s

FAILED (failures=1) /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py:247: UserWarning: test module run as script. guessing baseline image locations warnings.warn('test module run as script. guessing baseline image locations')

F

FAIL: main.test_remove_chartjunk.test

Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(_self.arg) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 39, in failer result = f(_args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 158, in do_test '(RMS %(rms).3f)'%err) ImageComparisonFailure: images not close: /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_remove_chartjunk/remove_chartjunk.png vs. /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_remove_chartjunk/remove_chartjunk-expected.png (RMS 336.883)


Ran 1 test in 0.368s

FAILED (failures=1) /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py:247: UserWarning: test module run as script. guessing baseline image locations warnings.warn('test module run as script. guessing baseline image locations')

F

FAIL: main.test_scatter.test

Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(_self.arg) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 39, in failer result = f(_args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 158, in do_test '(RMS %(rms).3f)'%err) ImageComparisonFailure: images not close: /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_scatter/scatter.png vs. /Users/alvaro/Astrosoftware/prettyplotlib/tests/result_images/test_scatter/scatter-expected.png (RMS 102.915)


Ran 1 test in 0.662s

FAILED (failures=1)

llimllib commented 10 years ago

OTOH, all tests pass for me

olgabot commented 10 years ago

@aribas thanks for checking. It looks like some of the tests are failing because this should really require matplotlib>=1.3.1, for eventplot, and others because the six module is required. Can you try making those upgrades? I'll update the requirements.

Also, next time there's output >20 lines or so, do you mind making it a gist on gist.github.com? Just to keep the big output separate from the discussion.

@llimllib Hmm... Are you on Windows/OSX/GNU/Linux?

llimllib commented 10 years ago

@olgabot Mac Mavericks 10.9.2

olgabot commented 10 years ago

Hmm this is very weird. I'm getting a similar error in my homebrew python but don't get it when I use a virtualenv. There must be some kind of conflict going on.

alvaroribas commented 10 years ago

@olgabot Sorry, I didn't know about gist. I guess I just have to share the link, right? https://gist.github.com/aribas/75d475391b3cc7828cd5

I upgraded matplotlib and six, still get some failures.

llimllib commented 10 years ago

@olgabot I get the same thing, it works fine in a virtualenv. Very weird.

cherepaha commented 10 years ago

I've updated to v. 0.1.7 and now have the same problem (Ubuntu 12.04, python 2.7.3, matplotlib 1.3.1). There is also another problem that did not occur before upgrade, so I think it may be relevant in resolving the problem with colors (just let me know if it deserves a new issue). The problem is basically that when I set the axis scale to logarithmic, ticks appear on that axis (but not on the other) figure_1

andrewclegg commented 10 years ago

Unfortunately this hasn't fixed it for me, but I don't think I can reopen the ticket.

I've upgraded to fc04d6e4f5edf1d402f51abeacc0dfd5132f60be which is 4 revisions after the changes pulled in #61, but I still get a barplot with the standard colours as shown at the top of this page.

All the tests pass for me.

You can reproduce this via Snake Charmer if that helps -- download it and install it as described in the readme, then create a new iPython notebook and run the example I attached to the original ticket. The only difference is, Snake Charmer no longer uses the --pylab argument to ipython, so you have to add

import matplotlib.pyplot as plt
import numpy as np

to the top of the example.