Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the scatterplot character in the gnuplot dumb terminal?

Tags:

gnuplot

In gnuplot's dumb terminal, I can plot multiple series of 2D data like so:

set terminal dumb 79 24
plot "series1.dat", "series2.dat"

Points in series 1 are represented as the 'A' character; points in series 2 as 'B', and so on:

enter image description here

I can set the point type as follows:

plot "series1.dat" pt 1

but all the point types are just A-Z modulo pt (that is, 1 = 'A', 26 = 'Z', 27 = 'A', etc.)

It would be easier to understand my plot if I could set one of these to, say, * or .. How can I set the point in each series to something of my choosing?

like image 985
Sasgorilla Avatar asked Oct 26 '25 06:10

Sasgorilla


2 Answers

In version 5.0, you can do this by specifying the character as the point type

plot "series1.dat" pt "*"

will use the * character as the point.

For example, with the data

1 2
5 8
3 9

we get

10 +-+-----------+-------------+-------------+-------------+-----------+-+
   +             +             +             +             +             +
   |                    *                                                |
   |                                                                     |
 8 +-+                                *                                +-+
   |                                                                     |
   |                                                                     |
   |                                                                     |
 6 +-+                                                                 +-+
   |                                                                     |
   |                                                                     |
 4 +-+                                                                 +-+
   |                                                                     |
   |                                                                     |
   |                                                                     |
 2 +-+    *                                                            +-+
   |                                                                     |
   |                                                                     |
   +             +             +             +             +             +
 0 +-+-----------+-------------+-------------+-------------+-----------+-+
   0             2             4             6             8             10

where the * character is used for the point.

This is documented under help points which says ...any single printable character may be given instead of a point type....

like image 143
Matthew Avatar answered Oct 29 '25 07:10

Matthew


You ask:

It would be easier to understand my plot if I could set one of these to, say, * or .

I have gnuplot 4.6 patchlevel 6 (2013), and although @Matthew's pt solution does not work for me, if you merely want one of the two series to be a dot ., you actually can do:

plot "series1.dat", "series2.dat" with dots

Example

series1.dat:

1   1
2   2

series2.dat:

4   6
5   7
7   5
8   5

start gnuplot, then

set term dumb 79, 24

plot "series1.dat", "series2.dat" with dots

result:

7 ++--------+---------+---------+----------.---------+---------+--------++
  +         +         +         +          +        "series1.dat"   A    +
  |                                                 "series2.dat"   .    |
6 ++                            .                                       ++
  |                                                                      |
  |                                                                      |
5 ++                                                           .        +.
  |                                                                      |
  |                                                                      |
4 ++                                                                    ++
  |                                                                      |
  |                                                                      |
  |                                                                      |
3 ++                                                                    ++
  |                                                                      |
  |                                                                      |
2 ++        A                                                           ++
  |                                                                      |
  +         +         +         +          +         +         +         +
1 A+--------+---------+---------+----------+---------+---------+--------++
  1         2         3         4          5         6         7         8
  • The series1.dat remains the default with lines style
  • however series2.dat is rendered with dots style which generates . for each point
like image 27
clarity123 Avatar answered Oct 29 '25 07:10

clarity123



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!