From: marcel1 <cemarcel@u.washington.edu> - 2010-05-12 11:07:05
|
Hi users, I am running gnuplot 4.2 patchlevel 5 on darwin 8.11.1, having a lot of trouble adding labels to a 4-panel graph using multiplot. I have read the manual, searched extensively online, still can't solve my problem. I would like to: i) add labels A, B, C and D to the lower left corners of the four graphs in my multiplot, in line with the y label ii) annotate certain graphs with a message, like R^2 = 0.4 in the body of the plots While my plots print out fine, I am experiencing behavior that i don't understand with the labels. I can get labels to appear on all of the plots, but I also get a "duplicate" label A that creeps in from the bottom of the 4x4 plot area, as I adjust the position of the desired "A" to the top left graph. I have tried a variety of changes in the code to see where this comes from to no avail. when I comment out labels that appear later in the code and use >show label I get: label 1 "C" at (0.72, -33, 0) left not rotated back font "arial, 16" nopoint label 3 "A" at (0.72, 28, 0) left not rotated back font "arial, 16" nopoint which is what I would want. Strangely, when I do this, the figure also displays an additional "C" and two misplaced "A"s in seemingly random locations. Could anyone explain why this is happening and how to set the labels as I would like them? Many thanks, Marcel #CODE set nomultiplot unset title unset key unset label set terminal aqua font "arial, 12" set size 0.3, 0.3 set grid set rmargin 0 set lmargin 0 set tmargin 0 set bmargin 0 set multiplot set pointsize 0.5 ############# plot 1 ############## set title "mytitle" offset 0, -0.75 set origin 0.1,0.1 set label 1 "C" at 0.72,-33 font "arial, 16" set label 3 "A" at 0.72,28 font "arial, 16" set ylabel "label" offset 1.5, 0 set ytics font "arial 18" offset 0, 0 set yrange[45:100] set xlabel "label" offset 0, 1.1 set xtics font "arial 18" offset 0, 0.3 set xrange[0:1500] plot 'datafile' using 5:8 with points pt 4 lc 3 lw 8 notitle ############# plot 2 ############## set title "mytitle" offset 0, -0.75 set nokey set ylabel "label" set ytics font "arial 18" offset 0, 0 set yrange[45:100] set xlabel "label" offset 0, 1.1 set xtics font "arial 18" offset 0, 0.3 set xrange[2:9] plot 'datafile' using 12:8 with points pt 4 lc 1 lw 8 ############# plot 3 ############## set title "mytitle" offset 0, -0.75 set origin 0.5,0.1 set key left top unset label set label 2 "D" at -0.95,-33 font "arial, 16" set label 4 "B" at -0.95,42 font "arial, 16" set ylabel "label" set ytics font "arial 18" set yrange[45:100] set xlabel "label" offset 0, 1.1 set xtics font "arial 18" offset 0, 0.3 set xrange[1980:2006] # add regression line for length vs year data f(x) = m*x + b fit f(x) 'datafile' using 4:8 via m,b plot 'datafile' using 4:8 with points pt 5 lc 6 lw 8 title "Length vs year", f(x) with line title "model fit" unset key ############# plot 4 ############## ############# boxplot lengths/stage############ set title "mytitle" offset 0, -0.75 set origin 0.5,0.5 set points 11 set pointsize 0.1 set bars 7.0 set style fill empty set ylabel "label" set ytics font "arial 18" set yrange[45:100] set xrange[0:5] set xlabel "label" plot 'datafile' using 1:3:2:6:5 with candlesticks lt -1 lw 1 title "quartiles" whiskerbars, 'datafile' using 3:1 with points 26, 'datafile' using 1:4:4:4:4 with candlesticks lt 1 lw 1 title "median" set nomultiplot -- View this message in context: http://old.nabble.com/Trouble-with-labels-in-multiplot-tp28534532p28534532.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
From: Thomas S. <t.s...@fz...> - 2010-05-12 12:48:38
|
labels are plotted each time a 'plot' command is executed, so you if need one label per plot, define this (and only this) label just before calling 'plot'. in your case it would be the best to work with only one label, redefining it for each plot. and the positioning should be done in axis-range-independent coordinates: reset set multiplot set size 0.3,0.3 # set origin 0.1,0.1 set label 1 "A" at graph -0.2,-0.2 plot sin(x) # set origin 0.5,0.1 set label 1 "B" plot sin(x) # set origin 0.1,0.5 set label 1 "C" plot sin(x) # set origin 0.5,0.5 set label 1 "D" plot sin(x) # unset multiplot marcel1 wrote: > > Hi users, > I am running gnuplot 4.2 patchlevel 5 on darwin 8.11.1, having a lot of > trouble adding labels to a 4-panel graph using multiplot. I have read the > manual, searched extensively online, still can't solve my problem. I would > like to: > > i) add labels A, B, C and D to the lower left corners of the four graphs > in my multiplot, in line with the y label > ii) annotate certain graphs with a message, like R^2 = 0.4 in the body of > the plots > > While my plots print out fine, I am experiencing behavior that i don't > understand with the labels. I can get labels to appear on all of the > plots, but I also get a "duplicate" label A that creeps in from the bottom > of the 4x4 plot area, as I adjust the position of the desired "A" to the > top left graph. I have tried a variety of changes in the code to see where > this comes from to no avail. > > when I comment out labels that appear later in the code and use >show > label > I get: > label 1 "C" at (0.72, -33, 0) left not rotated back font "arial, 16" > nopoint > label 3 "A" at (0.72, 28, 0) left not rotated back font "arial, 16" > nopoint > > which is what I would want. Strangely, when I do this, the figure also > displays an additional "C" and two misplaced "A"s in seemingly random > locations. Could anyone explain why this is happening and how to set the > labels as I would like them? > > Many thanks, > Marcel > > > #CODE > set nomultiplot > unset title > unset key > unset label > > set terminal aqua font "arial, 12" > set size 0.3, 0.3 > set grid > > set rmargin 0 > set lmargin 0 > set tmargin 0 > set bmargin 0 > set multiplot > set pointsize 0.5 > > ############# plot 1 ############## > > set title "mytitle" offset 0, -0.75 > set origin 0.1,0.1 > set label 1 "C" at 0.72,-33 font "arial, 16" > set label 3 "A" at 0.72,28 font "arial, 16" > > set ylabel "label" offset 1.5, 0 > set ytics font "arial 18" offset 0, 0 > set yrange[45:100] > > set xlabel "label" offset 0, 1.1 > set xtics font "arial 18" offset 0, 0.3 > set xrange[0:1500] > > plot 'datafile' using 5:8 with points pt 4 lc 3 lw 8 notitle > > ############# plot 2 ############## > > set title "mytitle" offset 0, -0.75 > set nokey > > set ylabel "label" > set ytics font "arial 18" offset 0, 0 > set yrange[45:100] > > set xlabel "label" offset 0, 1.1 > set xtics font "arial 18" offset 0, 0.3 > set xrange[2:9] > > plot 'datafile' using 12:8 with points pt 4 lc 1 lw 8 > > ############# plot 3 ############## > > set title "mytitle" offset 0, -0.75 > set origin 0.5,0.1 > set key left top > unset label > set label 2 "D" at -0.95,-33 font "arial, 16" > set label 4 "B" at -0.95,42 font "arial, 16" > > set ylabel "label" > set ytics font "arial 18" > set yrange[45:100] > > set xlabel "label" offset 0, 1.1 > set xtics font "arial 18" offset 0, 0.3 > set xrange[1980:2006] > > # add regression line for length vs year data > f(x) = m*x + b > fit f(x) 'datafile' using 4:8 via m,b > > plot 'datafile' using 4:8 with points pt 5 lc 6 lw 8 title "Length vs > year", f(x) with line title "model fit" > > unset key > > ############# plot 4 ############## > ############# boxplot lengths/stage############ > > set title "mytitle" offset 0, -0.75 > set origin 0.5,0.5 > set points 11 > set pointsize 0.1 > set bars 7.0 > set style fill empty > > set ylabel "label" > set ytics font "arial 18" > set yrange[45:100] > > set xrange[0:5] > set xlabel "label" > > plot 'datafile' using 1:3:2:6:5 with candlesticks lt -1 lw 1 title > "quartiles" whiskerbars, 'datafile' using 3:1 with points 26, 'datafile' > using 1:4:4:4:4 with candlesticks lt 1 lw 1 title "median" > > set nomultiplot > -- View this message in context: http://old.nabble.com/Trouble-with-labels-in-multiplot-tp28534532p28535482.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
From: Hans-Bernhard B. <HBB...@t-...> - 2010-05-13 11:02:08
|
marcel1 wrote: > While my plots print out fine, I am experiencing behavior that i don't > understand with the labels. I can get labels to appear on all of the plots, > but I also get a "duplicate" label A That's almost certainly caused by a misunderstanding of what 'multiplot' and 'set label' actually do. The key is that a 'set label' command affects _all_ plots following it. Yes, that means the label you set for the first plot of your multiplot will also appear in the other three, and so on. Which you may or may not want. In the case at hand, you don't want it, so you should turn off the labels between individual plots. See 'help unset label'. > when I comment out labels that appear later in the code and use >show label > I get: > label 1 "C" at (0.72, -33, 0) left not rotated back font "arial, 16" > nopoint > label 3 "A" at (0.72, 28, 0) left not rotated back font "arial, 16" > nopoint > > which is what I would want. Actually, it's what you _don't_ want. |
From: marcel1 <cemarcel@u.washington.edu> - 2010-05-12 22:06:18
|
Using one label and redefining for each plot worked perfectly. Thank you! marcel -- View this message in context: http://old.nabble.com/Trouble-with-labels-in-multiplot-tp28534532p28541655.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |