Skip to content

Instantly share code, notes, and snippets.

@shunkino
Created November 28, 2018 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shunkino/ebf266ce0e316e27c26a159f5bd9a7cb to your computer and use it in GitHub Desktop.
Save shunkino/ebf266ce0e316e27c26a159f5bd9a7cb to your computer and use it in GitHub Desktop.
Function to convert colorscale format. for my blog.
import numpy as np
import colorlover as cl
def convert_colorscale_format(colorscale):
plotly_colorscale = []
for index, sec_value in enumerate(np.linspace(0, 1, len(colorscale))):
plotly_colorscale.append([sec_value, colorscale[index]])
return plotly_colorscale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment