Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError on text.latex.preamble parameter #11

Open
mmsaki opened this issue Mar 17, 2024 · 1 comment
Open

ValueError on text.latex.preamble parameter #11

mmsaki opened this issue Mar 17, 2024 · 1 comment

Comments

@mmsaki
Copy link

mmsaki commented Mar 17, 2024

Erorr

  • When I run python two_assets.py a value error is being raised:
ValueError: Key text.latex.preamble: Could not convert ['\\usepackage{gensymb}'] to str

See more of this issue here documented matplotlib/matplotlib#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}',
    }
@ruidazeng
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants