How to export a MATLAB plot without changing the color? - matlab

I'm trying to export plots of MATLAB but the colours change a bit.
This is my exportation using RGB and 600 as resolution:
And this the screenshot:
I would like to know how can I keep the red of the screenshot one.
Thank you.

Did you try this framework?
https://de.mathworks.com/matlabcentral/fileexchange/23629-export-fig
Else this problem might be related to the export command Export Matlab figure as PNG?

Related

Color legend missing when export scene (.eps) from paraview

I want to export eps format image from paraview. The paraview version I am using is 5.4.0. When I export eps format image from paraview, the color legend is missing as shown as the figure. The text and the color legend is missing and only the tick label is there. I tried with and without rasterizing the image but still get the same output. Is there any setting need to be changed?
Thank you
This was a bug in ParaView, it has been fixed for the upcoming release, 5.8.1
https://gitlab.kitware.com/paraview/paraview/issues/17639

Copy figure in Matlab

I am asking for a solution to the blurred image I get when I use copy figure option in Matlab. For example, when I plot 3d figure in matlab I get the following image (It is the result of printscreen!)..
However, when I use the option copy figure I get a blurred image as the following image
.
How can I avoid this as I need to get high resolution image using copy figure option. Thank you in advance for any help you may lend.
By default, the figure is copied as an Enhanced Metafile (a color graphics format) which works for basic plots such as bar plots, line plots, and other 2D plots but may yield undesirable results for more complex plots as in your case. This is because the rendering of the Metafile content is controlled my Microsoft Word and it may render things differently than MATLAB.
If you need a high resolution image, I would recommend using the print command where you can specify the desired resolution (using the -r option). Then you can import the resulting image into Word
print(gcf, 'myfile.png', '-dpng', '-r300')
Alternately, you can use export_fig from the File Exchange which better preserves the appearance
Another option would be to change the format used by Copy Figure to tell it to use a bitmap instead
Or you can call Copy Figure programmatically and specify a different format (either a bitmap or PDF)
print(gcf, '-clipboard', '-dpdf')

Matlab figure saved as .eps appears in 'horizontal sections' when opened in Adobe Illustrator

I normally save my matlab figures as .eps and then make them better looking using Adobe Illustrator. This works for most figures but not all.
For example I plotted my data using the violin.m function from file exchange. When I save it as .eps and open it in Illustrator, I don't get an editable figure as I usually do. Instead, My figure appears chopped in horizontal sections, and all I can do is delete them (like in the figure below).
Is there anything I can do in either matlab or Illustrator to be able to edit the figure?
I don't need an .eps file, I just need to be able to edit it.
EDITS:
I tried #MattSchmatt's suggestion of using the print2eps function but I had the same problem.
Saving as .pdf doesn't solve the problem, because the image I get is not editable in Illustrator (plus, I also get the horizontal 'chunks').
A minimal, complete and verifiable example requires matlab, the violin function linked above and illustrator. But if it helps, here's the matlab code to produce a similar figure. I save by clicking on Figure -> save as. (But as I said above I tried the print2eps function and that was the same).
X = rand(100,6);
figure; violin(X)
I tried the following, didn't work either.
set(gcf, 'Renderer', 'painters')
As the author of the question suggests, I also wasn't able to export an editable (vectorized) .eps file into Illustrator. However, exporting it as .pdf does the trick. The 'fill' for the violin plots is weird, though, and has horizontal sections (perhaps something to do with the way the density estimate is being plotted?) all over. I was able to fix this and make the plots normal (with solid filled shades): select all the horizontal sections/chunks using the magic wand tool, and then increase opacity to 100% (it is set to 50 based on the exported file). Once all the required edits are made, export the file as .tiff and it seems to look fine. Hope this replicates, and thus helps! (my MATLAB version is 2016, and Illustrator version is the CS5)

Matlab border around figure

In attached image the output looks boring to me. Is it possible to have the subplots enclosed in a border?
Note: This question is not specific to publishing only but in general, say for exported images also.
Thanks
Postscript: I actually need this:
You can add a box like in here
making your code:
close all
figure()
padd=0.04
axes('Position',[padd padd 1-padd*2 1-padd*2],'xtick',[],'ytick',[],'box','on','handlevisibility','off')
subplot(1,2,1)
imagesc(magic(2))
subplot(1,2,2)
imagesc(magic(3))
This yields
And you can change the padd to be bigger or smaller
I obtained this just by plotting lines of different thickness 1.
The text was added with Inkscape though.
If I understand correctly what you want to do, you can obtain borders inside a figure using uipanels http://www.mathworks.com/help/matlab/ref/uipanel.html like this:
Code is:
u=uipanel('Title','MainPanel')
u1=uipanel('Parent',u,'BorderType','line','HighlightColor','k','Title','Subpanel 1','Position',[0,0,0.5,1])
u2=uipanel('Parent',u,'BorderType','line','HighlightColor','k','Title','Subpanel 2','Position',[0.5,0,0.5,1])
axes1=axes('Parent',u1)
imagesc(magic(2))
axes2=axes('Parent',u2)
imagesc(magic(3))
Of course you can change border widths, colors, titles and such

how to save imageof axes for high resolution in matlab GUI

I trying save image with the comand 'getframe' but resolution is very low, so I can not give zoom. for now I'm using the code:
[arq,dir] = uiputfile('*.jpg','Output Files');
fileName=fullfile(dir,arq);
f=getframe(handles.axes1);
[x,map]=frame2im(f);
imwrite(x,fileName,'jpg');
I need save in jpg and also need save the label (x,y) in graph. How do ? There is another command better than the getframe??
Print is a good command?
Thanks
try using something other than jpg, it doesn't scale well. eps is a good choice as it is a vector format.
Try exportfig from FEX: exportfig