|
967 | 967 | " else:\n", |
968 | 968 | " summary_xmin, summary_xmax = ax_to_plot.get_xlim()\n", |
969 | 969 | " summary_bars_colors = (\n", |
970 | | - " [summary_bars_kwargs.get('color')]*(max(summary_bars)+1)\n", |
| 970 | + " [summary_bars_kwargs.get('color')]*(max(ticks_to_plot)+1)\n", |
971 | 971 | " if summary_bars_kwargs.get('color') is not None\n", |
972 | | - " else ['black']*(max(summary_bars)+1)\n", |
| 972 | + " else ['black']*(max(ticks_to_plot)+1)\n", |
973 | 973 | " if color_col is not None or (proportional and is_paired) or is_paired \n", |
974 | 974 | " else list(plot_palette_raw.values())\n", |
975 | 975 | " )\n", |
|
1098 | 1098 | "\n", |
1099 | 1099 | " swarm_means = plot_data.groupby(xvar, observed=False)[yvar].mean().reindex(index=swarm_bars_order)\n", |
1100 | 1100 | " swarm_bars_colors = (\n", |
1101 | | - " [swarm_bars_kwargs.get('color')] * (max(swarm_bars_order) + 1) \n", |
| 1101 | + " [swarm_bars_kwargs.get('color')] * (len(swarm_bars_order) + 1) \n", |
1102 | 1102 | " if swarm_bars_kwargs.get('color') is not None \n", |
1103 | 1103 | " else ['black']*(len(swarm_bars_order)+1)\n", |
1104 | 1104 | " if color_col is not None or is_paired\n", |
|
1182 | 1182 | " delta_text_x_adjustment = delta_text_kwargs.get('x_adjust')\n", |
1183 | 1183 | "\n", |
1184 | 1184 | " if delta_text_x_coordinates is not None:\n", |
1185 | | - " if not isinstance(delta_text_x_coordinates, list):\n", |
| 1185 | + " if not isinstance(delta_text_x_coordinates, (list, tuple)) or not all(isinstance(x, (int, float)) for x in delta_text_x_coordinates):\n", |
1186 | 1186 | " raise TypeError(\"delta_text_kwargs['x_coordinates'] must be a list of x-coordinates.\")\n", |
1187 | | - " if len(delta_text_x_coordinates) != len(total_ticks):\n", |
| 1187 | + " if len(delta_text_x_coordinates) != total_ticks:\n", |
1188 | 1188 | " raise ValueError(\"delta_text_kwargs['x_coordinates'] must have the same length as the number of ticks to plot.\")\n", |
1189 | 1189 | " else:\n", |
1190 | 1190 | " delta_text_x_coordinates = ticks_to_plot\n", |
|
1201 | 1201 | " delta_text_y_coordinates = delta_text_kwargs.get('y_coordinates')\n", |
1202 | 1202 | "\n", |
1203 | 1203 | " if delta_text_y_coordinates is not None:\n", |
1204 | | - " if not isinstance(delta_text_y_coordinates, list):\n", |
| 1204 | + " if not isinstance(delta_text_y_coordinates, (list, tuple)) or not all(isinstance(y, (int, float)) for y in delta_text_y_coordinates):\n", |
1205 | 1205 | " raise TypeError(\"delta_text_kwargs['y_coordinates'] must be a list of y-coordinates.\")\n", |
1206 | | - " if len(delta_text_y_coordinates) != len(total_ticks):\n", |
| 1206 | + " if len(delta_text_y_coordinates) != total_ticks:\n", |
1207 | 1207 | " raise ValueError(\"delta_text_kwargs['y_coordinates'] must have the same length as the number of ticks to plot.\")\n", |
1208 | 1208 | " else:\n", |
1209 | 1209 | " delta_text_y_coordinates = Delta_Values\n", |
|
0 commit comments