create figure with resolution and loglog plot

2 views (last 30 days)
Shay Buzaglo
Shay Buzaglo on 30 Dec 2018
Answered: Akshat on 26 Dec 2024
hello,
I tried to set a window with a specific resolution of 4 graphs (with subplot) and one of them from loglog.
When I tried to set the window with setting the resolution the graphs become smaller and rise on top of each other
I used the command:
name_of_figure=figure('rend','painters','pos',[15 30 1500 900]);
And then saving the file using the command
saveas(name_of_figure,'name_of_figure');
saveas(name_of_figure,'name_of_figure.emf');
I will be happy to receive command tu create figure with loglog plot and with define resolution.

Answers (1)

Akshat
Akshat on 26 Dec 2024
In order to make the plots with respect to pixels of the screen, which is my understanding of the issue here, you can set the "Units" property of the figure to "Pixels".
This will make the figure consistent and fit a particular size specified by you.
You just need to change the initialisation of the 'figure' object, something like this:
% Create the figure with correct resolution
name_of_figure = figure('Units', 'pixels', ...
'Position', [100 100 1500 900], ...
'PaperPositionMode', 'auto', ...
'Renderer', 'painters');
While saving, you can add the DPI (Dots Per Inch) of the image that you want to save by this following edit:
print(fig, 'name_of_figure', '-dmeta', '-r300'); % EMF format with 300 DPI
saveas(fig, 'name_of_figure.png'); % PNG format
Hope this resolves the issue you are facing.

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!