# How to fix interact flickering of a ranged plot?

I have this code

```
var('k');f(x) = sum(1/k,k,1,floor(x))
@interact
def _(n=slider(20,200,step_size=1)):
p1 = plot(f(x),(x,1,n),fill=log(x),fillcolor="lightgreen",alpha=0.2,legend_label='$f(x)=\sum_{k=1}^{\lfloor x \\rfloor}\\frac{1}{k}$')
p2 = plot(log(x),(x,1,n),fill='axis',fillcolor="lightgrey",legend_label="$g(x)=\log (x)$")
show(p1 + p2)
```

but this have the problem that when I change the value of the slider the graph flicker instead of a smooth change. It is a way to fix this or change this behavior? Thank you.

I'm not sure what you mean by flicker, but I assume you mean that there is a slight delay in the update. Since Sage is not

compilingthe interact, but still interacting with the Sage program itself for each computation, this delay is inevitable. There has been some work on making it much less, but I don't know where that has gone lately.@kcrisman the compilation is not the problem, we have by example geogebra that dont compile it code but the interactive plots are smooth.

But Geogebra applets are themselves compiled Java, are they not? And so is (or was) the program itself. Whereas Sage interactive graphics are still images. There are javascript libraries one could incorporate into Sage which could achieve (some) of what you want, but so far no one has made a link from the plotting code directly to these.