Creates the figure and axes for the plotting panel.
12664
def createPlotPanel(self):
        ''''''
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self,-1,self.figure)
        self.canvas.SetSize(wx.Size(300,300))
        self.axes.axis('off')
        self.figure.subplots_adjust(left=0,right=1,top=1,bottom=0)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas,1,wx.EXPAND,wx.ALL)
        self.SetSizerAndFit(self.sizer)
        self.Fit()
343252
def make_plot(self):
        
        X, Y, DX, DY = self._calc_partials()
        
        # Plot the values
        self.figure = plt.Figure()
        axes = self.figure.add_subplot(1, 1, 1)
        axes.quiver(X, Y, DX, DY, angles='xy', color='b', edgecolors=('k',))
        axes.axhline(color='black')
        axes.axvline(color='black')
        latex = sympy.latex(self.equation)
        axes.set_title(r'Direction field for $\frac{dy}{dx} = %s$' % latex, y=1.01)
1136354
def _x_axis(self, draw_axes=True):
        """"""
        axis = self.svg.node(self.nodes['plot'], class_="axis y gauge")
        x, y = self.view((0, 0))
        self.svg.node(axis, 'circle', cx=x, cy=y, r=4)
469539
def _generate_grid(self):
        """"""
        grid_axes = []
        for _, param in self.tunables:
            grid_axes.append(param.get_grid_axis(self.grid_width))

        return grid_axes
1171596
def _setup_axes(self, axes_data):
        """"""

        self.__axes.clear()

        key_setter = [
            ("title", self.__axes.set_title),
            ("xlabel", self.__axes.set_xlabel),
            ("ylabel", self.__axes.set_ylabel),
            ("xscale", self.__axes.set_xscale),
            ("yscale", self.__axes.set_yscale),
            ("xticks", self.__axes.set_xticks),
            ("xtick_labels", self.__axes.set_xticklabels),
            ("xtick_params", self.__axes.tick_params),
            ("yticks", self.__axes.set_yticks),
            ("ytick_labels", self.__axes.set_yticklabels),
            ("ytick_params", self.__axes.tick_params),
            ("xlim", self.__axes.set_xlim),
            ("ylim", self.__axes.set_ylim),
            ("xgrid", self.__axes.xaxis.grid),
            ("ygrid", self.__axes.yaxis.grid),
            ("xdate_format", self._xdate_setter),
        ]

        key2setter = OrderedDict(key_setter)

        for key in key2setter:
            if key in axes_data and axes_data[key]:
                try:
                    kwargs_key = key + "_kwargs"
                    kwargs = axes_data[kwargs_key]

                except KeyError:
                    kwargs = {}

                if key == "title":
                    # Shift title up
                    kwargs["y"] = 1.08

                key2setter[key](axes_data[key], **kwargs)
48076
private static void createAndShowGUI() {

    // Create and set up the window.
    JFrame frame = new JFrame("XChart Demo");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    // Add content to the window.
    frame.add(new XChartDemo());

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }
989748
def create_data_figs(self):
        

        logger.info("Generating the report data and figs from %s to %s",
                    self.start_date, self.end_date)

        self.get_sec_overview()
        self.get_sec_project_activity()
        self.get_sec_project_community()
        self.get_sec_project_process()

        logger.info("Data and figs done")
1333866
def BuildPanel(self):
        
        self.fig   = Figure(self.figsize, dpi=self.dpi)
        # 1 axes for now
        self.gridspec = GridSpec(1,1)
        kwargs = {'facecolor': self.conf.bgcolor}
        if matplotlib.__version__ < "2.0":
            kwargs = {'axisbg': self.conf.bgcolor}

        self.axes  = self.fig.add_subplot(self.gridspec[0], **kwargs)

        self.canvas = FigureCanvas(self, -1, self.fig)

        self.printer.canvas = self.canvas
        self.set_bg(self.conf.framecolor)
        self.conf.canvas = self.canvas
        self.canvas.SetCursor(wxCursor(wx.CURSOR_CROSS))
        self.canvas.mpl_connect("pick_event", self.__onPickEvent)

        # overwrite ScalarFormatter from ticker.py here:
        self.axes.xaxis.set_major_formatter(FuncFormatter(self.xformatter))
        self.axes.yaxis.set_major_formatter(FuncFormatter(self.yformatter))

        # This way of adding to sizer allows resizing
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 2, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 0)
        self.SetAutoLayout(True)
        self.autoset_margins()
        self.SetSizer(sizer)
        self.Fit()

        canvas_draw = self.canvas.draw
        def draw(*args, **kws):
            self.autoset_margins()
            canvas_draw(*args, **kws)
        self.canvas.draw = draw
        self.addCanvasEvents()
1020920
def setup_axes(
        ax=None,
        panels='blue',
        colorbars=[False],
        right_margin=None,
        left_margin=None,
        projection='2d',
        show_ticks=False):
    
    if '3d' in projection: from mpl_toolkits.mplot3d import Axes3D
    avail_projections = {'2d', '3d'}
    if projection not in avail_projections:
        raise ValueError('choose projection from', avail_projections)
    if left_margin is not None:
        raise ValueError('Currently not supporting to pass `left_margin`.')
    if np.any(colorbars) and right_margin is None:
        right_margin = 1 - rcParams['figure.subplot.right'] + 0.21  # 0.25
    elif right_margin is None:
        right_margin = 1 - rcParams['figure.subplot.right'] + 0.06  # 0.10
    # make a list of right margins for each panel
    if not isinstance(right_margin, list):
        right_margin_list = [right_margin for i in range(len(panels))]
    else:
        right_margin_list = right_margin

    # make a figure with len(panels) panels in a row side by side
    top_offset = 1 - rcParams['figure.subplot.top']
    bottom_offset = 0.15 if show_ticks else 0.08
    left_offset = 1 if show_ticks else 0.3  # in units of base_height
    base_height = rcParams['figure.figsize'][1]
    height = base_height
    base_width = rcParams['figure.figsize'][0]
    if show_ticks: base_width *= 1.1

    draw_region_width = base_width - left_offset - top_offset - 0.5  # this is kept constant throughout

    right_margin_factor = sum([1 + right_margin for right_margin in right_margin_list])
    width_without_offsets = right_margin_factor * draw_region_width  # this is the total width that keeps draw_region_width

    right_offset = (len(panels) - 1) * left_offset
    figure_width = width_without_offsets + left_offset + right_offset
    draw_region_width_frac = draw_region_width / figure_width
    left_offset_frac = left_offset / figure_width
    right_offset_frac = 1 - (len(panels) - 1) * left_offset_frac

    if ax is None:
        pl.figure(figsize=(figure_width, height),
                  subplotpars=sppars(left=0, right=1, bottom=bottom_offset))
    left_positions = [left_offset_frac, left_offset_frac + draw_region_width_frac]
    for i in range(1, len(panels)):
        right_margin = right_margin_list[i-1]
        left_positions.append(left_positions[-1] + right_margin * draw_region_width_frac)
        left_positions.append(left_positions[-1] + draw_region_width_frac)
    panel_pos = [[bottom_offset], [1-top_offset], left_positions]

    axs = []
    if ax is None:
        for icolor, color in enumerate(panels):
            left = panel_pos[2][2*icolor]
            bottom = panel_pos[0][0]
            width = draw_region_width / figure_width
            height = panel_pos[1][0] - bottom
            if projection == '2d': ax = pl.axes([left, bottom, width, height])
            elif projection == '3d': ax = pl.axes([left, bottom, width, height], projection='3d')
            axs.append(ax)
    else:
        axs = ax if isinstance(ax, list) else [ax]

    return axs, panel_pos, draw_region_width, figure_width
395659
def _makeplot(self, ax, fig, data, ymin=None, ymax=None, height=6,
                  width=6, dos=None, color=None):
        
        # Define colours
        if color is None:
            color = 'C0'  # Default to first colour in matplotlib series

        # set x and y limits
        tymax = ymax if (ymax is not None) else max(flatten(data['frequency']))
        tymin = ymin if (ymin is not None) else min(flatten(data['frequency']))
        pad = (tymax - tymin) * 0.05

        if ymin is None:
            ymin = 0 if tymin >= self.imag_tol else tymin - pad
        ymax = ymax if ymax else tymax + pad

        ax.set_ylim(ymin, ymax)
        ax.set_xlim(0, data['distances'][-1][-1])

        if ymin < 0:
            dashline = True
            ax.axhline(0, color=rcParams['grid.color'], linestyle='--',
                       dashes=dashes,
                       zorder=0,
                       linewidth=rcParams['ytick.major.width'])
        else:
            dashline = False

        if dos is not None:
            self._plot_phonon_dos(dos, ax=fig.axes[1], color=color,
                                  dashline=dashline)
        else:

            # keep correct aspect ratio; match axis to canvas
            x0, x1 = ax.get_xlim()
            y0, y1 = ax.get_ylim()

            if width is None:
                width = rcParams['figure.figsize'][0]
            if height is None:
                height = rcParams['figure.figsize'][1]
            ax.set_aspect((height/width) * ((x1-x0)/(y1-y0)))
430868
def plot_grid(self, **kwargs):
        
        fig, ax = plt.subplots(1, 1)
        self.plot_grid_to_ax(ax, **kwargs)
        return fig, ax
1005619
def initialize_plot(self, ranges=None):
        
        # Get element key and ranges for frame
        fig = self.generate_plot(self.keys[-1], ranges)
        self.drawn = True
        return fig
977313
def plot_coordinates(self, X, ax=None, figsize=(6, 6), x_component=0, y_component=1,
                                   show_row_labels=True, show_col_labels=True, **kwargs):
        """"""

        utils.validation.check_is_fitted(self, 's_')

        if ax is None:
            fig, ax = plt.subplots(figsize=figsize)

        # Add style
        ax = plot.stylize_axis(ax)

        # Get labels and names
        row_label, row_names, col_label, col_names = util.make_labels_and_names(X)

        # Plot row principal coordinates
        row_coords = self.row_coordinates(X)
        ax.scatter(
            row_coords[x_component],
            row_coords[y_component],
            **kwargs,
            label=row_label
        )

        # Plot column principal coordinates
        col_coords = self.column_coordinates(X)
        ax.scatter(
            col_coords[x_component],
            col_coords[y_component],
            **kwargs,
            label=col_label
        )

        # Add row labels
        if show_row_labels:
            x = row_coords[x_component]
            y = row_coords[y_component]
            for i, label in enumerate(row_names):
                ax.annotate(label, (x[i], y[i]))

        # Add column labels
        if show_col_labels:
            x = col_coords[x_component]
            y = col_coords[y_component]
            for i, label in enumerate(col_names):
                ax.annotate(label, (x[i], y[i]))

        # Legend
        ax.legend()

        # Text
        ax.set_title('Principal coordinates')
        ei = self.explained_inertia_
        ax.set_xlabel('Component {} ({:.2f}% inertia)'.format(x_component, 100 * ei[x_component]))
        ax.set_ylabel('Component {} ({:.2f}% inertia)'.format(y_component, 100 * ei[y_component]))

        return ax
415960
def _create_axes(hist: HistogramBase, vega: dict, kwargs: dict):
    """"""
    xlabel = kwargs.pop("xlabel", hist.axis_names[0])
    ylabel = kwargs.pop("ylabel", hist.axis_names[1] if len(hist.axis_names) >= 2 else None)
    vega["axes"] = [
        {"orient": "bottom", "scale": "xscale", "title": xlabel},
        {"orient": "left", "scale": "yscale", "title": ylabel}
    ]
1243773
private static void createAndShowGUI() {

    // Create and set up the window.
    JFrame frame = new JFrame("XChart Swing Demo");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    // Add content to the window.
    JPanel chartPanel = new XChartPanel(new AreaChart01().getChart());
    frame.add(chartPanel);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }
454268
function buildAxis() {
            axis = d3Axis.axisBottom(xScale)
                .ticks(ticks)
                .tickPadding(tickPadding)
                .tickFormat(d3Format.format(numberFormat));
        }
1285194
def plot_and_save(self, **kwargs):
        """"""
        self.fig = pyplot.figure()
        self.plot()
        self.axes = pyplot.gca()
        self.save_plot(self.fig, self.axes, **kwargs)
        pyplot.close(self.fig)