'gnuplot, problem with margins in spiderplot
I am trying to create a spider plot using data from several files. Everything is in order (axes, values etc) with the exception of the margins and plot title position.
The script in use and the resulting image follo:
set title "Optimal solutions for the subcritical conventional cycle"
set termopt enhanced
set encoding utf8
set terminal windows
set size ratio -1
set spiderplot
#set grid spiderplot
set style spiderplot fs transparent solid 0.2 border lw 1.5 pt 7 ps 1.5
set paxis 1 range[100:275]
set paxis 2 range[0:10]
set paxis 3 range[0:25]
set paxis 4 range[0:25]
set paxis 1 label "T_{evap} [^{o}C]"
set paxis 2 label " ΔT_{super} [^{o}C]"
set paxis 3 label "ΔT_{pp,evap} [^{o}C]"
set paxis 4 label "ΔT_{pp,cond} [^{o}C] "
set paxis 1 tics 100,25,275
set paxis 2 tics 0,1,10
set paxis 3 tics 0,5,25
set paxis 4 tics 0,5,25
plot \
keyentry with spiderplot lc "#E74C3C" lw 1.5 title "R124",\
for [i=1:4] "optsub_conv_optimal_solution_R124.txt" using i notitle lw 1.5 lc "#E74C3C",\
newspiderplot,\
keyentry with spiderplot lc "#F39C12" lw 1.5 title "Isobutane",\
for [i=1:4] "optsub_conv_optimal_solution_Isobutane.txt" using i notitle lw 1.5 lc "#F39C12",\
newspiderplot,\
keyentry with spiderplot lc "#2ECC71" lw 1.5 title "R245fa",\
for [i=1:4] "optsub_conv_optimal_solution_R245fa.txt" using i notitle lw 1.5 lc "#2ECC71",\
newspiderplot,\
keyentry with spiderplot lc "#3498DB" lw 1.5 title "Isopentane",\
for [i=1:4] "optsub_conv_optimal_solution_Isopentane.txt" using i notitle lw 1.5 lc "#3498DB",\
newspiderplot,\
keyentry with spiderplot lc "#9B59B6" lw 1.5 title "Cyclopentane",\
for [i=1:4] "optsub_conv_optimal_solution_Cyclopentane.txt" using i notitle lw 1.5 lc "#9B59B6"
Evidently, the plot appears with too much white space on the sides. Additionally the title appears right on top of an axis label, while another axis label lies outside the plot. The typical margin commands (tmargin,bmargin,lmargin,rmargin) do not appear to work. Any ideas?
These are the data files: optsub_conv_optimal_solution_R124.txt
#(1) Tevap [oC] (2) DTsuper [oC] (3) DTppevap [oC] (4) DTppcond [oC] (5) nth [-] (6) nex [-] (7) wnet [kJ/kg] (8) mwf [kg/s] (9) nthchp [-] (10) nelchp [-] (11) nchp [-] (12) PHR [-] (13) PESR [-] (14) Toout [oC] (15) mo [kg/s] (16) Twoout [oC] (17) mw [kg/s] (18) Aevap [m^2] (19) Acond [m^2]
109.741738 9.911802 13.686376 10.490225 0.079108 0.777738 11901.389154 4.667989 0.874848 0.067637 0.942485 0.077313 0.150392 73.898046 1.431867 53.509008 4.618337 2.153230 2.338824
optsub_conv_optimal_solution_Isobutane.txt
#(1) Tevap [oC] (2) DTsuper [oC] (3) DTppevap [oC] (4) DTppcond [oC] (5) nth [-] (6) nex [-] (7) wnet [kJ/kg] (8) mwf [kg/s] (9) nthchp [-] (10) nelchp [-] (11) nchp [-] (12) PHR [-] (13) PESR [-] (14) Toout [oC] (15) mo [kg/s] (16) Twoout [oC] (17) mw [kg/s] (18) Aevap [m^2] (19) Acond [m^2]
129.026974 9.784578 10.589184 7.690567 0.097319 0.802556 36554.377923 1.519806 0.857547 0.083208 0.940755 0.097030 0.170107 71.949670 1.155533 59.034857 3.158823 2.010785 2.219941
optsub_conv_optimal_solution_R245fa.txt
#(1) Tevap [oC] (2) DTsuper [oC] (3) DTppevap [oC] (4) DTppcond [oC] (5) nth [-] (6) nex [-] (7) wnet [kJ/kg] (8) mwf [kg/s] (9) nthchp [-] (10) nelchp [-] (11) nchp [-] (12) PHR [-] (13) PESR [-] (14) Toout [oC] (15) mo [kg/s] (16) Twoout [oC] (17) mw [kg/s] (18) Aevap [m^2] (19) Acond [m^2]
148.519152 9.253894 16.742495 5.918559 0.117315 0.819801 26564.547418 2.091342 0.838550 0.100305 0.938855 0.119617 0.190727 76.298702 0.974274 60.864612 2.447578 1.892059 2.023517
optsub_conv_optimal_solution_Isopentane.txt
#(1) Tevap [oC] (2) DTsuper [oC] (3) DTppevap [oC] (4) DTppcond [oC] (5) nth [-] (6) nex [-] (7) wnet [kJ/kg] (8) mwf [kg/s] (9) nthchp [-] (10) nelchp [-] (11) nchp [-] (12) PHR [-] (13) PESR [-] (14) Toout [oC] (15) mo [kg/s] (16) Twoout [oC] (17) mw [kg/s] (18) Aevap [m^2] (19) Acond [m^2]
178.491873 8.061367 17.725536 5.478487 0.136583 0.843387 68534.805634 0.810618 0.820246 0.116779 0.937025 0.142370 0.209648 78.618217 0.844249 67.467127 1.770176 1.957984 1.699375
optsub_conv_optimal_solution_Cyclopentane.txt
#(1) Tevap [oC] (2) DTsuper [oC] (3) DTppevap [oC] (4) DTppcond [oC] (5) nth [-] (6) nex [-] (7) wnet [kJ/kg] (8) mwf [kg/s] (9) nthchp [-] (10) nelchp [-] (11) nchp [-] (12) PHR [-] (13) PESR [-] (14) Toout [oC] (15) mo [kg/s] (16) Twoout [oC] (17) mw [kg/s] (18) Aevap [m^2] (19) Acond [m^2]
227.881346 6.390844 21.097316 5.927053 0.183182 0.871473 106815.328762 0.520108 0.775977 0.156620 0.932598 0.201836 0.251947 90.943453 0.660987 63.128907 1.374341 2.673516 1.218769
Removing the size ratio command slightly alters the dimensions. The problem however persists. Terminal wxt is a disaster, while with terminal qt the result is similar.
I am using 5.4 Patchlevel 3 on Windows 10 64-bit. Thank you in advance.
The issue was resolved by following the suggestions of both theozh and Ethan. The terminal was changed to qt, the title and labels were offset and the margins were defined using the set margins command. For some reason set tmargin/bmargin/lmargin/rmargin did not work.
Solution 1:[1]
I think the simplest way to get more space around the plot is set margins
with specific values adjusted to taste. I can't exactly reproduce your plot, but the biggest issue I have is positioning the key so that it doesn't overlap with the plot content. I modified your script by adding
set margins 4,4,4,4
set key at graph 0.75, 1.00 top left
to produce the figure below. Obviously the horizontal axis label placement could be improved also. You could use, e.g.
set paxis 2 label offset 4
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ethan |