I am trying to plot multiplots in png files. Multiplot has 8 plots. Each plot has two y-axis and grid is to be displayed with ls 0. Everything works fine until I change the line width of a plot. When I change line style or line width directly in the plot, the grids in rest of the plots are displayed with the new line width and color. I am using GNU Plot version 5 in Windows 7 MinGW.
Things I have already tried is setting the line style in grid like below:
1. set style line 4 lc rgb 'black' lt 0 set grid xtics ytics y2tics ls 4
- Setting the line width while plotting like below: input_filename using 11:9 with lines axes x1y2 lc rgb 'green' lw 2 title 'Plot-5'
But nothing works. Below is the full code:
#----------------
#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
Working with pngcairo. Below is the final code for reference. Thanks Schorsch.
#----------------
#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:
# http://stackoverflow.com/questions/19412382/gnuplot-line-types/19420678#19420678
# http://stackoverflow.com/questions/34689654/grid-lines-are-changed-in-multiplot-if-lines-styles-of-y-column-is-changed/34751992#34751992
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