1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        柱狀圖基本用法

        共 998字,需瀏覽 2分鐘

         ·

        2024-04-10 20:25

        你好,我是郭震

        adc66c3e7450fa644ae9a36123680906.webp

        今天介紹:柱狀圖基本用法

        附完整代碼:
              
              import matplotlib.pyplot as plt
        from matplotlib.font_manager import FontProperties

        # 指定中文字體,這里使用的是微軟雅黑,你可能需要根據(jù)你的系統(tǒng)調(diào)整字體名稱或路徑
        font = FontProperties(fname="C:\Windows\Fonts\msyh.ttc", size=14)

        # 咖啡店及其銷售額數(shù)據(jù)
        coffee_shops = ['咖啡店A''咖啡店B''咖啡店C''咖啡店D''咖啡店E']
        sales = [1200, 1500, 1800, 1600, 2000]

        # 創(chuàng)建柱狀圖
        plt.figure(figsize=(10, 6))  # 設置畫布大小
        plt.bar(coffee_shops, sales, color='skyblue')  # 繪制柱狀圖

        plt.xticks(ticks=range(len(coffee_shops)), labels=coffee_shops, fontproperties=font)

        # 繪制X軸和Y軸標簽
        plt.xlabel('咖啡店',  fontproperties=font)  # X軸標簽
        plt.ylabel('銷售額(美元)',  fontproperties=font)  # Y軸標簽

        # 添加圖表標題
        # plt.title('某小鎮(zhèn)咖啡店一周銷售額對比',  fontproperties=font)  # 圖表標題

        # 顯示圖表
        plt.show()


        瀏覽 36
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            japanfreeavtv | 国产毛片美女18**多 | 18禁免费观看网站 | 国产高潮好爽受不了了夜色 | 欧美午夜黄色 | 91亚洲日本AⅤ精品一区二区 | 免费黄色无码视频 | 琪琪色原影音先锋 | 污免费视频 | 老鸭窝毛片观看 |