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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:09:20+00:00 2026-06-05T09:09:20+00:00

I want to plot column 3 and 4 with bars for each data set

  • 0

I want to plot column 3 and 4 with bars for each data set in the file, data set are identified by multiple newline and are referred using index as show in script below. I can draw this data with “linespoint”. My graph looks like my graph. But I want to plot data with “boxes” as I want graph like this.

x-axis will have column 3 (1,2,3) and y-axis will have column 4, For each value of x (1,2,3) there should be 2 bars, one from index 0 and second from index 1.

Data file looks like:

2-100

2 100 1 3.10 249

2 100 2 3.41 250

2 100 4 3.70 249

3-100

3 100 1 3.10 252

3 100 2 3.48 252

3 100 4 3.72 254

2-100 an 3-100 will be used as title “first row of block and first column”, first 4 lines are read as “index o” in script and second 4 lines as “index 1”

script I used:

plot \

  "$1" index 0 using 3:4 with boxes fs solid title columnhead(1),\

  "$1" index 1 using 3:4 with boxes fs solid title columnhead(1)
  • 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-05T09:09:21+00:00Added an answer on June 5, 2026 at 9:09 am

    I’ve reformatted your datafile a little bit (at least, if I understood your original question correctly) — It now looks like:

    2-100
    2 100 1 3.10 249
    2 100 2 3.41 250
    2 100 4 3.70 249
    
    
    3-100
    3 100 1 3.10 252
    3 100 2 3.48 252
    3 100 4 3.72 254
    

    You should be able to format your datafile like this using sed:

    sed -e '/^$/ d'           -e '/[0-9]-100/{x;p;p;x}'               datafile.dat
    #     #remove all newlines  #reinsert newlines where appropriate
    

    (this assumes that the column heads always start with a number (0-9) and then “-100”. You’re re might need to be a little more interesting if your datafile is a little more complicated.

    This can be plotted using:

    set yrange [0:*]
    set style fill solid
    plot for [i=0:1] 'test2.dat' index i u ($3+i*0.25):4:(0.25) w boxes title columnhead(1)
    

    Of course, you can break up the for loop to assign special properties to each plot or whatever…

    If you want special labels, you can do this

    set xtics scale 0,0 format ""
    set xtics ("This is at 1" 1, "this is at 2" 2, "this is at 3" 3)
    

    before your plot command.

    Here’s what I get using the above with the png (libgd) terminal:

    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 data file which I want to plot with gnuplot. However, for
I want to plot some data. The first column contains the x-data. But matplotlib
I want to plot a simple histogram, using raw data. ie, I have a
So I am creating a .csv file with data I want to plot in
I have a data which I want to plot in cumulative function. The R
I want to use core-plot for drawing line graph dynamically. data won't come at
I want to write a bash script to automate the plotting of data, using
I have a data set that has two tab delimited columns that I plot
I want to have a single .plt file storing both data and gnuplot commands.
If I have a file of several data points. How can I plot a

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.