There are a couple of subtle issues here.
The first one is: what are you trying to achieve? The first image above (unfiltered signal) already has "overshoot". Are you trying to remove the oscillations about $1$ after about $t=0.13$ ??
The second one is: the filter you appear to have used has a very large delay, which means the rise in value has moved from $t=0.13$ to $t=0.37$ or so. That suggests that you've used a very long filter (for the size of data).
I'd suggest using a shorter (lower order) filter.
Here is some scilab code that tries two approaches:
x = [zeros(130,1);
1.2*ones(370,1) + 0.2*cos(2*%pi*[0:369]'/90)];
y = x + 0.1*rand(500,1,'normal');
[h,hm,fr]=wfir("lp",33,[.05 0],"hm",[0 0])
z = filter(h,1,y);
alpha = 0.98;
zz = filter(1-alpha, [1 -alpha], y);
clf
plot(x);
plot(y,'r.');
plot(z,'g');
plot(zz,'m');
The first, z
, uses a relatively short FIR filter. This does not resolve issue #1 (removing the oscillation).
The second, zz
, uses a first order IIR filter (exponential forgetter). This has the advantages of simplicity and reducing the amount of oscillation. The disadvantage is that it takes a while for the filtered value to reach $1$.
The noiseless signal is blue, the noisy signal is plotted as red dots, the FIR filtered noisy signal is in green and the first-order filtered noisy signal is in magenta.