Python第三方庫之openpyxl(12)

來源:互聯網
上載者:User

標籤:顏色   copy   地區   image   openpyxl   ram   chart   lap   spec   

Python第三方庫之openpyxl(12)地面天氣圖

在工作表上的列或行中安排的資料可以在一個表中繪製。當您想要在兩組資料之間找到最佳組合時,一個表面圖表是有用的。正如在地形圖中一樣,顏色和圖案表示的地區是相同的範圍。預設情況下,所有的表面圖都是3D的。通過設定rotation 和perspective來建立2D線框和輪廓圖。

from openpyxl import Workbookfrom openpyxl.chart import (    SurfaceChart,    SurfaceChart3D,    Reference,    Series,)from openpyxl.chart.axis import SeriesAxiswb = Workbook()ws = wb.activedata = [    [None, 10, 20, 30, 40, 50,],    [0.1, 15, 65, 105, 65, 15,],    [0.2, 35, 105, 170, 105, 35,],    [0.3, 55, 135, 215, 135, 55,],    [0.4, 75, 155, 240, 155, 75,],    [0.5, 80, 190, 245, 190, 80,],    [0.6, 75, 155, 240, 155, 75,],    [0.7, 55, 135, 215, 135, 55,],    [0.8, 35, 105, 170, 105, 35,],    [0.9, 15, 65, 105, 65, 15],]for row in data:    ws.append(row)c1 = SurfaceChart()ref = Reference(ws, min_col=2, max_col=6, min_row=1, max_row=10)labels = Reference(ws, min_col=1, min_row=2, max_row=10)c1.add_data(ref, titles_from_data=True)c1.set_categories(labels)c1.title = "Contour"ws.add_chart(c1, "A12")from copy import deepcopy# wireframec2 = deepcopy(c1)c2.wireframe = Truec2.title = "2D Wireframe"ws.add_chart(c2, "G12")# 3D Surfacec3 = SurfaceChart3D()c3.add_data(ref, titles_from_data=True)c3.set_categories(labels)c3.title = "Surface"ws.add_chart(c3, "A29")c4 = deepcopy(c3)c4.wireframe = Truec4.title = "3D Wireframe"ws.add_chart(c4, "G29")wb.save("surface.xlsx")
View Code

 

Python第三方庫之openpyxl(12)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.