How to print a figure to the clipboard with the PRINT function with a quality identical to the parameter "Change & # 8594; Copy picture"?

Is there a way to print the figure to the clipboard so that the quality is identical to what the Edit-->Copy Figure option provides?

I used to save the shape in the powerpoint file using saveppt.m obtained from Matlab Central . He worked until yesterday. I noticed that the quality of the saved image was somehow degraded. I tried to generate some ppt slides with exactly the same script and the same raw data, but the new slides are just worse.

I investigated this problem a bit and found that when the figure is copied to the clipboard by running print -dmeta , the image on the clipboard is already degraded, and if I use the Edit-->Copy Figure option in the picture window, I get the image as clearly as the original image in the picture window.

Below is an example of your link. I copied the image from the shape to the clipboard in two different ways and pasted it into the Microsoft Paint program and cut out part of it to show below:

Image using print -dmeta : stored figure using "print -dmeta"

Image using Edit-->Copy Figure : stored figure using "Copy Figure"

If you compare the Xtick label '50', you can see that the image from Edit-->Copy Figure is smoother.

At the beginning, I thought it was a permission problem, but setting -rN to change the resolution does not seem to solve my problem, at least not for N <= 300.

Thank you for your help.

+7
source share
2 answers

I think I found the answer myself. Using print -dmeta -painters to specify a renderer solves my problem.

In File-->Preference-->Figure Copy Template-->Copy Option I noticed that there are 3 options:

  • metafile
  • Save information
  • Raster

I found that if I select 1, Edit-->Copy Figure displays the same image as print -dmeta . Therefore, I kind of confirmed that I need information in the Preserve information option. A quick Google search led me to a discussion of the potential differences in application rendering, and in the end I confirmed that using painters would print the image to the clipboard the way I wanted.

The image in the question seems to be created by the zbuffer and painters renderer, respectively. I still don't know why the paint -dmeta default paint -dmeta changes.

+2
source

Short answer ... Use the same function that was called in the callback for this menu item:

 editmenufcn(gcf,'EditCopyFigure'); 


Longer answer ... How exactly did I find this? You can see my previous answer to a question about reproducing what was done using the File menu option . The concept is the same for just another menu of shapes. For example, this will find the callback you want for the currently active shape window:

 >> hCopyFigure = findall(gcf,'Label','Copy &Figure'); %# Handle for the "Copy %# Figure" menu item >> get(hCopyFigure,'Callback') %# Callback invoked when that item is selected ans = editmenufcn(gcbf,'EditCopyFigure') 

The EDITMENUFCN function is another of these rarely documented functions, but looking at the code (by entering edit editmenufcn.m ) shows that it either calls Java (if you're on a Mac) or the undocumented UIMENUFCN function.

+6
source

All Articles