Reputation: 10795
I am trying to draw something similar:
The main idea is to draw ellipses with different color in some specific range, for example from [-6, 6].
I have understood that plt.contour
function can be used. But I do not understand how to generate lines.
Upvotes: 2
Views: 4263
Reputation: 12234
I personally wouldn't do this with contour as you then need to add information about the elevation which I don't think you want?
matplotlib
has Ellipse
which is a subclass of Artist
. The following example adds a single ellipse to a plot.
import matplotlib as mpl
ellipse = mpl.patches.Ellipse(xy=(0, 0), width=2.0, height=1.0)
fig, ax = plt.subplots()
fig.gca().add_artist(ellipse)
ax.set_aspect('equal')
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
You then need to research how to get the effect you are looking for, I would have a read of the docs in general making things transparent is done through alpha
.
Upvotes: 4