|
From: Kevin K. <kk...@gm...> - 2015-02-03 23:37:56
|
I am trying to use Gnuplot 5's hypertext labels in conjunction with multiple datasets on the same plot and am finding that when I add the hypertext labels it removes the identifying color markings in my key. The following works fine and produces a plot with a legend/key in the upper right with a blue box next to v5 and a green box next to v6: set term svg size 600,400 dynamic mousing name "test" set output "test.svg" plot "data_file.txt" using 1:2 title 'v5' w point pt 5 lc rgb 'blue', "data_file.txt" using 4:5 title 'v6' w point pt 5 lc rgb 'green' Now I want to recreate the same plot with some hypertext labels: set term svg size 600,400 dynamic mousing name "test" set output "test.svg" plot "data_file.txt" using 1:2:3 title 'v5' w labels hypertext point pt 5 lc rgb 'blue', "data_file.txt" using 4:5:6 title 'v6' w labels hypertext point pt 5 lc rgb 'green' The plot is created and the hypertext labels appear when I mouse over the data points, but my legend/key in the upper right no longer contains a blue and green box next to the dataset titles. It is just blank white where the two separate color points should be. Why is this happening? Here are the contents of data_file.txt: 150 1 x1 185 1 x1 105 1 x2 140 1 x2 140 1 x3 180 1 x3 |
|
From: Ethan A M. <EAM...@gm...> - 2015-02-09 01:00:15
|
On Tuesday, 03 February 2015 05:37:50 PM Kevin Klein wrote: > I am trying to use Gnuplot 5's hypertext labels in conjunction with > multiple datasets on the same plot and am finding that when I add the > hypertext labels it removes the identifying color markings in my key. > > The following works fine and produces a plot with a legend/key in the upper > right with a blue box next to v5 and a green box next to v6: > > set term svg size 600,400 dynamic mousing name "test" > set output "test.svg" > plot "data_file.txt" using 1:2 title 'v5' w point pt 5 lc rgb 'blue', > "data_file.txt" using 4:5 title 'v6' w point pt 5 lc rgb 'green' > > Now I want to recreate the same plot with some hypertext labels: > > set term svg size 600,400 dynamic mousing name "test" > set output "test.svg" > plot "data_file.txt" using 1:2:3 title 'v5' w labels hypertext point pt 5 > lc rgb 'blue', "data_file.txt" using 4:5:6 title 'v6' w labels hypertext > point pt 5 lc rgb 'green' > > The plot is created and the hypertext labels appear when I mouse over the > data points, but my legend/key in the upper right no longer contains a blue > and green box next to the dataset titles. It is just blank white where the > two separate color points should be. Why is this happening? Each plot style places a corresponding symbol in the key together with its title. "with lines" places a line, "with boxes" places a box, "with points" places a point, and so on. "with labels" does not place a separate symbol because its primary feauture text and the corresponding title already representes text. So your plot "with points" showed a point in the key. Your plot "with labels" did not. Hypertext is actually not relevant here. Having said that, I am sympathetic to the idea that a plot using "with labels point pointtype 7 lc 'green'" could place a filled green circle next to the plot title just as it does next to each label in the plot itself. I suggest you add that as a Feature Request on the issues tracker on the project's SourceForge page. Meanwhile you could use the approach in the hypertext demo http://gnuplot.sourceforge.net/demo_svg_5.0/hypertext.html The data is plotted twice, once "with points" and then again "with labels hypertext". The demo doesn't use a key, but if you enable the key then the "with points" plot will be represented by a corresponding point sample in the key. Ethan > > > Here are the contents of data_file.txt: > > 150 1 x1 185 1 x1 > 105 1 x2 140 1 x2 > 140 1 x3 180 1 x3 |
|
From: Kevin K. <kk...@gm...> - 2015-02-10 20:27:14
|
Thanks for the tips. I was able to get a plot with both data points and hypertext labels on the plot but with only data points visible in the legend using a command of this form: plot <filename> using 1:2 title <title> w points, <filename> using 1:2:3 notitle w labels hypertext point lc rgb #FFFFFFFF note that I made the points associated with the hypertext labels transparent. I did this because I did not want to see visible points on the graph associated with the hypertext labels (that's what the first plot statement is for - to create the actual visible data points on the graph), yet the hypertext labels apparently don't work unless there is an actual point on the graph associated with the label via the "point" statement that follows "w labels hypertext". I tried setting the hypertext point size to 0 and also tried using nopoint, but these prevented the labels from showing up. Kevin On Sun, Feb 8, 2015 at 6:56 PM, Ethan A Merritt <EAM...@gm...> wrote: > On Tuesday, 03 February 2015 05:37:50 PM Kevin Klein wrote: > > I am trying to use Gnuplot 5's hypertext labels in conjunction with > > multiple datasets on the same plot and am finding that when I add the > > hypertext labels it removes the identifying color markings in my key. > > > > The following works fine and produces a plot with a legend/key in the > upper > > right with a blue box next to v5 and a green box next to v6: > > > > set term svg size 600,400 dynamic mousing name "test" > > set output "test.svg" > > plot "data_file.txt" using 1:2 title 'v5' w point pt 5 lc rgb 'blue', > > "data_file.txt" using 4:5 title 'v6' w point pt 5 lc rgb 'green' > > > > Now I want to recreate the same plot with some hypertext labels: > > > > set term svg size 600,400 dynamic mousing name "test" > > set output "test.svg" > > plot "data_file.txt" using 1:2:3 title 'v5' w labels hypertext point pt 5 > > lc rgb 'blue', "data_file.txt" using 4:5:6 title 'v6' w labels hypertext > > point pt 5 lc rgb 'green' > > > > The plot is created and the hypertext labels appear when I mouse over the > > data points, but my legend/key in the upper right no longer contains a > blue > > and green box next to the dataset titles. It is just blank white where > the > > two separate color points should be. Why is this happening? > > > Each plot style places a corresponding symbol in the key together with > its title. "with lines" places a line, "with boxes" places a box, > "with points" places a point, and so on. "with labels" does not place > a separate symbol because its primary feauture text and the corresponding > title already representes text. > > So your plot "with points" showed a point in the key. > Your plot "with labels" did not. Hypertext is actually not relevant here. > > Having said that, I am sympathetic to the idea that a plot using > "with labels point pointtype 7 lc 'green'" could place a filled green > circle next to the plot title just as it does next to each label in > the plot itself. I suggest you add that as a Feature Request on the > issues tracker on the project's SourceForge page. > > Meanwhile you could use the approach in the hypertext demo > http://gnuplot.sourceforge.net/demo_svg_5.0/hypertext.html > The data is plotted twice, once "with points" and then again > "with labels hypertext". The demo doesn't use a key, but if you > enable the key then the "with points" plot will be represented > by a corresponding point sample in the key. > > Ethan > > > > > > > > > Here are the contents of data_file.txt: > > > > 150 1 x1 185 1 x1 > > 105 1 x2 140 1 x2 > > 140 1 x3 180 1 x3 > > |