Skip to content

Commit

Permalink
Get more rcParams for 3d
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom authored and WeatherGod committed Jul 16, 2016
1 parent 6d339ed commit a241436
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 9 deletions.
16 changes: 16 additions & 0 deletions doc/users/whats_new/style_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,19 @@ Legends
data possible.

- The legend now has rounded corners by default.

mplot3d
```````

- mplot3d now obeys some style-related rcParams, rather than using
hard-coded defaults. These include:

- xtick.major.width
- ytick.major.width
- xtick.color
- ytick.color
- axes.linewidth
- axes.edgecolor
- grid.color
- grid.linewidth
- grid.linestyle
54 changes: 45 additions & 9 deletions lib/mpl_toolkits/mplot3d/axis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from matplotlib import lines as mlines, axis as maxis, \
patches as mpatches
from matplotlib import rcParams
from . import art3d
from . import proj3d

Expand Down Expand Up @@ -80,15 +81,44 @@ def __init__(self, adir, v_intervalx, d_intervalx, axes, *args, **kwargs):
# This is a temporary member variable.
# Do not depend on this existing in future releases!
self._axinfo = self._AXINFO[adir].copy()
self._axinfo.update({'label' : {'va': 'center',
'ha': 'center'},
'tick' : {'inward_factor': 0.2,
'outward_factor': 0.1},
'axisline': {'linewidth': 0.75,
'color': (0, 0, 0, 1)},
'grid' : {'color': (0.9, 0.9, 0.9, 1),
'linewidth': 1.0},
})
if rcParams['_internal.classic_mode']:
self._axinfo.update({'label':
{'va': 'center',
'ha': 'center'},
'tick':
{'inward_factor': 0.2,
'outward_factor': 0.1,
'linewidth': rcParams['lines.linewidth'],
'color': 'k'},
'axisline':
{'linewidth': 0.75,
'color': (0, 0, 0, 1)},
'grid' :
{'color': (0.9, 0.9, 0.9, 1),
'linewidth': 1.0,
'linestyle': '-'},
})
else:
self._axinfo.update({'label' :
{'va': 'center',
'ha': 'center'},
'tick' :
{'inward_factor': 0.2,
'outward_factor': 0.1,
'linewidth': rcParams.get(
adir + 'tick.major.width',
rcParams['xtick.major.width']),
'color': rcParams.get(
adir + 'tick.color',
rcParams['xtick.color'])},
'axisline':
{'linewidth': rcParams['axes.linewidth'],
'color': rcParams['axes.edgecolor']},
'grid' :
{'color': rcParams['grid.color'],
'linewidth': rcParams['grid.linewidth'],
'linestyle': rcParams['grid.linestyle']},
})


maxis.XAxis.__init__(self, axes, *args, **kwargs)
Expand Down Expand Up @@ -375,6 +405,10 @@ def draw(self, renderer):
if self.axes._draw_grid:
self.gridlines.set_segments(lines)
self.gridlines.set_color([info['grid']['color']] * len(lines))
self.gridlines.set_linewidth(
[info['grid']['linewidth']] * len(lines))
self.gridlines.set_linestyle(
[info['grid']['linestyle']] * len(lines))
self.gridlines.draw(renderer, project=True)

# Draw ticks
Expand Down Expand Up @@ -414,6 +448,8 @@ def draw(self, renderer):
renderer.M)

tick_update_position(tick, (x1, x2), (y1, y2), (lx, ly))
tick.tick1line.set_linewidth(info['tick']['linewidth'])
tick.tick1line.set_color(info['tick']['color'])
tick.set_label1(label)
tick.set_label2(label)
tick.draw(renderer)
Expand Down

0 comments on commit a241436

Please sign in to comment.