cfmm-routing-code
cfmm-routing-code copied to clipboard
ValueError on `text.latex.preamble` parameter
Erorr
- When I run
python two_assets.pya value error is being raised:
ValueError: Key text.latex.preamble: Could not convert ['\\usepackage{gensymb}'] to str
- Source of the error is here: https://github.com/angeris/cfmm-routing-code/blob/65311c1661ee96961a00f2bb07f70013f912d707/latexify.py#L43
See more of this issue here documented https://github.com/matplotlib/matplotlib/issues/26464
Fix
def latexify(fig_width=None, fig_height=None, font_size=12, columns=2):
params = {'backend': 'ps',
# Fix: This is expecting a string instead of array
'text.latex.preamble': '\\usepackage{gensymb}',
}
I am getting the same error:
Market 0, delta: [1.36343959e+00 1.58164645e-07 1.71126741e-06], lambda: [2.52437230e-06 3.52652847e-02 5.11873169e-01]
Market 1, delta: [3.34685119e+00 5.33609778e-07], lambda: [4.32965939e-06 2.48876402e-01]
Market 2, delta: [2.84141146e-01 8.32723985e-07], lambda: [1.25438513e-07 2.14315509e+00]
Market 3, delta: [3.51887098e+01 1.03917898e-06], lambda: [4.02743625e-06 3.15269960e+01]
Market 4, delta: [1.01010229e+01 3.02392793e-06], lambda: [1.26200964e-05 1.00000030e+01]
Traceback (most recent call last):
File "/Users/ruidazeng/cfmm-routing-code/two-asset.py", line 102, in <module>
latexify(fig_width=6, fig_height=3.5)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ruidazeng/cfmm-routing-code/latexify.py", line 55, in latexify
matplotlib.rcParams.update(params)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "<frozen _collections_abc>", line 987, in update
File "/opt/homebrew/lib/python3.13/site-packages/matplotlib/__init__.py", line 738, in __setitem__
raise ValueError(f"Key {key}: {ve}") from None
ValueError: Key text.latex.preamble: Could not convert ['\\usepackage{gensymb}'] to str
Ooh, weird ! Perhaps the package has been updated or something. Thanks for the catch.