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

AttributeError: 'AxesSubplot' object has no attribute 'set_facecolor' #39

Closed
ABC0408 opened this issue Mar 8, 2017 · 4 comments
Closed

Comments

@ABC0408
Copy link

ABC0408 commented Mar 8, 2017

What operating system, architecture, Python version, and OSMnx version are you using?

os 10.12 ,pycharm, python2.7, OSMnx 0.4

Code that reproduces the issue

raceback (most recent call last):
File "/Users/eden/PycharmProjects/examples/09-example-figure-ground.py", line 17, in
fig, ax = ox.plot_figure_ground(point=point, filename=place, network_type='drive', dpi=dpi)
File "/Library/Python/2.7/site-packages/osmnx/plot.py", line 706, in plot_figure_ground
show=show, save=save, close=close, filename=filename, file_format=file_format, dpi=dpi)
File "/Library/Python/2.7/site-packages/osmnx/plot.py", line 256, in plot_graph
ax.set_facecolor(bgcolor)
AttributeError: 'AxesSubplot' object has no attribute 'set_facecolor'

import osmnx as ox
from IPython.display import Image
#matplotlib inline
ox.config(log_file=True, log_console=True, use_cache=True)
# configure the inline image display
img_folder = 'images'
extension = 'png'
size = 350
dpi = 90

place = 'portland'
point = (45.517309, -122.682138)
fig, ax = ox.plot_figure_ground(point=point, filename=place, network_type='drive', dpi=dpi)
Image('{}/{}.{}'.format(img_folder, place, extension), height=size, width=size)
@ABC0408 ABC0408 closed this as completed Mar 8, 2017
@ABC0408 ABC0408 reopened this Mar 8, 2017
@gboeing
Copy link
Owner

gboeing commented Mar 8, 2017

What version of matplotlib are you using?

Note that OSMnx requires matplotlib version 2.0 or higher:

osmnx/setup.py

Line 57 in b29eea6

'matplotlib>=2.0',

@gboeing gboeing changed the title osmnx/examples/09-example-figure-ground.ipynb AttributeError: 'AxesSubplot' object has no attribute 'set_facecolor' Mar 8, 2017
@ABC0408
Copy link
Author

ABC0408 commented Mar 8, 2017

altgraph (0.13)
appdirs (1.4.3)
appnope (0.1.0)
backports.shutil-get-terminal-size (1.0.0)
bdist-mpkg (0.5.0)
bonjour-py (0.3)
branca (0.2.0)
Cerberus (1.1)
cffi (1.9.1)
click (6.7)
click-plugins (1.0.3)
cligj (0.4.0)
cryptography (1.7.2)
cycler (0.10.0)
Cython (0.25.2)
decorator (4.0.11)
descartes (1.1.0)
enum34 (1.1.6)
Fiona (1.7.4)
folium (0.3.0)
functools32 (3.2.3.post2)
future (0.15.2)
geopandas (0.2.1)
geopy (1.11.0)
idna (2.5)
ipaddress (1.0.18)
ipython (5.3.0)
ipython-genutils (0.1.0)
Jinja2 (2.9.5)
macholib (1.8)
MarkupSafe (1.0)
matplotlib (2.0.0)
modulegraph (0.14)
munch (2.1.0)
network (0.1)
networkx (1.11)
numexpr (2.6.2)
numpy (1.12.0)
osmnx (0.4)
packaging (16.8)
pandana (0.2.0)
pandas (0.19.2)
pathlib2 (2.2.1)
pexpect (4.2.1)
pickleshare (0.7.4)
PIL (1.1.7)
pip (9.0.1)
prompt-toolkit (1.0.13)
ptyprocess (0.5.1)
py2app (0.12)
pyasn1 (0.2.3)
pycparser (2.17)
Pygments (2.2.0)
pymongo (3.4.0)
pyobjc (3.2.1)
pyobjc-core (3.2.1)
pyOpenSSL (16.2.0)
pyparsing (2.2.0)
pyproj (1.9.5.1)
PySAL (1.13.0)
python-dateutil (2.6.0)
pytz (2016.10)
requests (2.13.0)
rpy2 (2.8.5)
Rtree (0.8.3)
scandir (1.5)
schema (0.6.5)
scikit-learn (0.19.dev0)
scipy (0.18.1)
setuptools (34.3.1)
Shapely (1.5.17.post1)
simplegeneric (0.8.1)
singledispatch (3.4.0.3)
six (1.10.0)
subprocess32 (3.2.7)
tables (3.3.0)
traitlets (4.3.2)
wcwidth (0.1.7)
xattr (0.9.1)
youtube-dl (2017.3.7)
zope.interface (4.3.3)

I have upgraded all the install_requires and extras_require, but it has the same error.

@gboeing
Copy link
Owner

gboeing commented Mar 8, 2017

Try to run the following code in this same notebook:

import matplotlib as mpl, matplotlib.pyplot as plt
print(mpl.__version__)
fig, ax = plt.subplots()
ax.set_facecolor('k')

Make sure it prints '2.0.0' and that it recognizes that ax does indeed have set_facecolor.

@ABC0408
Copy link
Author

ABC0408 commented Mar 8, 2017

HaHa,There are two versions. But now is right. Thank you very much.

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