Skip to content

Commit

Permalink
README: add instructions for using pip
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettj403 committed Apr 9, 2020
1 parent 21b4740 commit 18f3318
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ This repo has Matplotlib styles to format your plots for scientific papers, pres
Installation
------------

Put all of the ``*.mplstyle`` files into your Matplotlib style directory. If you're not sure where this is, in an interactive python console type:
The easiest way to install SciencePlots is using ``pip``:

```bash
python -m pip install git+https://github.com/garrettj403/SciencePlots.git
```

This will move all of the ``*.mplstyle`` files into the appropriate directory. You can also do this manually, if you like. First, clone the repository and then copy all of the ``*.mplstyle`` files into your Matplotlib style directory. If you're not sure where this is, in an interactive python console type:

```python
import matplotlib
print(matplotlib.get_configdir())
```

You should get back something like ``/home/garrett/.matplotlib``. You would then put the ``*.mplstyle`` files in ``/home/garrett/.matplotlib/stylelib/`` (you may need to create the ``stylelib`` directory). If you're on macOS, you can run:

```bash
mkdir -p ~/.matplotlib/stylelib/
cp styles/*.mplstyle ~/.matplotlib/stylelib/
cp styles/misc/*.mplstyle ~/.matplotlib/stylelib/
cp styles/color/*.mplstyle ~/.matplotlib/stylelib/
cp styles/journals/*.mplstyle ~/.matplotlib/stylelib/
```
You should get back something like ``/home/garrett/.matplotlib``. You would then put the ``*.mplstyle`` files in ``/home/garrett/.matplotlib/stylelib/`` (you may need to create the ``stylelib`` directory).

Using the Styles
----------------
Expand Down
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
"""

from setuptools import setup
from setuptools.command.install import install
import os
import shutil
import atexit
import glob
import os
import shutil

import matplotlib
from setuptools import setup
from setuptools.command.install import install


def install_styles():

# Find all style files
stylefiles = glob.glob('styles/**/*.mplstyle', recursive=True)

Expand All @@ -30,7 +32,6 @@ def install_styles():
for stylefile in stylefiles:
print(os.path.basename(stylefile))
shutil.copy(
# os.path.join(os.path.dirname(__file__), stylefile),
stylefile,
os.path.join(mpl_stylelib_dir, os.path.basename(stylefile)))

Expand Down

0 comments on commit 18f3318

Please sign in to comment.