@@ -762,6 +762,21 @@ def rc_params(fail_on_error=False):
762
762
763
763
# this is the instance used by the matplotlib classes
764
764
rcParams = rc_params ()
765
+
766
+ if rcParams ['examples.directory' ]:
767
+ # paths that are intended to be relative to matplotlib_fname()
768
+ # are allowed for the examples.directory parameter.
769
+ # However, we will need to fully qualify the path because
770
+ # Sphinx requires absolute paths.
771
+ if not os .path .isabs (rcParams ['examples.directory' ]):
772
+ _basedir , _fname = os .path .split (matplotlib_fname ())
773
+ # Sometimes matplotlib_fname() can return relative paths,
774
+ # Also, using realpath() guarentees that Sphinx will use
775
+ # the same path that matplotlib sees (in case of weird symlinks).
776
+ _basedir = os .path .realpath (_basedir )
777
+ _fullpath = os .path .join (_basedir , rcParams ['examples.directory' ])
778
+ rcParams ['examples.directory' ] = _fullpath
779
+
765
780
rcParamsOrig = rcParams .copy ()
766
781
767
782
rcParamsDefault = RcParams ([ (key , default ) for key , (default , converter ) in \
@@ -770,6 +785,8 @@ def rc_params(fail_on_error=False):
770
785
rcParams ['ps.usedistiller' ] = checkdep_ps_distiller (rcParams ['ps.usedistiller' ])
771
786
rcParams ['text.usetex' ] = checkdep_usetex (rcParams ['text.usetex' ])
772
787
788
+
789
+
773
790
def rc (group , ** kwargs ):
774
791
"""
775
792
Set the current rc params. Group is the grouping for the rc, eg.
0 commit comments