当前位置: 首页>>代码示例>>Python>>正文


Python matplotlib.matplotlib_fname函数代码示例

本文整理汇总了Python中matplotlib.matplotlib_fname函数的典型用法代码示例。如果您正苦于以下问题:Python matplotlib_fname函数的具体用法?Python matplotlib_fname怎么用?Python matplotlib_fname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了matplotlib_fname函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_if_rctemplate_is_up_to_date

def test_if_rctemplate_is_up_to_date():
    # This tests if the matplotlibrc.template file
    # contains all valid rcParams.
    dep1 = mpl._all_deprecated
    dep2 = mpl._deprecated_set
    deprecated = list(dep1.union(dep2))
    #print(deprecated)
    path_to_rc = mpl.matplotlib_fname()
    with open(path_to_rc, "r") as f:
        rclines = f.readlines()
    missing = {}
    for k,v in mpl.defaultParams.items():
        if k[0] == "_":
            continue
        if k in deprecated:
            continue
        if "verbose" in k:
            continue
        found = False
        for line in rclines:
            if k in line:
                found = True
        if not found:
            missing.update({k:v})
    if missing:
        raise ValueError("The following params are missing " +
                         "in the matplotlibrc.template file: {}"
                         .format(missing.items()))
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:28,代码来源:test_rcparams.py

示例2: init_matplotlib

def init_matplotlib(output, use_markers, load_rc):
    if not HAS_MATPLOTLIB:
        raise RuntimeError("Unable to plot -- matplotlib is missing! Please install it if you want plots.")
    global pyplot, COLOURS
    if output != "-":
        if output.endswith('.svg') or output.endswith('.svgz'):
            matplotlib.use('svg')
        elif output.endswith('.ps') or output.endswith('.eps'):
            matplotlib.use('ps')
        elif output.endswith('.pdf'):
            matplotlib.use('pdf')
        elif output.endswith('.png'):
            matplotlib.use('agg')
        else:
            raise RuntimeError("Unrecognised file format for output '%s'" % output)

    from matplotlib import pyplot

    for ls in LINESTYLES:
        STYLES.append(dict(linestyle=ls))
    for d in DASHES:
        STYLES.append(dict(dashes=d))
    if use_markers:
        for m in MARKERS:
            STYLES.append(dict(marker=m, markevery=10))

    # Try to detect if a custom matplotlibrc is installed, and if so don't
    # load our own values.
    if load_rc \
      and not os.environ['HOME'] in matplotlib.matplotlib_fname() \
      and not 'MATPLOTLIBRC' in os.environ and hasattr(matplotlib, 'rc_file'):
        rcfile = os.path.join(DATA_DIR, 'matplotlibrc.dist')
        if os.path.exists(rcfile):
            matplotlib.rc_file(rcfile)
    COLOURS = matplotlib.rcParams['axes.color_cycle']
开发者ID:jcristau,项目名称:flent,代码行数:35,代码来源:plotters.py

示例3: test_if_rctemplate_would_be_valid

def test_if_rctemplate_would_be_valid(tmpdir):
    # This tests if the matplotlibrc.template file would result in a valid
    # rc file if all lines are uncommented.
    path_to_rc = mpl.matplotlib_fname()
    with open(path_to_rc, "r") as f:
        rclines = f.readlines()
    newlines = []
    for line in rclines:
        if line[0] == "#":
            newline = line[1:]
        else:
            newline = line
        if "$TEMPLATE_BACKEND" in newline:
            newline = "backend : Agg"
        if "datapath" in newline:
            newline = ""
        newlines.append(newline)
    d = tmpdir.mkdir('test1')
    fname = str(d.join('testrcvalid.temp'))
    with open(fname, "w") as f:
        f.writelines(newlines)
    with pytest.warns(None) as record:
        dic = mpl.rc_params_from_file(fname,
                                      fail_on_error=True,
                                      use_default_template=False)
        assert len(record) == 0
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:26,代码来源:test_rcparams.py

示例4: do_nothing_show

    def do_nothing_show(*args, **kwargs):
        frame = inspect.currentframe()
        fname = frame.f_back.f_code.co_filename
        if fname in ('<stdin>', '<ipython console>'):
            warnings.warn("""
Your currently selected backend, '{0!s}' does not support show().
Please select a GUI backend in your matplotlibrc file ('{1!s}')
or with matplotlib.use()""".format(backend, matplotlib.matplotlib_fname()))
开发者ID:runt18,项目名称:nupic,代码行数:8,代码来源:__init__.py

示例5: install

def install(robustus, requirement_specifier, rob_file, ignore_index):
    # First install it through the wheeling
    robustus.install_through_wheeling(requirement_specifier, rob_file, ignore_index)
    import matplotlib
    rcfile = matplotlib.matplotlib_fname()
    # Writing the settings to the file --- we may add more is needed
    logging.info('Writing the configuration file %s' % rcfile)
    with open(rcfile, 'w') as f:
        logging.info('Configuring matplotlib to use PySide as the backend...')
        f.write('backend : qt4agg\n')
        f.write('backend.qt4 : PySide\n')
开发者ID:bossjones,项目名称:robustus,代码行数:11,代码来源:install_matplotlib.py

示例6: show_mplrc_settings

def show_mplrc_settings():
    """Display information about matplotlibrc file"""
    print 'Using %s' % mpl.matplotlib_fname()
    r = mpl.rcParams

    ff = r['font.family'][0]
    print 'Font sizes for axes: %g; (x,y) ticks: (%g, %g): legend %g' % \
          (r['axes.labelsize'], r['xtick.labelsize'],
           r['ytick.labelsize'], r['legend.fontsize'])
    print 'Font family %s uses face %s' % (ff, r['font.'+ff])

    print 'Figure size: %s, dpi: %g' % (r['figure.figsize'], r['figure.dpi'])
开发者ID:aarontran,项目名称:snr-filaments,代码行数:12,代码来源:fplot.py

示例7: async_wrapper

 def async_wrapper(*args, **kwargs):
     # TODO handle this better in the future, but stop the massive error
     # caused by MacOSX async runs for now.
     try:
         import matplotlib as plt
         if plt.rcParams['backend'] == 'MacOSX':
             raise EnvironmentError(backend_error_template %
                                    plt.matplotlib_fname())
     except ImportError:
         pass
     args = args[1:]
     pool = concurrent.futures.ProcessPoolExecutor(max_workers=1)
     future = pool.submit(self, *args, **kwargs)
     pool.shutdown(wait=False)
     return future
开发者ID:Kleptobismol,项目名称:qiime2,代码行数:15,代码来源:visualizer.py

示例8: __init__

    def __init__(self, currentFolder,nproc):
        import matplotlib
        matplotlib.use('GTKAgg')
        print 'MATPLOTLIB FILE: %s'%matplotlib.matplotlib_fname()
        
        figureResidualsUI.__init__(self)
        self.currentFolder = currentFolder
        self.nproc = nproc
        [self.timedir,self.fields,curtime] = currentFields(self.currentFolder,nproc=self.nproc)
        self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)

        for field in self.fields:
            if field not in unknowns:
                continue
            item = QtGui.QListWidgetItem()
            item.setCheckState(QtCore.Qt.Unchecked)
            item.setText(field)
            self.listWidget.addItem(item)
开发者ID:jmarcelogimenez,项目名称:petroSym,代码行数:18,代码来源:figureResiduals.py

示例9: _set_matplotlib_default_backend

def _set_matplotlib_default_backend():
    """
    matplotlib will try to print to a display if it is available, but don't want
    to run it in interactive mode. we tried setting the backend to 'Agg'' before
    importing, but it was still resulting in issues. we replace the existing
    backend with 'agg' in the default matplotlibrc. This is a hack until we can
    find a better solution
    """
    if _matplotlib_installed():
        import matplotlib
        matplotlib.use('Agg', force=True)
        config = matplotlib.matplotlib_fname()
        with file_transaction(config) as tx_out_file:
            with open(config) as in_file, open(tx_out_file, "w") as out_file:
                for line in in_file:
                    if line.split(":")[0].strip() == "backend":
                        out_file.write("backend: agg\n")
                    else:
                        out_file.write(line)
开发者ID:GetBen,项目名称:bcbio-nextgen,代码行数:19,代码来源:install.py

示例10: main

def main():
    x1 = np.linspace(0.0, 5.0)
    x2 = np.linspace(0.0, 2.0)
    
    y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
    y2 = np.cos(2 * np.pi * x2)
    
    plt.subplot(2, 1, 1)
    plt.plot(x1, y1, 'yo-')
    plt.title('A tale of 2 subplots')
    plt.ylabel('Damped oscillation')
    
    plt.subplot(2, 1, 2)
    plt.plot(x2, y2, 'r.-')
    plt.xlabel('time (s)')
    plt.ylabel('Undamped')
    print(matplotlib.matplotlib_fname())
    #plt.savefig("tmp.png")
    plt.show()
开发者ID:foxli180,项目名称:Self_Learning,代码行数:19,代码来源:matplotlib_test.py

示例11: async_wrapper

        def async_wrapper(*args, **kwargs):
            # TODO handle this better in the future, but stop the massive error
            # caused by MacOSX async runs for now.
            try:
                import matplotlib as plt
                if plt.rcParams['backend'] == 'MacOSX':
                    raise EnvironmentError(backend_error_template %
                                           plt.matplotlib_fname())
            except ImportError:
                pass

            # This function's signature is rewritten below using
            # `decorator.decorator`. When the signature is rewritten, args[0]
            # is the function whose signature was used to rewrite this
            # function's signature.
            args = args[1:]

            pool = concurrent.futures.ProcessPoolExecutor(max_workers=1)
            future = pool.submit(self, *args, **kwargs)
            pool.shutdown(wait=False)
            return future
开发者ID:qiime2,项目名称:qiime2,代码行数:21,代码来源:callable.py

示例12: async_wrapper

        def async_wrapper(*args, **kwargs):
            # TODO handle this better in the future, but stop the massive error
            # caused by MacOSX asynchronous runs for now.
            try:
                import matplotlib as plt
                if plt.rcParams['backend'].lower() == 'macosx':
                    raise EnvironmentError(backend_error_template %
                                           plt.matplotlib_fname())
            except ImportError:
                pass

            # This function's signature is rewritten below using
            # `decorator.decorator`. When the signature is rewritten, args[0]
            # is the function whose signature was used to rewrite this
            # function's signature.
            args = args[1:]

            pool = concurrent.futures.ProcessPoolExecutor(max_workers=1)
            future = pool.submit(_subprocess_apply, self, args, kwargs)
            # TODO: pool.shutdown(wait=False) caused the child process to
            # hang unrecoverably. This seems to be a bug in Python 3.7
            # It's probably best to gut concurrent.futures entirely, so we're
            # ignoring the resource leakage for the moment.
            return future
开发者ID:thermokarst,项目名称:qiime2,代码行数:24,代码来源:action.py

示例13: print

#
# oe_generate_legend.py
# The OnEarth Legend Generator.
#
#
# Global Imagery Browse Services
# NASA Jet Propulsion Laboratory
# 2015

import sys
import urllib
import xml.dom.minidom
from optparse import OptionParser
import matplotlib as mpl
mpl.use('Agg')
print(mpl.matplotlib_fname())
from matplotlib import pyplot
from matplotlib import rcParams
import matplotlib.pyplot as plt
from StringIO import StringIO
import numpy as np
import math

# for SVG tooltips
try:
    import lxml.etree as ET
except ImportError:
    import xml.etree.ElementTree as ET
    ET.register_namespace("","http://www.w3.org/2000/svg")

toolName = "oe_generate_legend.py"
开发者ID:AChelikani,项目名称:onearth,代码行数:31,代码来源:oe_generate_legend.py

示例14: print

#!/usr/bin/env python3
# -*- coding: utf-8; mode: python; mode: auto-fill; fill-column: 78 -*-
# Time-stamp: <2016-02-11 15:06:51 (kthoden)>

"""Auswertung
lade csv
"""
import csv
import json
import survey_data
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.image as image

print("config %s" % mpl.matplotlib_fname())
titles = open("titles.txt", mode="a")
# Set color transparency (0: transparent; 1: solid)
ALPHA_VALUE = 0.7
CHART_COLOUR = "#448CC7"
# using colour scheme from last year's poster
COLOURS = ['#663366', '#cc9900', '#99cccc', '#669966', '#669999', '#99cccc']
CSV_PATH = "csv_sources/"
EXTENSION = "png"                         #or pdf
WIDTH=0.75

def turnaround_dict(dictionary, value_list):
    """Turns
    ist = 'bibarchiv': {'Nein': 5, 'Ja': 93}, 'persoenlich': {'Nein': 39, 'Ja': 59}, 'eigenarchiv': {'Nein': 67, 'Ja': 31}, 'online': {'Nein': 2, 'Ja': 96}}
    into
    eigentlich = {'Nein': {'bibarchiv' : 5, 'persoenlich': 39, 'eigenarchiv': 67, 'online': 2}, 'Ja' : {'bibarchiv' : 93, 'persoenlich': 59, 'eigenarchiv': 31, 'online': 96}}
开发者ID:DARIAH-DE,项目名称:cluster1-umfrage-nutzerverhalten,代码行数:31,代码来源:big_csv.py

示例15: float64

        rownames.append(thisname)
        # print rownames
        for col_num in lineList:
            # print res_num, colCounter
            mymatrix[res_num, colCounter] = float64(thislinearray[col_num])
            # print mymatrix
            colCounter = colCounter + 1
    # DEBUG
    # print res, colnames, res==colnames
    # end DEBUG
    return mymatrix, rownames, colnames


if __name__ == "__main__":
    print "You are using matplotlib version " + matplotlib.__version__
    print "You can make changes to global plotting options in " + matplotlib.matplotlib_fname()

    parser = OptionParser()
    parser.add_option(
        "-i",
        "--interactive",
        action="store_true",
        default=False,
        help="Runs interactive browser of the mutual information matrix",
    )
    parser.add_option("-f", "--filename", default="2esk_demo.txt", help="Filename of mutInf matrix")

    (options, args) = parser.parse_args()

    j = mutInfmat(  #'/home/ahs/r3/Ubc1/wt/Ubc1p_wt/Ubc1p_wt.reslist-nsims6-structs20081-bin30_bootstrap_avg_mutinf_res_sum_0diag.txt',[])
        # options.filename,[])
开发者ID:asteeves,项目名称:mutinf_analysis,代码行数:31,代码来源:mutinf_analysis.py


注:本文中的matplotlib.matplotlib_fname函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。