如果更改 y 列的线条样式,则多图中的网格线会更改
grid lines are changed in multiplot if lines styles of y column is changed
我正在尝试在 png 文件中绘制多图。 Multiplot 有 8 个地块。每个图都有两个 y 轴,网格将使用 ls 0 显示。一切正常,直到我更改图的线宽。当我直接在绘图中更改线型或线宽时,其余绘图中的网格将以新的线宽和颜色显示。我在 Windows 7 MinGW 中使用 GNU Plot 版本 5。
我已经尝试过在网格中设置线条样式,如下所示:
1。
设置样式行 4 lc rgb 'black' lt 0
设置网格 xtics ytics y2tics ls 4
- 绘图时设置线宽,如下所示:
input_filename using 11:9 with lines axes x1y2 lc rgb 'green' lw 2 title 'Plot-5'
但没有任何效果。以下是完整代码:
#----------------
#input variables
#----------------
#input_filename
#png_filename
#----------------
# Sample Command:
#
# gnuplot -e "input_filename='test.csv'" -e "png_filename='test.png'" gnuplotMultiSample_A.plt
#
#----------------
#----------------
# Code Starts
#----------------
reset
set datafile separator ","
set term png
set output png_filename
set size 1,2
set terminal png size 2560,1920
set ytics nomirror
set y2tics
set multiplot layout 4,2 columnsfirst title png_filename
set style line 1 lc rgb 'red' lt 3
set style line 2 lc rgb 'blue' lt 2 lw 2
set style line 3 lc rgb 'green' lt 1
set style line 4 lc rgb 'black' lt 0
unset grid
#set grid xtics ytics y2tics lt 0 lc rgb "#880000"
set grid xtics ytics y2tics ls 4
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-1'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 ls 2 title 'Plot-2'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:5 with lines axes x1y2 ls 3 title 'Plot-3'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:7 with lines axes x1y2 ls 4 title 'Plot-4'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:9 with lines axes x1y2 lc rgb 'green' title 'Plot-5'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:11 with lines axes x1y2 lc rgb 'green' title 'Plot-6'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-7'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 lc rgb 'green' title 'Plot-8'
unset grid
unset multiplot
正在使用 pngcairo。下面是最终代码供参考。谢谢肖尔施。
#----------------
#input variables
#----------------
#input_filename
#png_filename
#----------------
# Sample Command:
#
# gnuplot -e "input_filename='test.csv'" -e "png_filename='test.png'" gnuplotMultiSample_A.plt
#
#----------------
#----------------
# Code Starts
#----------------
reset
set term pngcairo size 2560,1920
#set terminal pngcairo dashed
#set termoption dashed
set datafile separator ","
#set term png
set output png_filename
set size 1,2
#set terminal png size 2560,1920
set ytics nomirror
set y2tics
set multiplot layout 4,2 columnsfirst title png_filename
set style line 81 lc rgb 'red' lt 3 lw 1
set style line 82 lc rgb 'blue' lt 2 lw 2
set style line 83 lc rgb 'green' lt 1 lw 1
set style line 84 lc rgb 'black' lt 0 lw 1
unset grid
#set grid xtics ytics y2tics lt 0 lc rgb "#880000"
#set grid xtics ytics y2tics lt 1 lw 1 lc rgb "#880000"
# Line type 1 works for Png but not lt 0. As per the guidelines
# trying using "set terminal pngcairo dashed" as per the site:
#
#
set grid xtics ytics y2tics lt 0 lw 1 lc rgb "#880000"
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-1'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 ls 82 title 'Plot-2'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:5 with lines axes x1y2 ls 83 title 'Plot-3'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:7 with lines axes x1y2 ls 84 title 'Plot-4'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:9 with lines axes x1y2 lc rgb 'green' title 'Plot-5'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:11 with lines axes x1y2 lc rgb 'green' title 'Plot-6'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-7'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 lc rgb 'green' title 'Plot-8'
unset grid
unset multiplot
我认为您的问题与您设置的线条样式有关:
set style line 1 lc rgb 'red' lt 3
set style line 2 lc rgb 'blue' lt 2 lw 2
set style line 3 lc rgb 'green' lt 1
set style line 4 lc rgb 'black' lt 0
由于有预定义的线型,这些线型可能无法正常工作并最终弄乱多图环境中的网格线。更具体地说,是选项 lw 2
打断了您的网格线。
Printing a test
output 对于 png terminal
你可以看到有 80 种预定义的线条样式:
因此,将上面的行更改为
set style line 81 lc rgb 'red' lt 3
set style line 82 lc rgb 'blue' lt 2 lw 2
set style line 83 lc rgb 'green' lt 1
set style line 84 lc rgb 'black' lt 0
并修改脚本中的 plot
命令以引用这些线条样式编号,您将得到此图:
调试备注:
真正让情节混乱的是 lw 2
选项。奇怪的是,如果您使用 lw 3
指定网格线,它们不会受到影响(但也会比您想要的粗)。
各种组合中的 dashtype
选项似乎也无法解决您的问题。对于网格线,它被完全忽略。
除了一种预定义的线型之外,任何其他线型都会导致此问题。您可以选择 lt 8
并获得黑色实心网格线。
您可以考虑使用不同的终端:
`set terminal pngcairo`
使用不同的终端,您的原始脚本会按预期运行。
我正在尝试在 png 文件中绘制多图。 Multiplot 有 8 个地块。每个图都有两个 y 轴,网格将使用 ls 0 显示。一切正常,直到我更改图的线宽。当我直接在绘图中更改线型或线宽时,其余绘图中的网格将以新的线宽和颜色显示。我在 Windows 7 MinGW 中使用 GNU Plot 版本 5。
我已经尝试过在网格中设置线条样式,如下所示:
1。 设置样式行 4 lc rgb 'black' lt 0 设置网格 xtics ytics y2tics ls 4
- 绘图时设置线宽,如下所示: input_filename using 11:9 with lines axes x1y2 lc rgb 'green' lw 2 title 'Plot-5'
但没有任何效果。以下是完整代码:
#----------------
#input variables
#----------------
#input_filename
#png_filename
#----------------
# Sample Command:
#
# gnuplot -e "input_filename='test.csv'" -e "png_filename='test.png'" gnuplotMultiSample_A.plt
#
#----------------
#----------------
# Code Starts
#----------------
reset
set datafile separator ","
set term png
set output png_filename
set size 1,2
set terminal png size 2560,1920
set ytics nomirror
set y2tics
set multiplot layout 4,2 columnsfirst title png_filename
set style line 1 lc rgb 'red' lt 3
set style line 2 lc rgb 'blue' lt 2 lw 2
set style line 3 lc rgb 'green' lt 1
set style line 4 lc rgb 'black' lt 0
unset grid
#set grid xtics ytics y2tics lt 0 lc rgb "#880000"
set grid xtics ytics y2tics ls 4
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-1'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 ls 2 title 'Plot-2'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:5 with lines axes x1y2 ls 3 title 'Plot-3'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:7 with lines axes x1y2 ls 4 title 'Plot-4'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:9 with lines axes x1y2 lc rgb 'green' title 'Plot-5'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:11 with lines axes x1y2 lc rgb 'green' title 'Plot-6'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-7'
plot input_filename using 11:12 with lines axes x1y1 ls 1 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 lc rgb 'green' title 'Plot-8'
unset grid
unset multiplot
正在使用 pngcairo。下面是最终代码供参考。谢谢肖尔施。
#----------------
#input variables
#----------------
#input_filename
#png_filename
#----------------
# Sample Command:
#
# gnuplot -e "input_filename='test.csv'" -e "png_filename='test.png'" gnuplotMultiSample_A.plt
#
#----------------
#----------------
# Code Starts
#----------------
reset
set term pngcairo size 2560,1920
#set terminal pngcairo dashed
#set termoption dashed
set datafile separator ","
#set term png
set output png_filename
set size 1,2
#set terminal png size 2560,1920
set ytics nomirror
set y2tics
set multiplot layout 4,2 columnsfirst title png_filename
set style line 81 lc rgb 'red' lt 3 lw 1
set style line 82 lc rgb 'blue' lt 2 lw 2
set style line 83 lc rgb 'green' lt 1 lw 1
set style line 84 lc rgb 'black' lt 0 lw 1
unset grid
#set grid xtics ytics y2tics lt 0 lc rgb "#880000"
#set grid xtics ytics y2tics lt 1 lw 1 lc rgb "#880000"
# Line type 1 works for Png but not lt 0. As per the guidelines
# trying using "set terminal pngcairo dashed" as per the site:
#
#
set grid xtics ytics y2tics lt 0 lw 1 lc rgb "#880000"
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-1'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 ls 82 title 'Plot-2'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:5 with lines axes x1y2 ls 83 title 'Plot-3'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:7 with lines axes x1y2 ls 84 title 'Plot-4'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:9 with lines axes x1y2 lc rgb 'green' title 'Plot-5'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:11 with lines axes x1y2 lc rgb 'green' title 'Plot-6'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:1 with lines axes x1y2 lc rgb 'green' title 'Plot-7'
plot input_filename using 11:12 with lines axes x1y1 ls 81 title 'Actual', \
input_filename using 11:3 with lines axes x1y2 lc rgb 'green' title 'Plot-8'
unset grid
unset multiplot
我认为您的问题与您设置的线条样式有关:
set style line 1 lc rgb 'red' lt 3
set style line 2 lc rgb 'blue' lt 2 lw 2
set style line 3 lc rgb 'green' lt 1
set style line 4 lc rgb 'black' lt 0
由于有预定义的线型,这些线型可能无法正常工作并最终弄乱多图环境中的网格线。更具体地说,是选项 lw 2
打断了您的网格线。
Printing a test
output 对于 png terminal
你可以看到有 80 种预定义的线条样式:
因此,将上面的行更改为
set style line 81 lc rgb 'red' lt 3
set style line 82 lc rgb 'blue' lt 2 lw 2
set style line 83 lc rgb 'green' lt 1
set style line 84 lc rgb 'black' lt 0
并修改脚本中的 plot
命令以引用这些线条样式编号,您将得到此图:
调试备注:
真正让情节混乱的是
lw 2
选项。奇怪的是,如果您使用lw 3
指定网格线,它们不会受到影响(但也会比您想要的粗)。各种组合中的
dashtype
选项似乎也无法解决您的问题。对于网格线,它被完全忽略。除了一种预定义的线型之外,任何其他线型都会导致此问题。您可以选择
lt 8
并获得黑色实心网格线。您可以考虑使用不同的终端:
`set terminal pngcairo`
使用不同的终端,您的原始脚本会按预期运行。