ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 29 Oct 2019 02:18:17 +0100How to use an image as a vertex label in a graph?https://ask.sagemath.org/question/48537/how-to-use-an-image-as-a-vertex-label-in-a-graph/Exactly what the title says. I have a graph, but I'd like to change the labels of the vertices so that I can display my own images at each vertex.
I figured something like the code below would work, but instead of showing the images at the vertices, I see a string of where the image is located in memory.
from PIL import Image
H = Graph({img0:[1], 1:[2], 2:[3]})
img0 = Image.open('image0.png')
img1 = Image.open('image1.png')
img2 = Image.open('image2.png')
img3 = Image.open('image3.png')
img_list = [img0 ,img1, img2, img3]
def my_label_function (vertex_number):
return img_list[vertex_number]
H.relabel(my_label_function)
H.plot()SultanTue, 29 Oct 2019 02:18:17 +0100https://ask.sagemath.org/question/48537/Typeset latex in SMChttps://ask.sagemath.org/question/30345/typeset-latex-in-smc/In the classical Sage notebook there is the "view" command that
can be used to e.g. get a plot of a graph rendered by pdflatex.
Is there an equivalent in SMC?
For example I want the following code to give me a graph plot rendered by pdflatex.
G=graphs.BullGraph()
G.set_latex_options(format='dot2tex', prog='dot')
view(G)
I can get the corresponding latex code in SMC by
latex(G)
but I have no idea how to render it.Jeremias EpperleinThu, 29 Oct 2015 17:28:20 +0100https://ask.sagemath.org/question/30345/