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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:24:37+00:00 2026-06-01T02:24:37+00:00

I am trying to have two data series plotted in one graph as boxes

  • 0

I am trying to have two data series plotted in one graph as boxes in gnuplot. The script looks like this currently:

set terminal postscript eps enhanced color
set title "Distribution of the extrepreneur PnL. Loan $6."
set output 'pnl_loan6.eps'


#set xrange [0:]
set xlabel "Discounted profit"

set style fill solid 0.8 border -1
plot 'pnl_loan6.txt' using 1:2 title 'PnL high risk (xi=1)' with boxes,\
     'pnl_loan6.txt' using 1:3 title 'PnL high risk (xi=1.5)' with boxes

however the two series overlap. Instead of the overlap I would like to have one series draw its box in the left half of the existing box, and the other one in the right half, so that they effectively alternate. How can I do it?

EDIT:

  1. I tried a histogram plot, but this didn’t look very good. The xtics were not what I was after and there were spaces in between the columns.
  2. Sample data (first 20 columns out of 100):

Data:

-10.000000 20251.000000 31825.000000
-4.892638 26743.000000 21310.000000
0.214725 20362.000000 14590.000000
5.322087 13023.000000 9645.000000
10.429449 7730.000000 6347.000000
15.536812 4636.000000 4331.000000
20.644174 2714.000000 2964.000000
25.751536 1647.000000 2121.000000
30.858899 1044.000000 1586.000000
35.966261 648.000000 1106.000000
41.073624 396.000000 873.000000
46.180986 257.000000 685.000000
51.288348 166.000000 471.000000
56.395711 101.000000 369.000000
61.503073 83.000000 321.000000
66.610435 52.000000 260.000000
71.717798 40.000000 184.000000
76.825160 30.000000 172.000000
81.932522 21.000000 143.000000
87.039885 11.000000 116.000000
  • 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-01T02:24:39+00:00Added an answer on June 1, 2026 at 2:24 am

    I am not really sure what you are after but maybe this little hackerish approach will do the trick:

    set style fill solid 0.8 border -1
    set boxwidth 0.5 relative
    plot 'pnl_loan6.txt' using ($1+1.27684075):2 title 'PnL high risk (xi=1)' with boxes,\
         'pnl_loan6.txt' using ($1-1.27684075):3 title 'PnL high risk (xi=1.5)' with boxes
    

    The difference to your script is

    1. setting the boxwidth do 0.5 relative
    2. offsetting the plots by half the distance on the x-axis (this only works because your x-axis scaling is equidistant.

    Anyhow this is the resulting plot:

    enter image description here

    PS:
    You might want to think about a logarithmic scaling on the y-axis with set logscale y which would result in this plot:

    enter image description here

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

Sidebar

Related Questions

I have a factored time series that looks like this: df <- data.frame(a=c(11-JUL-2004, 11-JUL-2005,
I have two arrays of data that I'm trying to amalgamate. One contains actual
I have two time series of data, one which is water temperature and the
I'm trying a multithreaded Core Data implementation on iPhone SDK 3.1.3. I have two
I am trying to have two submit buttons in my form - one accepts
I have two arrayLists and I am trying to subtract one arrayList from another.
I have a two data arrays sent in from a form, one called transloaded
I am trying to plot two data series in an MSChart. I am using
I have two data.frame s in R , each indexed by date. One is
I am trying to import data from a large database. I have two tables

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.