दुर्भाग्य से ऐसा प्रतीत नहीं होता है। स्रोत को देखते हुए, मुख्य आंतरिक चर _AXINFO
पर कॉल करता है जिसे हम सावधानीपूर्वक उप-वर्गीकरण से ओवरराइड कर सकते हैं।
dict custom_AXINFO
साथ यह शैली के बाद अपने आंकड़ा बनाई गई है यह कोड जोड़ें, और:
from mpl_toolkits.mplot3d import Axes3D
import mpl_toolkits.mplot3d.axis3d as axis3d
# New axis settings
custom_AXINFO = {
'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
'color': (0.00, 0.00, 0.25, .75)},
'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
'color': (0.20, 0.90, 0.90, 0.25)},
'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
'color': (0.925, 0.125, 0.90, 0.25)},}
class custom_XAxis(axis3d.Axis):
_AXINFO = custom_AXINFO
class custom_YAxis(axis3d.Axis):
_AXINFO = custom_AXINFO
class custom_ZAxis(axis3d.Axis):
_AXINFO = custom_AXINFO
class custom_Axes3D(Axes3D):
def _init_axis(self):
'''Init 3D axes; overrides creation of regular X/Y axes'''
self.w_xaxis = custom_XAxis('x', self.xy_viewLim.intervalx,
self.xy_dataLim.intervalx, self)
self.xaxis = self.w_xaxis
self.w_yaxis = custom_YAxis('y', self.xy_viewLim.intervaly,
self.xy_dataLim.intervaly, self)
self.yaxis = self.w_yaxis
self.w_zaxis = custom_ZAxis('z', self.zz_viewLim.intervalx,
self.zz_dataLim.intervalx, self)
self.zaxis = self.w_zaxis
for ax in self.xaxis, self.yaxis, self.zaxis:
ax.init3d()
# The rest of your code below, note the call to our new custom_Axes3D
points = (5*np.random.randn(3, 50)+np.tile(np.arange(1,51), (3, 1))).transpose()
fig = plt.figure(figsize = (10,10))
ax = custom_Axes3D(fig)
इस बंदर-पैच है पर यह सबसे खराब है, और पर भरोसा नहीं किया जाना चाहिए बाद के संस्करणों के लिए काम करते हैं।
चेहरे के रंगों को ठीक करना ग्रिड लाइनों से आसान था, क्योंकि इसे __init__
विधियों में से एक के ओवरराइड की आवश्यकता होती है, हालांकि इसे और अधिक काम के साथ किया जा सकता है।
इसे अंतिम उपयोगकर्ता को बेनकाब करना मुश्किल नहीं लगता है, और जैसा कि मैं कल्पना कर सकता हूं कि इसे बाद के संस्करणों में ठीक किया जा सकता है।
ऐसा लगता है कि आप ax.w_xaxis.plane.set_color ((1,0,0)) कर सकते हैं; ax.w_xaxis.plane.set_alpha (0.5)। ऐसा लगता है कि यह set_color में अल्फा चैनल को अनदेखा करता है लेकिन set_alpha में से एक का उपयोग करता है। – Ben