You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to configure mplcursors via the following code:
import os
os.environ["MPLCURSORS"] = '{"hover": 1}'
import mplcursors
however this doesn't appear to work... no cursors appear when I click on the resulting plots. I'm not sure why, because my understanding is that this sets env vars for the python process. Seems that setting the env vars before mplcursors is imported would cause it to see them, just as if they had been set at the CLI.
When I call my script via
MPLCURSORS='{"hover": 1}' python3 my_script.py
I see cursors as expected.
I'd like to be able to globally configure cursors (since I have a lot of plots), but I don't want the user to have to remember to set env vars when they invoke the script, which is why I'm trying to set them in the code itself.
Is this method of setting env variables expected to work? Does it matter where the env var is set relative to the mplcursors import? Or relative to the matplotlib import?
Is there an easier way of configuring mplcursors globally without using env vars? Perhaps a module variable that could be set?
The text was updated successfully, but these errors were encountered:
Setting the environment variable a posteriori is not expected to work given the way things are implemented right now. It would indeed be nice if it did; ideally registration should be rewritten to be based on the new rcParams["figure.hooks"] system but I can't promise any timeline for that. (There's no other global config available either.)
I'm attempting to configure mplcursors via the following code:
however this doesn't appear to work... no cursors appear when I click on the resulting plots. I'm not sure why, because my understanding is that this sets env vars for the python process. Seems that setting the env vars before
mplcursors
is imported would cause it to see them, just as if they had been set at the CLI.When I call my script via
I see cursors as expected.
I'd like to be able to globally configure cursors (since I have a lot of plots), but I don't want the user to have to remember to set env vars when they invoke the script, which is why I'm trying to set them in the code itself.
Is this method of setting env variables expected to work? Does it matter where the env var is set relative to the
mplcursors
import? Or relative to the matplotlib import?Is there an easier way of configuring
mplcursors
globally without using env vars? Perhaps a module variable that could be set?The text was updated successfully, but these errors were encountered: