How to crop or zoom into a plot area

Hello,
I have a polar plot, and I want to zoom into one section of it, How can I do that.

using Plots
x = [0,pi/6,pi/4,pi/3,pi/2] # theta
y = [0,0.1, 0.2, 0.3, 0.4]  # r
p = plot(x,y,axis=false,legend=false,proj =:polar)

let say I want to zoom in a section with r limit [0.1,0.3] and theta limit =[pi/6, pi/2].
How can I do that?
I saw the lens function, but it seems that it only works with cartesian plots.

Thank you for your help.

Maybe not what you’re looking for, but the PlotlyJS backend has very nice interactive zooming and panning.

1 Like

If you want interactive zooming and panning, try using the Plotly backend by calling the function plotly() before you create your plot.

I need something more like a croping tool, which can crop a section of a plot.
I am making a gif so interactive zooming isn’t helpful to me.

Use xlim and ylim to specify boundaries for the plot area. You’ll get a rectangular area and you’ll need to do your own polar to rectangular conversion first.

Edit: an example of use is here: http://docs.juliaplots.org/latest/#simple-is-beautiful-1

1 Like