Example #1
0
 def choose_light_palette_husl(h=(0, 359),
                               s=(0, 99),
                               l=(0, 99),
                               n=(3, 17)):
     color = h, s, l
     pal[:] = light_palette(color, n, input="husl")
     palplot(pal)
     if as_cmap:
         colors = light_palette(color, 256, input="husl")
         _update_lut(cmap, colors)
Example #2
0
 def choose_light_palette_hls(h=(0., 1.),
                              l=(0., 1.),
                              s=(0., 1.),
                              n=(3, 17)):
     color = h, l, s
     pal[:] = light_palette(color, n, input="hls")
     palplot(pal)
     if as_cmap:
         colors = light_palette(color, 256, input="husl")
         _update_lut(cmap, colors)
Example #3
0
 def choose_light_palette_rgb(r=(0., 1.),
                              g=(0., 1.),
                              b=(0., 1.),
                              n=(3, 17)):
     color = r, g, b
     pal[:] = light_palette(color, n, input="rgb")
     palplot(pal)
     if as_cmap:
         colors = light_palette(color, 256, input="husl")
         _update_lut(cmap, colors)
Example #4
0
 def choose_diverging(name=opts,
                      n=(2, 16),
                      desat=FloatSliderWidget(min=0, max=1, value=1),
                      variant=variants):
     if variant == "reverse":
         name += "_r"
     pal[:] = color_palette(name, n, desat)
     palplot(pal)
     if as_cmap:
         colors = color_palette(name, 256, desat)
         _update_lut(cmap, np.c_[colors, np.ones(256)])
Example #5
0
 def choose_cubehelix(n_colors=IntSliderWidget(min=2, max=16, value=9),
                      start=FloatSliderWidget(min=0, max=3, value=0),
                      rot=FloatSliderWidget(min=-1, max=1, value=.4),
                      gamma=FloatSliderWidget(min=0, max=5, value=1),
                      hue=FloatSliderWidget(min=0, max=1, value=.8),
                      light=FloatSliderWidget(min=0, max=1, value=.85),
                      dark=FloatSliderWidget(min=0, max=1, value=.15),
                      reverse=False):
     pal[:] = cubehelix_palette(n_colors, start, rot, gamma, hue, light,
                                dark, reverse)
     palplot(pal)
     if as_cmap:
         colors = cubehelix_palette(256, start, rot, gamma, hue, light,
                                    dark, reverse)
         _update_lut(cmap, np.c_[colors, np.ones(256)])
Example #6
0
 def choose_diverging_palette(h_neg=IntSliderWidget(min=0,
                                                    max=359,
                                                    value=220),
                              h_pos=IntSliderWidget(min=0,
                                                    max=359,
                                                    value=10),
                              s=IntSliderWidget(min=0, max=99, value=74),
                              l=IntSliderWidget(min=0, max=99, value=50),
                              sep=IntSliderWidget(min=1, max=50, value=10),
                              n=(2, 16),
                              center=["light", "dark"]):
     pal[:] = diverging_palette(h_neg, h_pos, s, l, sep, n, center)
     palplot(pal)
     if as_cmap:
         colors = diverging_palette(h_neg, h_pos, s, l, sep, 256, center)
         _update_lut(cmap, colors)
Example #7
0
    def test_palplot_size(self):
        """
        The plot that is made must have the right dimensions.
        """
        pal4 = color_palette("husl", 4)
        misc.palplot(pal4)
        size4 = plt.gcf().get_size_inches()
        self.assertEqual(tuple(size4), (4, 1))

        pal5 = color_palette("husl", 5)
        misc.palplot(pal5)
        size5 = plt.gcf().get_size_inches()
        self.assertEqual(tuple(size5), (5, 1))

        palbig = color_palette("husl", 3)
        misc.palplot(palbig, 2)
        sizebig = plt.gcf().get_size_inches()
        self.assertEqual(tuple(sizebig), (6, 2))

        plt.close("all")
Example #8
0
 def choose_qualitative(name=opts,
                        n=(2, 16),
                        desat=FloatSliderWidget(min=0, max=1, value=1)):
     pal[:] = color_palette(name, n, desat)
     palplot(pal)