Closed RadekValtera closed 4 months ago
There's no direct way to do this right now. But if drawing on a Matplotlib axis (the default if Matplotlib is installed), you could add images to the axis after drawing, something like:
d = schemdraw.Drawing()
d += elm.Gap() # Put resistor image here
d += elm.Capacitor().down()
d.draw()
imgax = d.fig.ax.inset_axes([0, -.375, # Lower left corner, in drawing units
3, .75], # width, height in drawing units
zorder=0, # Put it below other elements
transform=d.fig.ax.transData)
img = plt.imread('resistor.png')
imgax.imshow(img)
imgax.axis('off')
d
For a longer term solution, I'd propose something like a new ElementImage
class, which takes an image file or bytes. It could be subclassed something like this, to specify the image, size, and add anchors or other drawing segments:
class LCD(ElementImage):
def __init__(self, **kwargs):
super().__init__(image='lcd.png', width=6, height=1, **kwargs)
self.anchors['gnd'] = (0, 0)
self.anchors['D0'] = (.5, 0)
# etc.
A new ElementImage
class was added in 37d7d05. See an example here.
Hello
is there any way to insert an external image into the schematic please? I would like to use various images of PLC or LCD or other compoment that are freely available on manufacturers' websites and insert them into the schematic.
Thank you for your answer