1 Star 0 Fork 1

hliu / SciencePlots

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Science Plots

Matplotlib styles for scientific plotting

This repo has Matplotlib styles to format your plots for scientific papers, presentations and theses.

Installation

The easiest way to install SciencePlots is using pip:

# for latest version
pip install git+https://github.com/garrettj403/SciencePlots.git

# for last release
pip install SciencePlots

The pip installation will automatically move all of the *.mplstyle files into the appropriate directory. You can also do this manually, if you like. First, clone the repository and then copy all of the *.mplstyle files into your Matplotlib style directory. If you're not sure where this is, in an interactive python console type:

import matplotlib
print(matplotlib.get_configdir())

You should get back something like /home/garrett/.matplotlib. You would then put the *.mplstyle files in /home/garrett/.matplotlib/stylelib/ (you may need to create the stylelib directory).

Using the Styles

science.mplstyle is the main style from this repo. Whenever you want to use it, simply add the following to the top of your python script:

import matplotlib.pyplot as plt
 
plt.style.use('science')

You can also combine multiple styles together by:

plt.style.use(['science','ieee'])

In this case, the ieee style will override some of the parameters from the main science style in order to configure the plot for IEEE papers (column width, fontsizes, etc.).

To use any of the styles temporarily, you can use:

with plt.style.context(['science', 'ieee']):
    plt.figure()
    plt.plot(x, y)
    plt.show()

Examples

The science style (the base style):

The science + grid styles:

The science + ieee styles for IEEE papers:

IEEE requires figures to be readable when printed in black and white. The ieee style also sets the figure width to fit within one column of an IEEE paper.

The science + scatter styles for scatter plots:

The science + notebook styles for Jupyter notebooks:

You can also combine these styles with the other styles that come with Matplotlib. For example, the dark_background + science + high-vis styles:

Note: See the examples/ directory for more!

Color Cycles

The high-vis color cycle:

The bright color cycle:

The vibrant color cycle:

The muted color cycle:

The retro color cycle:

Note: The bright, vibrant and muted color cycles are from Paul Tol's website. They are color-blind safe!

Contribution

Please feel free to add to this repo! For example, it would be good to add styles for different journals or perhaps new color cycles.

You can checkout Matplotlib's documentation for more plotting options.

FAQ

  1. Errors related to Latex:

    • The default science style uses Latex font rendering. If you do not have Latex on your computer or if you think that Latex takes too long, you can disable Latex using the no-latex style:

      plt.style.use(['science','no-latex'])
    • For Windows users, you may need to manually add Latex to your environment path (see issue).

SciencePlots in Academic Papers

The following papers use SciencePlots:

If you use SciencePlots for your paper/thesis, feel free to add it to the list!

MIT License Copyright (c) 2018 John Garrett Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

可以画sci论文图 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/zucchliu_liuhong/SciencePlots.git
git@gitee.com:zucchliu_liuhong/SciencePlots.git
zucchliu_liuhong
SciencePlots
SciencePlots
master

搜索帮助