Ask Your Question
0

Is it possible to use a Bitmap Image as a Graphics object?

asked 2024-02-17 14:18:21 +0100

mlv gravatar image

updated 2024-02-17 14:18:58 +0100

I can use PIL.Image or sage.repl.image in Sagemath. Can I mix bitmap (non-vector) images with Sagemath Graphics objects (such as circle, text, plot, list_plot, etc)?

For example, if I have 3 bitmap images A, B, C and 4 plots P, Q, R, S, how can I use graphics_array to display them as tiles in 2 rows and 3 columns?

       A     P      C+Q
       R     B       S

where C+Q means adding bitmap images and graphics to the same Graphics object (for example: superimpose list_plot and text on a background PNG image)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-02-17 21:20:51 +0100

eric_g gravatar image

FWIW, it is possible to superpose a SageMath plot to a png image, via Matplotlib. The first step is to convert the plot to a Matplotlib object via the method matplotlib() and then use imgshow()to superpose the image. An example in shown in cell [26] of https://nbviewer.org/github/egourgoul...

edit flag offensive delete link more

Comments

Thanks for the comment. I looked at the example, which is very helpful. Do you have an example of displaying multiple images at different location of the same single matplotlib plot? I am interested in displaying images as tiles in a grid manner.

I am still looking at a solution without using matplotlib if possible.

mlv gravatar imagemlv ( 2024-02-21 16:34:47 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-02-17 14:18:21 +0100

Seen: 172 times

Last updated: Feb 17