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

  • Home
  • SEARCH
  • 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 8796663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:40:29+00:00 2026-06-13T23:40:29+00:00

I googled a bit but could not find a good solution. I have a

  • 0

I googled a bit but could not find a good solution. I have a sequence of events: A, B and C occurring over time repeatedly and I want to plot this on a timeline somewhat as follows:

AAABBBBAAAAACCAAAAAAAAABBBBABBBBB

But in a more aesthetic and colorful way. I use gnuplot, so, if someone knows the trick with gnuplot, that would be great.

The format of raw data is as follows:

A   4
B   6
C  10
A  14
B  17
C  22
A  27
B  27
C  35
A  35

And the gnuplot script that I worked out is as follows:

set terminal png enhanced
set style data histograms

set style histogram columnstacked
set output "timeline.png"
set xlabel "events"
set ylabel "min"
set auto x
set xtics 1
set key top left
set boxwidth 0.5 relative
set style fill solid 0.6 border -1
plot 'timeline.txt' using 2 t "execution"

After running this script on above data, I get the following plot:
Columnstacked histogram

I want: 1) the colors to be repeating based on the letters on first column and 2) the histogram to be horizontal, one-dimension plot.

Thanks for any help.

  • 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-13T23:40:30+00:00Added an answer on June 13, 2026 at 11:40 pm

    How about something like this:

    sum=0
    cum_sum(x)=(sum=sum+x,sum-x/2)
    set yrange [-1:2]
    set xrange [0:*]
    unset ytics
    set style fill solid
    plot 'test.dat' using (cum_sum($2)):(1.0):($2):($0) w boxes t "execution" lc variable
    

    and here’s a version which colors the boxes based on the label (I have to admit, I’m pretty proud of this hack):

    sum=0
    cum_sum(x)=(sum=sum+x,sum-x/2)
    set yrange [-1:2]
    set xrange [0:*]
    unset ytics
    set style fill solid
    LABELS="ABCD"
    plot 'test.dat' using (cum_sum($2)):(1.0):($2):(strstrt(LABELS,strcol(1))) w boxes t "execution" lc variable
    

    If you want to control which color a particular label gets, you’d want to use set style line X lc rgb 'cyan' where the label which starts at index X in the LABELS string will be colored cyan.

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

Sidebar

Related Questions

Before asking this question I have googled for some time, but could not find
Googled everything, but can't find solution for my problem. When i'm trying to deploy
Hi I know this question is a bit trivial. I googled it but could
This is probably a very novice question, but I could not find an answer.
I'm new to Data Generation Plans in Visual Studio, but I googled a bit
I google'd a bit and read http://en.wikipedia.org/wiki/Portable_Executable but i can't seem to find when
I have searched a bit on google, but didn't really found an answer to
I have googled a bit for how I should handle security in a web
I have searched google and exhausted a fair bit of my time trying to
I'm writing a Fixedpoint class, but have ran into bit of a snag... The

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.