Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:41:52+00:00 2026-06-13T18:41:52+00:00

I’m using gnuplot in the multiplot environment. I want to have only one key

  • 0

I’m using gnuplot in the multiplot environment. I want to have only one key box (which is not a problem) that i want to put in “horizontal mode” under the plots.

Nice Plot1 | Nice Plot2

Nice Plot3 | Nice Plot4

      the keybox

It seems that the total size of the keybox can’t exceed the width of its corresponding plot (so here it’s half the screen size). This is causing line returns in the keybox which i don’t want.

Is there anyway to get around it?

Thanks.

Edit: Script added. (the keybox is on 3 lines)

set terminal epslatex color
set output 'Plot.tex'
set multiplot
set xrange [0:0.8]
set key box
set key reverse horizontal maxcols 10 samplen 0.5 spacing 1
#set key font ",9"
set key at screen 0.9,0.15
set size 0.5,0.5
set origin 0,0
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x  with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title '$k$-NN'


#
# Plot n°2
#
set size 0.5,0.5
set origin 0,0.5
set xrange [0:0.8]
set key off
set title ''
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x  with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x  with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x  with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x  with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title 'KNN',\
x with lines lt 1 lw 4 lc rgb "black" title 'Ground Truth'

set size 0.5,0.5
set origin 0.5,0
set xrange [0:0.8]
set key off
set title ''
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title 'KNN',\
x with lines lt 1 lw 4 lc rgb "black" title 'Ground Truth'


set size 0.5,0.5
set origin 0.5,0.5
set xrange [0:0.8]
set key off
set title ''
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x  with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x  with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title 'KNN',\
x with lines lt 1 lw 4 lc rgb "black" title 'Ground Truth'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:41:53+00:00Added an answer on June 13, 2026 at 6:41 pm

    This is an ugly problem. I’ve never really used the epslatex terminal much — That may cause additional complications as the documentation states that

    “When using the Tex terminal … where formatting information is embedded in the string, gnuplot can only estimate the correct width for string positioning”

    You’re right on with the fact that gnuplot doesn’t seem to want to make a key that is wider than the plot — too bad you can’t specify the width explicitly like you would be able to do with a rectangle. That’s easy enough to work around though. The trick is to make your plots (without keys) as normal and then make a final “null” plot that is as big as you need it to be to fit the labels:

    set term ...
    set output ...
    
    #Let the magic begin!
    
    set multiplot
    unset key
    
    #<plot 1>
    #...
    #</plot 1>
    
    #<plot 2>
    #...
    #</plot 2>
    
    #<plot 3>
    #...
    #</plot 3>
    
    #<plot 4>
    #...
    #</plot 4>
    
    #<null>
    #here we need to unset everything that was set previously
    unset origin
    unset border
    unset tics
    unset label
    unset arrow
    unset title
    unset object
    
    #Now set the size of this plot to something BIG
    set size 2,2 #however big you need it
    
    #example key settings
    set key box 
    set key horizontal reverse samplen 1 width -4 maxrows 1 maxcols 12 
    set key at screen 0.5,screen 0.15 center top
    
    #We need to set an explicit xrange.  Anything will work really.
    set xrange [-1:1]
    set yrange [-1:1]
    
    plot NaN w title 'title 1',\
         NaN w title 'title 2',\
         NaN w title 'title 3',\
         NaN w title 'title 4'   #etc.
    
    #</null>
    unset multiplot  #<--- Necessary for some terminals, but not postscript I don't think.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.