Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4361 > unrolled thread
| Started by | Massimiliano LANDI <landim@smu.edu.sg> |
|---|---|
| First post | 2011-08-13 10:50 +0000 |
| Last post | 2011-08-14 12:21 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
I want a plot label that shows interactively the values of a Massimiliano LANDI <landim@smu.edu.sg> - 2011-08-13 10:50 +0000
Re: I want a plot label that shows interactively the values of a "Chris Degnen" <degnen@cwgsy.net> - 2011-08-14 12:16 +0000
Re: I want a plot label that shows interactively the values of a Yves Klett <yves.klett@googlemail.com> - 2011-08-14 12:21 +0000
| From | Massimiliano LANDI <landim@smu.edu.sg> |
|---|---|
| Date | 2011-08-13 10:50 +0000 |
| Subject | I want a plot label that shows interactively the values of a |
| Message-ID | <j25ktl$ov3$1@smc.vnet.net> |
Hello everyone
I am trying to add to a plot I created a text that shows the value of a variable, call it p2, that can be changed via Manipulate.
So I did:
Manipulate[
Plot[....,Epilog->{Text[Style["p2=" p2, 18, If[(A/(1 + B n) <= p2 <= (A + A n)/(1 + n + B n) && k == 2) || (p2 == 1 && k == 1), Red, Black], Background -> LightGray]}],
...]
The funny thing is that with this code, in the text label, the actual value of the variable appears before the text p2.
For example, when I set p2=10, the label in the graph becomes
10 p2
whereas I would like to see
p2 = 10
Any help?
Thanks in advance
Massimiliano Landi
[toc] | [next] | [standalone]
| From | "Chris Degnen" <degnen@cwgsy.net> |
|---|---|
| Date | 2011-08-14 12:16 +0000 |
| Message-ID | <j28ea7$3cm$1@smc.vnet.net> |
| In reply to | #4361 |
You could try something like this,
adapted from the help examples on Manipulate and Epilog:-
Manipulate[
Plot[Sin[x(1+p2*x)],{x,0,6},
Epilog->{Inset[
Text[Style["p2="<>ToString[p2],20,If[p2<1,Red,Black]],
Background->LightGray],{Right,Top},{Right,Top}]}],{p2,0,2}]
----- Original Message -----
From: "Massimiliano LANDI" <landim@smu.edu.sg>
Newsgroups: comp.soft-sys.math.mathematica
Sent: Saturday, August 13, 2011 11:50 AM
Subject: I want a plot label that shows interactively the values of a
> Hello everyone
>
> I am trying to add to a plot I created a text that shows the value of a
> variable, call it p2, that can be changed via Manipulate.
>
> So I did:
>
> Manipulate[
> Plot[....,Epilog->{Text[Style["p2=" p2, 18, If[(A/(1 + B n) <= p2 <= (A
> + A n)/(1 + n + B n) && k == 2) || (p2 == 1 && k == 1), Red, Black],
> Background -> LightGray]}],
> ...]
>
> The funny thing is that with this code, in the text label, the actual
> value of the variable appears before the text p2.
>
> For example, when I set p2=10, the label in the graph becomes
>
> 10 p2
>
> whereas I would like to see
>
> p2 = 10
>
> Any help?
>
> Thanks in advance
>
> Massimiliano Landi
[toc] | [prev] | [next] | [standalone]
| From | Yves Klett <yves.klett@googlemail.com> |
|---|---|
| Date | 2011-08-14 12:21 +0000 |
| Message-ID | <j28ekv$3eo$1@smc.vnet.net> |
| In reply to | #4361 |
Use StringJoin and ToString to produce a string that is displayed
properly. Otherwise, you get a mix of strings and expressions that is
ordered like any other input:
"p2="*10
becomes
10 "p2="
Regards,
Yves
PS: Supplying incomplete code (with ... etc.) is not very helpful. Paste
working code if possible or make up a simplified - also working - example.
Am 13.08.2011 12:50, schrieb Massimiliano LANDI:
> Hello everyone
>
> I am trying to add to a plot I created a text that shows the value of a variable, call it p2, that can be changed via Manipulate.
>
> So I did:
>
> Manipulate[
> Plot[....,Epilog->{Text[Style["p2=" p2, 18, If[(A/(1 + B n) <= p2 <= (A + A n)/(1 + n + B n) && k == 2) || (p2 == 1 && k == 1), Red, Black], Background -> LightGray]}],
> ....]
>
> The funny thing is that with this code, in the text label, the actual value of the variable appears before the text p2.
>
> For example, when I set p2=10, the label in the graph becomes
>
> 10 p2
>
> whereas I would like to see
>
> p2 = 10
>
> Any help?
>
> Thanks in advance
>
> Massimiliano Landi
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web