在散点图中创建点

时间:2013-10-01 12:12:47

标签: python xlsxwriter

我已经提出问题并得到了回答。 create point in graph using xslwriter

我正在尝试使用'type': 'scatter','subtype' : 'straight'和标记添加相同的功能添加系列但是最终会有以下选项。

  File "C:\Python27\lib\site-packages\xlsxwriter\workbook.py", line 386, in _store_workbook
    packager._create_package()
  File "C:\Python27\lib\site-packages\xlsxwriter\packager.py", line 122, in _create_package
    self._write_chart_files()
  File "C:\Python27\lib\site-packages\xlsxwriter\packager.py", line 205, in _write_chart_files
    chart._assemble_xml_file()
  File "C:\Python27\lib\site-packages\xlsxwriter\chart.py", line 525, in _assemble_xml_file
    self._write_chart()
  File "C:\Python27\lib\site-packages\xlsxwriter\chart.py", line 1158, in _write_chart
    self._write_plot_area()
  File "C:\Python27\lib\site-packages\xlsxwriter\chart_scatter.py", line 168, in _write_plot_area
    self._write_chart_type({'primary_axes': 1})
  File "C:\Python27\lib\site-packages\xlsxwriter\chart_scatter.py", line 52, in _write_chart_type
    self._write_scatter_chart(args)
  File "C:\Python27\lib\site-packages\xlsxwriter\chart_scatter.py", line 91, in _write_scatter_chart
    self._modify_series_formatting()
  File "C:\Python27\lib\site-packages\xlsxwriter\chart_scatter.py", line 284, in _modify_series_formatting
    if series['marker'] is None or not series['marker']['defined']:
KeyError: 'defined'

1 个答案:

答案 0 :(得分:0)

您需要将子类型定义为straight_with_markers

尝试这样的事情:

chart = workbook.add_chart({'type': 'scatter',
                            'subtype': 'straight_with_markers'})