Skip to content

Commit

Permalink
tons of improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Apr 21, 2023
1 parent 30f455c commit 8485480
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 126 deletions.
36 changes: 0 additions & 36 deletions make_sphinx_and_commit.sh

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

matplotlib
numpy
colourmap
seaborn
requests
colourmap>="1.1.11"
4 changes: 3 additions & 1 deletion scatterd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = 'Erdogan Tasksen'
__email__ = 'erdogant@gmail.com'
__version__ = '1.2.6'
__version__ = '1.2.7'

# module level doc-string
__doc__ = """
Expand Down Expand Up @@ -39,6 +39,8 @@
>>> # Scatter with density and gradient
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=df['labx'], density=True, gradient='#FFFFFF')
>>>
>>> # Only density
>>> fig, ax = scatterd(df['tsneX'], df['tsneY'], labels=None, density=True)
References
----------
Expand Down
69 changes: 63 additions & 6 deletions scatterd/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,73 @@
c=colourmap.fromlist(labels)[0]
c[0]=[0,0,0]
c[1]=[0,0,0]
s = (labels+1) * 200
random_integers = np.random.randint(0, len(s), size=X.shape[0])
alpha = np.random.rand(1, X.shape[0])[0][random_integers]

# %%

fig, ax = scatterd(X[:,0], X[:,1], labels=None, s=alpha*1000, alpha=alpha)

# %%
# s=np.random.randint(10, 500,len(labels))
fig, ax = scatterd(X[:,0], X[:,1], labels=None, marker=labels.astype(str), s=s, cmap='Set2', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0])
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, marker=labels, s=s, cmap='Set2', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0])

fig, ax = scatterd(X[:,0], X[:,1], labels=None, marker=np.repeat('X', X.shape[0]))
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, marker=labels, s=300)
fig, ax = scatterd(X[:,0], X[:,1], labels=None, marker=labels, s=300)
fig, ax = scatterd(X[:,0], X[:,1], labels=None, marker='s', visible=True)


marker=labels.astype(str)
marker[labels==0]='s'
marker[labels==1]='o'
marker[labels==2]='d'

fig, ax = scatterd(X[:,0], X[:,1], labels=None, marker=marker, visible=True)

# %% Scatter
fig, ax = scatterd(X[:,0], X[:,1], c=c, s=150)

fig, ax = scatterd(X[:,0], X[:,1], c=[0,0,0], labels=None, verbose=4, visible=False)
scatterd(X[:,0], X[:,1], c=None, density=True, ax=ax)
fig.set_visible(True)

fig, ax = scatterd(X[:,0], X[:,1], c=[1,0,0], labels=None, verbose=4)

fig, ax = scatterd(X[:,0], X[:,1], labels=None, c=[0,0,0], density=True)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, c=[0,0,0], density=True, fontsize=28, legend=False, fontcolor='#000000')
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, c=[0,0,0], density=True, fontsize=28, legend=True, fontcolor='#000000')

fig, ax = scatterd(X[:,0], X[:,1], labels=None, c=None, density=True)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, density=True)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, c=None, density=True)

fig, ax = scatterd(X[:,0], X[:,1], labels=labels, verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], c=[1,0,0], labels=None, verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], c=[0,0,0], labels=labels, verbose=4, gradient='#ffffff')
fig, ax = scatterd(X[:,0], X[:,1], c=[0,0,0], labels=labels, verbose=4, gradient='#ffffff')
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, verbose=4, gradient='#ffffff')

# Grid options
fig, ax = scatterd(X[:,0], X[:,1], c=c, grid=False, verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], c=c, grid=True, verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], c=c, grid='#000000', verbose=4)

# Change figure size
fig, ax = scatterd(X[:,0], X[:,1])
fig, ax = scatterd(X[:,0], X[:,1], c=[1,0,0])
fig, ax = scatterd(X[:,0], X[:,1], verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], c=[0,0,0], verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], c=[0,0,0], labels=labels, verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], X[:,1], c=c, verbose=4)
fig, ax = scatterd(X[:,0], X[:,1], c=[0,0,0], density=True)

fig, ax = scatterd(X[:,0], X[:,1], labels=labels)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, fontcolor='#000000')
fig, ax = scatterd(X[:,0], X[:,1], labels=None, c=[0,0,0])
fig, ax = scatterd(X[:,0], X[:,1], fontcolor=[1,0,0])
fig, ax = scatterd(X[:,0], X[:,1], fontcolor='r')

fig, ax = scatterd(X[:,0], X[:,1], labels=labels, s=150)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, s=150, fontcolor='r')
fig, ax = scatterd(X[:,0], X[:,1], c=c, s=150)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, gradient='#FFFFFF', s=150)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, cmap='Set2', s=150)
Expand All @@ -48,8 +102,11 @@
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, s=s, cmap='Set2', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True)

fig, ax = scatterd(X[:,0], X[:,1], labels=labels, s=s, cmap='Set2', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0])
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, marker=labels, s=s, cmap='Set2', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0])
fig, ax = scatterd(X[:,0], X[:,1], labels=None, marker=labels, s=s, cmap='Set2', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0])

args_density = {'fill': True, 'thresh': 0, 'levels': 100, 'cmap':"mako", 'cbar': False, 'shade':True}
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, s=s, cmap='Set2', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0], axiscolor=None, args_density=args_density)
args_density = {'fill': True, 'thresh': 0, 'levels': 100, 'cmap':"mako", 'cbar': False}
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, s=s, cmap='tab20c', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0], grid=None, args_density=args_density)
fig, ax = scatterd(X[:,0], X[:,1], labels=labels, s=0, cmap='tab20c', xlabel='xlabel', ylabel='ylabel', title='Title', fontsize=25, density=True, fontcolor=[0,0,0], grid=None, args_density=args_density)

# %%
Loading

0 comments on commit 8485480

Please sign in to comment.