在virtualenv(python)中,matplotlib的$HOME等价于什么

2024-09-28 21:55:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我发现这个漂亮的ggplot inspired color scheme for matplotlib并想将其用于特定的项目。在

根据matplotlib文档,自定义配色方案不应覆盖site-packages中的默认值,而应放在$HOME/.matplotlib中。但是在a venv中,$HOME的等价物是什么呢?特别是:如何确保在安装/升级新的matplotlib时不会覆盖此配色方案


Tags: 项目文档homeforvenvmatplotlibpackages方案
2条回答

在接受了Voithos的回答后,我找到了MPLtools,它有助于:

A key feature of mpltools is the ability to set “styles”—essentially, stylesheets that are similar to matplotlibrc files. This example demonstrates the “ggplot” style, which adjusts the style to emulate ggplot

为后人发帖:-)

http://tonysyu.github.com/mpltools/auto_examples/style/plot_ggplot.html

有什么原因不想把它保存在实际的$HOME目录下?在

Virtualenv是一个用于创建隔离的Python环境的工具。因此,它并不试图提供一个完整的用户环境。所以基本上,virtualenv的$HOME就是用户的正常$HOME。在

至于Matplotlib,documentation提到了如何搜索matplotlibrc文件:

  1. 首先,它在当前目录中查找matplotlibrc。这可能是您的venv特定配置的候选位置。在
  2. 其次,它查看用户的配置(~/.matplotlib/matplotlibrc)。在
  3. 最后,在安装目录中查找。在

相关问题 更多 >