facebookresearch/hiplot

Change color palette

zzzbobml opened this issue · 2 comments

Is it possible to change color palette to the plot (for example, blues, reds, etc..)?

Hi @zzzbobml
It's indeed possible to change the colormap of the plot. Assuming you are using hiplot in a notebook, you can do something like:

# Create your experiment as usual
import hiplot as hip
data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'},
        {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'},
        {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}]
exp = hip.Experiment.from_iterable(data)
# Do this before calling `display`:
# Select a colormap from https://github.com/d3/d3-scale-chromatic
exp.colormap = "interpolateWarm"
exp.display()

I hope this helps :)

Hi, I'm using the React component and I cannot for the life of me figure out how to change the colors. I have a colorby column with 3 options and I'd like to be able to set specific colors.

Nevermind, I finally figured it out.

 experiment.parameters_definition = {
    Size: {
      type: 'categorical',
      colors: {
        Small: 'rgb(236, 217, 72)',
        Medium: 'rgb(78, 121, 167)',
        Large: 'rgb(255, 87, 89)',
      },
      colormap: null,
      force_value_min: null,
      force_value_max: null,
      label_css: null,
      label_html: null,
    },
  };

Where Size is the name of my colorby column.