首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Gnuplot中绘制histogram+linespoints

在Gnuplot中绘制histogram+linespoints
EN

Stack Overflow用户
提问于 2019-08-21 02:13:49
回答 1查看 155关注 0票数 1

我想用线点连接直方图中选定的条形图。现在

我在Gnuplot中使用以下代码创建了直方图:

代码语言:javascript
复制
set terminal postscript eps enhanced colour font 'Times-Roman,12' size 6in,4in  
set output "LS_Figure_Histogram_New_2019_III.eps"

set xtics out scale 1.5 
set ytics out scale 1.5
set y2tics out scale 1.5 
set ytics nomirror
set yrange [-3.50:-3.70]
set y2range [0:45] 
set key off
set tics font ", 14"
set xlabel "Experiment No." font ",16"
set ylabel "Li^{+}|Li vs. Cl^{-}|Cl_{2} (V)" font ",16"
set y2label "Residual Current Density (mA/cm^{2})" font ",16"
set key autotitle columnheader
set key inside left horizontal
set style fill solid 1.00 noborder
set style histogram clustered gap 1 title textcolor lt -1


set style data histograms
plot 'LS_Histogram_Comp_2019.dat' using 2:xtic(1) ls 2 ti col axis x1y1, '' u 3:xticlabels(1) ls 4 ti col axis x1y2

数据文件如下所示

代码语言:javascript
复制
# Histogram_Comparison of onset potential & Residual current density
Experimental "Li^{+}|Li (V)" "Res. Current Density (mA/cm^{2})" 
1   -3.64469    31.3
2   -3.65257    11.2
3   -3.66159    32.39
4   -3.66536    13.41
5   -3.66314    16.3
6   -3.64556    10.3
7   -3.64383    10.08
8   -3.63042    9.96
9   -3.65344    9.59
10  -3.64383    8.44
11  -3.64859    11.1
12  -3.63919    27.6
13  -3.64204    9.78
14  -3.62692    30.96
15  -3.64348    18.22
16  -3.6362         32.05
17  -3.62831    20.1
18  -3.62984    42.32
19  -3.63764    24.8

我希望使用线点连接对应于实验12、14、16和18的条(使用col 1和3数据)和条13、15、17和19 (使用col 1和3数据)。

有没有办法在Gnuplot中做到这一点?

EN

回答 1

Stack Overflow用户

发布于 2019-08-21 04:38:47

尝尝这个

代码语言:javascript
复制
set terminal postscript eps enhanced colour font 'Times-Roman,12' size 6in,4in  
set output "LS_Figure_Histogram_New_2019_III.eps"

set xtics out scale 1.5 
set ytics out scale 1.5
set y2tics out scale 1.5 
set ytics nomirror
set yrange [-3.50:-3.70]
set y2range [0:45] 
set key off
set tics font ", 14"
set xlabel "Experiment No." font ",16"
set ylabel "Li^{+}|Li vs. Cl^{-}|Cl_{2} (V)" font ",16"
set y2label "Residual Current Density (mA/cm^{2})" font ",16"
set key autotitle columnheader
set key inside left horizontal
set style fill solid 1.00 noborder
set style histogram clustered gap 1 title textcolor lt -1
# ----------------------------------------
set rmargin screen 0.9
set lmargin screen 0.1
set bmargin screen 0.1
set multiplot
# ----------------------------------------
set style data histograms
plot 'LS_Histogram_Comp_2019.dat' using 2:xtic(1) ls 2 ti col axis x1y1, '' u 3:xticlabels(1) ls 4 ti col axis x1y2
# ----------------------------------------
unset tics
unset xlabel
unset ylabel
unset y2label
set xrange [0:20]
set yrange [0:45]
plot 'LS_Histogram_Comp_2019.dat' \
        skip 12 every 2 using 1:3 w linespoints ls 1 lw 4 not,\
     '' skip 13 every 2 using 1:3 w linespoints ls 3 lw 4 not

结果

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57579429

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档