Skip to content

Commit

Permalink
release: grplot-0.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiffaryr committed Aug 24, 2022
1 parent 79abda8 commit e29954f
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 69 deletions.
101 changes: 57 additions & 44 deletions doc/Notebook Documentation.ipynb

Large diffs are not rendered by default.

20 changes: 1 addition & 19 deletions grplot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def grplot(plot, # default general value
by ghiffary rifqialdi
based on numpy, scipy, matplotlib, seaborn, squarify, and pandas
version = '0.10'
version = '0.10.2'
release date
25/08/2022
Expand Down Expand Up @@ -242,8 +242,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax,
axes='[{}]'.format(i+1),
xaxislabel=ax.get_xlabel(),
yaxislabel=ax.get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -304,8 +302,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax,
axes='[{}]'.format(i+1),
xaxislabel=ax.get_xlabel(),
yaxislabel=ax.get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -366,8 +362,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax,
axes='[{}]'.format(i+1),
xaxislabel=ax.get_xlabel(),
yaxislabel=ax.get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -435,8 +429,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax[i],
axes='[{}]'.format(i+1),
xaxislabel=ax[i].get_xlabel(),
yaxislabel=ax[i].get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -504,8 +496,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax[i,j],
axes='[{},{}]'.format(i+1,j+1),
xaxislabel=ax[i,j].get_xlabel(),
yaxislabel=ax[i,j].get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -574,8 +564,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax[i],
axes='[{}]'.format(i+1),
xaxislabel=ax[i].get_xlabel(),
yaxislabel=ax[i].get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -643,8 +631,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax[i,j],
axes='[{},{}]'.format(i+1,j+1),
xaxislabel=ax[i,j].get_xlabel(),
yaxislabel=ax[i,j].get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -714,8 +700,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax[i],
axes='[{}]'.format(i+1),
xaxislabel=ax[i].get_xlabel(),
yaxislabel=ax[i].get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down Expand Up @@ -782,8 +766,6 @@ def grplot(plot, # default general value
fig=fig,
ax=ax[i,j],
axes='[{},{}]'.format(i+1,j+1),
xaxislabel=ax[i,j].get_xlabel(),
yaxislabel=ax[i,j].get_ylabel(),
hue=hue,
size=size,
ci=ci,
Expand Down
15 changes: 13 additions & 2 deletions grplot/features/optimizer/optimizer_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from logging import raiseExceptions
import numpy
import pandas
from grplot.features.optimizer.optimizer_key import optimizer_key
Expand All @@ -21,14 +22,24 @@ def optimizer_data(plot, df, x, y, hue, size, style, units, axes, mode):
# filter data
if type(df) == dict:
if mode == 'numpy':
df_ = {k: df[k] for k in numpy.unique(key) if k in df.keys()}
df_ = {}
for k in numpy.unique(key):
if k in df.keys():
if type(df[k]) == list:
df_[k] = numpy.array(df[k])
elif type(df[k]) == numpy.ndarray:
df_[k] = df[k]
else:
raise Exception('Unsupported dictionary sub data structure!')
else:
pass
elif mode == 'pandas':
df_ = pandas.DataFrame.from_dict({k: df[k] for k in numpy.unique(key) if k in df.keys()})
else:
raise Exception('Unknown optimization mode!')
elif type(df) == pandas.core.frame.DataFrame:
if mode == 'numpy':
df_ = {k: df[k] for k in numpy.unique(key) if k in df}
df_ = {k: df.to_records()[k]for k in numpy.unique(key) if k in df}
elif mode == 'pandas':
df_ = df[[k for k in numpy.unique(key) if k in df]]
# if there is only one column
Expand Down
12 changes: 12 additions & 0 deletions grplot/hotfix/axislabel_fix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def axislabel_fix(ax, x, y):
# x
if x is not None and (ax.get_xlabel() == ''):
ax.set_xlabel(x)
else:
pass
# y
if y is not None and (ax.get_ylabel() == ''):
ax.set_ylabel(y)
else:
pass
return ax
6 changes: 4 additions & 2 deletions grplot/setting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy
from grplot.hotfix.axislabel_fix import axislabel_fix
from grplot.features.font.check_fontsize import check_fontsize
from grplot.hotfix.histplot_legend_fix import histplot_legend_fix
from grplot.features.lim.check_lim import check_lim
Expand Down Expand Up @@ -26,8 +27,6 @@ def setting(plot,
fig,
ax,
axes,
xaxislabel,
yaxislabel,
hue,
size,
ci,
Expand Down Expand Up @@ -71,6 +70,9 @@ def setting(plot,
if plot is None:
pass
elif type(plot) == str:
ax = axislabel_fix(ax, x, y)
xaxislabel = ax.get_xlabel()
yaxislabel = ax.get_ylabel()
plot_, hue_, size_, ci_, multiple_ = plot, hue, size, ci, multiple
tick_fontsize, \
legend_fontsize, \
Expand Down
5 changes: 4 additions & 1 deletion grplot/utils/first_valid_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

def first_valid_index(series):
if type(series) in [list, numpy.ndarray]:
first_valid_index = (~numpy.isnan(series)).argmax()
try:
first_valid_index = (~numpy.isnan(series)).argmax()
except:
first_valid_index = numpy.where(series==numpy.array([value for value in series if str(value) != 'nan'])[0])[0][0]
elif type(series) == pandas.core.series.Series:
first_valid_index = series.first_valid_index()
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

DISTNAME = "grplot"
VERSION = "0.10"
VERSION = "0.10.2"
MAINTAINER = "Ghiffary Rifqialdi"
MAINTAINER_EMAIL = "[email protected]"
DESCRIPTION = "grplot: lazy statistical data visualization"
Expand Down

0 comments on commit e29954f

Please sign in to comment.