How do I save a figure as an accurate image?

1 回表示 (過去 30 日間)
Kevin Stanley-Adams
Kevin Stanley-Adams 2013 年 12 月 14 日
編集済み: Kevin Stanley-Adams 2013 年 12 月 14 日
Hi. I've found exporting graphs to image files in Matlab a pretty inefficient process. I'm not sure if it is due to my methodology or if it is just due to the limitations of the software. I am using Mac OSX and Matlab 2013a.
Using the following code, it generates a figure:
n = -10:0.1:10;
a = tansig(n);
b = logsig(n);
hold on;
plot(n,a,'b')
plot(n,b,'r')
xlabel('v - Induced Local Field','FontSize',20)
ylabel('Neuron Output','FontSize',20)
title('Neuron Output with a Sigmoid Activation Function','FontSize', 20)
plotLegend = legend('Hyperbolic Tangent Sigmoid Function','Logistic Sigmoid Function');
set(plotLegend,'FontSize',20);
This figure looks like this when viewed inside Matlab:
However, if I use Edit --> Copy Figure, I get the following result:
It appears to take a screenshot of the figure, but on the wrong portion of the screen. I think this may be because I am using a HiDPI screen and Matlab might be expecting a different pixel density.
If I use File --> Save As --> figure.png I get the following result:
This is almost exactly how I want it (with the white background) but the line on the figure is no longer correctly representing the data. The blue line has been cut short.
Please can somebody advise me what I should do differently to not get this problem?
Thanks for your time!

回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by