@@ -1114,13 +1114,13 @@ def build_dataframe(args, constructor):
1114
1114
1115
1115
if missing_bar_dim and constructor == go .Bar :
1116
1116
# now that we've populated df_output, we check to see if the non-missing
1117
- # dimensio is categorical: if so, then setting the missing dimension to a
1117
+ # dimension is categorical: if so, then setting the missing dimension to a
1118
1118
# constant 1 is a less-insane thing to do than setting it to the index by
1119
1119
# default and we let the normal auto-orientation-code do its thing later
1120
1120
other_dim = "x" if missing_bar_dim == "y" else "y"
1121
1121
if not _is_continuous (df_output , args [other_dim ]):
1122
- args [missing_bar_dim ] = missing_bar_dim
1123
- constants [missing_bar_dim ] = 1
1122
+ args [missing_bar_dim ] = "_count_"
1123
+ constants ["_count_" ] = 1
1124
1124
else :
1125
1125
# on the other hand, if the non-missing dimension is continuous, then we
1126
1126
# can use this information to override the normal auto-orientation code
@@ -1146,14 +1146,24 @@ def build_dataframe(args, constructor):
1146
1146
df_output [var_name ] = df_output [var_name ].astype (str )
1147
1147
args ["orientation" ] = args .get ("orientation" , None ) or "v"
1148
1148
orient_v = args ["orientation" ] == "v"
1149
- if constructor in [ go .Scatter , go . Bar ] :
1149
+ if constructor == go .Scatter :
1150
1150
args ["x" if orient_v else "y" ] = index_name
1151
1151
args ["y" if orient_v else "x" ] = "_value_"
1152
1152
args ["color" ] = args ["color" ] or var_name
1153
+ if constructor == go .Bar :
1154
+ if _is_continuous (df_output , "_value_" ):
1155
+ args ["x" if orient_v else "y" ] = index_name
1156
+ args ["y" if orient_v else "x" ] = "_value_"
1157
+ args ["color" ] = args ["color" ] or var_name
1158
+ else :
1159
+ args ["x" if orient_v else "y" ] = "_value_"
1160
+ args ["y" if orient_v else "x" ] = "_count_"
1161
+ df_output ["_count_" ] = 1
1162
+ args ["color" ] = args ["color" ] or var_name
1153
1163
if constructor in [go .Violin , go .Box ]:
1154
1164
args ["x" if orient_v else "y" ] = var_name
1155
1165
args ["y" if orient_v else "x" ] = "_value_"
1156
- if constructor in [ go .Histogram ] :
1166
+ if constructor == go .Histogram :
1157
1167
args ["x" if orient_v else "y" ] = "_value_"
1158
1168
args ["color" ] = args ["color" ] or var_name
1159
1169
0 commit comments