excel 中的 X-Y 散点图
X-Y scatter plots in excel
我试图在 excel 中绘制一些比较数据,但所有可用的图表似乎都是基本线条的变体(例如,条形图只是同一逻辑的不同表示)。
我的数据是几十个人提供的两个选项的比较评分(从 1 到 10)。
OptA OptB
Score1 1 3
Score1 3 4
Score1 8 5
Score1 6 6
如何将其绘制为正确的散点图;轴是 OptA 和 OptB 的分数,在 (1,3)、(3,4)、(8,5) 和 (6.6) 处带有点,最好在每个点旁边标有记分员的名字?
目的是允许直观地表示相对分数和任何趋势。
这个怎么样:
它将生成如下图表:
更新 1
如果您希望 B 列为 X 轴,C 列为 Y 轴,则 select 只有点击图表图标前的数据:
更新 2
微软的页面上有一个宏可以做到:
我来复制它的精华:
Sub AttachLabelsToPoints()
'Dimension variables.
Dim Counter As Integer, ChartName As String, xVals As String
' Disable screen updating while the subroutine is run.
Application.ScreenUpdating = False
'Store the formula for the first series in "xVals".
xVals = ActiveChart.SeriesCollection(1).Formula
'Extract the range for the data from xVals.
xVals = Mid(xVals, InStr(InStr(xVals, ","), xVals, _
Mid(Left(xVals, InStr(xVals, "!") - 1), 9)))
xVals = Left(xVals, InStr(InStr(xVals, "!"), xVals, ",") - 1)
Do While Left(xVals, 1) = ","
xVals = Mid(xVals, 2)
Loop
'Attach a label to each data point in the chart.
For Counter = 1 To Range(xVals).Cells.Count
ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel = _
True
ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = _
Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
Next Counter
End Sub
或者,您可以使用 PowerPoint 的散点图,它可以在没有宏的情况下完成。
我试图在 excel 中绘制一些比较数据,但所有可用的图表似乎都是基本线条的变体(例如,条形图只是同一逻辑的不同表示)。
我的数据是几十个人提供的两个选项的比较评分(从 1 到 10)。
OptA OptB
Score1 1 3
Score1 3 4
Score1 8 5
Score1 6 6
如何将其绘制为正确的散点图;轴是 OptA 和 OptB 的分数,在 (1,3)、(3,4)、(8,5) 和 (6.6) 处带有点,最好在每个点旁边标有记分员的名字?
目的是允许直观地表示相对分数和任何趋势。
这个怎么样:
它将生成如下图表:
更新 1
如果您希望 B 列为 X 轴,C 列为 Y 轴,则 select 只有点击图表图标前的数据:
更新 2
微软的页面上有一个宏可以做到:
我来复制它的精华:
Sub AttachLabelsToPoints()
'Dimension variables.
Dim Counter As Integer, ChartName As String, xVals As String
' Disable screen updating while the subroutine is run.
Application.ScreenUpdating = False
'Store the formula for the first series in "xVals".
xVals = ActiveChart.SeriesCollection(1).Formula
'Extract the range for the data from xVals.
xVals = Mid(xVals, InStr(InStr(xVals, ","), xVals, _
Mid(Left(xVals, InStr(xVals, "!") - 1), 9)))
xVals = Left(xVals, InStr(InStr(xVals, "!"), xVals, ",") - 1)
Do While Left(xVals, 1) = ","
xVals = Mid(xVals, 2)
Loop
'Attach a label to each data point in the chart.
For Counter = 1 To Range(xVals).Cells.Count
ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel = _
True
ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = _
Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
Next Counter
End Sub
或者,您可以使用 PowerPoint 的散点图,它可以在没有宏的情况下完成。