equinor/webviz-archived

Color choice in plotly plots

Closed this issue · 0 comments

Description

FanChart (and other plotly plots?) should improve on colors chosen. As in the example below, when two sets are used with check_box=True, the colors chosen for the user is orange and red. When in addition transparency is used for showing min-p10-mean-p90-max, it is not ideal choise of colors.

Expected behavior

When the number of input data sets is small, it should be possible to choose more distinct colors.

Actual behavior

WIth N=2 sets, red and orange are the colors chosen.

How to reproduce

from webviz import Webviz, Page
from webviz.page_elements import FanChart
import pandas as pd
from pandas.compat import StringIO

web = Webviz('Fan Chart Example')

lines = pd.read_csv(StringIO("""
index,name,mean,p10,p90,max,min,category
2012-01-01,line-1, 8, 9, 6, 10, 5,A
2012-01-02,line-1, 10, 12, 6, 20, 3,A
2012-01-03,line-1, 7, 9, 5, 14, 4,A
2012-01-04,line-1, 5, 6, 3, 7, 2,A
2012-01-05,line-1, 25, 26, 25, 26, 24,A
2012-01-06,line-1, 17, 18, 16, 18, 16,A
2012-01-07,line-1, 23, 24, 22, 25, 20,A
2012-01-08,line-1, 21, 23, 20, 23, 19,A
2012-01-09,line-1, 8, 8, 7, 9, 6,A
2012-01-10,line-1, 8, 9, 7, 10, 6,A
2012-01-01,line-2, 4, 5, 3, 8, 1,B
2012-01-02,line-2, 7, 12, 6, 14, 3,B
2012-01-03,line-2, -5, 9, 5, 14, 4,B
2012-01-04,line-2, 20, 21, 18, 21, 17,B
2012-01-05,line-2, 16, 19, 14, 21, 13,B
2012-01-06,line-2, 10, 15, 9, 16, 6,B
2012-01-07,line-2, 5, 6, 3, 7, 2,B
2012-01-08,line-2, 7, 8, 3, 10, 0,B
2012-01-09,line-2, 5, 6, 4, 8, 1,B
2012-01-10,line-2, 3, 3, 2, 3, 1,B
"""))

lines.set_index(pd.Index(lines['index'].values), inplace=True)
lines.drop(columns=['category'], inplace=True)

web.index.add_content(FanChart(lines, check_box=True))
web.write_html("./webviz_example", overwrite=True, display=True)

Screenshots

image