[英]How to do an Arrhenius plot using excel-VBA? AKA: How to do a reciprocal x-axis in excel-VBA?
I want to write a program to transform temperature dependend data into an Arrhenius plot.我想编写一个程序将温度相关数据转换为 Arrhenius 图。 An Arrhenius plot show the logarithm of a property that is thermally acitavted versus the reciprocal temperature aka 1/T.
阿伦尼乌斯图显示了热活化属性与倒数温度(即 1/T)的对数。 Now is 1/T something that most people are not used to.
现在是大多数人不习惯的 1/T。 This is why most of the plot also contain the translation in temperature on a second axis.
这就是为什么大多数绘图还包含第二个轴上的温度平移。 Usually on top of the graph.
通常在图表的顶部。 The output should look like this:
输出应如下所示:
The second axis is only for better readability and is corresponds to the primary axis with the relation:第二个轴只是为了更好的可读性,对应于具有关系的主轴:
primary=1/secondary
secondary=1/primary
What I am not able to do in excel-VBA (excel 2010) is the reciprocal second x-axis.我无法在 excel-VBA (excel 2010) 中做的是倒数第二个 x 轴。 There is no predefined axis scaling like this.
没有像这样的预定义轴缩放。 There is
xlScaleLinear
and xlScaleLogarithmic
for the property ScaleType
of an axis.有
xlScaleLinear
和xlScaleLogarithmic
为属性ScaleType
的轴线。 Is there a way to do this?有没有办法做到这一点?
A secondary problem is that this:第二个问题是:
Dim CH As Chart
Set CH = Tabelle2.ChartObjects(1).Chart
CH.ChartType = xlXYScatterLinesNoMarkers
With CH
.HasAxis(xlCategory, xlSecondary) = True
End With
Does not seem to work.似乎不起作用。 Which means that a xyScatterplot does not seem to have a secondaryXaxis enabled.
这意味着 xyScatterplot 似乎没有启用辅助 Xaxis。
I could try to add the lables and ticks myself using forms but this seems a little to much pain, I cannot be the only one who has encountered this problem.我可以尝试使用表格自己添加标签和刻度线,但这似乎有点痛苦,我不可能是唯一遇到这个问题的人。
Problem 1: How to format an axis reciprocal (1/x)?问题 1:如何格式化轴倒数 (1/x)?
Problem 1b: How to properly add a second x axis in a XYscatterplot?问题 1b:如何在 XY 散点图中正确添加第二个 x 轴?
You can do this by creating a fake axis using a series with data labels (inspired by https://peltiertech.com/secondary-axes-that-work-proportional-scales/ ):您可以通过使用带有数据标签的系列(受https://peltiertech.com/secondary-axes-that-work-proportional-scales/启发)创建一个假轴来做到这一点:
Columns A and B are your data. A 列和 B 列是您的数据。 Column C matches the X-ticks of your primary X-axis.
C 列与主 X 轴的 X 刻度相匹配。 Column D is
=1/C2
etc and column E is the y-axis maximum for your chart. D 列是
=1/C2
等,E 列是图表的 y 轴最大值。 Now simply create a new series of columns C and E, format it to have no line and in this case I chose the + marker but you can create your own vertical line marker if you want it to be exact.现在只需创建一系列新的列 C 和 E,将其格式化为没有线,在这种情况下,我选择了 + 标记,但如果您希望它准确,您可以创建自己的垂直线标记。 Then add data labels set to range column D.
然后将数据标签集添加到范围列 D。
I don't think you'll find another way to do it without this hack, but it's really not that hard and doesn't require VBA which is always a plus in terms of readability / audibility of your workbook.我认为如果没有这个 hack,你不会找到另一种方法来做到这一点,但它真的没有那么难,并且不需要 VBA,这在工作簿的可读性/可听性方面总是一个加分项。
Another alternative would be to use the data labels to write the actual temperature to the data points:另一种选择是使用数据标签将实际温度写入数据点:
Column C has the temperature in Celsius. C列的温度单位为摄氏度。
Since the Arrhenius plot is only defined as ln(k)
against 1/T
, this would be a good option I think.由于 Arrhenius 图仅定义为
ln(k)
对1/T
,我认为这将是一个不错的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.