vba 如何绘制这样的“带标记的线”图?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5692247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 13:02:34  来源:igfitidea点击:

How to draw a "Line with Markers" graph like this?

excelvbagraph

提问by hungbm06

Please view this image (focus to red around area):

请查看此图像(焦点区域周围的红色):

enter image description here

在此处输入图片说明

回答by mousio

I cannot get it to work with the letters, but I can get it to work with numbers (=CODE(A1)-CODE("a")+1):

我不能让它与字母一起工作,但我可以让它与数字 ( =CODE(A1)-CODE("a")+1)一起工作:

Scatter

分散

UPDATEafter reading Jean-Fran?ois's answer (but on another computer):

UPDATE?读书让-弗朗索瓦的回答后(但另一台计算机上):

  • Added a second series just for the custom labels
  • Show data labels for the new series
  • Explicitly set the Y axis minimum at 0
  • Deleted the original X axis labels
  • Deleted the legend entry of the second series
  • 为自定义标签添加了第二个系列
  • 显示新系列的数据标签
  • 显式设置 Y 轴最小值为 0
  • 删除了原来的 X 轴标签
  • 删除了第二系列的图例条目

Scatter2

散点2

A few more steps and we're there:

再走几步,我们就到了:

  • multiplied the X axis values by 10, to adjust granularity for positioning stuff
  • subtracted 5 for series1 values, to get the data in the middle between major tick marks
  • played with series2 values, to get the labels also in the middle between major tick marks
  • 将 X 轴值乘以 10,以调整定位内容的粒度
  • 为 series1 值减去 5,以获得位于主要刻度线中间的数据
  • 使用 series2 值,使标签也位于主要刻度线之间的中间

Scatter3

散点3

回答by Jon Peltier

Here's an easier way.

这是一个更简单的方法。

Set up the data like this:

像这样设置数据:

Data for chart with letter axis labels

带有字母轴标签的图表数据

Select the first two columns (blue) and insert a column chart (zero value columns do not appear): Column Chart

选择前两列(蓝色),插入柱状图(不出现零值列): 柱状图

Select and copy third and fourth columns (red), select the chart, Paste Special as new series, check first column and first row boxes (it's added as another column): Column chart with XY data as another column

选择并复制第三和第四列(红色),选择图表,选择性粘贴为新系列,选中第一列和第一行框(它被添加为另一列): 以 XY 数据作为另一列的柱形图

Right click new column series, choose Change Series Chart Type, and select the XY with Lines style: Column and XY Chart

右键单击新列系列,选择更改系列图表类型,然后选择 XY with Lines 样式: 柱状图和 XY 图表

Right click XY series, choose Format Data Series, change to Primary Axis: Finished XY chart with letter X axis labels

右键单击 XY 系列,选择格式数据系列,更改为主轴: 带有字母 X 轴标签的成品 XY 图表