我有同一函数的两个表示。一个是电压的函数,另一个是深度的函数(一个单调但复杂的函数)。深度可以表示为电压的函数。我想在深度表示中添加一些类似电压轴的东西,但这似乎是不可能的。
如何在电压增量处添加垂直线,如-0.5,-1.0,-1.5,...在深度图上?
发布于 2013-03-22 06:26:48
我发现确实可以在顶部创建一个自定义的第二个轴。结果如下所示:https://dl.dropbox.com/u/226980/solved.jpg
这是通过使用FixedLocator实现的。
整个代码如下所示:
f = subplot(111)
p1 = plot(depth_samples,NtNdbulk, label = "relative concentration")
xlabel("depth [um]")
ylabel("N_trap/N_bulk")
twinx()
p2 = plot(depth_samples,Nt, color='r', label = "absolute concentration")
p = p1 + p2
ylabel("N_trap")
labs = [l.get_label() for l in p]
legend(p, labs, loc=0)
ax2 = twiny()
p1 = plot(depth_samples,NtNdbulk, alpha = 0) #invisible
l = matplotlib.ticker.FixedLocator(tick_depth*1e4) # Positions of the ticks
ax2.get_xaxis().set_major_locator(l)
ax2.get_xaxis().set_ticklabels(ticks) # Voltages as displayed
xlabel("DLTS voltage during pulse")
show()https://stackoverflow.com/questions/15548165
复制相似问题