Skip to content
Snippets Groups Projects
Select Git revision
  • mysql-3.23.58
  • 10.6 default
  • bb-10.6-midenok-MDEV-16417
  • bb-10.4-MDEV-23675
  • 10.5
  • bb-10.2-MDEV-18867
  • bb-10.3-sujatha
  • bb-10.2-sujatha
  • bb-10.5-MDEV-23456
  • bb-10.1-sujatha
  • bb-10.4-anel-MDEV-23626-connect
  • bb-10.5-midenok
  • bb-10.2-MDEV-19264-backup-slave-info
  • bb-10.2-MDEV-23456
  • bb-10.4-anel-MDEV-23589
  • 10.5-mdev21829
  • bb-10.6-midenok-MDEV-17554
  • bb-10.5-mdev23662
  • 10.2
  • bb-10.4-thiru
  • 10.1
  • bb-10.2-midenok
  • mariadb-10.5.5
  • mariadb-10.4.14
  • mariadb-10.3.24
  • mariadb-10.2.33
  • mariadb-10.1.46
  • mariadb-10.5.4
  • mariadb-10.5.3
  • mariadb-10.4.13
  • mariadb-10.3.23
  • mariadb-10.2.32
  • mariadb-10.1.45
  • mariadb-5.5.68
  • mariadb-10.5.2
  • mariadb-10.5.1
  • mariadb-10.4.12
  • mariadb-10.3.22
  • mariadb-10.2.31
  • mariadb-10.1.44
  • mariadb-5.5.67
  • mariadb-10.4.11
42 results

MySQL-Source.icc

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    save_plot.py 910 B
    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    """
    Export a plot figure to a picture file.
    
    Functions:
        save_plot(figure, string) -> path-like
    """
    
    import matplotlib
    import matplotlib.pyplot as plt
    
    
    def save_plot(figure, plot_name, extension='png'):
        """
        Export plot.
    
        Parameters
        ----------
        figure : figure object
            Figure that was tagged and now should be saved as picture.
        plot_name: Name of the file where the plot will be saved to.
        extension: string
            File extension for the plot export.
    
        Returns
        -------
        plot_path: Name of the created picture.
    
        """
        match type(figure):
            case matplotlib.figure.Figure:
                plt.figure(figure)
                plot_path = plot_name + '.' + extension
                plt.savefig(plot_path)
            case _:
                raise TypeError('The given figure is not a valid figure object.')
    
        return plot_path