当前位置:   article > 正文

python 画折线图怎么控制x轴间隔_如何在折线图的分类轴(xaxis)上指定标签之间的间隔?...

python如何让qvalueaxis相隔若干个数值才显示标签

我在一张折线图上对一年的时间序列数据进行建模。我有分类轴标签作为日期,但它是自动显示12个标签(日期)的x轴。我想把这个改为显示3或4个标签。你知道吗

在powerpoint本身上,此功能将位于格式轴-->;轴选项-->;标签-->;下,然后将“标签之间的间隔”从自动更改为“指定间隔单位”。我不知道如何在代码中做到这一点。你知道吗

此外,了解如何将类别轴设置为日期轴也很有帮助。你知道吗def add_stock_chart(ppt,data, company, slide_num =0):

# data is a series indexed by date -- dates are all written as 'Excel numbers'

# company_name is a string of the company's ticker

slide = ppt.slides[slide_num]

chart_data = CategoryChartData()

chart_data.categories = data.index.tolist()

chart_data.add_series(str(company),tuple(data.values.tolist()))

x, y, cx, cy = Inches(.403), Inches(5.33), Inches(2.22), Inches(1.3)

chart = slide.shapes.add_chart(

XL_CHART_TYPE.LINE, x, y, cx, cy, chart_data

).chart

chart.font.size = Pt(8)

chart.font.name = 'Arial'

date_axis = chart.category_axis

date_axis.tick_labels.number_format = 'mmm-yy'

date_axis.major_unit = 90

chart.has_legend = False

chart.show_legend_key = False

chart.has_title = False

chart.series[0].smooth = True

return ppt

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/1001759
推荐阅读
相关标签
  

闽ICP备14008679号