# Scaling of png from Matlab

Hi

I have been trying find a way to prevent or control scaling of generated png's in the sage notebook.

Sometimes I am using Matlab to generate graphs and it works fine, except that the image is scaled in the sage notebook. If I open the file in the cell folder then I can see that it is scaled, at least when I compare the output from the exact same code evaluated directly in Matlab.

Is there some way to control scaling in sage?

EDIT: The problem is that the generated image from Matlab has a higher resolution than the image which is saved in the cell folder in the notebook. It seems as if the image is first saved somewhere else, then scaled, and then saved in the cell folder. So I am wondering if there is som global setting in sage which sets the scaling factor. Example:

```
#auto
%matlab
clear;clc;clf;
h1 = [0.25 0.25 0.25 0.25]; % for n = 0,1,2,3
h2 = [1 -1]; % for n = 0,1
t=0:1:204;
x = randn(1,200);
hfig=figure(1); clf
plot(x)
hold on
plot(conv(x,h1),'r')
axis([1 500 -5 5])
hold on
plot(conv(x,h2),'g')
axis([1 50 -5 5])
legend('x','conv(x,h1)','conv(x,h2)', 'Location','NorthEastOutside')
print -dpng image.png
```

This code saves the produced plot in the current folder directly.

I know this is matlab code and not sage, but the same code produces a larger image (higher resolution) when evaluated directly in matlab, than it does when evaluated in matlab from the sage notebook.

Maybe I am mistaking about this, but these are the "symptoms" I'm experiencing here.

What happens if you try to run this in the command line? You should be able to use matlab.eval("foo") to try this. That's a way of checking whether the problem is Sage making the plot its own, or the notebook doing something specific to shrink it.

I have tried doing this from the command line, and the problem persists. So maybe the problem is caused by the python/sage interface to Matlab.

Probably right. I've changed the title of the question to address this - hope nobody put in any hard links to the URL!