作者viskboy (qa)
看板Python
标题[问题] 长条图标题与X轴标签字体大小调整
时间Sun Jun 16 00:36:43 2024
各位好,不好意思又遇到问题上网找不到答案,再麻烦帮忙。谢谢大家
问题:
建立长条图後想要修改图表标题字体大小跟图表X轴标签字体大小,我的程式码如下。谢谢
chart =arChart()
chart.type "col"
chart.style 10
chart.title "CP W1_CLIP"
chart.gapWidth 500
chart.legend Legend()
chart.legend.position 'b'
chart.legend.layout None
chart.legend.overlay False
data = Reference(ws_new,in_col=2,in_row=1,ax_col=len(weeks)+1,ax_row=len(vend_names)+1)
cats = Reference(ws_new,in_col=1,in_row=2,ax_row=len(vend_names)+1)
chart.add_data(data,itles_from_data=True)
chart.set_categories(cats)
ws_new.add_chart(chart, "I2")
target_value 0.8
target_data [target_value] *en(vend_names)
target_ref Reference(ws_new,in_col=len(weeks) + 2,in_row=1,ax_row=len(vend_names) + 1)
for, value in enumerate(target_data, start=2):
ws_new.cell(row=i, column=len(weeks) + 2, value=value)
line_chartineChart()
line_chart.add_data(target_ref,itles_from_data=True)
line_chart.set_categories(cats)
for series inine_chart.series:
series.graphicalProperties.line.solidFill "FF0000"
series.graphicalProperties.line.width 9525 * 2
chart +=ine_chart
chart.width 36
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 42.79.73.88 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1718469407.A.33C.html
1F:推 jasonfghx: 哪个套件? 06/18 19:25
2F:→ viskboy: from openpyxl.chart import BarChart, LineChart, 06/18 19:52
3F:→ viskboy: Refer。谢谢您帮忙 06/18 19:52
4F:→ viskboy: ence 06/18 19:52
5F:→ viskboy: from openpyxl.chart import BarChart, LineChart, 06/18 19:52
6F:→ viskboy: Reference 谢谢您的帮忙 06/18 19:53
7F:推 xhining: 喂狗openpyxl chart font size有答案,你要试试吗? 06/23 10:31
8F:→ viskboy: 您好,我有试过估狗。没看到X轴的资料修改字体。(除了全 06/24 09:29
9F:→ viskboy: 英文外(看不懂))感谢您的帮忙回覆 06/24 09:29
10F:→ cacadeon: 07/03 20:47