ghoem
(g p)
August 22, 2014, 4:01am
1
If I use the function ContourPlot, eg
ContourPlot[y == x, {x, -1, 1}, {y, -1, 1}]
when I put the mouse on the line, it the equation “y==x” appears.
This does not happen with the Plot function.
Is there some way to obtain a similar behaviour also with the Plot function?
Thanks a lot
mayest
(Tim Mayes)
August 22, 2014, 5:42am
2
How about something like this:
Plot[Tooltip[Sin[x], Sin[x]], {x, 0, 2 Pi}]
Using Tooltip you can specify the label just like in your ContourPlot.
ghoem
(g p)
August 22, 2014, 6:05am
3
Tooltip is what i was looking for!! Many many thanks
P.S.
By the way, I read the Tooltip documentation and the Neat Example
Tooltip["the transparent tooltip", Plot[x, {x, 0, 1}],
TooltipStyle -> {Background -> None}]
doesn’t give me a transparent tooltip, but one with white background…
mayest
(Tim Mayes)
August 22, 2014, 6:53am
4
TooltipStyle → {Background → Transparent}
seems to work. With None, I was getting a black background for some reason.
ghoem
(g p)
August 22, 2014, 7:02am
5
Mmmh I tried your suggestion, but it gives me the same output: a plot with a white background!
enter image description here
mayest
(Tim Mayes)
August 22, 2014, 7:12am
6
Did you want a transparent background for the plot, or the Tooltip? The above only affects the Tooltip. If you want a transparent background for the plot, add this as an option (outside of the Tooltip)
Background -> Transparent
For example:
Plot[Tooltip[Sin[x], Sin[x],
TooltipStyle -> {Background -> Transparent},
Background -> Transparent], {x, 0, 2 Pi}]
ghoem
(g p)
August 22, 2014, 9:36am
7
In the example, the plot is the tooltip; I tried with
Tooltip["the transparent tooltip",
Plot[x, {x, 0, 1}, Background -> Transparent],
TooltipStyle -> {Background -> Transparent}]
but seems it doesn’t work… I attach an immage
mayest
(Tim Mayes)
August 22, 2014, 4:15pm
8
I think that I see what you mean. The Tooltip isn’t transparent in the sense that you can see through it to whatever is behind it (the Sin[x] plot in your example). Instead, it seems to take one the background color of the stylesheet. Somebody else will have to chime in as I don’t know how to make that work.