本文整理汇总了Python中matplotlib.get_data_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_data_path函数的具体用法?Python get_data_path怎么用?Python get_data_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_data_path函数的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.
deprecated = {*mpl._all_deprecated, *mpl._deprecated_remain_as_none}
path_to_rc = os.path.join(mpl.get_data_path(), 'matplotlibrc')
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 k.startswith(
("verbose.", "examples.directory", "text.latex.unicode")):
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:jklymak,项目名称:matplotlib,代码行数:25,代码来源:test_rcparams.py
示例2: 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 = os.path.join(mpl.get_data_path(), 'matplotlibrc')
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:
mpl.rc_params_from_file(fname,
fail_on_error=True,
use_default_template=False)
assert len(record) == 0
开发者ID:jklymak,项目名称:matplotlib,代码行数:26,代码来源:test_rcparams.py
示例3: __init__
def __init__(self, lines):
import gtk.glade
datadir = matplotlib.get_data_path()
gladefile = os.path.join(datadir, 'lineprops.glade')
if not os.path.exists(gladefile):
raise IOError('Could not find gladefile lineprops.glade in %s'%datadir)
self._inited = False
self._updateson = True # suppress updates when setting widgets manually
self.wtree = gtk.glade.XML(gladefile, 'dialog_lineprops')
self.wtree.signal_autoconnect(dict([(s, getattr(self, s)) for s in self.signals]))
self.dlg = self.wtree.get_widget('dialog_lineprops')
self.lines = lines
cbox = self.wtree.get_widget('combobox_lineprops')
cbox.set_active(0)
self.cbox_lineprops = cbox
cbox = self.wtree.get_widget('combobox_linestyles')
for ls in self.linestyles:
cbox.append_text(ls)
cbox.set_active(0)
self.cbox_linestyles = cbox
cbox = self.wtree.get_widget('combobox_markers')
for m in self.markers:
cbox.append_text(m)
cbox.set_active(0)
self.cbox_markers = cbox
self._lastcnt = 0
self._inited = True
开发者ID:AndreI11,项目名称:SatStressGui,代码行数:34,代码来源:backend_gtk.py
示例4: 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))
path_to_rc = os.path.join(mpl.get_data_path(), 'matplotlibrc')
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:egpbos,项目名称:matplotlib,代码行数:27,代码来源:test_rcparams.py
示例5: recipe_matplotlib
def recipe_matplotlib(mf):
m = mf.findNode('matplotlib')
if not isRealModule(m):
return
import matplotlib
if 0: # do not copy matplotlibdata. assume matplotlib is installed as egg
dp = matplotlib.get_data_path()
assert dp
mf.copyTree(dp, "matplotlibdata", m)
# mf.import_hook("matplotlib.numerix.random_array", m)
backend_name = 'backend_' + matplotlib.get_backend().lower()
print "recipe_matplotlib: using the %s matplotlib backend" % (backend_name, )
mf.import_hook('matplotlib.backends.' + backend_name, m)
return True
开发者ID:jvb,项目名称:infobiotics-dashboard,代码行数:14,代码来源:freeze.py
示例6: default
def default(self, o):
if isinstance(o, FontManager):
return dict(o.__dict__, __class__='FontManager')
elif isinstance(o, FontEntry):
d = dict(o.__dict__, __class__='FontEntry')
try:
# Cache paths of fonts shipped with mpl relative to the mpl
# data path, which helps in the presence of venvs.
d["fname"] = str(
Path(d["fname"]).relative_to(mpl.get_data_path()))
except ValueError:
pass
return d
else:
return super().default(o)
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:15,代码来源:font_manager.py
示例7: _json_decode
def _json_decode(o):
cls = o.pop('__class__', None)
if cls is None:
return o
elif cls == 'FontManager':
r = FontManager.__new__(FontManager)
r.__dict__.update(o)
return r
elif cls == 'FontEntry':
r = FontEntry.__new__(FontEntry)
r.__dict__.update(o)
if not os.path.isabs(r.fname):
r.fname = os.path.join(mpl.get_data_path(), r.fname)
return r
else:
raise ValueError("don't know how to deserialize __class__=%s" % cls)
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:16,代码来源:font_manager.py
示例8: recipe_matplotlib
def recipe_matplotlib(mf):
m = mf.findNode('matplotlib')
if not isRealModule(m):
return
import matplotlib
if 0: # do not copy matplotlibdata. assume matplotlib is installed as egg
dp = matplotlib.get_data_path()
assert dp
mf.copyTree(dp, "matplotlibdata", m)
mf.import_hook("matplotlib.numerix.random_array", m)
# the import hook expects a string (matplotlib in later versions has
# all rcParams, including the backend as unicode)
backend_name = 'backend_' + str(matplotlib.get_backend().lower())
print "recipe_matplotlib: using the %s matplotlib backend" % (backend_name, )
mf.import_hook('matplotlib.backends.' + backend_name, m)
return True
开发者ID:SiggyF,项目名称:bbfreeze,代码行数:18,代码来源:recipes.py
示例9: __init__
def __init__(self, data_source, figure_size, fontsize):
self.data_source = data_source
if iterable(figure_size):
self.figure_size = float(figure_size[0]), float(figure_size[1])
else:
self.figure_size = float(figure_size)
self.plots = PlotDictionary(data_source)
self._callbacks = []
self._field_transform = {}
self._colormaps = defaultdict(lambda: 'algae')
font_path = matplotlib.get_data_path() + '/fonts/ttf/STIXGeneral.ttf'
self._font_properties = FontProperties(size=fontsize, fname=font_path)
self._font_color = None
self._xlabel = None
self._ylabel = None
self._minorticks = {}
self._cbar_minorticks = {}
self._colorbar_label = PlotDictionary(
self.data_source, lambda: None)
开发者ID:danielgrassinger,项目名称:yt_new_frontend,代码行数:19,代码来源:plot_container.py
示例10: _remove_blacklisted_style_params
"""
import contextlib
import os
import re
import warnings
import matplotlib as mpl
from matplotlib import rc_params_from_file, rcParamsDefault
from matplotlib.cbook import MatplotlibDeprecationWarning
__all__ = ['use', 'context', 'available', 'library', 'reload_library']
BASE_LIBRARY_PATH = os.path.join(mpl.get_data_path(), 'stylelib')
# Users may want multiple library paths, so store a list of paths.
USER_LIBRARY_PATHS = [os.path.join(mpl.get_configdir(), 'stylelib')]
STYLE_EXTENSION = 'mplstyle'
STYLE_FILE_PATTERN = re.compile(r'([\S]+).%s$' % STYLE_EXTENSION)
# A list of rcParams that should not be applied from styles
STYLE_BLACKLIST = {
'interactive', 'backend', 'backend.qt4', 'webagg.port', 'webagg.address',
'webagg.port_retries', 'webagg.open_in_browser', 'backend_fallback',
'toolbar', 'timezone', 'datapath', 'figure.max_open_warning',
'savefig.directory', 'tk.window_focus', 'docstring.hardcopy'}
def _remove_blacklisted_style_params(d, warn=True):
开发者ID:dopplershift,项目名称:matplotlib,代码行数:31,代码来源:core.py
示例11: __init__
class Target:
def __init__(self, **kw):
self.__dict__.update(kw)
# for the versioninfo resources
self.version = local_config.__version__
self.company_name = "SasView.org"
self.copyright = "copyright 2009 - 2016"
self.name = "SasView"
#
# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib
# to use the MatPlotLib.
#
path = os.getcwd()
matplotlibdatadir = matplotlib.get_data_path()
matplotlibdata = findall(matplotlibdatadir)
DATA_FILES = []
if tinycc:
DATA_FILES += tinycc.data_files()
# Copying SLD data
import periodictable
DATA_FILES += periodictable.data_files()
from sas.sasgui.perspectives import fitting
DATA_FILES += fitting.data_files()
from sas.sasgui.perspectives import calculator
开发者ID:pkienzle,项目名称:sasview,代码行数:31,代码来源:setup_exe.py
示例12: get_egg_dir
# Include packages not detected by cx_Freeze
includes = ['matplotlib.backends.backend_qt4agg',
'scipy.special._ufuncs_cxx',
'scipy.sparse.csgraph._validation',
#'scipy.sparse.linalg.dsolve.umfpack',
'scipy.integrate.vode',
'scipy.integrate.lsoda'
]
# includes += ['skimage.io._plugins.'+modname
# for __, modname, __ in
# pkgutil.iter_modules(skimage.io._plugins.__path__) ]
# Include data/package files not accounted for by cx_Freeze
import matplotlib
include_files = [(matplotlib.get_data_path(), 'mpl-data'),
('matplotlibrc', '')]
#A simple util to get the egg dir name
def get_egg_dir(name):
base_name = pkg_resources.get_distribution(name).egg_name()
for posible_extention in ['.egg-info','.dist-info']:
full_path = os.path.join(SITE_PACKAGE_DIR , base_name + posible_extention)
print full_path
if os.path.exists(full_path):
return base_name+posible_extention
def get_pth_dir(name):
return pkg_resources.get_distribution(name).egg_name()+'-nspkg.pth'
开发者ID:ylockerman,项目名称:multi-scale-label-map-extraction,代码行数:30,代码来源:freeze_programs.py
示例13: new_figure_manager
except:
print >>sys.stderr, 'The CococaAgg backend required PyObjC to be installed!'
print >>sys.stderr, ' (currently testing v1.3.7)'
sys.exit()
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder, AppHelper
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backend_bases import FigureManagerBase
from backend_agg import FigureCanvasAgg
from matplotlib._pylab_helpers import Gcf
mplBundle = NSBundle.bundleWithPath_(matplotlib.get_data_path())
def new_figure_manager(num, *args, **kwargs):
thisFig = Figure( *args, **kwargs )
canvas = FigureCanvasCocoaAgg(thisFig)
return FigureManagerCocoaAgg(canvas, num)
def show():
for manager in Gcf.get_all_fig_managers():
manager.show()
def draw_if_interactive():
if matplotlib.is_interactive():
figManager = Gcf.get_active()
if figManager is not None:
figManager.show()
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:31,代码来源:backend_cocoaagg.py
示例14:
x,y = tup[1:]
path.line_to(x,y)
elif code == CURVE3:
xctl, yctl, xto, yto= tup[1:]
path.curve3(xctl, yctl, xto, yto)
elif code == CURVE4:
xctl1, yctl1, xctl2, yctl2, xto, yto= tup[1:]
path.curve4(xctl1, yct1, xctl2, yctl2, xto, yto)
elif code == ENDPOLY:
path.end_poly()
return path
width, height = 300,300
fname = os.path.join(matplotlib.get_data_path(), 'Vera.ttf')
font = FT2Font(fname)
glyph = font.load_char(ord('y'))
path = glyph_to_agg_path(glyph)
curve = agg.conv_curve_path(path)
scaling = agg.trans_affine_scaling(20,20)
translation = agg.trans_affine_translation(4,4)
rotation = agg.trans_affine_rotation(3.1415926)
mtrans = translation*scaling # cannot use this as a temporary
tpath = agg.conv_transform_path(path, mtrans)
curve = agg.conv_curve_trans(tpath)
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:30,代码来源:glyph_to_path.py
示例15:
'libwebkitgtk-3.0-0.dll',
'libwebp-5.dll',
'libwinpthread-1.dll',
'libxslt-1.dll',
'libzzz.dll',
]
include_files = []
for dll in missing_dlls:
include_files.append((os.path.join(include_dll_path, dll), dll))
gtk_libs = ['etc', 'lib', 'share']
for lib in gtk_libs:
include_files.append((os.path.join(include_dll_path, lib), lib))
include_files.append((matplotlib.get_data_path(), 'mpl-data'))
include_files.append((basemap.basemap_datadir, 'mpl-basemap-data'))
include_files.append(('data/client/king_phisher', 'king_phisher'))
exe_base = 'Win32GUI'
if is_debugging_build:
exe_base = 'Console'
executables = [
Executable(
'KingPhisher',
base=exe_base,
icon='data/client/king_phisher/king-phisher-icon.ico',
shortcutName='KingPhisher',
shortcutDir='ProgramMenuFolder'
)
开发者ID:jsmit260,项目名称:king-phisher,代码行数:31,代码来源:cx_freeze.py
示例16:
# cx_freeze script to generate a executable
# to run it, type in a command-line interface
# python setup.py build
import sys
import matplotlib
from cx_Freeze import setup, Executable
# replace base by None if a debug console is required
if sys.platform == "win32":
base = "Win32GUI"
build_exe_options = {"includes":["matplotlib.backends.backend_qt4agg","scipy.special._ufuncs_cxx",
"scipy.integrate","scipy.integrate.vode",
"scipy.integrate.lsoda","scipy.sparse.csgraph._validation"],
"include_files":[(matplotlib.get_data_path(), "mpl-data"),
('application_edit.ico','application_edit.ico'),
('trad.txt','trad.txt'),
('settings.ini','settings.ini')],
"excludes":[]}
setup(
name = "TopoPyGUI",
options = {"build_exe": build_exe_options},
version = "8.1",
description = "Draw topographic maps",
executables = [Executable("TopoPyGUI.py", base = base)],
)
开发者ID:jojo-,项目名称:TopoPy,代码行数:28,代码来源:setup.py
示例17: box
#!/usr/bin/env python
from __future__ import print_function
"""
This is a demo script to show you how to use all the properties of an
FT2Font object. These describe global font properties. For
individual character metrices, use the Glyp object, as returned by
load_char
"""
import matplotlib
import matplotlib.ft2font as ft
#fname = '/usr/local/share/matplotlib/VeraIt.ttf'
fname = matplotlib.get_data_path() + '/fonts/ttf/VeraIt.ttf'
#fname = '/usr/local/share/matplotlib/cmr10.ttf'
font = ft.FT2Font(fname)
print('Num faces :', font.num_faces) # number of faces in file
print('Num glyphs :', font.num_glyphs) # number of glyphs in the face
print('Family name :', font.family_name) # face family name
print('Syle name :', font.style_name) # face syle name
print('PS name :', font.postscript_name) # the postscript name
print('Num fixed :', font.num_fixed_sizes) # number of embedded bitmap in face
# the following are only available if face.scalable
if font.scalable:
# the face global bounding box (xmin, ymin, xmax, ymax)
print('Bbox :', font.bbox)
# number of font units covered by the EM
开发者ID:TD22057,项目名称:matplotlib,代码行数:31,代码来源:ftface_props.py
示例18: GetDossiers
# Polices
GetDossiers("Static/Polices"),
# Fichiers à importer :
('', ['noethys/Versions.txt', 'noethys/Licence.txt', 'noethys/Icone.ico']),
]
# Autres data_files
if "py2exe" in sys.argv :
# Ajoute les fichiers de Matplotlib
import matplotlib as mp
matplotlib_font_afm = glob.glob(os.sep.join([mp.get_data_path(), 'fonts\\afm\\*']))
matplotlib_font_pdfcorefonts = glob.glob(os.sep.join([mp.get_data_path(), 'fonts\\pdfcorefonts\\*']))
matplotlib_font_ttf = glob.glob(os.sep.join([mp.get_data_path(), 'fonts\\ttf\\*']))
matplotlib_images = glob.glob(os.sep.join([mp.get_data_path(), 'images\\*']))
data_files += mp.get_py2exe_datafiles()
# Ajoute les fichiers Windows
data_files.append(('', ['noethys/msvcm90.dll', 'noethys/msvcp90.dll', 'noethys/msvcr90.dll', 'noethys/Microsoft.VC90.CRT.manifest', 'noethys/gdiplus.dll', ]))
setup(
name = "Noethys",
version = VERSION_APPLICATION,
author = "Ivan LUCAS",
description = u"Noethys, le logiciel libre et gratuit de gestion multi-activités",
long_description = open("README.md").read().decode("iso-8859-15"),
开发者ID:Noethys,项目名称:Noethys,代码行数:30,代码来源:setup.py
示例19: write_setup
def write_setup(name, version, description="", author="", modules=[NUMPY], includes=[], include_files=[], icon=None, gui_only="True"):
"""['appfuncs','gui_test']"""
"""["graphics/", "imageformats/", ]"""
""""includes":["sip"],"""
imports = []
base = ""
excludes = ['PyQt4.uic.port_v3', 'Tkconstants', 'tcl', 'tk', 'doctest', '_gtkagg', '_tkagg', 'bsddb',
'curses', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'Tkinter',
'tables', 'zmq', 'win32', 'Pythonwin', 'Cython', 'statmodels', 'cvxopt', '_sqlite3', '_ssl', '_testcapi',
'markupsafe', 'numexpr', '_elementtree', '_hashlib', '_testcapi', 'simplejson', 'pyexpat', "lxml",
MATPLOTLIB, GUIDATA, PYQT4, PYSIDE, SCIPY, NUMPY, MULTIPROCESSING, DOCX, OPENGL, PIL, HDF5]
def add(module):
try:
excludes.remove(module)
except:
pass
#'pandas', '_socket', 'sip',
if MATPLOTLIB in modules:
mpl_path = matplotlib.get_data_path()
include_files.append(('mpl-data', mpl_path))
imports.append("import matplotlib")
if GUIDATA in modules:
include_files.append("guidata/images/")
if PYQT4 in modules:
#include_files.append("imageformats/")
includes.append("sip")
includes.append("PyQt4.QtWebKit")
includes.append("PyQt4.QtNetwork")
includes.append("PyQt4.Qsci")
# includes.append("PyQt4.uic")
# includes.append("PyQt4.uic.port_v3")
base = "base='Win32GUI', "
if SCIPY in modules:
imports.append("import scipy.sparse.csgraph")
includes.extend(["scipy.sparse.csgraph._validation", "scipy.sparse.linalg.dsolve.umfpack",
"scipy.integrate.vode", "scipy.integrate._ode", "scipy.integrate.lsoda"])
includes.append("scipy.special._ufuncs_cxx") #py3_64
from scipy.sparse.sparsetools import csr, csc, coo, dia, bsr, csgraph
for f in [csr._csr.__file__,
csc._csc.__file__,
coo._coo.__file__,
dia._dia.__file__,
bsr._bsr.__file__,
csgraph._csgraph.__file__]:
shutil.copy(f, os.path.basename(f))
include_files.append("%s" % os.path.basename(f))
if DOCX in modules:
include_files.append("functions/docx_document/docx-template_clean/")
#include_files.append("functions/docx_document/inkscape/")
includes.append("lxml._elementpath")
excludes.remove("lxml")
excludes.remove(PIL)
if OPENGL in modules:
includes.append("OpenGL")
includes.append("OpenGL.platform.win32")
includes.append("OpenGL.arrays.numpymodule")
includes.append("OpenGL.arrays.arraydatatype")
includes.append("OpenGL.converters")
includes.append("OpenGL.arrays.numbers")
includes.append("OpenGL.arrays.strings")
if HDF5 in modules:
includes.append("h5py")
includes.append('h5py.h5ac')
if PANDAS in modules:
#add('email')
includes.append("Pandas")
for m in modules:
try:
excludes.remove(m)
except ValueError:
pass
imports = "\n".join(imports)
if include_files:
#while any([os.path.isdir(f) for f in include_files if isinstance(f, str)]):
# for folder in [f for f in include_files if isinstance(f, str) and os.path.isdir(f)]:
# include_files.remove(folder)
# include_files.extend(os.listdir(folder))
include_files = "[" + ",".join([("'%s'" % str(f), str(f))[isinstance(f, tuple)] for f in include_files]) + "]"
include_files = include_files.replace("""'(matplotlib.get_data_path(),"mpl-data")'""", """(matplotlib.get_data_path(), "mpl-data")""")
if includes:
includes = "['" + "','".join(includes) + "']"
if icon is not None:
icon = "icon='%s', " % icon
else:
icon = ""
#.........这里部分代码省略.........
开发者ID:madsmpedersen,项目名称:MMPE,代码行数:101,代码来源:build_cx_esky_exe.py
示例20: len
import matplotlib.pyplot as plt
import six
from six import unichr
# the font table grid
labelc = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F']
labelr = ['00', '10', '20', '30', '40', '50', '60', '70', '80', '90',
'A0', 'B0', 'C0', 'D0', 'E0', 'F0']
if len(sys.argv) > 1:
fontname = sys.argv[1]
else:
fontname = os.path.join(matplotlib.get_data_path(),
'fonts', 'ttf', 'DejaVuSans.ttf')
font = FT2Font(fontname)
codes = sorted(font.get_charmap().items())
# a 16,16 array of character strings
chars = [['' for c in range(16)] for r in range(16)]
colors = [[(0.95, 0.95, 0.95) for c in range(16)] for r in range(16)]
plt.figure(figsize=(8, 4), dpi=120)
for ccode, glyphind in codes:
if ccode >= 256:
continue
r, c = divmod(ccode, 16)
s = unichr(ccode)
开发者ID:kshramt,项目名称:matplotlib,代码行数:31,代码来源:font_table_ttf_sgskip.py
注:本文中的matplotlib.get_data_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论