1

Why sometimes Matlab saves figures with wrong colors?

This is the code: http://pastebin.com/V50B9TSc

Basically for plotting I use the commands plot and scatter.

For example, look at this image. Those points are actually colored, they are colored in Matlab, but once I save that as .png image, the points lose color.

enter image description here

and this is the original:

enter image description here

Thanks

5
  • If you save it through a script, please provide the code. May 18, 2013 at 14:05
  • Nope, I save from the plot window. May 18, 2013 at 14:13
  • By the way, I edited my original post, you can compare the two images in terms of colors. May 18, 2013 at 14:17
  • Could you please add a minimal example how you plot dots and background or give us AT LEAST the commands you use? Thanks.
    – matheburg
    May 18, 2013 at 22:41
  • I updated the original post with the code guys. Thanks for helping out! May 19, 2013 at 14:29

1 Answer 1

0

My guess is that the background blending is messing with color of the points. How are you drawing the background?

A quick way of not having to worry about the color would be to use different makers for the two point sets.

EDIT: (also try saving as a jpg. If my hypothesis is correct the background might be weird but the points should have the right color)

6
  • I don't see why changing the markers would fix the colors problem. May 18, 2013 at 16:36
  • Changing the markers would not solve the problem, it would avoid it. If the jpg is the same, it's not a blending problem. can you post your plotting code?
    – Randi
    May 18, 2013 at 17:57
  • Just edited my original post, please check out the code. Thanks for helping! May 19, 2013 at 14:30
  • Sorry can't reproduce ... plotted with your code using a gradient for Z ... saved using the window button Here is the result I get result
    – Randi
    May 19, 2013 at 23:52
  • still can't reproduced tried Win7 x64 matlab R2012a and Debian same matlab version...sorry
    – Randi
    May 20, 2013 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.