@@ -72,24 +72,40 @@ def __init__(self, adir, v_intervalx, d_intervalx, axes, *args, **kwargs):
72
72
self .d_interval = d_intervalx
73
73
self .v_interval = v_intervalx
74
74
75
+ # This is a temporary member variable.
76
+ # Do not depend on this existing in future releases!
77
+ self ._axinfo = self ._AXINFO [adir ].copy ()
78
+ self ._axinfo .update ({'label' : {'space_factor' : 1.3 ,
79
+ 'va' : 'center' ,
80
+ 'ha' : 'center' },
81
+ 'tick' : {'inward_factor' : 0.2 ,
82
+ 'outward_factor' : 0.1 },
83
+ 'ticklabel' : {'space_factor' : 0.6 },
84
+ 'axisline' : {'linewidth' : 0.75 ,
85
+ 'color' : (0 , 0 , 0 , 1 )},
86
+ 'grid' : {'color' : (0.9 , 0.9 , 0.9 , 1 ),
87
+ 'linewidth' : 1.0 },
88
+ })
89
+
90
+
75
91
maxis .XAxis .__init__ (self , axes , * args , ** kwargs )
76
92
77
93
self .set_rotate_label (kwargs .get ('rotate_label' , None ))
78
94
79
95
80
96
def init3d (self ):
81
97
self .line = mlines .Line2D (xdata = (0 , 0 ), ydata = (0 , 0 ),
82
- linewidth = 0.75 ,
83
- color = ( 0 , 0 , 0 , 1 ) ,
84
- antialiased = True ,
98
+ linewidth = self . _axinfo [ 'axisline' ][ 'linewidth' ] ,
99
+ color = self . _axinfo [ 'axisline' ][ 'color' ] ,
100
+ antialiased = True ,
85
101
)
86
102
87
103
# Store dummy data in Polygon object
88
104
self .pane = mpatches .Polygon (np .array ([[0 ,0 ], [0 ,1 ], [1 ,0 ], [0 ,0 ]]),
89
105
alpha = 0.8 ,
90
106
facecolor = (1 ,1 ,1 ,0 ),
91
107
edgecolor = (1 ,1 ,1 ,0 ))
92
- self .set_pane_color (self ._AXINFO [ self . adir ] ['color' ])
108
+ self .set_pane_color (self ._axinfo ['color' ])
93
109
94
110
self .axes ._set_artist_props (self .line )
95
111
self .axes ._set_artist_props (self .pane )
@@ -124,6 +140,7 @@ def set_pane_pos(self, xys):
124
140
125
141
def set_pane_color (self , color ):
126
142
'''Set pane color to a RGBA tuple'''
143
+ self ._axinfo ['color' ] = color
127
144
self .pane .set_edgecolor (color )
128
145
self .pane .set_facecolor (color )
129
146
self .pane .set_alpha (color [- 1 ])
@@ -163,7 +180,7 @@ def draw_pane(self, renderer):
163
180
164
181
mins , maxs , centers , deltas , tc , highs = self ._get_coord_info (renderer )
165
182
166
- info = self ._AXINFO [ self . adir ]
183
+ info = self ._axinfo
167
184
index = info ['i' ]
168
185
if not highs [index ]:
169
186
plane = self ._PLANES [2 * index ]
@@ -183,7 +200,7 @@ def draw(self, renderer):
183
200
majorTicks = self .get_major_ticks ()
184
201
majorLocs = self .major .locator ()
185
202
186
- info = self ._AXINFO [ self . adir ]
203
+ info = self ._axinfo
187
204
index = info ['i' ]
188
205
189
206
# filter locations here so that no extra grid lines are drawn
@@ -232,7 +249,7 @@ def draw(self, renderer):
232
249
233
250
lxyz = 0.5 * (edgep1 + edgep2 )
234
251
235
- labeldeltas = 1.3 * deltas
252
+ labeldeltas = info [ 'label' ][ 'space_factor' ] * deltas
236
253
axmask = [True , True , True ]
237
254
axmask [index ] = False
238
255
lxyz = move_from_center (lxyz , centers , labeldeltas , axmask )
@@ -242,8 +259,8 @@ def draw(self, renderer):
242
259
if self .get_rotate_label (self .label .get_text ()):
243
260
angle = art3d .norm_text_angle (math .degrees (math .atan2 (dy , dx )))
244
261
self .label .set_rotation (angle )
245
- self .label .set_va ('center' )
246
- self .label .set_ha ('center' )
262
+ self .label .set_va (info [ 'label' ][ 'va' ] )
263
+ self .label .set_ha (info [ 'label' ][ 'ha' ] )
247
264
self .label .draw (renderer )
248
265
249
266
@@ -333,7 +350,7 @@ def draw(self, renderer):
333
350
lines = zip (xyz1 , xyz0 , xyz2 )
334
351
if self .axes ._draw_grid :
335
352
self .gridlines .set_segments (lines )
336
- self .gridlines .set_color ([( 0.9 , 0.9 , 0.9 , 1 ) ] * len (lines ))
353
+ self .gridlines .set_color ([info [ 'grid' ][ 'color' ] ] * len (lines ))
337
354
self .gridlines .draw (renderer , project = True )
338
355
339
356
# Draw ticks
@@ -351,15 +368,18 @@ def draw(self, renderer):
351
368
# Get tick line positions
352
369
pos = copy .copy (edgep1 )
353
370
pos [index ] = loc
354
- pos [tickdir ] = edgep1 [tickdir ] + 0.1 * ticksign * tickdelta
371
+ pos [tickdir ] = edgep1 [tickdir ] + info ['tick' ]['outward_factor' ] * \
372
+ ticksign * tickdelta
355
373
x1 , y1 , z1 = proj3d .proj_transform (pos [0 ], pos [1 ], pos [2 ], \
356
374
renderer .M )
357
- pos [tickdir ] = edgep1 [tickdir ] - 0.2 * ticksign * tickdelta
375
+ pos [tickdir ] = edgep1 [tickdir ] - info ['tick' ]['inward_factor' ] * \
376
+ ticksign * tickdelta
358
377
x2 , y2 , z2 = proj3d .proj_transform (pos [0 ], pos [1 ], pos [2 ], \
359
378
renderer .M )
360
379
361
380
# Get position of label
362
- labeldeltas = [0.6 * x for x in deltas ]
381
+ labeldeltas = [info ['ticklabel' ]['space_factor' ] * x for
382
+ x in deltas ]
363
383
axmask = [True , True , True ]
364
384
axmask [index ] = False
365
385
pos [tickdir ] = edgep1 [tickdir ]
0 commit comments