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


Python matplotlib.rc_file_defaults函数代码示例

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


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

示例1: plot_den

def plot_den(sim, snap, num, subdir="", voff = 0, box=10, elem="Si", ion=2):
    """Plot density"""
    hspec = get_hspec(sim, snap, snr=20., box=box)
    #Adjust the default plot parameters, which do not scale well in a gridspec.
    matplotlib.rc('xtick', labelsize=10)
    matplotlib.rc('ytick', labelsize=10)
    matplotlib.rc('axes', labelsize=10)
    matplotlib.rc('font', size=8)
    matplotlib.rc('lines', linewidth=1.5)
    gs = gridspec.GridSpec(9,2)
    ax3 = plt.subplot(gs[0:4,0])
    plt.sca(ax3)
    xoff = hspec.plot_spectrum(elem,ion,-1,num, flux=False)
    xlim = plt.xlim()
    ax3.xaxis.set_label_position('top')
    ax3.xaxis.tick_top()
    voff += xoff
    ax2 = plt.subplot(gs[5:,0])
    plt.sca(ax2)
    dxlim = hspec.plot_density(elem,ion, num)
    plt.ylabel(r"n$_\mathrm{"+elem+"II}$ (cm$^{-3}$)")
    plt.ylim(ymin=1e-9)
    ax1 = plt.subplot(gs[4,0])
    plt.sca(ax1)
    xscale = dxlim*hspec.velfac/xlim[1]
    hspec.plot_den_to_tau(elem, ion, num, thresh = 1e-9, xlim=200,voff=voff, xscale=xscale)
    ax1.axes.get_xaxis().set_visible(False)
    plt.xlabel("")
    plt.xlim(xlim)
    sdir = path.join(outdir,"spectra/"+subdir)
    if not path.exists(sdir):
        os.mkdir(sdir)
    save_figure(path.join(sdir,str(num)+"_cosmo"+str(sim)+"_"+elem+"_colden"))
    plt.clf()
    matplotlib.rc_file_defaults()
开发者ID:sbird,项目名称:vw_spectra,代码行数:35,代码来源:make_vel_width.py

示例2: run

    def run(self):
        if matplotlib is None:
            msg = req_missing(['matplotlib'], 'use the plot directive', optional=True)
            return [nodes.raw('', '<div class="text-error">{0}</div>'.format(msg), format='html')]

        if not self.arguments and not self.content:
            raise self.error('The plot directive needs either an argument or content.')

        if self.arguments and self.content:
            raise self.error('The plot directive needs either an argument or content, not both.')

        if self.arguments:
            plot_path = self.arguments[0]
            with io.open(plot_path, encoding='utf-8') as fd:
                data = fd.read()
        elif self.content:
            data = '\n'.join(self.content)
            plot_path = md5(data).hexdigest()

        # Always reset context
        plt.close('all')
        matplotlib.rc_file_defaults()
        # Run plot
        exec(data)

        out_path = os.path.join(self.out_dir, plot_path + '.svg')
        plot_url = '/' + os.path.join('pyplots', plot_path + '.svg').replace(os.sep, '/')

        figures = [manager.canvas.figure for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()]
        for figure in figures:
            makedirs(os.path.dirname(out_path))
            figure.savefig(out_path, format='svg')  # Yes, if there's more than one, it's overwritten, sucks.
        self.arguments = [plot_url]
        return super(PyPlot, self).run()
开发者ID:ChillarAnand,项目名称:plugins,代码行数:34,代码来源:pyplots.py

示例3: reset_rcparams_to_default

def reset_rcparams_to_default():
    """
    Reset the rcParams to the default settings.
    """
    mpl.rcParams.clear()
    mpl.rc_file_defaults()
    set_rcparams(DEFAULT_RCPARAMS)
    # We must keep our backend
    mpl.use(MPL_BACKEND)
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:config.py

示例4: print_pretty_spectra

def print_pretty_spectra(snapnum, simname):
    """Print pretty versions of spectra from a simulation snapshot"""
    rands = np.random.randint(0,1000,20)
    halo = ps.CIVPlot(snapnum, simname, savefile="nr_dla_spectra.hdf5", spec_res = 50.)
    offsets = halo.get_offsets()[rands]
    np.savetxt("tau_Rperp_table.txt", np.sort(np.vstack((np.arange(0,1000), halo.get_offsets())).T,0))
    for nn in rands:
        gs = gridspec.GridSpec(9,2)
        axes = (plt.subplot(gs[0:4,0]), plt.subplot(gs[5:,0]), plt.subplot(gs[4,0]))
        #Adjust the default plot parameters, which do not scale well in a gridspec.
        matplotlib.rc('xtick', labelsize=8)
        matplotlib.rc('ytick', labelsize=8)
        matplotlib.rc('axes', labelsize=8)
        matplotlib.rc('font', size=6)
        matplotlib.rc('lines', linewidth=1.5)
        plot_den(halo, axes, nn+1000, color="red")
        plot_den(halo, axes, nn)
        np.savetxt(str(nn)+"_tau_DLA.txt",halo.get_tau("C",4,1548,nn))
        np.savetxt(str(nn)+"_tau_CGM.txt",halo.get_tau("C",4,1548,nn+1000))
        axes[0].text(-500, 0.2,"offset (prop kpc): "+str(offsets[nn]*0.33333/0.7))
        odir = path.join(outdir, "spectra")
        save_figure(path.join(odir,str(nn)+"_cosmo"+"_CIV_spec"))
        plt.clf()
        matplotlib.rc_file_defaults()
开发者ID:sbird,项目名称:civ_kinematics,代码行数:24,代码来源:make_civ_plots.py

示例5: clear_state

def clear_state(plot_rcparams):
    plt.close('all')
    matplotlib.rc_file_defaults()
    matplotlib.rcParams.update(plot_rcparams)
开发者ID:SibghatullahSheikh,项目名称:nupic-darwin64,代码行数:4,代码来源:plot_directive.py

示例6: clear_state

def clear_state():
    plt.close('all')
    matplotlib.rc_file_defaults()
开发者ID:MariaNattestad,项目名称:clonal-deconvolution-from-copy-number,代码行数:3,代码来源:plot_directive.py

示例7: clear_state

def clear_state(plot_rcparams, close=True):
    if close:
        plt.close("all")
    matplotlib.rc_file_defaults()
    matplotlib.rcParams.update(plot_rcparams)
开发者ID:QuLogic,项目名称:cartopy,代码行数:5,代码来源:plot_directive.py

示例8: print

from scipy.signal import argrelextrema

from bisip import invResults as iR
from bisip.utils import format_results, get_data
from bisip.utils import split_filepath, get_model_type
from bisip.utils import var_depth, flatten

try:
    import lib_dd.decomposition.ccd_single as ccd_single
    import lib_dd.config.cfg_single as cfg_single
    print("\nCCDtools available")
except:
    pass

import matplotlib as mpl
mpl.rc_file_defaults()    

#==============================================================================
# Function to run MCMC simulation on selected model
# Arguments: model <function>, mcmc parameters <dict>,traces path <string>
def run_MCMC(function, mc_p, save_traces=False, save_where=None):
    print("\nMCMC parameters:\n", mc_p)
    if save_traces:
        # If path doesn't exist, create it
        if not path.exists(save_where): makedirs(save_where)
        MDL = pymc.MCMC(function, db='txt',
                        dbname=save_where)
    else:
        MDL = pymc.MCMC(function, db='ram',
                        dbname=save_where)
开发者ID:clberube,项目名称:BISIP,代码行数:30,代码来源:models.py

示例9: MapFigure

from __future__ import division

import numpy as np

import matplotlib
matplotlib.use("Agg", warn=False)
matplotlib.rc_file_defaults()

from matplotlib.figure import Figure
from mpl_toolkits.basemap import Basemap

import Utilities.colours 
from Utilities.smooth import smooth


class MapFigure(Figure, Basemap):

    def __init__(self):
        Figure.__init__(self)
        self.subfigures = []

    def add(self, data, xgrid, ygrid, title, levels, cbarlab, map_kwargs):
        self.subfigures.append((data, xgrid, ygrid, title, levels, cbarlab, map_kwargs))

    def labelAxes(self, axes, xlabel='Longitude', ylabel='Latitude'):
        axes.set_xlabel(xlabel, labelpad=20, fontsize='x-small')
        axes.set_ylabel(ylabel, labelpad=25, fontsize='x-small')


    def addGraticule(self, axes, mapobj, dl=10.):
        xmin = mapobj.llcrnrlon
开发者ID:HyeonJeongKim,项目名称:tcrm,代码行数:31,代码来源:maps.py

示例10: set_rc_params

 def set_rc_params(params):
     # Reset params from rc file if matplotlib installation supports it.
     if hasattr(matplotlib, 'rc_file_defaults'):
         matplotlib.rc_file_defaults()
     if params:
         matplotlib.rcParams.update(params)
开发者ID:galdreiman,项目名称:PAC,代码行数:6,代码来源:MyPlot.py

示例11: clear_state

def clear_state(plot_rcparams):
    plt.close('all')

    if hasattr(matplotlib, 'rc_file_defaults'):
        matplotlib.rc_file_defaults()
        matplotlib.rcParams.update(plot_rcparams)
开发者ID:asmeurer,项目名称:scipy-2011-tutorial,代码行数:6,代码来源:plot_directive.py

示例12: copy

matplotlib.use(arg, warn=False, force=True) # установить backend
matplotlib.get_backend()                    

class matplotlib.RcParams(*args, **kwargs)  # класс для хранения параметров
	copy()
	find_all(pattern)
	validate                                     # словарь с функциями валидации
matplotlib.rcParams                         # текущие параметры

matplotlib.rc_context(rc=None, fname=None)  # with rc_context(...) строим график

matplotlib.rc(group, **kwargs)              # устанавливает rc параметры
matplotlib.rc_file(fname)                   # устанавливает параметры из файла
matplotlib.rcdefaults()                     # устанавливает параметры по умолчанию
matplotlib.rc_file_defaults()               # устанавливает параметры из rc файла по умолчанию

matplotlib.rc_params(fail_on_error=False)   # возвращает параметры из rc файла по умолчанию
matplotlib.rc_params_from_file(fname, fail_on_error=False, use_default_template=True) # 
matplotlib.matplotlib_fname()               # путь к файлу с конфигами

matplotlib.interactive(b)                   # устанавливает интерактивность
matplotlib.is_interactive()                 # проверяет интерактивность

####################  module style
import matplotlib.style
matplotlib.style.context(style, after_reset=False)
matplotlib.style.reload_library()
matplotlib.style.use(style)
matplotlib.style.library                    # словарь доступных стилей
matplotlib.style.available                  # список доступных стилей
开发者ID:FeelUsM,项目名称:zadrotstvo,代码行数:30,代码来源:matplotlib.py


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