jsongrapher 4.3__py3-none-any.whl → 4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- JSONGrapher/JSONRecordCreator.py +62 -20
- JSONGrapher/styles/trace_styles_collection_library.py +14 -0
- JSONGrapher/version.py +1 -1
- {jsongrapher-4.3.dist-info → jsongrapher-4.4.dist-info}/METADATA +1 -1
- {jsongrapher-4.3.dist-info → jsongrapher-4.4.dist-info}/RECORD +10 -10
- {jsongrapher-4.3.data → jsongrapher-4.4.data}/data/LICENSE.txt +0 -0
- {jsongrapher-4.3.data → jsongrapher-4.4.data}/data/README.md +0 -0
- {jsongrapher-4.3.dist-info → jsongrapher-4.4.dist-info}/LICENSE.txt +0 -0
- {jsongrapher-4.3.dist-info → jsongrapher-4.4.dist-info}/WHEEL +0 -0
- {jsongrapher-4.3.dist-info → jsongrapher-4.4.dist-info}/top_level.txt +0 -0
JSONGrapher/JSONRecordCreator.py
CHANGED
@@ -2220,16 +2220,19 @@ def apply_trace_style_to_single_data_series(data_series, trace_styles_collection
|
|
2220
2220
|
if isinstance(trace_style, str): #check if it is a string type.
|
2221
2221
|
if "__" in trace_style:
|
2222
2222
|
trace_style, colorscale = trace_style.split("__")
|
2223
|
+
if ("bubble" in trace_style) and ("bubble3d" not in trace_style) and ("bubble2d" not in trace_style):
|
2224
|
+
trace_style = trace_style.replace("bubble", "bubble2d")
|
2223
2225
|
|
2224
2226
|
colorscale_structure = "" #initialize this variable for use later. It tells us which fields to put the colorscale related values in. This should be done before regular trace_style fields are applied.
|
2225
2227
|
#3D and bubble plots will have a colorscale by default.
|
2226
|
-
if trace_style
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2228
|
+
if isinstance(trace_style,str):
|
2229
|
+
if "bubble" in trace_style.lower(): #for bubble trace styles (both 2D and 3D), we need to prepare the bubble sizes. We also need to do this before the styles_dict collection is accessed, since then the trace_style becomes a dictionary.
|
2230
|
+
data_series = prepare_bubble_sizes(data_series)
|
2231
|
+
colorscale_structure = "bubble"
|
2232
|
+
elif "mesh3d" in trace_style.lower():
|
2233
|
+
colorscale_structure = "mesh3d"
|
2234
|
+
elif "scatter3d" in trace_style.lower():
|
2235
|
+
colorscale_structure = "scatter3d"
|
2233
2236
|
|
2234
2237
|
if trace_style in styles_collection_dict:
|
2235
2238
|
trace_style = styles_collection_dict.get(trace_style)
|
@@ -2249,7 +2252,7 @@ def apply_trace_style_to_single_data_series(data_series, trace_styles_collection
|
|
2249
2252
|
data_series[key] = value # Direct assignment for non-dictionary values
|
2250
2253
|
|
2251
2254
|
#Before applying colorscales, we check if we have recieved a colorscale from the user. If so, we'll need to parse the trace_type to assign the colorscale structure.
|
2252
|
-
if colorscale != "":
|
2255
|
+
if ((colorscale_structure == "") and (colorscale != "")):
|
2253
2256
|
#If it is a scatter plot with markers, then the colorscale_structure will be marker. Need to check for this before the lines alone case.
|
2254
2257
|
if ("markers" in data_series["mode"]) or ("markers+lines" in data_series["mode"]) or ("lines+markers" in data_series["mode"]):
|
2255
2258
|
colorscale_structure = "marker"
|
@@ -2269,6 +2272,8 @@ def apply_trace_style_to_single_data_series(data_series, trace_styles_collection
|
|
2269
2272
|
|
2270
2273
|
if colorscale_structure == "bubble":
|
2271
2274
|
#data_series["marker"]["colorscale"] = "viridis_r" #https://plotly.com/python/builtin-colorscales/
|
2275
|
+
if colorscale != "": #this means there is a user specified colorscale.
|
2276
|
+
data_series["marker"]["colorscale"] = colorscale
|
2272
2277
|
data_series["marker"]["showscale"] = True
|
2273
2278
|
if "z" in data_series:
|
2274
2279
|
color_values = clean_color_values(list_of_values= data_series["z"], variable_string_for_warning="z")
|
@@ -2278,6 +2283,8 @@ def apply_trace_style_to_single_data_series(data_series, trace_styles_collection
|
|
2278
2283
|
data_series["marker"]["color"] = color_values
|
2279
2284
|
elif colorscale_structure == "scatter3d":
|
2280
2285
|
#data_series["marker"]["colorscale"] = "viridis_r" #https://plotly.com/python/builtin-colorscales/
|
2286
|
+
if colorscale != "": #this means there is a user specified colorscale.
|
2287
|
+
data_series["marker"]["colorscale"] = colorscale
|
2281
2288
|
data_series["marker"]["showscale"] = True
|
2282
2289
|
if "z" in data_series:
|
2283
2290
|
color_values = clean_color_values(list_of_values= data_series["z"], variable_string_for_warning="z")
|
@@ -2287,6 +2294,8 @@ def apply_trace_style_to_single_data_series(data_series, trace_styles_collection
|
|
2287
2294
|
data_series["marker"]["color"] = color_values
|
2288
2295
|
elif colorscale_structure == "mesh3d":
|
2289
2296
|
#data_series["colorscale"] = "viridis_r" #https://plotly.com/python/builtin-colorscales/
|
2297
|
+
if colorscale != "": #this means there is a user specified colorscale.
|
2298
|
+
data_series["colorscale"] = colorscale
|
2290
2299
|
data_series["showscale"] = True
|
2291
2300
|
if "z" in data_series:
|
2292
2301
|
color_values = clean_color_values(list_of_values= data_series["z"], variable_string_for_warning="z")
|
@@ -2314,10 +2323,18 @@ def prepare_bubble_sizes(data_series):
|
|
2314
2323
|
#We also will scale them to some maximum bubble size that is specifed.
|
2315
2324
|
if "marker" not in data_series:
|
2316
2325
|
data_series["marker"] = {}
|
2317
|
-
if "
|
2326
|
+
if "bubble_sizes" in data_series:
|
2327
|
+
if isinstance(data_series["bubble_sizes"], str): #if bubble sizes is a string, it must be a variable name to use for the bubble sizes.
|
2328
|
+
bubble_sizes_variable_name = data_series["bubble_sizes"]
|
2329
|
+
data_series["marker"]["size"] = data_series[bubble_sizes_variable_name]
|
2330
|
+
else:
|
2331
|
+
data_series["marker"]["size"] = data_series["bubble_sizes"]
|
2332
|
+
elif "z_points" in data_series:
|
2318
2333
|
data_series["marker"]["size"] = data_series["z_points"]
|
2319
2334
|
elif "z" in data_series:
|
2320
2335
|
data_series["marker"]["size"] = data_series["z"]
|
2336
|
+
elif "y" in data_series:
|
2337
|
+
data_series["marker"]["size"] = data_series["y"]
|
2321
2338
|
|
2322
2339
|
#now need to normalize to the max value in the list.
|
2323
2340
|
def normalize_to_max(starting_list):
|
@@ -2442,7 +2459,11 @@ def extract_trace_style_from_data_series_dict(data_series_dict, new_trace_style_
|
|
2442
2459
|
additional_attributes_to_extract = []
|
2443
2460
|
|
2444
2461
|
if new_trace_style_name=='':
|
2445
|
-
|
2462
|
+
#Check if there is a current trace style that is a string, and use that for the name if present.
|
2463
|
+
current_trace_style = data_series_dict.get("trace_style", "")
|
2464
|
+
if isinstance(current_trace_style, str):
|
2465
|
+
new_trace_style_name = current_trace_style
|
2466
|
+
#if there is still no new_trace_style_name, we will name it 'custom'
|
2446
2467
|
if new_trace_style_name=='':
|
2447
2468
|
new_trace_style_name = "custom"
|
2448
2469
|
|
@@ -3120,19 +3141,40 @@ def remove_bubble_fields(fig_dict):
|
|
3120
3141
|
#This code will modify the data_series inside the fig_dict, directly.
|
3121
3142
|
bubble_found = False #initialize with false case.
|
3122
3143
|
for data_series in fig_dict["data"]:
|
3123
|
-
|
3124
|
-
|
3144
|
+
trace_style = data_series.get("trace_style") #trace_style will be None of the key is not present.
|
3145
|
+
|
3146
|
+
if isinstance(trace_style, str):
|
3147
|
+
#If the style is just "bubble" (not explicitly 2D or 3D), default to bubble2d for backward compatibility
|
3148
|
+
if ("bubble" in trace_style) and ("bubble3d" not in trace_style) and ("bubble2d" not in trace_style):
|
3149
|
+
trace_style = trace_style.replace("bubble", "bubble2d")
|
3150
|
+
if ("bubble" in trace_style.lower()) or ("max_bubble_size" in data_series):
|
3125
3151
|
bubble_found = True
|
3126
|
-
if bubble_found
|
3127
|
-
if "
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3152
|
+
if bubble_found is True:
|
3153
|
+
if "bubble2d" in trace_style.lower(): #pop the z variable if it's a bubble2d.
|
3154
|
+
if "z" in data_series:
|
3155
|
+
data_series.pop("z")
|
3156
|
+
if "z_points" in data_series:
|
3157
|
+
data_series.pop("z_points")
|
3131
3158
|
if "max_bubble_size" in data_series:
|
3132
3159
|
data_series.pop("max_bubble_size")
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3160
|
+
if "bubble_sizes" in data_series:
|
3161
|
+
# Now, need to check if the bubble_size is a variable that should be deleted.
|
3162
|
+
# That will be if it is a string, and also not a standard variable.
|
3163
|
+
if isinstance(data_series["bubble_sizes"], str):
|
3164
|
+
bubble_sizes_variable_name = data_series["bubble_sizes"]
|
3165
|
+
# For bubble2d case, will remove anything that is not x or y.
|
3166
|
+
if "bubble2d" in trace_style.lower():
|
3167
|
+
if bubble_sizes_variable_name not in ("x", "y"):
|
3168
|
+
data_series.pop(bubble_sizes_variable_name, None)
|
3169
|
+
if "bubble3d" in trace_style.lower():
|
3170
|
+
if bubble_sizes_variable_name not in ("x", "y", "z"):
|
3171
|
+
data_series.pop(bubble_sizes_variable_name, None)
|
3172
|
+
# next, remove bubble_sizes since it's not needed anymore and should be removed.
|
3173
|
+
data_series.pop("bubble_sizes")
|
3174
|
+
# need to remove "zaxis" if making a bubble2d.
|
3175
|
+
if "bubble2d" in trace_style.lower():
|
3176
|
+
if "zaxis" in fig_dict["layout"]:
|
3177
|
+
fig_dict["layout"].pop("zaxis")
|
3136
3178
|
return fig_dict
|
3137
3179
|
|
3138
3180
|
def update_3d_axes(fig_dict):
|
@@ -42,6 +42,15 @@ styles_library = {
|
|
42
42
|
"showscale": True
|
43
43
|
}
|
44
44
|
},
|
45
|
+
"bubble2d": {
|
46
|
+
"type": "scatter",
|
47
|
+
"mode": "markers",
|
48
|
+
"marker": {
|
49
|
+
"color": "auto",
|
50
|
+
"colorscale": "viridis_r",
|
51
|
+
"showscale": True
|
52
|
+
}
|
53
|
+
},
|
45
54
|
"spline": {
|
46
55
|
"type": "scatter",
|
47
56
|
"mode": "lines",
|
@@ -76,6 +85,11 @@ styles_library = {
|
|
76
85
|
"colorscale":"rainbow",
|
77
86
|
"showscale":True
|
78
87
|
},
|
88
|
+
"bubble3d": {
|
89
|
+
"mode": "markers",
|
90
|
+
"type": "scatter3d",
|
91
|
+
"marker": {"color" : "","colorscale":"rainbow", "showscale":True}
|
92
|
+
},
|
79
93
|
"heatmap": {
|
80
94
|
"type": "heatmap",
|
81
95
|
"colorscale": "Viridis",
|
JSONGrapher/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '4.
|
1
|
+
__version__ = '4.4'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
JSONGrapher/JSONRecordCreator.py,sha256=
|
1
|
+
JSONGrapher/JSONRecordCreator.py,sha256=7AlusrLNjMkqOZd3A_Kb_tyhqF-QOvRn7uQQGaXybFY,218318
|
2
2
|
JSONGrapher/UnitPytesting.py,sha256=xizJ-2fg9C5oNMFJyfavbBLMusayE9KWQiYIRrQQd4A,4363
|
3
3
|
JSONGrapher/UnitpyCustomUnitsTesting.py,sha256=Rwq5p8HXN0FP54lRFgLTV0kgJ9TpcFaD3_C0MEOoEzw,1297
|
4
4
|
JSONGrapher/__init__.py,sha256=fA3R6paWq3uskiLe3OglQZY_uJOejZHMFKdyX0dXWjo,310
|
@@ -6,14 +6,14 @@ JSONGrapher/drag_and_drop_gui.py,sha256=-7QJHLhzadHotWhONH4inerMaZ_xuwoTQSMRF_MP
|
|
6
6
|
JSONGrapher/equation_creator.py,sha256=VFu6dFo-C0wDf1N3e0CyCBI-53cCUrp3oe0umdMLofs,17968
|
7
7
|
JSONGrapher/equation_evaluator.py,sha256=Cm7UK5vWa6fT0OylD9f22_eR8zUvxY_Sy_W6n6N9bew,37012
|
8
8
|
JSONGrapher/units_list.py,sha256=ROrlAsD66oPozZmOaE65xjNUEg3CxkSmA8iPE2_ihYI,34438
|
9
|
-
JSONGrapher/version.py,sha256=
|
9
|
+
JSONGrapher/version.py,sha256=qBnDha-1O1-zjh3MFXQsOlQrB1ykLZIoeKE5jHBMh-k,19
|
10
10
|
JSONGrapher/styles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
JSONGrapher/styles/layout_styles_library.py,sha256=adGZNVAj_VysYX-9x1NqxDnhIQFtKsMW8swGaY30ocs,3100
|
12
|
-
JSONGrapher/styles/trace_styles_collection_library.py,sha256=
|
13
|
-
jsongrapher-4.
|
14
|
-
jsongrapher-4.
|
15
|
-
jsongrapher-4.
|
16
|
-
jsongrapher-4.
|
17
|
-
jsongrapher-4.
|
18
|
-
jsongrapher-4.
|
19
|
-
jsongrapher-4.
|
12
|
+
JSONGrapher/styles/trace_styles_collection_library.py,sha256=4WhrmsSotPGRwFplGPoRjTiyFd3PMneg5mUewjZMK88,6437
|
13
|
+
jsongrapher-4.4.data/data/LICENSE.txt,sha256=7Guw_pmj_H4sApnM7fld2L4HH6CP-3ZYdFoOXtHFx0Y,1489
|
14
|
+
jsongrapher-4.4.data/data/README.md,sha256=u9uRPF0T12Pl6M6qjEleXZoB41ye0VTQPCJpEdldwNU,8157
|
15
|
+
jsongrapher-4.4.dist-info/LICENSE.txt,sha256=7Guw_pmj_H4sApnM7fld2L4HH6CP-3ZYdFoOXtHFx0Y,1489
|
16
|
+
jsongrapher-4.4.dist-info/METADATA,sha256=XwDZLT51CId5nJG7-Mu-885q8NmVDvt168xza0qEuvc,9231
|
17
|
+
jsongrapher-4.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
18
|
+
jsongrapher-4.4.dist-info/top_level.txt,sha256=5f7Ui2hCKCPTQOjD540WKghKNYOvUDNfdpnDbIlAD3Y,12
|
19
|
+
jsongrapher-4.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|