santosjorge / cufflinks

Productivity Tools for Plotly + Pandas
MIT License
3.04k stars 675 forks source link

color range for charts #243

Open Rob-Hulley opened 4 years ago

Rob-Hulley commented 4 years ago

I have a complex subplot chart. Each subplot has 16 values, the color range appear to have 10 values and then it tries to repeat the same 10 values with a different opacity to make it slightly different. The first value of the 10 is orange, the last value of the 10 is lightblue2, The first value of the next 10 is lightblue2, followed by orange. In a stacked chart 2 lightblue2 values next to each other are hard to read. Why do we not start again from orange? I have attached a html sample of the issue, look at the 256KB and 512KB entries. I am using cf.subplot to create the charts. I cannot find a way to specify a longer color pallet.

hist_vlun_size_ALL.zip

santosjorge commented 4 years ago

Hi - you can pass a colorange=[list of colors]. This will override the default colorange.

Rob-Hulley commented 4 years ago

Thanks for the reply. I am having trouble trying to implement this, do you have an example?

This is my code and what I have tried: Current code: fig1 = cf.subplots([fig1_df.loc[:,('iops_r')].figure(kind='scatter'), fig1_df.loc[:,('iops_w')].figure(kind='scatter'), fig1_df.loc[:,('kbps_r')].figure(kind='scatter'), fig1_df.loc[:,('kbps_w')].figure(kind='scatter'), fig1_df.loc[:,('svt_r')].figure(kind='scatter'), fig1_df.loc[:,('svt_w')].figure(kind='scatter'), fig1_df.loc[:,('idlepct_t')].figure(kind='scatter')], shape=(),shared_xaxes=True,shared_yaxes=True,vertical_spacing=0.03,subplot_titles=("Read IOPs","Write IOPs","Read KiBs", "Write KiBs", "Read Svt","Write Svt","Drive Idle %"))

If I add colorange: I get error: TypeError: make_subplots() got unexpected keyword argument(s): ['colorange']

fig1 = cf.subplots([fig1_df.loc[:,('iops_r')].figure(kind='scatter'), fig1_df.loc[:,('iops_w')].figure(kind='scatter'), fig1_df.loc[:,('kbps_r')].figure(kind='scatter'), fig1_df.loc[:,('kbps_w')].figure(kind='scatter'), fig1_df.loc[:,('svt_r')].figure(kind='scatter'), fig1_df.loc[:,('svt_w')].figure(kind='scatter'), fig1_df.loc[:,('idlepct_t')].figure(kind='scatter')], shape=(),shared_xaxes=True,shared_yaxes=True,vertical_spacing=0.03,subplot_titles=("Read IOPs","Write IOPs","Read KiBs", "Write KiBs", "Read Svt","Write Svt","Drive Idle %"),colorange=['red','green','orange','purple'])