2
votes

I have a figure produced using the image function in Matlab 2014b. The image looks perfect in the figure window, but when I save it to a PDF or EPS file, it produces patches of colour that don't appear in the figure window. When using export_fig, this happens in both the PDF and EPS file formats, and when using print, it only shows up in the EPS file, not the PDF. However, some other weird stuff happens using the print function, so I would prefer not to use that.

The figure is a 3 x 4 set of maps, and the extra patches of colour can be seen in the snapshot below (at the bottom of each map and to the right of the MJJ map). I have been deleting them by hand in Illustrator, but I have a large amount of these figures so I need to stop it happening at the Matlab end really.

enter image description here

Does anyone know what is going on with this and how to fix it?

FYI, this is the code I am using to make the figures (amongst other lines to get it to look exactly like this):

h=image(lon_data,lat_data,plot_data);

And this to export the figures:

export_fig(filename,'-painters','-eps','-pdf','-r600')

Edited to add: this is how it should look - no extra bits at the bottom or sides of the maps. Sometimes the bit to the right happens further down too.

enter image description here

1
The images you posted: are they the good or the bad ones? It is unclear. Can you post something like: expected result and what you have?Ander Biguri
Apologies. Those are the bad ones. I will add one that doesn't have the extra patches on it.emmalgale
Hopefully that is clearer now.emmalgale
Thanks, it is. I reccomend you that you dubmitt your problem to: github.com/altmany/export_fig/issues , so the developers of export_fig know about this.Ander Biguri
Having looked at some other bugs on the github link, it seems to be caused by the painters renderer. I changed it to the opengl one, and the problem has gone away. It just means I can't do editing on the figures afterwards, but I don't need to now. I will still report it to them though,emmalgale

1 Answers

1
votes

Having done some research, this seems to be caused by the painters renderer. The problem goes away when using the opengl renderer instead, but this does have other repercussions (I can't edit the image elsewhere using this renderer).

It has been reported as a bug with the developer of export_fig here: https://github.com/altmany/export_fig/issues/61