예제 #1
0
파일: base.py 프로젝트: rrane/jcvi
    def set_image_options(self, args=None, figsize="6x6", dpi=300,
                          format="pdf", theme="helvetica"):
        """
        Add image format options for given command line programs.
        """
        from jcvi.graphics.base import ImageOptions, setup_theme

        allowed_format = ("emf", "eps", "pdf", "png", "ps", \
                          "raw", "rgba", "svg", "svgz")
        allowed_themes = ("helvetica", "palatino", "schoolbook", "mpl")

        group = OptionGroup(self, "Image options")
        self.add_option_group(group)

        group.add_option("--figsize", default=figsize,
                help="Figure size `width`x`height` in inches [default: %default]")
        group.add_option("--dpi", default=dpi, type="int",
                help="Physical dot density (dots per inch) [default: %default]")
        group.add_option("--format", default=format, choices=allowed_format,
                help="Generate image of format [default: %default]")
        group.add_option("--theme", default=theme, choices=allowed_themes,
                help="Font theme [default: %default]")

        if args is None:
            args = sys.argv[1:]

        opts, args = self.parse_args(args)

        assert opts.dpi > 0
        assert "x" in opts.figsize

        setup_theme(opts.theme)

        return opts, args, ImageOptions(opts)
예제 #2
0
파일: base.py 프로젝트: radaniba/jcvi
    def set_image_options(self, args=None, figsize="6x6", dpi=300,
                          format="pdf", font="Helvetica", palette="deep",
                          style="darkgrid"):
        """
        Add image format options for given command line programs.
        """
        from jcvi.graphics.base import ImageOptions, setup_theme

        allowed_format = ("emf", "eps", "pdf", "png", "ps", \
                          "raw", "rgba", "svg", "svgz")
        allowed_fonts = ("Helvetica", "Palatino", "Schoolbook", "Arial")
        allowed_styles = ("darkgrid", "whitegrid", "dark", "white", "ticks")
        allowed_diverge = ("BrBG", "PiYG", "PRGn", "PuOr", "RdBu", \
                           "RdGy", "RdYlBu", "RdYlGn", "Spectral")

        group = OptionGroup(self, "Image options")
        self.add_option_group(group)

        group.add_option("--figsize", default=figsize,
                help="Figure size `width`x`height` in inches [default: %default]")
        group.add_option("--dpi", default=dpi, type="int",
                help="Physical dot density (dots per inch) [default: %default]")
        group.add_option("--format", default=format, choices=allowed_format,
                help="Generate image of format [default: %default]")
        group.add_option("--font", default=font, choices=allowed_fonts,
                help="Font name")
        group.add_option("--style", default=style, choices=allowed_styles,
                help="Axes background")
        group.add_option("--diverge", default="PiYG", choices=allowed_diverge,
                help="Contrasting color scheme")
        group.add_option("--cmap", default="jet", help="Use this color map")

        if args is None:
            args = sys.argv[1:]

        opts, args = self.parse_args(args)

        assert opts.dpi > 0
        assert "x" in opts.figsize

        setup_theme(style=opts.style, font=opts.font)

        return opts, args, ImageOptions(opts)
예제 #3
0
    def set_image_options(self,
                          args=None,
                          figsize="6x6",
                          dpi=300,
                          format="pdf",
                          font="Helvetica",
                          palette="deep",
                          style="darkgrid"):
        """
        Add image format options for given command line programs.
        """
        from jcvi.graphics.base import ImageOptions, setup_theme

        allowed_format = ("emf", "eps", "pdf", "png", "ps", \
                          "raw", "rgba", "svg", "svgz")
        allowed_fonts = ("Helvetica", "Palatino", "Schoolbook", "Arial")
        allowed_styles = ("darkgrid", "whitegrid", "dark", "white", "ticks")
        allowed_diverge = ("BrBG", "PiYG", "PRGn", "PuOr", "RdBu", \
                           "RdGy", "RdYlBu", "RdYlGn", "Spectral")

        group = OptionGroup(self, "Image options")
        self.add_option_group(group)

        group.add_option(
            "--figsize",
            default=figsize,
            help="Figure size `width`x`height` in inches [default: %default]")
        group.add_option(
            "--dpi",
            default=dpi,
            type="int",
            help="Physical dot density (dots per inch) [default: %default]")
        group.add_option("--format",
                         default=format,
                         choices=allowed_format,
                         help="Generate image of format [default: %default]")
        group.add_option("--font",
                         default=font,
                         choices=allowed_fonts,
                         help="Font name")
        group.add_option("--style",
                         default=style,
                         choices=allowed_styles,
                         help="Axes background")
        group.add_option("--diverge",
                         default="PiYG",
                         choices=allowed_diverge,
                         help="Contrasting color scheme")
        group.add_option("--cmap", default="jet", help="Use this color map")

        if args is None:
            args = sys.argv[1:]

        opts, args = self.parse_args(args)

        assert opts.dpi > 0
        assert "x" in opts.figsize

        setup_theme(style=opts.style, font=opts.font)

        return opts, args, ImageOptions(opts)