How can I export a matlab figure as pdf/eps without loosing any part of the figure? - matlab-figure

How can I export a matlab figure as pdf/eps without loosing any part of the figure?
If I maximize the graphical window, I loose a part of the figure, if I minimize, I obtain a figure not filling all the space and if I save as jpg, I obtain a very well scaled figure, but with a bad resolution.

You can control size of the figure on the paper using the Position property which is a vector [left bottom width height]. For example:
set(gcf,'Position',[0,0,560,900])
Then export the re-sized figure to pdf.

Related

How to save photoshop pixel art

I'm having some troubles right now with isometric pixel art. So I'm drawing this picture that is going to be uploaded later in the game, but when I save it and zoom it looks like this:
The picture became blurred and colors are not that bright. Is there anything I could do about it? How can I save it so it will be the same as in the photoshop (300% zoom)?
Would be really grateful for any help.
As Phlume said, you can use Vector base software like illustrator, CorelDraw, Inkscape (freeware) etc. and export it as a SVG image.
OR
for a quick fix, in a Photoshop you can create image in a 300% size (canvas size 3 times then require ) and export image in 96dpi. And further to reduce the image size for faster loading you can try https://tinypng.com/
And by the coding you can resize it to required size.
Photoshop is a raster based program. To retain the clarity of the pixel artwork you should switch to a vector bed program such as illustrator. When you zoom in with illustrator the math recalculate to form clean lines from point to point. The blurry you see in photoshop is a product of the pixel data becoming compressed upon saving and finding a "happy medium" to represent the color within that region.

UI text display in World Space

I have added to my scene a simple text element on a Canvas that is set to World Space, so I can see it in VR, but no matter how much I change the size or how far away or close I get it to the camera, etc... it still shows a very blurry kind of text (which I use to display time).
The situation can be seen in the attached image, as well as my Canvas settings in the other image. Could someone please help me understand which setting(s) I should deal with to get this sorted?
It looks to me like the Canvas Scaler is the source of the problem here. For a Canvas set to the world space, the Canvas Scaler controls the pixel density of UI element in the Canvas.
To increase the pixel density (which should make rendered text sharper), you can raise the value of Dynamic Pixels Per Unit, which should increase the number of pixels used per unit to render your Text. I don't have an exact value for you, as this may vary based on circumstance; you'll just have to experiment to see what value works best for you.
An alternative workaround is to scale the Text way, way down, but increase its Font Size property proportionally.
Hope this helps! Let me know if you have any questions.

Saving a MATLAB surface object as an image

I can generate a MATLAB surface object (using h=pcolor(X,Y,C)) and I would like to save just that surface object in an image format (png, tiff, ...) without any visible background.
The surface is elliptical and not rectangular so I want to see just the ellipse, without white background, axes, labels, ticks, frame, menus, etc.
I want to use it as an overlay on Google Earth so the entity may be rectangular, as long as the parts outside the ellipse are transparent.
MATLAB and its user community seem to offer a number of ways to save images but I have not yet found one that saves just the surface object. Any solutions or even suggestions would be appreciated.
You can use export_fig tool from the matlab's FEX (www) to export the figure with a transparent background (not all the image formats are supported).
To get rid of the axes and just plot the surface, you can do
set(gca,'Visible','off')

Matlab GUIDE blurs image?

my plan is implementing an image in a Matlab GUIDE figure. Somehow the output is always blurred (see screenshot). On the left you can see the image in Photoshop on the right in Matlab - notice how the font and other parts become blurred.
I experimented with JPEG and PNG file formats (no compression), I also tried various pixel sizes(resolutions smaller, same and bigger as the actual position of the image) and DPI(values between 30-300) settings, because I expected some scaling issue. Somehow I am stuck - Looking forward to your input!
Thank you,
Florian
Screenshot of the issue: http://s1.bild.me/bilder/260513/6875414Screen_Shot_2014-06-29_at_23.19.34.png
Most probably the reason for the blur is interpolation.
If the axis size you allocated for the image is different from the size of the image MATLAB will resize the image to occupy the whole area.
In order to prevent any interpolation you must set the axis dimension to be the image dimension.

Display image at desired scale across subplot axes

Is it possible to display an image in multiple subplot axes, such that the image appears at the desired scale?
subplot(3,3,[1 4 7]);
%# image scaled down to fit 1 set of axes
imshow(img);
subplot(3,3,2);
plot(relevantData);
%# And so on with 5 other plots
I want to have the image scaled to either a fixed size or to fit the axes available to it, rather than to the size of a single axes.
My use case is to show a video alongside plots derived from the video, such that the plots are progressively drawn in step with the video. Once the display is correct I can save each image and combine them into a video.
Clarification
I am asking if it is possible to produce a figure as described without specifying the position of every element in absolute terms. Though one can make arbitrary figures that way (and in fact I have done so for this project), it is very tedious.
Edit:
For changing the size of the subplot:
In help subplot they mention that you can set parameters on the selected "axes" (that's what they call a plotting area in Matlab).
Using that, you can set the 'position', as seen in help axes. This property takes takes as argument:
[left, bottom, width, height]
As pointed out by #reve_etrange, one should use absolute positioning for axes 'Position'and 'OuterPosition' parameters. they can be in normalized coordinates, though.
For changing the size of the image in the subplot:
I think there are 2 useful things for you in the help imshow output:
'InitialMagnification': setting the magnification of the image.
'Parent': determines which parent imshow will use to put the image in (never tried using imshow with subplots).

Resources