コード例 #1
0
 def test_bad_year(self):
     with self.assertRaises(ValueError):
         plot_pie_chart_interactive(self.df,
                                    col="Quantite",
                                    year=20,
                                    year1=2005,
                                    sticker="Regions")
コード例 #2
0
 def test_bad_sticker(self):
     with self.assertRaises(ValueError):
         plot_pie_chart_interactive(self.df,
                                    col="Quantite",
                                    year=2004,
                                    year1=2025,
                                    sticker="LLX")
コード例 #3
0
"""

import os
import pandas as pd
import plotly
from templot import plot_pie_chart_interactive, add_regions, download_irep

filepath = os.path.join('..', 'templot', 'data', 'df.csv')

if not os.path.exists(filepath):
    download_irep(filepath)

df = pd.read_csv(filepath)
df = add_regions(df, "LLX", "LLY")

fig = plot_pie_chart_interactive(df, "Quantite", 2004, 2005, "Regions")

# visualize the html results in sphinx gallery
tmp_dir = os.path.join('..', 'dist', 'html')
if os.path.exists(tmp_dir):
    plotly.offline.plot(
        fig,
        filename=os.path.join(tmp_dir, 'example_ipchar.html'),
        auto_open=False,
    )

####################################
# .. raw:: html
#
#     <iframe src="../example_ipchar.html" height="800px" width="100%"></iframe>
コード例 #4
0
 def test_bad_df(self):
     with self.assertRaises(TypeError):
         df = []
         plot_pie_chart_interactive(df, "Quantite", 2004, 2005, "Regions")