如何使用阵列使Seaborn Barplot绘制
我有两个峰值宽度。一种用于初始读取光致发光光谱,另一个是最后一个读取。
阵列看起来像这样:
array([[12.91895903, 13.4987366 ],
[12.80932225, 13.48703181],
[13.31956175, 13.84200578],
[12.75569909, 13.40102423],
[13.0540267 , 13.49630721],
[12.99562842, 13.81240577],
[12.3739669 , 13.50472869],
[12.59581501, 13.59014109],
[12.63003447, 13.62653901],
[12.69311443, 13.43675767],
[14.13148875, 13.90222385],
[14.25998466, 14.1033694 ],
[15.05208333, 14.84765915],
[14.43515386, 14.04508814],
[14.65407438, 14.60280042],
[14.66398986, 14.51622903],
[13.83106512, 13.78256313],
[14.19863707, 13.96298736],
[14.1713615 , 14.07543705],
[13.83595496, 13.62599452],
[12.3825998 , 12.70562171],
[12.41156963, 12.88003495],
[12.6777705 , 12.57068032],
[12.53358095, 12.53534449],
[13.45467719, 13.26144976],
[12.78833045, 12.85806402],
[12.60006425, 12.71363882],
[12.88643467, 13.0602158 ],
[13.23320967, 12.97156171],
[12.86351657, 12.59229069],
[14.74385343, 14.55740068],
[15.00878816, 14.15872598],
[14.58857873, 14.41833132],
[14.92660875, 14.74147173],
[15.12535649, 14.95838854],
[14.64001146, 14.49185211],
[14.82511105, 14.17740149],
[15.12634785, 14.84858821],
[14.34005113, 14.05463422],
[14.15628504, 14.22486095],
[12.3724133 , 12.58139608],
[12.6060462 , 12.38097205],
[12.90278338, 12.51676469],
[13.76348633, 13.87927538],
[14.71027281, 14.53496475],
[14.40312148, 14.13345032],
[13.7478055 , 13.80244484],
[13.95752547, 14.05217398],
[13.71435207, 13.82068027],
[14.38300654, 14.02735273],
[15.26673587, 14.53162147],
[14.85648967, 14.37392304],
[15.08822055, 14.72235331],
[15.21932049, 13.80745798],
[14.58129602, 14.10233792],
[15.01609195, 13.99400871],
[15.13918822, 14.17885891],
[15.26248343, 14.16096096],
[14.51957429, 13.88691796],
[15.41818182, 15.15656029],
[12.6553847 , 13.38708514],
[13.13494664, 12.85261161],
[13.70420034, 13.59193989],
[15.3673978 , 14.55661419],
[15.35887749, 14.83222518],
[14.6031553 , 14.43384645],
[15.09809249, 14.67672868],
[14.71077586, 14.03549349],
[17.78779038, 16.91968642],
[14.18220261, 13.96151245],
[15.65687646, 15.01666667],
[15.50157895, 15.31943179],
[15.36605773, 15.12444836],
[15.515625 , 15.02318195],
[15.99393939, 15.71333964],
[15.82986111, 14.83928571],
[16.38146168, 15.81002331],
[17.21031746, 16.58461538],
[15.64144737, 15.65714286],
[17.22619048, 16.07165816]])
我想使用一个小号块绘制它,但是我遇到了麻烦,因为它一直告诉我它一定是1维,但是我很难拆分,因此可以读取它。
我确定这很简单,但我似乎无法理解。
y= peaks_width[:,0]
x= peaks_width[0,:]
import seaborn as sns
ax = sns.barplot(x, y)
I have an array of two peak widths. One for an initial read of a photoluminescence spectra and one that is the last read.
The array looks like this:
array([[12.91895903, 13.4987366 ],
[12.80932225, 13.48703181],
[13.31956175, 13.84200578],
[12.75569909, 13.40102423],
[13.0540267 , 13.49630721],
[12.99562842, 13.81240577],
[12.3739669 , 13.50472869],
[12.59581501, 13.59014109],
[12.63003447, 13.62653901],
[12.69311443, 13.43675767],
[14.13148875, 13.90222385],
[14.25998466, 14.1033694 ],
[15.05208333, 14.84765915],
[14.43515386, 14.04508814],
[14.65407438, 14.60280042],
[14.66398986, 14.51622903],
[13.83106512, 13.78256313],
[14.19863707, 13.96298736],
[14.1713615 , 14.07543705],
[13.83595496, 13.62599452],
[12.3825998 , 12.70562171],
[12.41156963, 12.88003495],
[12.6777705 , 12.57068032],
[12.53358095, 12.53534449],
[13.45467719, 13.26144976],
[12.78833045, 12.85806402],
[12.60006425, 12.71363882],
[12.88643467, 13.0602158 ],
[13.23320967, 12.97156171],
[12.86351657, 12.59229069],
[14.74385343, 14.55740068],
[15.00878816, 14.15872598],
[14.58857873, 14.41833132],
[14.92660875, 14.74147173],
[15.12535649, 14.95838854],
[14.64001146, 14.49185211],
[14.82511105, 14.17740149],
[15.12634785, 14.84858821],
[14.34005113, 14.05463422],
[14.15628504, 14.22486095],
[12.3724133 , 12.58139608],
[12.6060462 , 12.38097205],
[12.90278338, 12.51676469],
[13.76348633, 13.87927538],
[14.71027281, 14.53496475],
[14.40312148, 14.13345032],
[13.7478055 , 13.80244484],
[13.95752547, 14.05217398],
[13.71435207, 13.82068027],
[14.38300654, 14.02735273],
[15.26673587, 14.53162147],
[14.85648967, 14.37392304],
[15.08822055, 14.72235331],
[15.21932049, 13.80745798],
[14.58129602, 14.10233792],
[15.01609195, 13.99400871],
[15.13918822, 14.17885891],
[15.26248343, 14.16096096],
[14.51957429, 13.88691796],
[15.41818182, 15.15656029],
[12.6553847 , 13.38708514],
[13.13494664, 12.85261161],
[13.70420034, 13.59193989],
[15.3673978 , 14.55661419],
[15.35887749, 14.83222518],
[14.6031553 , 14.43384645],
[15.09809249, 14.67672868],
[14.71077586, 14.03549349],
[17.78779038, 16.91968642],
[14.18220261, 13.96151245],
[15.65687646, 15.01666667],
[15.50157895, 15.31943179],
[15.36605773, 15.12444836],
[15.515625 , 15.02318195],
[15.99393939, 15.71333964],
[15.82986111, 14.83928571],
[16.38146168, 15.81002331],
[17.21031746, 16.58461538],
[15.64144737, 15.65714286],
[17.22619048, 16.07165816]])
I want to plot it using a barplot but I am having trouble since it keeps on telling me it must be 1 dimensional but I am having trouble splitting so it can be read.
I am sure this is simple, but I can't seem to get it.
y= peaks_width[:,0]
x= peaks_width[0,:]
import seaborn as sns
ax = sns.barplot(x, y)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论