Разметка строк в таблице с помощью gnuplot - PullRequest
0 голосов
/ 05 февраля 2019

Кажется, что при построении таблицы длина строки столбца, по-видимому, ограничена примерно 62 символами.Приведенный ниже код является минимальным примером (gnuplot 5.2.5).

Почему длина строки ограничена таким «небольшим» значением?Есть ли способ использовать более длинные строки?

### plot dataset to table including strings
reset session

$DataInput <<EOD
# tab separated data
1   0.123   This is some text, actually a lot of text, which apparently is too much for gnuplot.    84
2   0.456   This is some text, actually a lot of text, which apparently is too much.    72
3   0.789   This is some text, actually a lot of text.  42
EOD

set datafile commentschar ""
set datafile separator "\n"
set table $DataOutput
    plot $DataInput u (stringcolumn(1)) with table
unset table
set datafile separator "\t"
set datafile commentschar "#"

print "DataInput:"
print $DataInput

print "DataOutput:"
print $DataOutput

### end of code

Вывод:

DataInput:
# tab separated data
1   0.123   This is some text, actually a lot of text, which apparently is too much for gnuplot.    84
2   0.456   This is some text, actually a lot of text, which apparently is too much.    72
3   0.789   This is some text, actually a lot of text.  42

DataOutput:
 # tab separated data   
 1  0.123   This is some text, actually a lot of text, which appar
 2  0.456   This is some text, actually a lot of text, which appar
 3  0.789   This is some text, actually a lot of text.  42

1 Ответ

0 голосов
/ 05 февраля 2019

Вы нашли ошибку или, по крайней мере, ненужное ограничение.Длина вывода для каждого столбца из "plot with table" ограничена максимальной шириной формата% g, но это не имеет значения для строк.

В зависимости от варианта использования в полном объеме вы можете обойтиошибка чем-то основанным на "plot with label".Вот ужасный пример, который нужно добавить в конец вашего примера кода:

print "\ndirect output to table with labels"
set table $LabelOutput
    plot $DataInput using (0):(0):(stringcolumn(1)) with labels
unset table
print $LabelOutput

print "\n Edited version"
do for [i=1:|$LabelOutput|] {
    print $LabelOutput[i][1:1], $LabelOutput[i][7:*]
}

Вывод (да, комментарии искажены, а я не удалил кавычки):

direct output to table with labels

# Curve 0 of 1, 4 points
# Curve title: "$DataInput using (0):(0):(stringcolumn(1))"
# x y label type
 0  0 "# tab separated data"
 0  0 "1   0.123   This is some text, actually a lot of text, which apparently is too much for gnuplot.    84"
 0  0 "2   0.456   This is some text, actually a lot of text, which apparently is too much.    72"
 0  0 "3   0.789   This is some text, actually a lot of text.  42"



 Edited version

#e 0 of 1, 4 points
#e title: "$DataInput using (0):(0):(stringcolumn(1))"
#label type
 "# tab separated data"
 "1   0.123   This is some text, actually a lot of text, which apparently is too much for gnuplot.    84"
 "2   0.456   This is some text, actually a lot of text, which apparently is too much.    72"
 "3   0.789   This is some text, actually a lot of text.  42"
...