How to use the getdist.plots.set_active_style function in getdist

To help you get started, we’ve selected a few getdist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cmbant / getdist / getdist / gui / mainwindow.py View on Github external
for v in six.itervalues(localdic):
                if isinstance(v, plots.GetDistPlotter):
                    self.updateScriptPreview(v)
                    break

            self.exportAct.setEnabled(True)

        except SyntaxError as e:
            QMessageBox.critical(self, "Plot script", type(e).__name__ + ': %s\n %s' % (e, e.text))
        except Exception as e:
            self.errorReport(e, caption="Plot script")
        finally:
            QApplication.restoreOverrideCursor()
            plots.default_settings = oldset
            plots.set_active_style(old_style)
            self._set_rc(oldrc)
            self.showMessage()
github cmbant / getdist / getdist / gui / mainwindow.py View on Github external
def getPlotter(self, chain_dir=None, loadNew=False):
        try:
            if self.plotter is None or chain_dir or loadNew:
                module = __import__(self.plot_module, fromlist=['dummy'])
                if hasattr(module, "style_name"):
                    plots.set_active_style(module.style_name)
                if self.plotter and not loadNew:
                    samps = self.plotter.sample_analyser.mcsamples
                else:
                    samps = None
                # set path of grids, so that any custom grid settings get propagated
                chain_dirs = []
                if chain_dir:
                    chain_dirs.append(chain_dir)
                for root in self.root_infos:
                    info = self.root_infos[root]
                    if info.batch:
                        if info.batch not in chain_dirs:
                            chain_dirs.append(info.batch)

                self.plotter = plots.get_subplot_plotter(chain_dir=chain_dirs, analysis_settings=self.current_settings)
                if samps:
github cmbant / getdist / getdist / gui / mainwindow.py View on Github external
def plotData2(self):
        """
        Slot function called when pushButtonPlot2 is pressed.
        """
        if self.tabWidget.currentIndex() == 0:
            self.plotData()
            return

        self.script_edit = self.textWidget.toPlainText()
        oldset = plots.default_settings
        old_style = plots.set_active_style()
        oldrc = matplotlib.rcParams.copy()
        plots.default_settings = plots.GetDistPlotSettings()
        self._set_rc(self.orig_rc)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.showMessage("Rendering plot....")
        try:
            script_exec = self.script_edit

            if "g.export()" in script_exec:
                # Comment line which produces export to PDF
                script_exec = script_exec.replace("g.export", "#g.export")

            globaldic = {}
            localdic = {}
            exec(script_exec, globaldic, localdic)