Ask Your Question

Revision history [back]

how to adjust intensity range in density_plot()

If I have code such as

var('x,y')
density_plot(0.05*sin(x^2+y^2)^2 + exp(-(x^2+y^2)), (x,-3,3), (y,-3,3), cmap='hot').show(aspect_ratio=1)

and I want to see details at a lower intensity ratio, how do I adjust the intensity range? In matplotlib, this could be done with clim(), but I can't find a similar option for a density_plot() or contour_plot() in SageMath.

edit: I've figured out how to do it with a contour_plot(), specifying the contours:

contour_plot(0.05*sin(x^2+y^2)^2 + exp(-(x^2+y^2)), (x,-3,3), (y,-3,3), 
    cmap='hot', contours=np.linspace(0,0.1,20)).show(aspect_ratio=1)