How do I save a figure as an accurate image?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!