00koeffers
00koeffers

Reputation: 327

Save Matlab plot in readable manner

I have a plot with many subplots. Due to the high number, these plots get way too crowded to be analysed in Matlab, therefore I want to save them. However, no matter how high I choose the resolution to be, the saved picture is always as crowded as the figure shown in Matlab.

Here I have a reproducible example:

for x = 1:1:20
        
    subplot(20, 3, 1+3*(x-1))
    plot(1:10);
    title('my_title');
    subplot(20, 3, 2+3*(x-1))
    plot(1:10);
    title('my_title');
    subplot(20, 3, 3+3*(x-1))
    plot(1:10);
    title('my_title');

end

print(gcf, 'test.png', '-dpng', '-r1000');

How can I save this plot in a readable manner?

Clarification: Due to the many plots on my small computer screen, the plots are very crowded. This is a problem due to the font size (which I assume could change somehow), but also due to the fact that the plots are strongly "compressed" to fit on my screen.

If I now save the plot with a higher resolution, the picture still looks like on my screen (crowded).

If I would connect a larger screen (higher resolution), the picture would look different (e.g. font size would stay the same, but the plots would take more space etc.).

Maybe an option to save the picture like if it was displayed on a bigger screen?

Upvotes: 1

Views: 142

Answers (1)

juju89
juju89

Reputation: 549

You need to do 2 things:

  • decrease the font of your axes and LineWidth/MarkerSize,
  • save your figure as a vector graphics files like PDF.

See below: The first 50 subplots are messy and unreadable, but the last 50 are clear when you zoom in (as long as you save the figure as vector graphics files).

enter image description here

Here is the code I used to generate the figure:

    figure;
for i = 1:10
    for j = 1:10

        subplot(10,10,(i-1)*10+j); grid on; hold on;
        p = plot([1,2],[1,2],'ko-');
        axis([0 3 0 3])

        if ((i-1)*10+j)>50
            set(gca, 'FontSize', 2)
            p.MarkerSize = 2;
        end

    end
end

Upvotes: 1

Related Questions