内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Python中openpyxl如何實現(xiàn)坐標軸范圍和對數(shù)縮放-創(chuàng)新互聯(lián)

Python中openpyxl如何實現(xiàn)坐標軸范圍和對數(shù)縮放?這個問題可能是我們?nèi)粘W習或工作經(jīng)常見到的。希望通過這個問題能讓你收獲頗深。下面是小編給大家?guī)淼膮⒖純?nèi)容,讓我們一起來看看吧!

為連云港等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及連云港網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為成都網(wǎng)站建設、做網(wǎng)站、連云港網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

坐標軸最小和大值

為了在圖表上顯示特定區(qū)域,可以手動設置坐標軸的最小值和大值。

   from openpyxl import Workbook    from openpyxl.chart import (        ScatterChart,        Reference,        Series,    )        wb = Workbook()    ws = wb.active        ws.append(['X', '1/X'])    for x in range(-10, 11):        if x:            ws.append([x, 1.0 / x])        chart1 = ScatterChart()    chart1.title = "Full Axes"    chart1.x_axis.title = 'x'    chart1.y_axis.title = '1/x'    chart1.legend = None        chart2 = ScatterChart()    chart2.title = "Clipped Axes"    chart2.x_axis.title = 'x'    chart2.y_axis.title = '1/x'    chart2.legend = None        chart2.x_axis.scaling.min = 0    chart2.y_axis.scaling.min = 0    chart2.x_axis.scaling.max = 11    chart2.y_axis.scaling.max = 1.5        x = Reference(ws, min_col=1, min_row=2, max_row=22)    y = Reference(ws, min_col=2, min_row=2, max_row=22)    s = Series(y, xvalues=x)    chart1.append(s)    chart2.append(s)        ws.add_chart(chart1, "C1")    ws.add_chart(chart2, "C15")        wb.save("minmax.xlsx")

Python中openpyxl如何實現(xiàn)坐標軸范圍和對數(shù)縮放

在某些情況下,如上面代碼所示,設置坐標軸范圍實際上等同于顯示數(shù)據(jù)的子范圍。對于大型數(shù)據(jù)集,使用Excel或者Open/Libre Office來繪制散點圖(可能還有其他)時,選擇數(shù)據(jù)子集方式要比設置坐標軸范圍的速度更快。

對數(shù)縮放

x軸和y軸都可以對數(shù)縮放。對數(shù)的基可以設置為任何有效的浮點。如果x軸按對數(shù)縮放,則將丟棄區(qū)域中的負值。

   from openpyxl import Workbook    from openpyxl.chart import (        ScatterChart,        Reference,        Series,    )    import math        wb = Workbook()    ws = wb.active        ws.append(['X', 'Gaussian'])    for i, x in enumerate(range(-10, 11)):        ws.append([x, "=EXP(-(($A${row}/6)^2))".format(row = i + 2)])        chart1 = ScatterChart()    chart1.title = "No Scaling"    chart1.x_axis.title = 'x'    chart1.y_axis.title = 'y'    chart1.legend = None        chart2 = ScatterChart()    chart2.title = "X Log Scale"    chart2.x_axis.title = 'x (log10)'    chart2.y_axis.title = 'y'    chart2.legend = None    chart2.x_axis.scaling.logBase = 10        chart3 = ScatterChart()    chart3.title = "Y Log Scale"    chart3.x_axis.title = 'x'    chart3.y_axis.title = 'y (log10)'    chart3.legend = None    chart3.y_axis.scaling.logBase = 10        chart4 = ScatterChart()    chart4.title = "Both Log Scale"    chart4.x_axis.title = 'x (log10)'    chart4.y_axis.title = 'y (log10)'    chart4.legend = None    chart4.x_axis.scaling.logBase = 10    chart4.y_axis.scaling.logBase = 10        chart5 = ScatterChart()    chart5.title = "Log Scale Base e"    chart5.x_axis.title = 'x (ln)'    chart5.y_axis.title = 'y (ln)'    chart5.legend = None    chart5.x_axis.scaling.logBase = math.e    chart5.y_axis.scaling.logBase = math.e        x = Reference(ws, min_col=1, min_row=2, max_row=22)    y = Reference(ws, min_col=2, min_row=2, max_row=22)    s = Series(y, xvalues=x)    chart1.append(s)    chart2.append(s)    chart3.append(s)    chart4.append(s)    chart5.append(s)        ws.add_chart(chart1, "C1")    ws.add_chart(chart2, "I1")    ws.add_chart(chart3, "C15")    ws.add_chart(chart4, "I15")    ws.add_chart(chart5, "F30")        wb.save("log.xlsx")

這將生成五個類似的圖表:

Python中openpyxl如何實現(xiàn)坐標軸范圍和對數(shù)縮放

五張圖使用了相同的數(shù)據(jù)。其中,第一個圖未縮放,第二和三張圖分別縮放了X和Y軸,第四張圖XY軸均進行了縮放,對數(shù)基數(shù)設置為10;最后的圖表XY軸均進行了縮放,但對數(shù)的底設置為e。

軸線方向

坐標軸可以正常顯示,也可以反向顯示。

軸方向由orientation屬性控制,minMax表示正向,maxMin表示反向。

   from openpyxl import Workbook    from openpyxl.chart import (        ScatterChart,        Reference,        Series,    )        wb = Workbook()    ws = wb.active        ws["A1"] = "Archimedean Spiral"    ws.append(["T", "X", "Y"])    for i, t in enumerate(range(100)):        ws.append([t / 16.0, "=$A${row}*COS($A${row})".format(row = i + 3),                             "=$A${row}*SIN($A${row})".format(row = i + 3)])        chart1 = ScatterChart()    chart1.title = "Default Orientation"    chart1.x_axis.title = 'x'    chart1.y_axis.title = 'y'    chart1.legend = None        chart2 = ScatterChart()    chart2.title = "Flip X"    chart2.x_axis.title = 'x'    chart2.y_axis.title = 'y'    chart2.legend = None    chart2.x_axis.scaling.orientation = "maxMin"    chart2.y_axis.scaling.orientation = "minMax"        chart3 = ScatterChart()    chart3.title = "Flip Y"    chart3.x_axis.title = 'x'    chart3.y_axis.title = 'y'    chart3.legend = None    chart3.x_axis.scaling.orientation = "minMax"    chart3.y_axis.scaling.orientation = "maxMin"        chart4 = ScatterChart()    chart4.title = "Flip Both"    chart4.x_axis.title = 'x'    chart4.y_axis.title = 'y'    chart4.legend = None    chart4.x_axis.scaling.orientation = "maxMin"    chart4.y_axis.scaling.orientation = "maxMin"        x = Reference(ws, min_col=2, min_row=2, max_row=102)    y = Reference(ws, min_col=3, min_row=2, max_row=102)    s = Series(y, xvalues=x)    chart1.append(s)    chart2.append(s)    chart3.append(s)    chart4.append(s)        ws.add_chart(chart1, "D1")    ws.add_chart(chart2, "J1")    ws.add_chart(chart3, "D15")    ws.add_chart(chart4, "J15")        wb.save("orientation.xlsx")

這將生成四個圖表,其中每個可能的方向組合的軸如下所示:

Python中openpyxl如何實現(xiàn)坐標軸范圍和對數(shù)縮放

感謝各位的閱讀!看完上述內(nèi)容,你們對Python中openpyxl如何實現(xiàn)坐標軸范圍和對數(shù)縮放大概了解了嗎?希望文章內(nèi)容對大家有所幫助。如果想了解更多相關文章內(nèi)容,歡迎關注創(chuàng)新互聯(lián)-成都網(wǎng)站建設公司行業(yè)資訊頻道。

網(wǎng)站題目:Python中openpyxl如何實現(xiàn)坐標軸范圍和對數(shù)縮放-創(chuàng)新互聯(lián)
轉(zhuǎn)載注明:http://www.rwnh.cn/article2/copeoc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設計、定制開發(fā)定制網(wǎng)站、標簽優(yōu)化企業(yè)網(wǎng)站制作、商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設
大余县| 红河县| 简阳市| 南和县| 凤凰县| 崇仁县| 手游| 重庆市| 措勤县| 金阳县| 峨山| 德州市| 咸宁市| 安宁市| 诸暨市| 南郑县| 垣曲县| 广西| 吴忠市| 禹城市| 穆棱市| 瑞昌市| 乌兰浩特市| 金昌市| 临高县| 新干县| 三原县| 贡嘎县| 德阳市| 土默特左旗| 泽库县| 佛学| 多伦县| 昌邑市| 中牟县| 海兴县| 姜堰市| 定远县| 甘谷县| 大冶市| 鹤山市|