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

Python rcParams.get函数代码示例

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

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



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

示例1: __init__

    def __init__(self, width, height, ipewriter, basename):
        self.width = width
        self.height = height
        self.writer = XMLWriter(ipewriter)
        self.basename = basename

        RendererBase.__init__(self)

        # use same latex as Ipe (default is xelatex)
        rcParams['pgf.texsystem'] = "pdflatex"
        self.latexManager = None
        if rcParams.get("ipe.textsize", False):
            self.latexManager = LatexManagerFactory.get_latex_manager()

        self._start_id = self.writer.start(
            u'ipe',
            version=u"70005",
            creator="matplotlib")
        pre = rcParams.get('ipe.preamble', "")
        if pre != "":
            self.writer.start(u'preamble')
            self.writer.data(pre)
            self.writer.end(indent=False)
        sheet = rcParams.get('ipe.stylesheet', "")
        if sheet != "":
            self.writer.insertSheet(sheet)
        self.writer.start(u'ipestyle', name=u"opacity")

        for i in range(10,100,10):
            self.writer.element(u'opacity', name=u'%02d%%'% i, 
                                value=u'%g'% (i/100.0))
        self.writer.end()
        self.writer.start(u'page')
开发者ID:otfried,项目名称:ipe-tools,代码行数:33,代码来源:backend_ipe.py


示例2: __init__

    def __init__(self, adir, v_intervalx, d_intervalx, axes, *args, **kwargs):
        # adir identifies which axes this is
        self.adir = adir
        # data and viewing intervals for this direction
        self.d_interval = d_intervalx
        self.v_interval = v_intervalx

        # This is a temporary member variable.
        # Do not depend on this existing in future releases!
        self._axinfo = self._AXINFO[adir].copy()
        if rcParams['_internal.classic_mode']:
            self._axinfo.update({'label':
                                    {'va': 'center',
                                     'ha': 'center'},
                                 'tick':
                                    {'inward_factor': 0.2,
                                     'outward_factor': 0.1,
                                     'linewidth': rcParams['lines.linewidth'],
                                     'color': 'k'},
                                 'axisline':
                                    {'linewidth': 0.75,
                                     'color': (0, 0, 0, 1)},
                                 'grid' :
                                    {'color': (0.9, 0.9, 0.9, 1),
                                     'linewidth': 1.0,
                                     'linestyle': '-'},
                                })
        else:
            self._axinfo.update({'label' :
                                    {'va': 'center',
                                     'ha': 'center'},
                                 'tick' :
                                    {'inward_factor': 0.2,
                                     'outward_factor': 0.1,
                                     'linewidth': rcParams.get(
                                        adir + 'tick.major.width',
                                        rcParams['xtick.major.width']),
                                     'color': rcParams.get(
                                        adir + 'tick.color',
                                        rcParams['xtick.color'])},
                                 'axisline':
                                    {'linewidth': rcParams['axes.linewidth'],
                                     'color': rcParams['axes.edgecolor']},
                                 'grid' :
                                    {'color': rcParams['grid.color'],
                                     'linewidth': rcParams['grid.linewidth'],
                                     'linestyle': rcParams['grid.linestyle']},
                                })


        maxis.XAxis.__init__(self, axes, *args, **kwargs)

        self.set_rotate_label(kwargs.get('rotate_label', None))
开发者ID:AlexandreAbraham,项目名称:matplotlib,代码行数:53,代码来源:axis3d.py


示例3: __init__

 def __init__(self, ticksize=None, tick_out=None, **kwargs):
     if ticksize is None:
         ticksize = rcParams['xtick.major.size']
     self.set_ticksize(ticksize)
     self.set_tick_out(rcParams.get('xtick.direction', 'in') == 'out')
     self.clear()
     line2d_kwargs = {'color': rcParams['xtick.color'],
                      # For the linewidth we need to set a default since old versions of
                      # matplotlib don't have this.
                      'linewidth': rcParams.get('xtick.major.width', 1)}
     line2d_kwargs.update(kwargs)
     Line2D.__init__(self, [0.], [0.], **line2d_kwargs)
     self.set_visible_axes('all')
     self._display_minor_ticks = False
开发者ID:Juanlu001,项目名称:astropy,代码行数:14,代码来源:ticks.py


示例4: __init__

 def __init__(self, ticksize=None, tick_out=None, **kwargs):
     if ticksize is None:
         ticksize = rcParams["xtick.major.size"]
     self.set_ticksize(ticksize)
     self.set_tick_out(rcParams.get("xtick.direction", "in") == "out")
     self.clear()
     line2d_kwargs = {
         "color": rcParams["xtick.color"],
         # For the linewidth we need to set a default since old versions of
         # matplotlib don't have this.
         "linewidth": rcParams.get("xtick.major.width", 1),
     }
     line2d_kwargs.update(kwargs)
     Line2D.__init__(self, [0.0], [0.0], **line2d_kwargs)
     self.set_visible_axes("all")
     self._display_minor_ticks = False
开发者ID:saimn,项目名称:glue,代码行数:16,代码来源:ticks.py


示例5: as_species

def as_species(name, leave_path=False):
    """Cleans up a filename into a species name, italicizing it in latex."""
    #trim extension if present
    dot_location = name.rfind('.')
    if dot_location > -1:
        name = name[:dot_location]
    #get rid of _small if present -- used for debugging
    if name.endswith('_small'):
        name = name[:-len('_small')]
    if name.endswith('_codon_usage'):
        name = name[:-len('_codon_usage')]
    #get rid of path unless told to leave it
    name = split(name)[-1]
    #replace underscores with spaces
    name = name.replace('_', ' ')
    #make sure the first letter of the genus is caps, and not the first letter
    #of the species
    fields = name.split()
    fields[0] = fields[0].title()
    #assume second field is species name
    if len(fields) > 1:
        fields[1] = fields[1].lower()
    binomial = ' '.join(fields)
    if rcParams.get('text.usetex'):
        binomial = r'\emph{' + binomial + '}'
    return binomial
开发者ID:GavinHuttley,项目名称:pycogent,代码行数:26,代码来源:util.py


示例6: get_gwpy_tex_settings

def get_gwpy_tex_settings():
    """Return a dict of rcParams similar to GWPY_TEX_RCPARAMS

    Returns
    -------
    rcParams : `dict`
        a dictionary of matplotlib rcParams
    """
    # custom GW-DetChar formatting
    params = {
        'font.size': 10,
        'xtick.labelsize': 18,
        'ytick.labelsize': 18,
        'axes.labelsize': 20,
        'axes.titlesize': 24,
        'grid.alpha': 0.5,
    }
    if has_tex() and bool_env("GWPY_USETEX", True):
        params.update({
            'text.usetex': True,
            'text.latex.preamble': (
                rcParams.get('text.latex.preamble', []) + GWPY_TEX_MACROS),
            'font.family': ['serif'],
            'axes.formatter.use_mathtext': False,
        })
    return params
开发者ID:andrew-lundgren,项目名称:gwdetchar,代码行数:26,代码来源:plot.py


示例7: get_latex_manager

    def get_latex_manager():
        texcommand = get_texcommand()
        latex_header = LatexManager._build_latex_header()
        prev = LatexManagerFactory.previous_instance

        # check if the previous instance of LatexManager can be reused
        if prev and prev.latex_header == latex_header and prev.texcommand == texcommand:
            if rcParams.get("pgf.debug", False):
                print("reusing LatexManager")
            return prev
        else:
            if rcParams.get("pgf.debug", False):
                print("creating LatexManager")
            new_inst = LatexManager()
            LatexManagerFactory.previous_instance = new_inst
            return new_inst
开发者ID:717524640,项目名称:matplotlib,代码行数:16,代码来源:backend_pgf.py


示例8: print_jpg

        def print_jpg(self, filename_or_obj, *args, **kwargs):
            """
            Supported kwargs:

            *quality*: The image quality, on a scale from 1 (worst) to
                95 (best). The default is 95, if not given in the
                matplotlibrc file in the savefig.jpeg_quality parameter.
                Values above 95 should be avoided; 100 completely
                disables the JPEG quantization stage.

            *optimize*: If present, indicates that the encoder should
                make an extra pass over the image in order to select
                optimal encoder settings.

            *progressive*: If present, indicates that this image
                should be stored as a progressive JPEG file.
            """
            buf, size = self.print_to_buffer()
            if kwargs.pop("dryrun", False):
                return
            # The image is "pasted" onto a white background image to safely
            # handle any transparency
            image = Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
            color = mcolors.colorConverter.to_rgb(
                rcParams.get('savefig.facecolor', 'white'))
            color = tuple([int(x * 255.0) for x in color])
            background = Image.new('RGB', size, color)
            background.paste(image, image)
            options = restrict_dict(kwargs, ['quality', 'optimize',
                                             'progressive'])

            if 'quality' not in options:
                options['quality'] = rcParams['savefig.jpeg_quality']

            return background.save(filename_or_obj, format='jpeg', **options)
开发者ID:Jajauma,项目名称:dotfiles,代码行数:35,代码来源:backend_agg.py


示例9: get_filechooser

 def get_filechooser(self):
     fc = FileChooserDialog(
         title='Save the figure',
         parent=self.figure.canvas.manager.window,
         path=os.path.expanduser(rcParams.get('savefig.directory', '')),
         filetypes=self.figure.canvas.get_supported_filetypes(),
         default_filetype=self.figure.canvas.get_default_filetype())
     fc.set_current_name(self.figure.canvas.get_default_filename())
     return fc
开发者ID:RealGeeks,项目名称:matplotlib,代码行数:9,代码来源:backend_gtk3.py


示例10: __init__

    def __init__(self, ax, label, bar_length, **props):
        '''
        Draw a horizontal bar with the size in data coordinate of the give axes.
        A label will be drawn above (center-aligned).
        '''
        label_size = props['label_size'] if 'label_size' in props else \
            rcParams.get('scalebar.label_size', 16)
        label_family = props['label_family'] if 'label_family' in props else \
            rcParams.get('scalebar.label_family', 'sans-serif')
        label_color = props['label_color'] if 'label_color' in props else \
            rcParams.get('scalebar.label_color', 'black')
        location = props['location'] if 'location' in props else \
            rcParams.get('scalebar.location', 4)
        padding = props['padding'] if 'padding' in props else \
            rcParams.get('scalebar.padding', 0.5)
        sep = props['sep'] if 'sep' in props else \
            rcParams.get('scalebar.sep', 2)
        bar_color = props['bar_color'] if 'bar_color' in props else \
            rcParams.get('scalebar.bar_color', 'black')
        bar_width = props['bar_width'] if 'bar_width' in props else \
            rcParams.get('scalebar.bar_width', 0.1)
        bar_length = props['bar_length'] if 'bar_length' in props else \
            rcParams.get('scalebar.bar_length', 0.8)

        frameon = False
        prop = None

        self.scale_bar = AuxTransformBox(ax.transData)


        rect = mpatches.Rectangle((0, 0),
                          bar_length, bar_width,
                          linewidth=0, edgecolor=None,
                          facecolor=bar_color)

        self.scale_bar.add_artist(rect)

        textprops = {'size': label_size}

        self.txt_label = TextArea(label, textprops=textprops, minimumdescent=False)

        self._box = VPacker(children=[self.txt_label, self.scale_bar],
                            align="center",
                            pad=0, sep=sep)

        AnchoredOffsetbox.__init__(self, location, pad=padding, borderpad=0,
                                   child=self._box,
                                   prop=prop,
                                   frameon=frameon)
开发者ID:ngroup,项目名称:py_figure_template,代码行数:49,代码来源:scalebar.py


示例11: get_filechooser

 def get_filechooser(self):
     fc = FileChooserDialog(
         title="Save the figure",
         parent=self.win,
         path=os.path.expanduser(rcParams.get("savefig.directory", "")),
         filetypes=self.canvas.get_supported_filetypes(),
         default_filetype=self.canvas.get_default_filetype(),
     )
     fc.set_current_name(self.canvas.get_default_filename())
     return fc
开发者ID:petebachant,项目名称:matplotlib,代码行数:10,代码来源:backend_gtk.py


示例12: __init__

    def __init__(self, parent_axes=None, parent_map=None, transform=None, coord_index=None,
                 coord_type='scalar', coord_unit=None, coord_wrap=None, frame=None):

        # Keep a reference to the parent axes and the transform
        self.parent_axes = parent_axes
        self.parent_map = parent_map
        self.transform = transform
        self.coord_index = coord_index
        self.coord_unit = coord_unit
        self.frame = frame

        self.set_coord_type(coord_type, coord_wrap)

        # Initialize ticks
        self.dpi_transform = Affine2D()
        self.offset_transform = ScaledTranslation(0, 0, self.dpi_transform)
        self.ticks = Ticks(transform=parent_axes.transData + self.offset_transform)

        # Initialize tick labels
        self.ticklabels = TickLabels(self.frame,
                                     transform=None,  # display coordinates
                                     figure=parent_axes.get_figure())
        self.ticks.display_minor_ticks(False)
        self.minor_frequency = 5

        # Initialize axis labels
        self.axislabels = AxisLabels(self.frame,
                                     transform=None,  # display coordinates
                                     figure=parent_axes.get_figure())

        # Initialize container for the grid lines
        self.grid_lines = []

        # Initialize grid style. Take defaults from matplotlib.rcParams.
        # Based on matplotlib.axis.YTick._get_gridline.
        #
        # Matplotlib's gridlines use Line2D, but ours use PathPatch.
        # Patches take a slightly different format of linestyle argument.
        lines_to_patches_linestyle = {
            '-': 'solid',
            '--': 'dashed',
            '-.': 'dashdot',
            ':': 'dotted',
            'none': 'none',
            'None': 'none',
            ' ': 'none',
            '': 'none'
        }
        self.grid_lines_kwargs = {'visible': False,
                                  'facecolor': 'none',
                                  'edgecolor': rcParams['grid.color'],
                                  'linestyle': lines_to_patches_linestyle[rcParams['grid.linestyle']],
                                  'linewidth': rcParams['grid.linewidth'],
                                  'alpha': rcParams.get('grid.alpha', 1.0),
                                  'transform': self.parent_axes.transData}
开发者ID:Cadair,项目名称:wcsaxes,代码行数:55,代码来源:coordinate_helpers.py


示例13: __del__

 def __del__(self):
     if rcParams.get("pgf.debug", False):
         print "deleting LatexManager"
     try:
         self.latex_stdin_utf8.close()
         self.latex.communicate()
     except:
         pass
     try:
         os.remove("texput.log")
         os.remove("texput.aux")
     except:
         pass
开发者ID:jcmdev0,项目名称:matplotlib,代码行数:13,代码来源:backend_pgf.py


示例14: add_label_unit

 def add_label_unit(self, unit, axis='x'):
     label = getattr(self, 'get_%slabel' % axis)()
     if not label:
         label = unit.__doc__
     if rcParams.get("text.usetex", False):
         unitstr = tex.unit_to_latex(unit)
     else:
         unitstr = unit.to_string()
     set_ = getattr(self, 'set_%slabel' % axis)
     if label:
         set_("%s [%s]" % (label, unitstr))
     else:
         set_(unitstr)
开发者ID:pmeyers279,项目名称:seispy,代码行数:13,代码来源:axes.py


示例15: __del__

 def __del__(self):
     if rcParams.get("pgf.debug", False):
         print "deleting LatexManager"
     try:
         self.latex.terminate()
         self.latex.wait()
     except:
         pass
     try:
         os.remove("texput.log")
         os.remove("texput.aux")
     except:
         pass
开发者ID:VirgileFritsch,项目名称:matplotlib,代码行数:13,代码来源:backend_pgf.py


示例16: save_figure

 def save_figure(self, *args):
     fname, format = self.get_filechooser().get_filename_from_user()
     if fname:
         startpath = os.path.expanduser(rcParams.get('savefig.directory', ''))
         if startpath == '':
             # explicitly missing key or empty str signals to use cwd
             rcParams['savefig.directory'] = startpath
         else:
             # save dir for next time
             rcParams['savefig.directory'] = os.path.dirname(unicode(fname))
         try:
             self.canvas.print_figure(fname, format=format)
         except Exception as e:
             error_msg_gtk(str(e), parent=self)
开发者ID:Westacular,项目名称:matplotlib,代码行数:14,代码来源:backend_gtk.py


示例17: save_figure

 def save_figure(self, *args):
     chooser = self.get_filechooser()
     fname, format = chooser.get_filename_from_user()
     chooser.destroy()
     if fname:
         startpath = os.path.expanduser(rcParams.get("savefig.directory", ""))
         if startpath == "":
             # explicitly missing key or empty str signals to use cwd
             rcParams["savefig.directory"] = startpath
         else:
             # save dir for next time
             rcParams["savefig.directory"] = os.path.dirname(six.text_type(fname))
         try:
             self.canvas.print_figure(fname, format=format)
         except Exception as e:
             error_msg_gtk(str(e), parent=self)
开发者ID:petebachant,项目名称:matplotlib,代码行数:16,代码来源:backend_gtk.py


示例18: __init__

    def __init__(self):
        # store references for __del__
        self._os_path = os.path
        self._shutil = shutil
        self._debug = rcParams.get("pgf.debug", False)

        # create a tmp directory for running latex, remember to cleanup
        self.tmpdir = tempfile.mkdtemp(prefix="mpl_pgf_lm_")
        LatexManager._unclean_instances.add(self)

        # test the LaTeX setup to ensure a clean startup of the subprocess
        self.texcommand = get_texcommand()
        self.latex_header = LatexManager._build_latex_header()
        latex_end = "\n\\makeatletter\n\\@@end\n"
        try:
            latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
                                     stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
                                     cwd=self.tmpdir)
        except OSError as e:
            if e.errno == errno.ENOENT:
                raise RuntimeError("Latex command not found. "
                    "Install '%s' or change pgf.texsystem to the desired command."
                    % self.texcommand
                )
            else:
                raise RuntimeError("Error starting process '%s'" % self.texcommand)
        test_input = self.latex_header + latex_end
        stdout, stderr = latex.communicate(test_input.encode("utf-8"))
        if latex.returncode != 0:
            raise LatexError("LaTeX returned an error, probably missing font or error in preamble:\n%s" % stdout)

        # open LaTeX process for real work
        latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
                                 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                                 cwd=self.tmpdir)
        self.latex = latex
        self.latex_stdin_utf8 = codecs.getwriter("utf8")(self.latex.stdin)
        # write header with 'pgf_backend_query_start' token
        self._stdin_writeln(self._build_latex_header())
        # read all lines until our 'pgf_backend_query_start' token appears
        self._expect("*pgf_backend_query_start")
        self._expect_prompt()

        # cache for strings already processed
        self.str_cache = {}
开发者ID:717524640,项目名称:matplotlib,代码行数:46,代码来源:backend_pgf.py


示例19: get_fontspec

def get_fontspec():
    latex_fontspec = []
    texcommand = get_texcommand()

    if texcommand is not "pdflatex":
        latex_fontspec.append(r"\usepackage{fontspec}")

    if texcommand is not "pdflatex" and rcParams.get("pgf.rcfonts", True):
        # try to find fonts from rc parameters
        families = ["serif", "sans-serif", "monospace"]
        fontspecs = [r"\setmainfont{%s}", r"\setsansfont{%s}", r"\setmonofont{%s}"]
        for family, fontspec in zip(families, fontspecs):
            matches = [f for f in rcParams["font."+family] if f in system_fonts]
            if matches:
                latex_fontspec.append(fontspec % matches[0])
            else:
                pass # no fonts found, fallback to LaTeX defaule

    return "\n".join(latex_fontspec)
开发者ID:jcmdev0,项目名称:matplotlib,代码行数:19,代码来源:backend_pgf.py


示例20: plot_data

def plot_data(ax, data, labels, idx, change_marker):
    """ Actual plotting """
    color = get_color(idx)
    marker_color = get_color(idx, True)

    if "Model" in data.columns:
        color = get_color(idx/2)
        marker_color = get_color(idx/2, True)
        ax.plot(data["S"], data["Model"],
                marker=get_marker(idx, change_marker),
                markersize=rcParams.get("lines.markersize") * 0.6,
                color=ps.change_color_brightness(color, 0.2),
                markeredgecolor=ps.change_color_brightness(marker_color, 0.2),
                label=labels[idx])
        idx += 1

    ax.errorbar(data["S"], data["Value"], yerr=data["Error"],
                fmt=get_marker(idx, change_marker),
                color=color, markeredgecolor=marker_color,
                label=labels[idx])
开发者ID:pylhc,项目名称:Beta-Beat.src,代码行数:20,代码来源:plot_export.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python rcParams.update函数代码示例发布时间:2022-05-27
下一篇:
Python cm.rainbow函数代码示例发布时间: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