|
1936 | 1936 | " horizontal : bool\n", |
1937 | 1937 | " If the plot is horizontal.\n", |
1938 | 1938 | " \"\"\"\n", |
| 1939 | + " # Check if the custom_palette is a dictionary with two keys 0 and 1 (for filled bar coloring)\n", |
| 1940 | + " filled_bars = True if len(plot_palette_raw.keys())==2 and all(k in plot_palette_raw for k in [1, 0]) else False\n", |
| 1941 | + "\n", |
1939 | 1942 | " bar_width = barplot_kwargs.get('width', 0.5)\n", |
1940 | 1943 | " fontsize = barplot_kwargs.pop('fontsize')\n", |
1941 | 1944 | "\n", |
|
1963 | 1966 | " for hue_val in bar1_df[color_col]\n", |
1964 | 1967 | " ]\n", |
1965 | 1968 | " else:\n", |
1966 | | - " edge_colors = raw_colors\n", |
| 1969 | + " edge_colors = len(all_plot_groups)*['black',] if filled_bars else raw_colors\n", |
1967 | 1970 | "\n", |
1968 | 1971 | " bar1 = sns.barplot(\n", |
1969 | 1972 | " data=bar1_df,\n", |
|
1972 | 1975 | " ax=rawdata_axes,\n", |
1973 | 1976 | " order=all_plot_groups,\n", |
1974 | 1977 | " linewidth=2,\n", |
1975 | | - " facecolor=(1, 1, 1, 0),\n", |
| 1978 | + " facecolor=plot_palette_raw[0] if filled_bars else (1, 1, 1, 0),\n", |
1976 | 1979 | " edgecolor=edge_colors,\n", |
1977 | 1980 | " zorder=1,\n", |
1978 | 1981 | " orient=orient,\n", |
1979 | 1982 | " )\n", |
1980 | 1983 | "\n", |
| 1984 | + " if filled_bars:\n", |
| 1985 | + " barplot_kwargs['facecolor'] = plot_palette_raw[1]\n", |
| 1986 | + " barplot_kwargs['edgecolor'] = 'black'\n", |
| 1987 | + " barplot_kwargs['linewidth'] = 2\n", |
| 1988 | + " else:\n", |
| 1989 | + " barplot_kwargs['palette'] = plot_palette_raw\n", |
| 1990 | + "\n", |
1981 | 1991 | " bar2 = sns.barplot(\n", |
1982 | 1992 | " data=plot_data,\n", |
1983 | 1993 | " x=yvar if horizontal else xvar,\n", |
1984 | 1994 | " y=xvar if horizontal else yvar,\n", |
1985 | 1995 | " hue=xvar if color_col is None else color_col,\n", |
1986 | 1996 | " ax=rawdata_axes,\n", |
1987 | 1997 | " order=all_plot_groups,\n", |
1988 | | - " palette=plot_palette_raw,\n", |
1989 | 1998 | " dodge=False,\n", |
1990 | 1999 | " zorder=1,\n", |
1991 | 2000 | " orient=orient,\n", |
|
0 commit comments