Skip to content

Commit 7ef5489

Browse files
committed
update readme
1 parent eddafaf commit 7ef5489

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ or
1212
```bash
1313
git clone
1414
cd smplotlib
15-
pip install -e .
15+
pip install -e . --user
1616
```
1717

1818
## Usage
@@ -23,6 +23,11 @@ Then just use `matplotlib.pyplot` as usual. For a quick start, you can use `smpl
2323

2424
![example](two_phase.png)
2525

26+
### More advanced usage
27+
You can use the function ``smplotlib.set_style(fontweight='normal', usetex=False, fontsize=15, figsize=(6, 6), dpi=120)`` to customize the global seetings including font weight, font size, default figure size and resolution, and whether using LaTeX for math. The default font weight is ``'normal'``, and the default setting for LaTeX is ``False``. You can specify font weight as ``'light'`` or ``'heavy'``. Current support for LaTeX is not quite satisfying, so it is recommended to set ``usetex=False``.
28+
29+
You can turn off the black edgecolor of scatter plots by ``smplotlib.set_style(edgecolor='face')``. This is useful when you want to plot a large number of points.
30+
2631
## Hershey font
2732
SuperMongo uses [Hershey fonts](https://www.astro.princeton.edu/~rhl/sm/sm.html#TOC73). The [``ttf`` files](https://github.com/yangcht/Hershey_font_TTF) are from a compilation by astronomer [`yangcht`](https://github.com/yangcht). Thanks for the great work!
2833

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "smplotlib"
7-
version = "0.0.8"
7+
version = "0.0.9"
88
authors = [
99
{ name="Jiaxuan Li", email="[email protected]" },
1010
]

src/smplotlib/__init__.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# Load style
3030
plt.style.use(os.path.join(pkg_path, 'smplot.mplstyle'))
3131

32-
def set_style(usetex=False, fontsize=15, fontweight='normal', figsize=(6, 6), dpi=120):
32+
def set_style(usetex=False, fontsize=15, fontweight='normal', figsize=(6, 6), dpi=120, edgecolor='black'):
3333
'''
3434
Set matplotlib parameters for SuperMongo style.
3535
@@ -47,6 +47,8 @@ def set_style(usetex=False, fontsize=15, fontweight='normal', figsize=(6, 6), dp
4747
Figure size. Default is (6, 6).
4848
dpi : int, optional.
4949
Dots per inch. Default is 100.
50+
edgecolor : str, optional.
51+
Edge color. Default is 'black'. If you don't like the black edge, you can set it to 'face'.
5052
'''
5153
rcParams.update({'font.size': fontsize,
5254
'figure.figsize': "{0}, {1}".format(figsize[0], figsize[1]),
@@ -57,7 +59,15 @@ def set_style(usetex=False, fontsize=15, fontweight='normal', figsize=(6, 6), dp
5759
rcParams.update({
5860
"font.weight": "normal",
5961
"axes.labelweight": "normal",
60-
"mathtext.fontset": "custom"
62+
"mathtext.fontset": "custom",
63+
"mathtext.bf": "AVHershey Complex:medium",
64+
"mathtext.cal": "AVHershey Complex:medium",
65+
"mathtext.it": "AVHershey Complex:italic",
66+
"mathtext.rm": "AVHershey Complex:medium",
67+
"mathtext.sf": "AVHershey Duplex:medium",
68+
"mathtext.tt": "AVHershey Complex:medium",
69+
"mathtext.fallback": "cm",
70+
"mathtext.default": 'it'
6171
})
6272

6373
elif fontweight == 'light':
@@ -93,11 +103,6 @@ def set_style(usetex=False, fontsize=15, fontweight='normal', figsize=(6, 6), dp
93103
elif fontweight == 'heavy':
94104
rcParams.update({
95105
"axes.linewidth": 0.7,
96-
"xtick.major.width": 0.6,
97-
"xtick.minor.width": 0.5,
98-
"ytick.major.width": 0.6,
99-
"ytick.minor.width": 0.5,
100-
"font.family": "AVHershey Complex",
101106
"font.weight": "heavy",
102107
"axes.labelweight": "heavy",
103108
"mathtext.fontset": "custom",
@@ -122,6 +127,7 @@ def set_style(usetex=False, fontsize=15, fontweight='normal', figsize=(6, 6), dp
122127
])
123128
})
124129

130+
rcParams.update({'scatter.edgecolors': edgecolor})
125131
smplotlib.set_style()
126132

127133
from .demo import demo_plot

0 commit comments

Comments
 (0)