Skip to content

Commit

Permalink
Merge pull request #203 from SMTG-UCL/fix-times
Browse files Browse the repository at this point in the history
Fix optplot superscript
  • Loading branch information
utf authored Mar 29, 2023
2 parents 575996e + 0613e47 commit 6786d04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sumo/plotting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def power_tick(val, pos, times_sign=r"\times"):
coeff = val / 10**exponent
prec = 0 if coeff % 1 == 0 else 1

return rf"$\mathregular{{{coeff:.{prec}f} {times_sign} 10^{exponent:2d}}}$"
return rf"${coeff:.{prec}f}\mathrm{{{times_sign}}}10^{{{exponent:2d}}}$"


def colorline(
Expand Down
6 changes: 1 addition & 5 deletions sumo/plotting/optics_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,8 @@ def get_plot(

if spectrum_key == "absorption":
font = findfont(FontProperties(family=["sans-serif"]))
if "Whitney" in font:
times_sign = "x"
else:
times_sign = r"\times"
ax.yaxis.set_major_formatter(
FuncFormatter(curry_power_tick(times_sign=times_sign))
FuncFormatter(curry_power_tick(times_sign=r"\times"))
)

ax.yaxis.set_major_locator(MaxNLocator(5))
Expand Down

0 comments on commit 6786d04

Please sign in to comment.