@@ -1817,13 +1817,68 @@ def dist_origin(x, y, z):
1817
1817
'Electric' : ['rgb(0,0,0)' , 'rgb(255,250,220)' ],
1818
1818
'Viridis' : ['rgb(68,1,84)' , 'rgb(253,231,37)' ]}
1819
1819
1820
+ if isinstance (colors , str ):
1821
+ if colors in plotly_scales :
1822
+ colors = plotly_scales [colors ]
1823
+ else :
1824
+ if ('rgb' not in colors ) and ('#' not in colors ):
1825
+ raise exceptions .PlotlyError ("If you input a string "
1826
+ "for 'colors', it must "
1827
+ "either be a Plotly "
1828
+ "colorscale, an 'rgb' "
1829
+ "color, or a hex color." )
1830
+ colors_list = []
1831
+ colors_list .append (colors )
1832
+ colors = colors_list
1833
+
1834
+ if not isinstance (colors , list ):
1835
+ raise exceptions .PlotlyError ("'colors' needs to be either a "
1836
+ "plotly colorscale string or a "
1837
+ "list of at least two colors if "
1838
+ "use_colorscale is True." )
1839
+ if len (colors ) <= 0 :
1840
+ raise exceptions .PlotlyError ("Empty list of colors." )
1841
+
1842
+ if (not isinstance (data , list )) and data_header is None :
1843
+ raise exceptions .PlotlyError ("Please enter a string name for "
1844
+ "data_header" )
1845
+
1846
+
1820
1847
# Validate colormap
1821
1848
if colormap is None :
1822
1849
colormap = [DEFAULT_PLOTLY_COLORS [0 ],
1823
1850
DEFAULT_PLOTLY_COLORS [1 ]]
1824
1851
colormap = FigureFactory ._unlabel_rgb (colormap )
1825
1852
colormap = FigureFactory ._unconvert_from_RGB_255 (colormap )
1826
1853
1854
+ if isinstance (colormap , str ):
1855
+ if colormap in plotly_scales :
1856
+ colormap = plotly_scales [colormap ]
1857
+ colormap = FigureFactory ._unlabel_rgb (colormap )
1858
+ colormap = FigureFactory ._unconvert_from_RGB_255 (colormap )
1859
+ else :
1860
+ if ('rgb' not in colors ) and ('#' not in colors ):
1861
+ scale_keys = list (plotly_scales .keys ())
1862
+ raise exceptions .PlotlyError ("If you input a string "
1863
+ "for 'colormap', it must "
1864
+ "either be a Plotly "
1865
+ "colorscale, an 'rgb' "
1866
+ "color or a hex color."
1867
+ "Valud plotly colorscale "
1868
+ "names are {}" .format (scale_keys ))
1869
+ # put colormap string into a list
1870
+ colors_list = []
1871
+ colors_list .append (colormap )
1872
+ colormap = colors_list
1873
+
1874
+
1875
+
1876
+
1877
+
1878
+
1879
+
1880
+
1881
+
1827
1882
if isinstance (colormap , str ):
1828
1883
if colormap not in plotly_scales :
1829
1884
scale_keys = list (plotly_scales .keys ())
0 commit comments