Place an image between custom lines in a plot in python

Viewed 348

What I would like is to use specified functions or lines to create the border of the images, and then inside the borders place custom images.

I used fill between as an example, but maybe there is an easier way of achieving this. This is what I have in mind:

import matplotlib.pyplot as plt
import numpy as np

x   = np.linspace(0,100,1000)
y   = (3 + np.sin(x/5.)) * np.exp(-abs(x-50)/25.)*10

x2  = np.linspace(20,40,1000)
y2  = np.sqrt(100 - (x2 - 30)**2) + 40
y3  = -np.sqrt(100 - (x2 - 30)**2) + 40

plt.figure()
ax1 = plt.subplot(1,1,1, aspect='equal')
plt.fill_between(x=x, y1=y, y2=0,  alpha=0.5, color='orange', linewidth=3)
plt.fill_between(x=x2, y1=y2, y2=y3,  alpha=0.5, color='green', linewidth=3)
ax1.axis('off')

the output of that code is this image, what I have:

and I would like something like this, what I want:

Please have in mind that I would like to have a border around the image that I can customize it, and if I have more than one fillbetween, I can choose what to put inside the different curves. And also if its possible to respect the axis ratio of the image so its shape doesn't get distorted when I place it in the plot.

1 Answers
Related