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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:52:41+00:00 2026-06-17T12:52:41+00:00

I have a datafile with multiple columns, the first two indicating the position and

  • 0

I have a datafile with multiple columns, the first two indicating the position and the others indicating other properties (such as number of items sent from this point). eg:

1  1  1  57.11
2  1  2  62.40
3  4  1  31.92

What I want to do is plot the points at the positions, but use values from the other columns to vary point type and size (for example). However I can’t seem to find a way to reference columns in the plot. I know of the use of “variable”, but I cant find a way to use multiple variables.

What I want is something like the following:

plot "mydata" using 1:2 notitle with points pt ($3) ps ($4/10)

so that pt and ps use the value for each point taken from the third and fourth columns respectively.

Is this even possible in gnuplot? Is there some sort of work-around?

  • 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-17T12:52:43+00:00Added an answer on June 17, 2026 at 12:52 pm

    You should be able to use the keyword variable to do something like this:

    plot 'datafile' using 1:2:3:4 w points ps variable lc variable
    

    Or possibly mapping the value to a palette:

    plot 'datafile' using 1:2:3:4 w points ps variable lc palette
    

    The keyword variable and/or palette causes gnuplot to read the properties from the file and they both require an extra column to be read via using. Of course all the usual stuff with using applies — You can apply transforms to the data, etc:

    plot 'datafile' using 1:2:3:($4+32.) w points ps variable lc palette
    

    I don’t remember off the top of my head whether the 3rd column will be the pointsize or the color here, and I don’t have time right now to play around with it to figure it out. You can do the experimenting and post a comment, or I’ll come back to this when I have time and add an update.


    Some of the other properties (e.g. pointtype) can’t be changed quite to easily using variable. The easiest way to do this is to use filters with the gnuplot ternary operator.

    First, write a function that returns a pointtype based on the data from 1 column of the datafile:

    my_point_type(x) = x   
    

    Here I use a simple identity function, but it could be anything. Now, you can loop over the pointtypes you want (here 1-10) making a plot for each:

    plot [for PT=1:10] 'datafile' u 1:((my_point_type($3) == PT) ? $2:NaN) with points pt PT
    

    This assumes that the column with pointtype information is the 3rd column and that the second column holds the position information. This can also be combine with the stuff that I demonstrated above.

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

Sidebar

Related Questions

I have a datafile containing a large number of sentences, encoded like this: Gib
I have a data file with multiple rows, and 8 columns - I want
I have a large datafile in the following format below: ENST00000371026 WDR78,WDR78,WDR78, WD repeat
I have xml data(file or text) sent to client from web server. The xml
I have a Rails application to do web surveys. It stores answers to multiple-choices
I have a datafile (tab separated) which looks like this: chr1 38045559 38046059 chr1:38045559-38046559_NM_001142726_C1orf122_+,chr1:38045559-38046559_NM_198446_C1orf122_+,chr1:38045952-38046952_NM_024640_YRDC_-
I have a huge datafile (~4GB) that I am passing through R (to do
I have successfully downloaded an sqlite datafile from my testing app on my provisioned
I have an excel macro saved in a blank workbook and multiple data workbooks.
I have a program which creates multiple threads and each one of them tries

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.