Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in gnuplot how do i set a key (legend) when using "plot with labels"

When I use "plot with labels" with various groups of points everything is ok, labels appear in different colors.

However I could not find a way to set the key (legend) properly I would like to have a sample of the text color used for each group of points. All a get is the title associated to each group.

set term x11 
set key outside 
set grid 
set xlabel "#occurences"
set ylabel "F-score"
set title "Experiment"
plot "-" lw 1 with labels font "\"Helvetica\"" tc lt 1 title "foo" , "-" lw 1 with labels font "\"Helvetica\"" tc lt 2 title "bar"  
96.0 0.24390244 11
5547.0 0.7443704 24
3974.0 0.83244646 114
241.0 0.16025642 174
6220.0 0.7571273 188
7810.0 0.8637012 206
e

98.0 0.0 4
96.0 0.11320755 11
5547.0 0.75145125 24
3974.0 0.8333118 114
6220.0 0.7646692 188
7810.0 0.87222874 206
e
like image 497
Thibault Langlois Avatar asked Jul 15 '26 14:07

Thibault Langlois


1 Answers

That is done with set key textcolor variable, as stated in the comments:

set key outside textcolor variable
set grid 
set xlabel "#occurences"
set ylabel "F-score"
set title "Experiment"
plot "-" lw 1 with labels font "\"Helvetica\"" tc lt 1 title "foo" , "-" lw 1 with labels font "\"Helvetica\"" tc lt 2 title "bar"  
96.0 0.24390244 11
5547.0 0.7443704 24
3974.0 0.83244646 114
241.0 0.16025642 174
6220.0 0.7571273 188
7810.0 0.8637012 206
e

98.0 0.0 4
96.0 0.11320755 11
5547.0 0.75145125 24
3974.0 0.8333118 114
6220.0 0.7646692 188
7810.0 0.87222874 206
e

Result with 4.6.5:

enter image description here

like image 147
Christoph Avatar answered Jul 22 '26 17:07

Christoph