Metadata-Version: 2.1
Name: shs-plot-utils
Version: 1.7.0
Summary: plot utils for faster creation of plots in our projects
Home-page: https://gitlab.dillinger.de/KI/DataScience/utils/shs-plot-utils
Author: Benjamin Blaß, Nadja Wirth, Boris Wiegand
Author-email: benjamin.blass@dillinger.biz, nadja.wirth@dillinger.biz, boris.wiegand@dillinger.biz
License: UNKNOWN
Description: # shs-plot-utils
        
        Facilitates the creation of plots and reduces boilerplate code
        
        ## Prerequisites
        
        Python 3.7+
        
        ## Installing
        
        ```
        python -m pip install
               -i http://nexus.int.shsservices.de/repository/ki-python-releases/simple
               --trusted-host nexus.int.shsservices.de shs-plot-utils
        ```
        
        If pip is already configured to use the nexus repository:
        
        ```
        pip install shs-plot-utils
        ```
        
        ## Usage
        
        ### PlotContext
        
        If you want to create a single plot (without subplots) use PlotContext:
        
        ```python
        from shsplots.matplotlib.plot_context import PlotContext
        
        #plt.show is called automatically
        with PlotContext(title='My fancy plot'):
            plt.plot([1,2,3], [1,2,3])
        
        #savefig() is called automatically
        with PlotContext(show=False, filepath='fancy_plot.png'):
            plt.plot([1,2,3], [1,2,3])
        
        with PlotContext(show=False, filepath='fancy_plot.png') as plot_context:
            plt.plot([1,2,3], [1,2,3])
        
            #get underlying matplot libe figure and axes
            plot_context.get_figure()
            plot_context.get_axes()
        
            #get figure as base64 encoded string
            plot_context.to_base_64()
        ```
        
        ### GridPlotContext
        
        If you need subplots, use GridPlotContext:
        
        ```python
        from shsplots.matplotlib.plot_context import GridPlotContext
        
        #create a plot with three rows and two columns
        with GridPlotContext(3, 2) as plot_context:
            plot_context.get_axes(1, 0).plot(x, y)
        ```
        
        ### Heatmap:
        
        ```python
        from shsplots.matplotlib.plot_context import PlotContext
        from shsplots.matplotlib.heatmap import plot_heatmap
        from shsplots.matplotlib.heatmap import annotate_heatmap
        
        with PlotContext(title='My fancy heatmap'):
            data = np.array([[1000,2000,3000], [4000,0,2001]])
            heatmap, colorbar = plot_heatmap(
                data,
                ['row_1', 'row_2'],
                ['col_1', 'col_2', 'col_3'],
                colorbar_label='Value [unit]'
            )
            texts = annotate_heatmap(heatmap, valfmt="{x:.1f} t")
        ```
        
        ![heatmap](readme_resources/img/heatmap.png)
        
        ### Histograms:
        
        ```python
        from shsplots.matplotlib.plot_context import PlotContext
        from shsplots.matplotlib.histogram import plot_counts
        from shsplots.matplotlib.histogram import plot_histogram
        
        #for discrete data
        with PlotContext():
            plot_counts(['a', 'b', 'b', 'a', 'a', 'c', 'b', 'b', 'b', 'b'])
        ```
        
        ![heatmap](readme_resources/img/histogram.png)
        
        ```python
        #for continuous data
        with PlotContext((title='My fancy histogram'):
            plot_histogram([0.1, 0.9, ..., 0.37], nr_of_bins=10)
        ```
        
        ## Running the tests
        
        ```
        coverage run
              --source=shsplots
              -m unittest discover -p shsplots_tests -v
        ```
        
        ## Deployment
        
        When changes are pushed into the master branch, the project is bundled and
        uploaded to our Nexus automatically.
        
        ## Versioning
        
        We use [SemVer](http://semver.org/) for versioning.
        
        ## Authors
        
        * **Benjamin Blaß** - benjamin.blass@dillinger.biz
        * **Nadja Wirth** - nadja.wirth@dillinger.biz
        * **Boris Wiegand** - boris.wiegand@dillinger.biz
        
        See also the list of [contributors](https://gitlab.dillinger.de/KI/DataScience/utils/shs-plot-utils/-/graphs/master) who participated in this project.
        
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: matplotlib
Classifier: Topic :: plot
Classifier: Topic :: plotting
Classifier: Topic :: plots
Classifier: Topic :: graphs
Classifier: Topic :: diagrams
Description-Content-Type: text/markdown
