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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:44:55+00:00 2026-06-05T19:44:55+00:00

I want to plot multiple rowstacked histograms on the same graph using gnuplot. A

  • 0

I want to plot multiple rowstacked histograms on the same graph using gnuplot. A sample data file is the following:

App1 20 30 50
App2 10 20 70

The script I use is this

set terminal jpeg medium
set output "histo.jpeg"
set boxwidth 0.75 absolute
set style fill solid 1.00 border -1
set style data histogram
set style histogram rowstacked
set xtics 1000 nomirror
set ytics 100 nomirror
set mxtics 2
set mytics 2
set ytics 10
set yrange [0:120]
set ylabel "Total time"
set key below vertical

plot 'data' using 2 t "Idle", '' using 3 t "User space", '' using 4 :xtic(1) t "Kernel space"

The result I am getting is this:enter image description here

I would like to have separate keys below each histogram, since I want to display the amount of time each element is occupying which is different from one graph to the other. Also, possibly some elements appearing on one histogram will not appear on the other.

My intention is to create a script that generates both the data file and the gnuplot script to automate this process.

I have achieved the above using jgraph but the results are pretty poor in terms of appearance.

Thanks a lot,

Spap

  • 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-05T19:44:57+00:00Added an answer on June 5, 2026 at 7:44 pm

    Unfortunately, there is no clean way to do this. You can achieve something similar by plotting your data the first time around (in a multiplot) and then making “null” plots to add more keys after the fact.

    set boxwidth 0.75 absolute 
    set style fill solid 1.00 border -1
    set style data histogram
    set style histogram rowstacked
    set xtics 1000 nomirror
    set ytics 100 nomirror
    set mxtics 2
    set mytics 2
    set ytics 10
    set yrange [0:120]
    set ylabel "Total time"
    set multiplot
    
    #These might be helpful to keep all the "plots" aligned.
    set lmargin at screen .2
    set rmargin at screen .9
    set tmargin at screen .9
    set bmargin at screen .2
    
    set key at first .5,screen .1 #could be "set key at screen 0.1,0.1"  You'll have to play around with it.
    
    plot 'data' using 2 t "Idle", \
         '' using 3 t "User space", \
         '' using 4 :xtic(1) t "Kernel space"
    
    unset xtics
    unset xlabel
    unset ytics
    unset ylabel
    unset title
    unset border 
    set xrange [GPVAL_X_MIN:GPVAL_X_MAX]
    
    set key at first 1.5,screen .1 
    plot NaN t "Idle (app2)" w boxes, \
         NaN t "User space (app2)" w boxes, \
         NaN t "Kernel space (app2)" w boxes
    
    unset multiplot
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data file which I want to plot with gnuplot. However, for
I want to plot multiple lines on the sample plot using qplot in the
I want to plot multiple data sets on the same scatter plot: cases =
I want to have multiple lines on the same plot. Multiple data points. In
I want to use core-plot for drawing line graph dynamically. data won't come at
I want to plot some data into a web graph control(preferably javascript or php).
I want to plot multiple bounded functions in gnuplot. I.e. plot x from 0
I'm using JFreeChart and want to plot a series of data using a line
I want to plot a simple histogram, using raw data. ie, I have a
Hi I want to plot multiple (x,y) coordinates in a single graph. Say I

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.