本文整理汇总了Python中ert_gui.plottery.PlotStyle类的典型用法代码示例。如果您正苦于以下问题:Python PlotStyle类的具体用法?Python PlotStyle怎么用?Python PlotStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlotStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_plot_style_test_defaults
def test_plot_style_test_defaults(self):
style = PlotStyle("Test")
self.assertEqual(style.name, "Test")
self.assertEqual(style.color, "#000000")
self.assertEqual(style.line_style, "-")
self.assertEqual(style.alpha, 1.0)
self.assertEqual(style.marker, "")
self.assertEqual(style.width, 1.0)
self.assertTrue(style.isEnabled())
示例2: __init__
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="")
}
示例3: __init__
def __init__(self, line_style_set=STYLESET_DEFAULT):
QWidget.__init__(self)
self._style = PlotStyle("StyleChooser Internal Style")
self._styles = STYLES['default'] if not line_style_set in STYLES else STYLES[line_style_set]
self.setMinimumWidth(140)
self.setMaximumHeight(25)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
self.line_chooser = QComboBox()
self.line_chooser.setToolTip("Select line style.")
for style in self._styles:
self.line_chooser.addItem(*style)
self.marker_chooser = QComboBox()
self.marker_chooser.setToolTip("Select marker style.")
for marker in MARKERS:
self.marker_chooser.addItem(*marker)
self.thickness_spinner = QDoubleSpinBox()
self.thickness_spinner.setToolTip("Line thickness")
self.thickness_spinner.setMinimum(0.1)
self.thickness_spinner.setDecimals(1)
self.thickness_spinner.setSingleStep(0.1)
self.size_spinner = QDoubleSpinBox()
self.size_spinner.setToolTip("Marker Size")
self.size_spinner.setMinimum(0.1)
self.size_spinner.setDecimals(1)
self.size_spinner.setSingleStep(0.1)
# the text content of the spinner varies, but shouldn't push the control out of boundaries
self.line_chooser.setMinimumWidth(110)
layout.addWidget(self.line_chooser)
layout.addWidget(self.thickness_spinner)
layout.addWidget(self.marker_chooser)
layout.addWidget(self.size_spinner)
self.setLayout(layout)
self.line_chooser.currentIndexChanged.connect(self._updateStyle)
self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
self.thickness_spinner.valueChanged.connect(self._updateStyle)
self.size_spinner.valueChanged.connect(self._updateStyle)
self._updateLineStyleAndMarker(self._style.line_style, self._style.marker, self._style.width, self._style.size)
self._layout = layout
示例4: __init__
def __init__(self, plot_settings, title="Unnamed", x_label=None, y_label=None):
self._title = title
self._plot_settings = plot_settings
if self._plot_settings is None:
raise ValueError('PlotConfig needs a non-None plot settings.')
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"])
# alternative color cycle:
# ["#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, line_style="--", marker="", width=2.0,
enabled=self._plot_settings["SHOW_REFCASE"])
self._history_style = PlotStyle(name="History", alpha=0.8, marker=".", width=2.0,
enabled=self._plot_settings["SHOW_HISTORY"])
self._observs_style = PlotStyle(name="Observations", line_style="-", alpha=0.8,
marker=".", width=1.0, color="#000000")
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
示例5: __init__
def __init__(self, area_supported=False):
QWidget.__init__(self)
self._style = PlotStyle("StyleChooser Internal Style")
self._styles = STYLES if area_supported else STYLES_LINE_ONLY
self.setMinimumWidth(140)
self.setMaximumHeight(25)
layout = QHBoxLayout()
layout.setMargin(0)
layout.setSpacing(2)
self.line_chooser = QComboBox()
self.line_chooser.setToolTip("Select line style.")
for style in self._styles:
self.line_chooser.addItem(*style)
self.marker_chooser = QComboBox()
self.marker_chooser.setToolTip("Select marker style.")
for marker in MARKERS:
self.marker_chooser.addItem(*marker)
self.thickness_spinner = QDoubleSpinBox()
self.thickness_spinner.setToolTip("Line thickness")
self.thickness_spinner.setMinimum(0.1)
self.thickness_spinner.setDecimals(1)
self.thickness_spinner.setSingleStep(0.1)
self.size_spinner = QDoubleSpinBox()
self.size_spinner.setToolTip("Marker Size")
self.size_spinner.setMinimum(0.1)
self.size_spinner.setDecimals(1)
self.size_spinner.setSingleStep(0.1)
layout.addWidget(self.line_chooser)
layout.addWidget(self.thickness_spinner)
layout.addWidget(self.marker_chooser)
layout.addWidget(self.size_spinner)
self.setLayout(layout)
self.line_chooser.currentIndexChanged.connect(self._updateStyle)
self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
self.thickness_spinner.valueChanged.connect(self._updateStyle)
self.size_spinner.valueChanged.connect(self._updateStyle)
self._updateLineStyleAndMarker(self._style.line_style, self._style.marker, self._style.width, self._style.size)
self._layout = layout
示例6: __init__
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
示例7: getStatisticsStyle
def getStatisticsStyle(self, statistic):
style = self.__statistics_style[statistic]
copy_style = PlotStyle(style.name)
copy_style.copyStyleFrom(style)
copy_style.color = self.currentColor()
return copy_style
示例8: distributionStyle
def distributionStyle(self):
""" @rtype: PlotStyle """
style = PlotStyle("Distribution Style")
style.copyStyleFrom(self.__distribution_style)
style.color = self.currentColor()
return style
示例9: histogramStyle
def histogramStyle(self):
""" @rtype: PlotStyle """
style = PlotStyle("Histogram Style")
style.copyStyleFrom(self.__histogram_style)
style.color = self.currentColor()
return style
示例10: refcaseStyle
def refcaseStyle(self):
""" @rtype: PlotStyle """
style = PlotStyle("Refcase Style")
style.copyStyleFrom(self.__refcase_style)
return style
示例11: observationsStyle
def observationsStyle(self):
""" @rtype: PlotStyle """
style = PlotStyle("Observations Style")
style.copyStyleFrom(self.__observation_style)
return style
示例12: defaultStyle
def defaultStyle(self):
style = PlotStyle("Default Style")
style.copyStyleFrom(self.__default_style)
style.color = self.currentColor()
return style
示例13: historyStyle
def historyStyle(self):
""" @rtype: PlotStyle """
style = PlotStyle("History Style")
style.copyStyleFrom(self._history_style)
return style
示例14: test_plot_style_builtin_checks
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())
示例15: distributionLineStyle
def distributionLineStyle(self):
""" @rtype: ert_gui.plottery.PlotStyle """
style = PlotStyle("Distribution Line Style")
style.copyStyleFrom(self.__distribution_line_style)
return style