Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

get_sample_data() in cbook.py duplicates code from _get_data_path() __init__.py #6536

Copy link
Copy link
Closed
@rathann

Description

@rathann
Issue body actions

To help us understand and resolve your issue please check that you have provided
the information below.

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)

1.5.2rc2, python 2.7.11 and python 3.5.1, Fedora rawhide.

  • How did you install Matplotlib and Python (pip, anaconda, from source ...)

From source, I'm building a new version of the Fedora package.

  • If possible please supply a Short, Self Contained, Correct, Example
    that demonstrates the issue i.e a small piece of code which reproduces the issue
    and can be run with out any other (or as few as possible) external dependencies.

In Fedora, we're patching the lib/matplotlib/__init__.py to use /usr/share/matplotlib/mpl-data as the path for data files. cbook.py seems to have its own reimplementation of the data files path code, so the path needs to be patched in two locations. It would be nice if we could specify the desired data files location path at build time, by the way. Shall I open a separate issue for that?

Trivial patch:

--- a/lib/matplotlib/cbook.py   2016-05-20 14:14:52.000000000 +0200
+++ b/lib/matplotlib/cbook.py   2016-05-20 19:28:57.373601582 +0200
@@ -823,8 +823,7 @@ def get_sample_data(fname, asfileobj=Tru
     if matplotlib.rcParams['examples.directory']:
         root = matplotlib.rcParams['examples.directory']
     else:
-        root = os.path.join(os.path.dirname(__file__),
-                            "mpl-data", "sample_data")
+        root = os.path.join(matplotlib._get_data_path(), 'sample_data')
     path = os.path.join(root, fname)

     if asfileobj:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.