I usually code in Python and do not know any GNUplot but I have to use a small bit of C to plot human cells represented as polygons. I have a file with all the coordinates of the polygon vertices at each time (it is a dynamic simulation), what the code does (and I don't know how) is that it links each cell vertex to form a cell edge and so we can see the different cells. Here is the code used to plot my polygons, the code I was given.
start = 0000
stop = 49990
set terminal pngcairo rounded size 800,800
set style line 1 lt 3 lc rgb pt 7 lw 2
set xrange [0:d*sqrt(N)]
set yrange [0:h*sqrt(N)]
point_files(n) = sprintf('./PointFiles/points%06d.txt', n)
cell_files(n) = sprintf('./CellpopFiles/cells%06d.txt', n)
do for [i = start:stop:10] {
outfile = sprintf('./Figures/figures%06d.png',i)
set output outfile
unset key
plot cell_files(i) w filledcurves ls 1
}
So far the code works but then, I want to separate my cell population in 2 and color the two populations in 2 different colors, that's what I haven't managed. Only one of my cells are colored and even then the cell edges are not shown - I have white (instead of green) and red surfaces moving around but I can't see the limit between each cell, there is no edge.
start = 0000
stop = 49990
set terminal pngcairo rounded size 800,800
set style line 1 lt 3 lc rgb 'red' pt 7 lw 2
set style line 2 lt 3 lc rgb 'green' pt 7 lw 2
set xrange [0:d*sqrt(N)]
set yrange [0:h*sqrt(N)]
point_files(n) = sprintf('./PointFiles/points%06d.txt', n)
cell_files0(n) = sprintf('./Cellpop0Files/cells%06d.txt', n)
cell_files1(n) = sprintf('./Cellpop1Files/cells%06d.txt', n)
do for [i = start:stop:10] {
outfile = sprintf('./Figures/figures%06d.png',i)
set output outfile
unset key
plot cell_files0(i) w filledcurves ls 1
plot cell_files1(i) w filledcurves ls 2
}
Using 'w filledcurves closed ls 1' does not change anything.
The solution might be pretty simple but without knowing any C I've been struggling, thank you in advance!
Plotting multiple files into the same plot can be done by separating the plotting elements via comma. Check help plot
.
Syntax:
plot {<ranges>} <plot-element> {, <plot-element>, <plot-element>}
In order to increase the readability of the script and lengthy plot commands, you can introduce "linebreaks" with \
being the very last character in the line (couldn't find the help keyword anymore for this, but I know it is somewhere hidden in help).
Have you tried:
plot cell_files0(i) w filledcurves ls 1, \
cell_files1(i) w filledcurves ls 2