Text with a framebox #2695
-
How do I add a text with a bounding box as shown in the figure below generate from the following matplotlib script import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(2,2))
ax.imshow(np.random.rand(32,32));
ax.axis("off")
ax.text(0.95, 0.95, "rand", ha="right", va="top", transform=ax.transAxes, bbox={"facecolor" : "white"}, fontsize=10) I have tried the following fig, ax, im = heatmap(rand(32,32); interpolate = false)
hidedecorations!.(ax, grid = false)
t = text!(ax, 0.95, 0.95; text ="rand", space=:relative, align = (:right, :top), depth_shift=1.0)
poly!(ax, boundingbox(t),color=(:White,1.0), space=:pixel, depth_shift=0.8)
fig |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You should translate your text plot "upwards" in the z-axis, by |
Beta Was this translation helpful? Give feedback.
-
A couple of notes on
|
Beta Was this translation helpful? Give feedback.
You should translate your text plot "upwards" in the z-axis, by
translate!(t, 0, 0, 1)
(for example). I don't know why depth_shift isn't working for you - which backend are you using? If it's a GL backend then worth an issue, otherwise CairoMakie doesn't really support it I think.