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 9255481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:43:38+00:00 2026-06-18T11:43:38+00:00

As the title suggests I want to place the plot legend below a multiplot

  • 0

As the title suggests I want to place the plot legend below a multiplot graph. I add the legend for just one of the plots because the line styles are the same for all. The problem I encounter is that, if I add the key by set key below, the plots themselves get resized as to fit the (large) key inside the canvas. I would rather want to maintain the size of the plots. I tried adding the key as additional plot in the multiplot with set key inside, but then the key can overlap the plots if it is too large. I am using the epslatex terminal.

  • 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-18T11:43:40+00:00Added an answer on June 18, 2026 at 11:43 am

    Here is a way to do it with some functions to help adjust the positions of the margins in the plot:

    #!/usr/bin/env gnuplot
    
    ### n: change this parameter to equal the number of data sets to be plotted
    n = 3
    # t: top margin in pixels
    t = 75.0
    # b: key height in pixels (bottom margin)
    b = 300.0
    # h: height of output in pixels
    h = 150.0*n + t + b
    
    ### define functions to help set top/bottom margins
    top(i,n,h,t,b) = 1.0 - (t+(h-t-b)*(i-1)/n)/h
    bot(i,n,h,t,b) = 1.0 - (t+(h-t-b)*i/n)/h
    
    ### first set up some basic plot parameters
    set term pngcairo enhanced size 800,h font 'FreeMono-Bold,14'
    set output 'bigkey.png'
    
    set title 'Big Key Plot'
    set ylabel 'Y Axis'
    
    set multiplot layout (n+1),1
    ### First plot
    # change only plot command here
    currentplot = 1
    set tmargin at screen top(currentplot,n,h,t,b)
    set bmargin at screen bot(currentplot,n,h,t,b)
    unset key
    unset xtics
    plot sin(1*x) title 'Line 1', \
         sin(2*x) title 'Line 2', \
         sin(3*x) title 'Line 3', \
         sin(4*x) title 'Line 4', \
         sin(5*x) title 'Line 5', \
         sin(6*x) title 'Line 6', \
         sin(7*x) title 'Line 7'
    ### Middle plot
    # copy and paste this code to make more middle plots
    currentplot = currentplot + 1
    set tmargin at screen top(currentplot,n,h,t,b)
    set bmargin at screen bot(currentplot,n,h,t,b)
    unset title
    replot
    ### Last plot
    # change only plot command here
    currentplot = currentplot + 1
    set tmargin at screen top(currentplot,n,h,t,b)
    set bmargin at screen bot(currentplot,n,h,t,b)
    set xlabel 'X Axis'
    set xtics
    replot
    ### Last (key) plot
    set tmargin at screen bot(n,n,h,t,b)
    set bmargin at screen 0
    set key center center
    set border 0
    unset tics
    unset xlabel
    unset ylabel
    set yrange [0:1]
    plot 2 t 'Line 1', \
         2 t 'Line 2', \
         2 t 'Line 3', \
         2 t 'Line 4', \
         2 t 'Line 5', \
         2 t 'Line 6', \
         2 t 'Line 7'
    
    unset multiplot
    

    Here is the result:
    enter image description here

    The things you have to adjust manually are the number of plots and the size of the bottom margin, which is where the key gets drawn. The comments generally say where you have to change things.

    I put the key in a plot by itself so that it would be easy to keep the sizes of the other plots the exact same. Plotting the number 2 when the y range is 0 to 1 keeps the lines from showing in the key plot.

    This is mostly based on my answer here, which is why I have the plots all touching. You can adjust the top() and bot() functions with an additional margin parameter if you want a gap between the plots.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the title suggests, I just want to display a standard windows error icon
As the question title suggests, I want to add an Action<string> to an interface.
As title suggests I want to know the difference between the change and click
Well, as the title suggests: I have a storyboard and I want it's animation
Okay, the title of the question kind of suggests one solution I've been considering
As the title suggests I want to know what the app/templates directory is for
As the title suggests, I want to actually brute-force (don't pay attention, useless information)
As the title suggests I want to create a custom title bar for a
as the title suggests I want somebody to help me in coding the conversion
As the title suggests, I want to get a list of all packages that

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.