Skip to content

Commit

Permalink
Use the other alternative proposed in #93 (#107)
Browse files Browse the repository at this point in the history
* Even a better fix to #30

Co-Authored-By: Josh Borrow <josh@joshborrow.com>

* Update examples to showcase `no-latex` + `science`

---------

Co-authored-by: Josh Borrow <josh@joshborrow.com>
  • Loading branch information
echedey-ls and JBorrow authored Nov 25, 2023
1 parent 26eb00a commit 8a49b8a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Examples

The basic ``science`` style is shown below:

<img src="https://github.com/garrettj403/SciencePlots/raw/master/examples/figures/fig01.jpg" width="500">
<img src="https://github.com/garrettj403/SciencePlots/raw/master/examples/figures/fig01a.jpg" width="500">

It can be cascaded with other styles to fine-tune the appearance. For example, the ``science`` + ``notebook`` styles (intended for Jupyter notebooks):

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/figures/fig01b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion examples/plot-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@ def model(x, p):
ax.legend(title='Order')
ax.autoscale(tight=True)
ax.set(**pparam)
fig.savefig('figures/fig01.jpg', dpi=300)
fig.savefig('figures/fig01a.jpg', dpi=300)
plt.close()

with plt.style.context(['science', 'no-latex']):
fig, ax = plt.subplots()
for p in [10, 15, 20, 30, 50, 100]:
ax.plot(x, model(x, p), label=p)
ax.legend(title='Order')
ax.autoscale(tight=True)
ax.set(**pparam)
fig.savefig('figures/fig01b.jpg', dpi=300)
plt.close()

with plt.style.context(['science', 'ieee']):
Expand Down
8 changes: 5 additions & 3 deletions scienceplots/styles/misc/no-latex.mplstyle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

text.usetex : False

# Stix is designed to look similar to Times.
font.family: STIXGeneral
mathtext.fontset: stix
# Set fonts to be LaTeX defaults
font.serif : cmr10, Computer Modern Serif, DejaVu Serif
font.family : serif
axes.formatter.use_mathtext : True
mathtext.fontset : cm

0 comments on commit 8a49b8a

Please sign in to comment.