方便地编排数字格式以符合学术期刊的出版要求

plotsettings的Python项目详细描述


仅使用matplotlib(a)和使用matplotlib发布图形的区别 使用plotsettings(b)

https://dl.dropboxusercontent.com/u/35392962/annotated_example.jpg

亮点

为了使你的形象符合作者的指导方针,把头发扯下来 为了一本特别的日记?被PNAS拒绝,无法改变自己 提交给plos one的所有字体?让plotsettings为您提供方便! plotsettings是确保您的图形符合要求的便捷方法 供出版。一行就足以选择一个目标日记帐,而只有一行 更多行自动输出完全符合1、2甚至1.5的数字 柱!你甚至可以设置你的身材的长宽比,如果你的 身材比一页纸高。实际上,plotsettings已经知道 所有这些日志的适当字体、文本大小和图形尺寸:

  • Cell (use argument ‘Cell’)
  • Copeia (use argument ‘Copeia’)
  • Deep Sea Research II (use argument ‘DSRII’)
  • Ecology Letters (use argument ‘EcolLett’)
  • Global Change Biology (use argument ‘GlobChangeBio’)
  • Global Environmental Change (use argument ‘GlobEnvChange’)
  • Integrative and Comparative Biology (use argument ‘IntCompBiol’)
  • Journal of Experimental Biology (use argument ‘JEB’)
  • Limnology and Oceanography (use argument ‘LimnolOcean’)
  • Marine Ecology Progress Series (use argument ‘MEPS’)
  • Nature magazine (use argument ‘Nature’)
  • Oecologia (use argument ‘Oecologia’)
  • Proceedings of the National Academy of Sciences, USA (use argument ‘PNAS’)
  • Proceedings of the Royal Society B (use argument ‘ProcRoySocB’)
  • Public Library of Science One (use argument ‘PLOSOne’)
  • Public Library of Science Biology (use argument ‘PLOSBio’)
  • Science magazine (use argument ‘Science’)
  • Presentation (okay, this is not a journal but it’s still useful for outputting figures to presentation slides; access with the argument ‘Presentation’)

在列表中看不到所需的日志(假设要在Proceedings of the 6th ACM Workshop on Next Generation Mobile Computing for Dynamic Personalised Travel Planning中发布)?编译您的 通过创建包含 每个日志的设置you使用!可以指定接受的任何参数 通过matplotlib.rcparams以及列宽、间距宽度、页面高度和 多面板图形的标记方式。

另外,还有奖金!:

  • 1-line labeling of all the subplots in a figure (e.g. with ‘(a)’, ‘(b)’, ‘(c)’ etc.) using the standalone function panel_labels or the method Set.panel_labels!

安装

plotsettings只在python 2.7中测试过

通过PIP安装:

$ pip install plotsettings

需要以下非标准库:

  • matplotlib

因为matplotlib的首选安装可能因操作系统而异, matplotlib不会作为依赖项自动安装。相反,安装将 如果在pythonpath中找不到matplotlib,则引发异常。在这种情况下,请 通过您喜欢的方法安装matplotlib,其中大多数方法都有说明by matplotlib

用法

首先设置要提交到的日志:

publishable = plotsettings.Set('MEPS') # Lets publish in Marine Ecology Progress Series!

然后用线设置特定图形的尺寸:

publishable.set_figsize(n_columns = 1, n_rows = 1)

这将导致绘制的下一个图形为1列宽(对于MEPS为81 mm)x 1 row high(“rows”的概念有点杜撰,但默认值是一行 等于一个列宽乘以黄金分割率,因此在本例中为50.1 mm)。一次 第一个图形绘制完毕,我们可以将下一个图形设置为2列宽1行 高,这次将行高设置为等于列宽,如下所示:

publishable.set_figsize(2, 1, aspect_ratio = 1)

重要的是,plotsettings不只是将2列图形的宽度计算为2 乘以一列的宽度,但包括排水沟的宽度(介于 页上的列)。因此,上述行后面的数字将结束 高169 mm宽(两列各81 mm加上一个7 mm排水沟)和81 mm高(世界其他地区 高度=1*列宽)。

创建图形后,可以方便地向每个子批次添加标签(如果您有 多部分图:

publishable.panel_labels(fig = fig, position = 'outside', case = 'lower',
                                                 prefix = '', suffix = '.', fontweight = 'bold')

在左上角外以粗体字母创建标签('a.','b.','c.…) 每一个子批次。

通过在pythonpath上指定python文件,可以使用自定义日志设置:

publishable = plotsettings.Set('my_journal_name', 'module_name')

文件“module_name”应该包含一个名为journals的字典,其中 以下结构:

journals = {'journal1':      {'rcParams':     {'param1': value1,
                                               'param2': value2 ...},
                              'figsize':      {'param1': value1,
                                               'param2': value2 ...},
                              'panel_labels': {'param1': value1,
                                               'param2': value2 ...},
            'journal2':      {'rcParams':     {'param1': value1,
                                               'param2': value2 ...},
                              'figsize':      {'param1': value1,
                                               'param2': value2 ...},
                              'panel_labels': {'param1': value1,
                                               'param2': value2 ...},
            'journal3'...
            }

其中“JournalX”是学术期刊的识别名称(例如“性质”),其中 每个日志的规范分为3个字典:

  • rcParams: All parameters are optional. Any valid input to pyplot.rcParams (for example font name and sizes, default linewidths) is accepted. Definitions of valid keys to rcParams can be found here.
  • figsize: Set figure dimension calculations. Requires the parameters column_width, gutter_width, and units. The parameter max_height is optional. See below for details.
  • panel_labels: Set default panel labels (i.e. the text that identifies each subplot in a figure as A, B, C, etc.). All parameters are optional. See below for details.

可能的非rcparams参数是:

  • figsize:

    • column_width (required) - the maximum width a figure is allowed to be while still fitting withing a single column.
    • gutter_width (required) - the width of the gutter (space between columns). This can usually be found by comparing the maximum width that a journal allows for a single- column figure with the maximum width of a 2-column figure. For example, PLoS One allows a 1-column figure to be 83 mm in width and a 2-column figure to be 173.5 mm, meaning that the gutter width (173.5 - 83*2) must be 7.5 mm wide.
    • max_height (optional) - the maximum height a figure is allowed to be while fitting on a single page (i.e. the page height).
    • units (required) - the units in which the above are reported. Can be one of ‘mm’, ‘cm’, ‘inch’, or ‘pts’
  • 面板标签:

    • fontweight (optional) - the font weight of panel annotations (e.g. A, B, C etc.). Default is ‘bold’
    • case (optional) - whether to capitalize (‘upper’) or not capitalize (‘lower’) the panel labels.
    • prefix (optional) - characters to prepend to panel label (e.g. if the desired label style is (A), (B), etc., set label_prefix to ‘)’).
    • suffix (optional) - characters to append to panel label (e.g. if the desired label style is a., b., etc., set label_suffix = ‘.’)
    • fontsize (optional) - font size in pts of the label. Defaults to rcParams[‘font.size’]

更改日志

1.0.4-2(2014年11月14日)

  • Updated doctests

1.0.4-1(2014年11月14日)

  • Removed deprecated keywords from default journal parameters

1.0.4(2014年10月20日)

  • Added ability for panel_labels method to automatically detect axes that contain only colorbars and not label them (use detect_colorbars = True). This method relies on the assumption that colorbar axes are not navigable (e.g. cannot be panned or zoomed in the interactive figure). This property was chosen because it seems to work both for colorbars created by pyplot.colorbar() as well as those created explicitly in a new axis such as using the AxesGrid toolkit.

1.0.3(2014年10月15日)

  • package matplotlib is no longer explicitly required in setup.py. Installation will raise an error if matplotlib is not present - please install in your preferred way.

1.0.2(2014年10月15日)

  • Changed format of dictionary specifying journal settings. Settings for each journal are now divided between the dictionaries ‘rcParams’, ‘figsize’ and ‘panel_labels’ instead of being amalgamated into a single dictionary.
  • Added journals Science, Integrative and Comparative Zoology, Copeia, Cell, Global Change Biology, Global Environmental Change, Limnology and Oceanography, Nature, PLOS Biology and Oecologia to the list of natively supported publications.
  • Added method panel_labels to class Set to allow panel labels (e.g. A, B, C etc.) to automatically follow default settings for the journal (e.g. boldface, uppercase, etc.)

1.0.1(2014年10月14日)

  • Fixed bug that made plotsettings.Set unable to find the default journals module
  • Added function panel_labels for convenient, 1-line addition of formatted panel labels (e.g. A, B, C) to every subplot in a figure.
  • Added ‘Presentation’ as a journal type for PowerPoint slides

1.0.0(2014年10月13日)

  • First release

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何修复无法解析从未使用过的符号和变量的错误   java lucene搜索   java无法获取可用的提供程序解析程序   java问题使用引发SAXException的方法编译类   是否可以编辑抽象类?JAVA   java AppletViewer出现错误并试图加入计时器   基于java JNI的Android库,在没有NDK的情况下使用   Java如何使用Jenkins中的环境变量?   XMLHttpRequestJavaJavaScript   JPA实体中的java枚举类型字段   java泛型方法将一种枚举类型转换为另一种枚举类型   java Liveconnect小程序问题   java SpringBoost应用程序和Apache Ignite配置:启动ApplicationContext时出现问题   反射从Java8中的类对象获取方法引用   调试时Eclipse在java 8类加载器上中断