Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8a18a1

Browse files
committed
Docstring revised, working dir added to sys.path
1 parent d30d57c commit e8a18a1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,17 @@
106106
be applied before each plot.
107107
108108
plot_apply_rcparams
109-
Apply rcParams before each plot. When context is used, rcParams are
110-
not applied, and this configuration option overrides this behavior.
109+
By default, rcParams are applied when `context` option is not used in
110+
a plot directive. This configuration option overrides this behaviour
111+
and applies rcParams before each plot.
111112
112113
plot_working_directory
113114
By default, the working directory will be changed to the directory of
114115
the example, so the code can get at its data files, if any. Also its
115-
path to sys.path so it can import any helper modules sitting beside it.
116-
This configuration option can be used to specify a central directory
117-
where data files for all code are located.
116+
path will be added to `sys.path` so it can import any helper modules
117+
sitting beside it. This configuration option can be used to specify
118+
a central directory (also added to `sys.path`) where data files and
119+
helper modules for all code are located.
118120
119121
plot_template
120122
Provide a customized template for preparing resturctured text.
@@ -463,8 +465,9 @@ def run_code(code, code_path, ns=None, function_name=None):
463465

464466
pwd = os.getcwd()
465467
old_sys_path = list(sys.path)
466-
if setup.config.plot_working_directory:
468+
if setup.config.plot_working_directory is not None:
467469
os.chdir(setup.config.plot_working_directory)
470+
sys.path.insert(0, setup.config.plot_working_directory)
468471
elif code_path is not None:
469472
dirname = os.path.abspath(os.path.dirname(code_path))
470473
os.chdir(dirname)

0 commit comments

Comments
 (0)