plotly-extend-wrapper 1.1.0__py3-none-any.whl → 1.2.0__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.
- plotly_extend_wrapper/wrapper.py +24 -13
- {plotly_extend_wrapper-1.1.0.dist-info → plotly_extend_wrapper-1.2.0.dist-info}/METADATA +8 -21
- plotly_extend_wrapper-1.2.0.dist-info/RECORD +8 -0
- {plotly_extend_wrapper-1.1.0.dist-info → plotly_extend_wrapper-1.2.0.dist-info}/WHEEL +1 -1
- plotly_extend_wrapper-1.1.0.dist-info/RECORD +0 -8
- {plotly_extend_wrapper-1.1.0.dist-info → plotly_extend_wrapper-1.2.0.dist-info}/licenses/LICENSE +0 -0
plotly_extend_wrapper/wrapper.py
CHANGED
|
@@ -5,6 +5,7 @@ from plotly_extend_wrapper.common import check_directory
|
|
|
5
5
|
from plotly import graph_objects as go
|
|
6
6
|
from scipy.interpolate import griddata
|
|
7
7
|
import numpy as np
|
|
8
|
+
from copy import deepcopy
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def Plot_pie(data: pd.DataFrame, target: str, **kwargs):
|
|
@@ -112,7 +113,8 @@ class Plot_bubble_chart:
|
|
|
112
113
|
if len(grouper) == 0:
|
|
113
114
|
return vc
|
|
114
115
|
else:
|
|
115
|
-
max_probs = vc.groupby(
|
|
116
|
+
max_probs = vc.groupby(
|
|
117
|
+
grouper)["count"].max().reset_index(name="max")
|
|
116
118
|
max_value = max_probs["max"].max()
|
|
117
119
|
max_probs["ratio"] = max_value / max_probs["max"]
|
|
118
120
|
smooth_dict = max_probs.set_index(grouper)["ratio"].to_dict()
|
|
@@ -125,7 +127,8 @@ class Plot_bubble_chart:
|
|
|
125
127
|
|
|
126
128
|
def _value_counts(self):
|
|
127
129
|
cols = [self.x, self.y]
|
|
128
|
-
grouper = list(
|
|
130
|
+
grouper = list(
|
|
131
|
+
filter(None, [self.color, self.facet_col, self.facet_row]))
|
|
129
132
|
if len(grouper) == 0:
|
|
130
133
|
vc = self.df.value_counts(
|
|
131
134
|
subset=cols, normalize=self.normalize
|
|
@@ -156,13 +159,15 @@ class Plot_bubble_chart:
|
|
|
156
159
|
)
|
|
157
160
|
|
|
158
161
|
for col, decimal in zip(self.rounded, self.decimals):
|
|
159
|
-
df.loc[:, f"{col}_rounded"] = df.loc[:,
|
|
162
|
+
df.loc[:, f"{col}_rounded"] = df.loc[:,
|
|
163
|
+
col].round(decimals=decimal)
|
|
160
164
|
if self.x == col:
|
|
161
165
|
self.x = f"{col}_rounded"
|
|
162
166
|
elif self.y == col:
|
|
163
167
|
self.y = f"{col}_rounded"
|
|
164
168
|
else:
|
|
165
|
-
raise ValueError(
|
|
169
|
+
raise ValueError(
|
|
170
|
+
f"{col} is not indicated. Check parameters")
|
|
166
171
|
|
|
167
172
|
return df
|
|
168
173
|
|
|
@@ -249,7 +254,8 @@ def Plot_line(
|
|
|
249
254
|
|
|
250
255
|
plot_all_cols = pd.Series(y + secondary_y)
|
|
251
256
|
if (~plot_all_cols.isin(df.columns)).any():
|
|
252
|
-
not_include_cols = plot_all_cols[~plot_all_cols.isin(
|
|
257
|
+
not_include_cols = plot_all_cols[~plot_all_cols.isin(
|
|
258
|
+
df.columns)].tolist()
|
|
253
259
|
raise ValueError(f"{not_include_cols} columns are not in dataframe")
|
|
254
260
|
|
|
255
261
|
y = [c for c in y if c not in secondary_y]
|
|
@@ -262,7 +268,8 @@ def Plot_line(
|
|
|
262
268
|
|
|
263
269
|
subfig = make_subplots(specs=[[{"secondary_y": True}]])
|
|
264
270
|
fig = px.line(df, x=x, y=y, **px_kwargs)
|
|
265
|
-
fig2 = px.line(df, x=x, y=secondary_y,
|
|
271
|
+
fig2 = px.line(df, x=x, y=secondary_y,
|
|
272
|
+
line_dash_sequence=["dash"], **px_kwargs)
|
|
266
273
|
fig2.update_traces(yaxis="y2")
|
|
267
274
|
|
|
268
275
|
subfig.add_traces(fig.data + fig2.data)
|
|
@@ -367,10 +374,14 @@ def Plot_bubble_chart_with_line(
|
|
|
367
374
|
)
|
|
368
375
|
|
|
369
376
|
subfig = make_subplots()
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
377
|
+
for trace in bubble_plot.data + line_plot.data:
|
|
378
|
+
subfig.add_trace(trace)
|
|
379
|
+
if xtitle is not None:
|
|
380
|
+
subfig.layout.xaxis.title = xtitle
|
|
381
|
+
if ytitle is not None:
|
|
382
|
+
subfig.layout.yaxis.title = ytitle
|
|
383
|
+
original_layout = deepcopy(bubble_plot.layout)
|
|
384
|
+
subfig.update_layout(original_layout, **kwargs)
|
|
374
385
|
return subfig
|
|
375
386
|
|
|
376
387
|
|
|
@@ -391,7 +402,7 @@ def Plot_surface(
|
|
|
391
402
|
xi = np.linspace(x.min(), x.max(), num)
|
|
392
403
|
yi = np.linspace(y.min(), y.max(), num)
|
|
393
404
|
xi, yi = np.meshgrid(xi, yi)
|
|
394
|
-
zi = griddata((x,y), z, (xi.ravel(), yi.ravel()), method="cubic")
|
|
405
|
+
zi = griddata((x, y), z, (xi.ravel(), yi.ravel()), method="cubic")
|
|
395
406
|
zi = zi.reshape(xi.shape)
|
|
396
407
|
zi = np.nan_to_num(zi)
|
|
397
408
|
return xi, yi, zi
|
|
@@ -402,13 +413,13 @@ def Plot_surface(
|
|
|
402
413
|
Z = df[z].values
|
|
403
414
|
X, Y, Z = smooth_df(X, Y, Z, smooth_point_num)
|
|
404
415
|
else:
|
|
405
|
-
pivot_df = pd.pivot_table(
|
|
416
|
+
pivot_df = pd.pivot_table(
|
|
417
|
+
df, index=x, columns=y, values=z, fill_value=fill_value)
|
|
406
418
|
|
|
407
419
|
X = pivot_df.columns.values
|
|
408
420
|
Y = pivot_df.index.values
|
|
409
421
|
Z = pivot_df.values
|
|
410
422
|
|
|
411
|
-
|
|
412
423
|
data = [go.Surface(x=X, y=Y, z=Z)]
|
|
413
424
|
layout = go.Layout(
|
|
414
425
|
title=title,
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: plotly-extend-wrapper
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Author-email: Laplusdestiny <prayonshootingstars@gmail.com>
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.9
|
|
7
7
|
Requires-Dist: kaleido==0.2.1
|
|
8
|
+
Requires-Dist: nbformat>=4.2.0
|
|
9
|
+
Requires-Dist: numpy>=1.24.0
|
|
8
10
|
Requires-Dist: pandas>=2.0.0
|
|
9
|
-
Requires-Dist: plotly>=5.
|
|
11
|
+
Requires-Dist: plotly>=5.12.0
|
|
10
12
|
Requires-Dist: pyarrow>=10.0.0
|
|
11
|
-
Requires-Dist: scipy>=1.
|
|
13
|
+
Requires-Dist: scipy>=1.8.0
|
|
12
14
|
Description-Content-Type: text/markdown
|
|
13
15
|
|
|
14
16
|
# plotly_extend_wrapper
|
|
@@ -29,6 +31,7 @@ You can make plot simply
|
|
|
29
31
|
- Plotly >= 5.0.0
|
|
30
32
|
- kaleido = 0.2.1
|
|
31
33
|
- pandas >= 2.2.0
|
|
34
|
+
- scipy >= 1.12.0
|
|
32
35
|
|
|
33
36
|
## Graph
|
|
34
37
|
|
|
@@ -37,23 +40,7 @@ You can make plot simply
|
|
|
37
40
|
- Bubble (`wrapper.Plot_bubble_chart`)
|
|
38
41
|
- Line with secondary y-axis (`wrapper.Plot_line`)
|
|
39
42
|
- Bubble with linear line (`wrapper.Plot_bubble_with_line`)
|
|
40
|
-
|
|
41
|
-
## Common function
|
|
42
|
-
|
|
43
|
-
- updater
|
|
44
|
-
- Add options
|
|
45
|
-
- Available options
|
|
46
|
-
- x-axis title
|
|
47
|
-
- y-axis title
|
|
48
|
-
- secondary_y-axis title
|
|
49
|
-
- show legend
|
|
50
|
-
- height
|
|
51
|
-
- width
|
|
52
|
-
- marker size
|
|
53
|
-
- common
|
|
54
|
-
- check_directory
|
|
55
|
-
- Check directory with pathlib
|
|
56
|
-
- Make directory if parent directory doesn't exist
|
|
43
|
+
- Surface (`wrapper.Plot_surface`)
|
|
57
44
|
|
|
58
45
|
|
|
59
46
|
## Issue
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
plotly_extend_wrapper/__init__.py,sha256=0_Vut6cAmxsQUIfqkfwxf1WTG10IJseCqoEcXVGfB-Q,154
|
|
2
|
+
plotly_extend_wrapper/common.py,sha256=il-4w-f7gsgKuHKHyy-lAbema6-ADdRFdHXZNTYSdhk,262
|
|
3
|
+
plotly_extend_wrapper/updater.py,sha256=Q-O5FC7z_y1Xel24rBaaiN7MPOQqOy5wG7bpth_VVts,2510
|
|
4
|
+
plotly_extend_wrapper/wrapper.py,sha256=T1cpVJ9hbmO_aFPQ9jtQMRWCUuxCA8h4Ndk89UG6U8w,12763
|
|
5
|
+
plotly_extend_wrapper-1.2.0.dist-info/METADATA,sha256=91k2H2qgNB2G24CaXrr7KHFDAPEXy0HOKpfUG1FzhXw,1802
|
|
6
|
+
plotly_extend_wrapper-1.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
plotly_extend_wrapper-1.2.0.dist-info/licenses/LICENSE,sha256=LanHfVWzsvc8f0WfJlk8s_qAhDW1RdNJMYDjDMJvl1Y,1070
|
|
8
|
+
plotly_extend_wrapper-1.2.0.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
plotly_extend_wrapper/__init__.py,sha256=0_Vut6cAmxsQUIfqkfwxf1WTG10IJseCqoEcXVGfB-Q,154
|
|
2
|
-
plotly_extend_wrapper/common.py,sha256=il-4w-f7gsgKuHKHyy-lAbema6-ADdRFdHXZNTYSdhk,262
|
|
3
|
-
plotly_extend_wrapper/updater.py,sha256=Q-O5FC7z_y1Xel24rBaaiN7MPOQqOy5wG7bpth_VVts,2510
|
|
4
|
-
plotly_extend_wrapper/wrapper.py,sha256=sn2TngeQlY4WaHsx3ygtl6euPoyQJxG4Y_FIZuG_EWA,12427
|
|
5
|
-
plotly_extend_wrapper-1.1.0.dist-info/METADATA,sha256=y86e5vkjQPTAA2sUccoxlqsl_0acdUBw5_cto9qn5Qw,2006
|
|
6
|
-
plotly_extend_wrapper-1.1.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
7
|
-
plotly_extend_wrapper-1.1.0.dist-info/licenses/LICENSE,sha256=LanHfVWzsvc8f0WfJlk8s_qAhDW1RdNJMYDjDMJvl1Y,1070
|
|
8
|
-
plotly_extend_wrapper-1.1.0.dist-info/RECORD,,
|
{plotly_extend_wrapper-1.1.0.dist-info → plotly_extend_wrapper-1.2.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|