Hi Ben,

It works for me. Thank you very much !

Best wishes
                        Nils



On Tue, Sep 17, 2013 at 3:25 PM, Benjamin Root <ben.r...@ou.edu> wrote:

>
>
>
> On Tue, Sep 17, 2013 at 4:25 AM, Nils Wagner <nils...@googlemail.com>wrote:
>
>> Hi all,
>>
>> How can I modify the grid linewidth and grid line color of an Axes3D
>> object ?
>> is it possible to use white instead of gray for the background color ?
>>
>> The following snippet doesn't show the desired effect.
>>
>> from mpl_toolkits.mplot3d import Axes3D
>> import matplotlib.pyplot as plt
>> fig = plt.figure(figsize=(10,8))
>> ax = fig.gca(projection='3d')
>> ax.grid(color='r',linestyle='-',linewdith=2)
>>
>>
> A (somewhat) undocumented feature (and is not guaranteed to work in the
> future!) is the axis's _axinfo dictionary.
>
>         # 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' : {'space_factor': 1.6,
>                                         'va': 'center',
>                                         'ha': 'center'},
>                              'tick' : {'inward_factor': 0.2,
>                                        'outward_factor': 0.1},
>                              'ticklabel': {'space_factor': 0.7},
>                              'axisline': {'linewidth': 0.75,
>                                           'color': (0, 0, 0, 1)},
>                              'grid' : {'color': (0.9, 0.9, 0.9, 1),
>                                        'linewidth': 1.0},
>                             })
>
> where _AXINFO is a class-level attribute defined as:
>     # Some properties for the axes
>     _AXINFO = {
>         'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
>             'color': (0.95, 0.95, 0.95, 0.5)},
>         'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
>             'color': (0.90, 0.90, 0.90, 0.5)},
>         'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
>             'color': (0.925, 0.925, 0.925, 0.5)},
>     }
>
> This information used to be hard-coded throughout the axis3d.py module. I
> consolidated it all into this dictionary for each Axis3D instance. So, you
> should be able to create your Axes3D object, and then do something like the
> following:
>
> ax = fig.gca(projection='3d')
> ax.xaxis._axinfo['grid'].update({'color': 'r', 'linewidth': 2})
> ax.xaxis._axinfo['color'] = 'white'
>
> (Note: untested code!) I don't think the linestyle can be specified,
> though. At some point, I probably should get the Axes3D.grid() function
> defined to mess around with this _axinfo modify the _axinfo dictionary.
>
> I hope that helps!
> Ben Root
>
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to