|
From: LukasP <LP...@po...> - 2010-08-27 12:12:35
|
Hello, let's have a datafile "a.txt": 1 10 100 2 15 150 3 30 300 Let's have a predefined value, say "X=2". Let's plot the datafile by: plot "a.txt" u 1:2 w lp, "" u 1:3 w lp Is it possible (and if so, how?) to make gnuplot plot the y-value of the 2nd column as text for (only) this preset X? Let's have another datafile, "b.txt": 1 10 100 2 15 150 * 3 30 300 Is it possible (and if so, how?) to make gnuplot plot the y-value as text (only) when the line of the datafile contains "*" at the last position (or wherever on the line)? Thank you in advance. LukasP -- View this message in context: http://old.nabble.com/Write-text-value-for-a-specific-x-tp29551956p29551956.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2010-08-27 14:40:15
|
xx=2
plot "a.txt" u 1:2 w lp, "" u 1:3 w lp, "" u 1:($1==xx?$2:0/0):2 w labels
or
plot "b.txt" u 1:2 w lp, "" u 1:3 w lp, "" u
1:(strlen("".stringcolumn(4))>0?$2:0/0):2 w labels
LukasP wrote:
>
> Hello,
>
> let's have a datafile "a.txt":
>
> 1 10 100
> 2 15 150
> 3 30 300
>
> Let's have a predefined value, say "X=2".
>
> Let's plot the datafile by:
>
> plot "a.txt" u 1:2 w lp, "" u 1:3 w lp
>
> Is it possible (and if so, how?) to make gnuplot plot the y-value of the
> 2nd column as text for (only) this preset X?
>
> Let's have another datafile, "b.txt":
>
> 1 10 100
> 2 15 150 *
> 3 30 300
>
> Is it possible (and if so, how?) to make gnuplot plot the y-value as text
> (only) when the line of the datafile contains "*" at the last position (or
> wherever on the line)?
>
> Thank you in advance.
>
> LukasP
>
>
--
View this message in context: http://old.nabble.com/Write-text-value-for-a-specific-x-tp29551956p29553294.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: LukasP <LP...@po...> - 2010-08-29 19:12:02
|
Thanks, this works perfectly.
I would have one more question. I'm drawing plot by:
plot "b.txt" u 1:2 w lp, "" u 1:2:3 w labels
Is it possible to specify somehow the alignment of the texts? E.g. to be
aligned above or under the coordinates read from file? If I use the command
written above, the text gets "scratched" by the plot. If texts were placed
higher, they wouldn't seem scratched.
I know I can write:
plot "b.txt" u 1:2 w lp, "" u 1:($2+100):3 w labels
which moves texts 100 units above. But the problem is that I'm using the
script for plotting many files and y-range of each varies. Thus I don't know
what the offset (= 100 in the example) should be - this one value doesn't
work generally for all files to be plotted.
I tried as well:
plot "b.txt" u 1:2 w lp, "" u 1:2:(stringcolumn(3)."\n") w labels
hoping that the "\n" character will cause the text to be shifted above
(similarly 1:2:("\n".stringcolumn(3)) to shift down). But it doesn't work.
So is there a switch like "w labels above" or "w labels ls XYZ" where "XYZ"
would define the shift?
Or how would you solve the problem?
Thanks in advance.
LukasP
--
View this message in context: http://old.nabble.com/Write-text-value-for-a-specific-x-tp29551956p29567248.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: Thomas S. <t.s...@fz...> - 2010-08-29 19:28:54
|
plot "b.txt" u 1:2 w lp, "" u 1:2:3 w labels offset graph 0.1,0.0
LukasP wrote:
>
> Thanks, this works perfectly.
>
> I would have one more question. I'm drawing plot by:
>
> plot "b.txt" u 1:2 w lp, "" u 1:2:3 w labels
>
> Is it possible to specify somehow the alignment of the texts? E.g. to be
> aligned above or under the coordinates read from file? If I use the
> command written above, the text gets "scratched" by the plot. If texts
> were placed higher, they wouldn't seem scratched.
>
> I know I can write:
>
> plot "b.txt" u 1:2 w lp, "" u 1:($2+100):3 w labels
>
> which moves texts 100 units above. But the problem is that I'm using the
> script for plotting many files and y-range of each varies. Thus I don't
> know what the offset (= 100 in the example) should be - this one value
> doesn't work generally for all files to be plotted.
>
> I tried as well:
>
> plot "b.txt" u 1:2 w lp, "" u 1:2:(stringcolumn(3)."\n") w labels
>
> hoping that the "\n" character will cause the text to be shifted above
> (similarly 1:2:("\n".stringcolumn(3)) to shift down). But it doesn't work.
>
> So is there a switch like "w labels above" or "w labels ls XYZ" where
> "XYZ" would define the shift?
>
> Or how would you solve the problem?
>
> Thanks in advance.
>
> LukasP
>
>
--
View this message in context: http://old.nabble.com/Write-text-value-for-a-specific-x-tp29551956p29567358.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|