![]() % plot sin-curves with the 7 standard colors Opts.Colors = get(groot,'defaultAxesColorOrder') Feel free to use it as a starting point for your own figure exporting routine and adapt it to your liking. Probably the best summary of this blog entry is the following code, which was used to plot and export the last figure. However, as many journals convert the figures to raster graphics anyway, it’s often better to directly convert the figures to avoid problems of subsequent conversion. If using vector graphics, ‘-dpng’ can be replaced by ‘-epsc’ for colored eps. The following command exports the current figure to a png file with 600 dpi resolution: print('img/my_figure', '-dpng', '-r600') But first, in order for the exported file to have the same size as the Matlab figure, it’s necessary to first set the PaperPositionMode to automatic: fig.PaperPositionMode = 'auto' This can be done with the saveas command, but the print command allows for the definition of more attributes of the exported file. Step 5: Exportingįinally, the figure can be exported to the desired graphics format. The following figure, which was a standard size figure in Matlab, was exported to a raster graphics format before cropping it to the final width, making the axes labels and the legend hard to read in the typical width of a one-column figure (around 8 cm).įigure 6: Figure with minimized white space. You want to do this before exporting the plot, as font sizes and line widths are not preserved when a figure is cropped after exporting. The next important step after adding all lines and annotations to the plot is scaling it to the desired size. But as soon as you need more than two of them (solid and dashed) things get complicated… Step 2: Scaling The grey values of the standard colors can be calculated by typing: rgb2gray(get(groot,'defaultAxesColorOrder'))Ĭombinations that work well in color and greyscale are the first three colors (blue, red, and yellow) for three-line plots and the last two colors (light blue and ruby) for two-line plots.Īnother way to make lines distinguishable in greyscale is by using different line styles. Nevertheless, I would not use more than 3 different colors in the same plot, because not all of the 7 colors are well distinguishable in greyscale. Luckily, the new Matlab color scheme ‘Parula’ (since Matlab 2014b) offers 7 colors with quite a wide spread of brightness:įigure 2: The 7 line colors of the Parula color scheme printed in greyscale. However, a figure that’s meant for publication also has to be readable in greyscale, as most documents are not printed in color. Step 1: Colors and line stylesĬolorful figures are nice to look at on the computer screen and help distinguishing different aspects. The following list describes by no means the perfect or the only way to do things, but it summarizes the most important steps and commands necessary to obtain nice figures of your data that can be imported into the text editing program of your choice. I know, there are probably thousands of articles on this topic available out there and at least as many opinions on what is right or wrong, but I have also been asked often enough about how to export Matlab plots. In the following, I will explain the main steps I usually take. In order to prepare Matlab figures for publication, some modifications should be made to the figures. ![]() As my tool of choice for most calculations is Matlab, most of my data ends up in the Matlab workspace at some point and gets plotted from there. And often, the most important parts of our written documents are the figures that visualize the data we generated. ![]() For us researchers, writing documentation and preparing manuscripts for publication is a large part of our work.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |