Repository: rootpy/rootpy

Issue:
root styled fillstyle code
When I do
```python
import rootpy.ROOT as ROOT
h = ROOT.Hist(0,100,100)
h.fillstyle = 3001
```
I get this error:
```
h.fillstyle=3001
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-d16d8a33d4ff> in <module>()
----> 1 h.fillstyle=3001

/home/chenyh/.local/lib/python2.7/site-packages/rootpy/plotting/base.pyc in fillstyle(self, style)
    361     @fillstyle.setter
    362     def fillstyle(self, style):
--> 363         self.SetFillStyle(style)
    364 
    365     def SetMarkerColor(self, color):

/home/chenyh/.local/lib/python2.7/site-packages/rootpy/plotting/base.pyc in SetFillStyle(self, style)
    344         :class:`rootpy.plotting.style.FillStyle`.
    345         """
--> 346         self._fillstyle = FillStyle(style)
    347         if isinstance(self, ROOT.TAttFill):
    348             ROOT.TAttFill.SetFillStyle(self, self._fillstyle('root'))

/home/chenyh/.local/lib/python2.7/site-packages/rootpy/plotting/base.pyc in __init__(self, style)
    924     """
    925     def __init__(self, style):
--> 926         _StyleContainer.__init__(self, style, convert_fillstyle)
    927 
    928 

/home/chenyh/.local/lib/python2.7/site-packages/rootpy/plotting/base.pyc in __init__(self, value, function)
    535         self._input = value
    536         self._root = function(value, 'root')
--> 537         self._mpl = function(value, 'mpl')
    538 
    539     def __call__(self, output_type=None):

/home/chenyh/.local/lib/python2.7/site-packages/rootpy/plotting/base.pyc in convert_fillstyle(inputstyle, mode, inputmode)
    881             return fillstyles_root2mpl[inputstyle]
    882         raise ValueError(
--> 883             "`{0}` is not a valid `fillstyle`".format(inputstyle))
    884     else:
    885         if inputstyle is not None and inputstyle[0] not in fillstyles_mpl2root:

ValueError: `3001` is not a valid `fillstyle`
```
, which makes root styled fillstyle code not working.

It seems I can make it work by simply doing:
```diff
diff --git a/home/chenyh/.local/lib/python2.7/site-packages/rootpy/plotting/base.py b/home/chenyh/Desktop/base-modified.py
index 6053819..11aafa5 100644
--- a/home/chenyh/.local/lib/python2.7/site-packages/rootpy/plotting/base.py
+++ b/home/chenyh/Desktop/base-modified.py
@@ -894,6 +894,7 @@ def convert_fillstyle(inputstyle, mode, inputmode=None):
             return inputstyle
         if inputstyle in fillstyles_root2mpl:
             return fillstyles_root2mpl[inputstyle]
+        return inputstyle
         raise ValueError(
             "`{0}` is not a valid `fillstyle`".format(inputstyle))
     else:
```
Or maybe you intend not to do so for some reason?

Thanks


Discussion:

Resolving patch:
diff --git a/rootpy/plotting/base.py b/rootpy/plotting/base.py
--- a/rootpy/plotting/base.py
+++ b/rootpy/plotting/base.py
@@ -549,7 +549,10 @@ class _StyleContainer(object):
     def __init__(self, value, function):
         self._input = value
         self._root = function(value, 'root')
-        self._mpl = function(value, 'mpl')
+        try:
+            self._mpl = function(value, 'mpl')
+        except ValueError:
+            self._mpl = self._root
 
     def __call__(self, output_type=None):
         if not output_type:


Test patch: