cplot icon indicating copy to clipboard operation
cplot copied to clipboard

How to plot points on top of cplot?

Open kaceyaurum opened this issue 3 years ago • 6 comments

I used cplot to graph a complex function, and I want to mark certain points in the complex plane. How can I do this?

kaceyaurum avatar Oct 14 '22 14:10 kaceyaurum

How would you plot the points with mpl?

nschloe avatar Oct 14 '22 14:10 nschloe

I would like to use matplotlib.pyplot.scatter, but I am not sure how to format my input with the complex plane.

kaceyaurum avatar Oct 15 '22 15:10 kaceyaurum

mpl doesn't know it's a complex plane. You can just scatterplot over the cplot and x-y-coordinates.

nschloe avatar Oct 15 '22 17:10 nschloe

I want to do something like: ax = cplot.plot(f, (-2.0, +2.0, 400), (-2.0, +2.0, 400)) ax.scatter([.5], [0], s=100, marker='.', c='red') plt.show(ax)

but this puts the points in the arg scale bar. How can I put the points on the main plot?

kaceyaurum avatar Oct 15 '22 18:10 kaceyaurum

Ah, I see. cplot.plot doesn't return the ax, but plt. You'll have to manually find the correct axis to plot to. Maybe it should return ax? Not sure.

nschloe avatar Oct 15 '22 18:10 nschloe