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


Python PlotStyle.setEnabled方法代码示例

本文整理汇总了Python中ert_gui.plottery.PlotStyle.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python PlotStyle.setEnabled方法的具体用法?Python PlotStyle.setEnabled怎么用?Python PlotStyle.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ert_gui.plottery.PlotStyle的用法示例。


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

示例1: test_plot_style_builtin_checks

# 需要导入模块: from ert_gui.plottery import PlotStyle [as 别名]
# 或者: from ert_gui.plottery.PlotStyle import setEnabled [as 别名]
    def test_plot_style_builtin_checks(self):
        style = PlotStyle("Test")

        style.name = None
        self.assertIsNone(style.name)

        style.color = "notacolor"
        self.assertEqual(style.color, "notacolor") # maybe make this a proper check in future ?

        style.line_style = None
        self.assertEqual(style.line_style, "")

        style.marker = None
        self.assertEqual(style.marker, "")

        style.width = -1
        self.assertEqual(style.width, 0.0)

        style.size = -1
        self.assertEqual(style.size, 0.0)

        style.alpha = 1.1
        self.assertEqual(style.alpha, 1.0)

        style.alpha = -0.1
        self.assertEqual(style.alpha, 0.0)

        style.setEnabled(False)
        self.assertFalse(style.isEnabled())
开发者ID:pgdr,项目名称:ert,代码行数:31,代码来源:test_plot_style.py

示例2: test_plot_style_copy_style

# 需要导入模块: from ert_gui.plottery import PlotStyle [as 别名]
# 或者: from ert_gui.plottery.PlotStyle import setEnabled [as 别名]
    def test_plot_style_copy_style(self):
        style = PlotStyle("Test", "red", 0.5, ".", "o", 2.5)
        style.setEnabled(False)

        copy_style = PlotStyle("Copy")

        copy_style.copyStyleFrom(style)

        self.assertNotEqual(style.name, copy_style.name)
        self.assertEqual(style.color, copy_style.color)
        self.assertEqual(style.alpha, copy_style.alpha)
        self.assertEqual(style.line_style, copy_style.line_style)
        self.assertEqual(style.marker, copy_style.marker)
        self.assertEqual(style.width, copy_style.width)
        self.assertNotEqual(style.isEnabled(), copy_style.isEnabled())

        another_copy_style = PlotStyle("Another Copy")
        another_copy_style.copyStyleFrom(style, copy_enabled_state=True)
        self.assertEqual(style.isEnabled(), another_copy_style.isEnabled())
开发者ID:akva2,项目名称:ert,代码行数:21,代码来源:test_plot_style.py

示例3: PlotConfig

# 需要导入模块: from ert_gui.plottery import PlotStyle [as 别名]
# 或者: from ert_gui.plottery.PlotStyle import setEnabled [as 别名]
class PlotConfig(object):

    def __init__(self, title="Unnamed", x_label=None, y_label=None):
        super(PlotConfig, self).__init__()
        self.__title = title

        self.__line_color_cycle_colors = ["#000000"]
        self.__line_color_cycle = itertools.cycle(self.__line_color_cycle_colors) #Black
        # Blueish, Greenlike, Beigeoid, Pinkness, Orangy-Brown
        self.setLineColorCycle(["#386CB0", "#7FC97F", "#FDC086", "#F0027F", "#BF5B17"])

        self.__legend_items = []
        self.__legend_labels = []

        self.__x_label = x_label
        self.__y_label = y_label

        self.__default_style = PlotStyle(name="Default", color=None, alpha=0.8)
        self.__refcase_style = PlotStyle(name="Refcase", alpha=0.8, marker="x", width=2.0)
        self.__observation_style = PlotStyle(name="Observations")
        self.__histogram_style = PlotStyle(name="Histogram", width=2.0)
        self.__distribution_style = PlotStyle(name="Distribution", line_style="", marker="o", alpha=0.5, width=10.0)
        self.__distribution_line_style = PlotStyle(name="Distribution Lines", line_style="-", alpha=0.25, width=1.0)
        self.__distribution_line_style.setEnabled(False)
        self.__current_color = None

        self.__legend_enabled = True
        self.__grid_enabled = True
        self.__date_support_active = True

        self.__statistics_style = {
            "mean": PlotStyle("Mean", line_style=""),
            "p50": PlotStyle("P50", line_style=""),
            "min-max": PlotStyle("Min/Max", line_style=""),
            "p10-p90": PlotStyle("P10-P90", line_style=""),
            "p33-p67": PlotStyle("P33-P67", line_style="")
        }

    def currentColor(self):
        if self.__current_color is None:
            self.nextColor()

        return self.__current_color

    def nextColor(self):
        self.__current_color = self.__line_color_cycle.next()
        return self.__current_color

    def setLineColorCycle(self, color_list):
        self.__line_color_cycle_colors = color_list
        self.__line_color_cycle = itertools.cycle(color_list)

    def addLegendItem(self, label, item):
        self.__legend_items.append(item)
        self.__legend_labels.append(label)

    def title(self):
        """ :rtype: str """
        return self.__title if self.__title is not None else "Unnamed"

    def setTitle(self, title):
        self.__title = title

    def isUnnamed(self):
        return self.__title is None

    def defaultStyle(self):
        style = PlotStyle("Default Style")
        style.copyStyleFrom(self.__default_style)
        style.color = self.currentColor()
        return style

    def observationsStyle(self):
        """ @rtype: PlotStyle """
        style = PlotStyle("Observations Style")
        style.copyStyleFrom(self.__observation_style)
        return style

    def refcaseStyle(self):
        """ @rtype: PlotStyle """
        style = PlotStyle("Refcase Style")
        style.copyStyleFrom(self.__refcase_style)
        return style

    def histogramStyle(self):
        """ @rtype: PlotStyle """
        style = PlotStyle("Histogram Style")
        style.copyStyleFrom(self.__histogram_style)
        style.color = self.currentColor()
        return style

    def distributionStyle(self):
        """ @rtype: PlotStyle """
        style = PlotStyle("Distribution Style")
        style.copyStyleFrom(self.__distribution_style)
        style.color = self.currentColor()
        return style

    def distributionLineStyle(self):
        """ @rtype: ert_gui.plottery.PlotStyle """
#.........这里部分代码省略.........
开发者ID:akva2,项目名称:ert,代码行数:103,代码来源:plot_config.py

示例4: PlotConfig

# 需要导入模块: from ert_gui.plottery import PlotStyle [as 别名]
# 或者: from ert_gui.plottery.PlotStyle import setEnabled [as 别名]
class PlotConfig(object):

    def __init__(self, title="Unnamed", x_label=None, y_label=None):
        super(PlotConfig, self).__init__()
        self._title = title

        self._line_color_cycle_colors = ["#000000"]
        self._line_color_cycle = itertools.cycle(self._line_color_cycle_colors) #Black
        # Blueish, Greenlike, Beigeoid, Pinkness, Orangy-Brown
        self.setLineColorCycle(["#386CB0", "#7FC97F", "#FDC086", "#F0027F", "#BF5B17"])
#        self.setLineColorCycle(["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf" ,"#386CB0", "#7FC97F", "#FDC086", "#F0027F", "#BF5B17"])

        self._legend_items = []
        self._legend_labels = []

        self._x_label = x_label
        self._y_label = y_label

        self._limits = PlotLimits()

        self._default_style = PlotStyle(name="Default", color=None, alpha=0.8)
        self._refcase_style = PlotStyle(name="Refcase", alpha=0.8, marker="x", width=2.0)
        self._history_style = PlotStyle(name="History", alpha=0.8, marker="D", width=2.0)

        # Insanely ugly implementation of user preferences.
        if os.getenv("ERT_SHOW_HISTORY_VECTORS"):
            self._history_style.setEnabled(True)
        else:
            self._history_style.setEnabled(False)

        self._observation_style = PlotStyle(name="Observations")
        self._histogram_style = PlotStyle(name="Histogram", width=2.0)
        self._distribution_style = PlotStyle(name="Distribution", line_style="", marker="o", alpha=0.5, size=10.0)
        self._distribution_line_style = PlotStyle(name="Distribution Lines", line_style="-", alpha=0.25, width=1.0)
        self._distribution_line_style.setEnabled(False)
        self._current_color = None

        self._legend_enabled = True
        self._grid_enabled = True


        self._statistics_style = {
            "mean": PlotStyle("Mean", line_style=""),
            "p50": PlotStyle("P50", line_style=""),
            "min-max": PlotStyle("Min/Max", line_style=""),
            "p10-p90": PlotStyle("P10-P90", line_style=""),
            "p33-p67": PlotStyle("P33-P67", line_style=""),
            "std": PlotStyle("Std dev", line_style="")
        }

        self._std_dev_factor = 1 # sigma 1 is default std dev

    def currentColor(self):
        if self._current_color is None:
            self.nextColor()

        return self._current_color

    def nextColor(self):
        self._current_color = self._line_color_cycle.next()
        return self._current_color

    def setLineColorCycle(self, color_list):
        self._line_color_cycle_colors = color_list
        self._line_color_cycle = itertools.cycle(color_list)

    def lineColorCycle(self):
        return list(self._line_color_cycle_colors)

    def addLegendItem(self, label, item):
        self._legend_items.append(item)
        self._legend_labels.append(label)

    def title(self):
        """ :rtype: str """
        return self._title if self._title is not None else "Unnamed"

    def setTitle(self, title):
        self._title = title

    def isUnnamed(self):
        return self._title is None

    def defaultStyle(self):
        style = PlotStyle("Default Style")
        style.copyStyleFrom(self._default_style)
        style.color = self.currentColor()
        return style

    def observationsStyle(self):
        """ @rtype: PlotStyle """
        style = PlotStyle("Observations Style")
        style.copyStyleFrom(self._observation_style)
        return style

    def refcaseStyle(self):
        """ @rtype: PlotStyle """
        style = PlotStyle("Refcase Style")
        style.copyStyleFrom(self._refcase_style)
        return style
#.........这里部分代码省略.........
开发者ID:arielalmendral,项目名称:ert,代码行数:103,代码来源:plot_config.py


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