• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python matplotlib.matplotlib_fname函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: print

#!/usr/bin/python3
# coding: utf-8
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
print(matplotlib.matplotlib_fname())  # 将会获得 matplotlib 包所在文件夹
# 然后执行下面的操作
# sudo cp msyh.ttf /usr/share/fonts/
# cp msyh.ttf ~/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf
# cd ~/anaconda3/lib/python3.6/site-packages/matplotlib/mpl-data
# vim matplotlibrc  # 删除 font.family 和 font.sans-serif 两行前的 #, 并在 font.sans-serif 后添加中文字体 Microsoft YaHei, ...(其余不变)
# rm -rf ~/.cache/matplotlib/*
##################################################################
## 打印出可用的字体
## 系统可用中文字体
import subprocess
output = subprocess.check_output('fc-list :lang=zh -f "%{family}\n"', shell=True)
print( '*' * 10, '系统可用的中文字体', '*' * 10)
print(output)  # 编码有问题
zh_fonts = set(f.split(',', 1)[0] for f in output.decode('utf-8').split('\n'))
print(zh_fonts)

## matplotlib 可用所有字体
from matplotlib import font_manager
mat_fonts = set(f.name for f in font_manager.FontManager().ttflist)
available = mat_fonts & zh_fonts
print ('*' * 10, '可用的字体', '*' * 10)
for f in available: print (f)

## 另一种方法获得 matplotlib 可用所有字体
import pandas as pd
开发者ID:coder352,项目名称:shellscript,代码行数:31,代码来源:l47_字体_中文问题.py


示例17: print


# add filemode="w" to overwrite
# add a date or time stamp
logging.basicConfig(filename="sample.log", filemode="w", level=logging.INFO)

logging.debug("This is a debug message")
logging.info("Informational message")
logging.error("An error has happened!")


import inspect

import matplotlib as mpl
print('matplotlib: ', mpl.__version__)
print('matplotlib.matplotlib_fname(): ',mpl.matplotlib_fname())

# Force matplotlib to not use any Xwindows backend
# useful when you want to turn off plt.show()
try: mpl.use('Agg')
except: pass

# Fonts, latex:
mpl.rc('font',**{'family':'serif', 'serif':['TimesNewRoman']})
mpl.rc('text', usetex=True)
#mpl.rcParams['text.usetex']=True


import matplotlib.pyplot as plt
import numpy as np
print('numpy: ', np.__version__)
开发者ID:richardgmcmahon,项目名称:SLQmocks,代码行数:29,代码来源:lrg_match_vhs_wise.py


示例18: print

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.draw()
plt.show()

import matplotlib
print(matplotlib.matplotlib_fname())
开发者ID:raddy,项目名称:copper,代码行数:7,代码来源:test.py


示例19: RedirectText

import numpy as np
import csv
#from Animation import AnimatedScatter
import pandas
import multiprocessing
from matplotlib_panel import MatplotlibPanel
from OneD_Plot_Methods import one_d_line_plot, OneD_Line_Same_XAxis, OneD_Compare_Plots
from TwoD_Plot_Methods import TwoD_Scatter, TwoD_Hexbin
from ThreeD_Plot_Methods import ThreeD_Scatter
import XMLParser
from Helpers import DataSize, ChangeBaseAxis, ComparePlots
import wx.lib.agw.flatnotebook as fnb
from wx.lib.colourdb import getColourList
import subprocess
import matplotlib
file_matplotlibrc = matplotlib.matplotlib_fname()


"""
Uncomment this line if you want to replace your matplotlib settings file with the one, available in this repository
subprocess.call["cp", matplotlibrc, file_matplotlibrc]
"""

#This list has all the colors available in wx python
colors = [color for color in getColourList()]



class RedirectText(object):
	def __init__(self, aWxTextCtrl):
		self.out = aWxTextCtrl
开发者ID:kaali-python,项目名称:Plotting_Tool,代码行数:31,代码来源:PlottingTool.py


示例20:

# Problem importing pylab in Ubuntu 8.1
&gt;&gt;&gt; import matplotlib
&gt;&gt;&gt; matplotlib.matplotlib_fname()
开发者ID:AK-1121,项目名称:code_extraction,代码行数:3,代码来源:python_1915.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python matplotlib.plot函数代码示例发布时间:2022-05-27
下一篇:
Python matplotlib.is_interactive函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap