This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
it_matlab_figures [2025/02/07 16:03] trinh |
it_matlab_figures [2025/05/02 18:40] (current) trinh |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Here are some brief details and tips for developing a good workflow for generating publication-quality images. | Here are some brief details and tips for developing a good workflow for generating publication-quality images. | ||
| - | ===== A workflow for saving images ===== | + | ===== 1. A workflow for saving images ===== |
| As you become a more experienced researcher, you will learn the value of developing a workflow where images can be easily re-generated. This means that you can easily replot the images when you are finalising the presentation. | As you become a more experienced researcher, you will learn the value of developing a workflow where images can be easily re-generated. This means that you can easily replot the images when you are finalising the presentation. | ||
| Line 11: | Line 11: | ||
| - **Tip: save your figures as .fig.** Similar to above, you may want to save '' | - **Tip: save your figures as .fig.** Similar to above, you may want to save '' | ||
| - | ===== Exporting figures ===== | + | ===== 2. Exporting figures ===== |
| Traditionally (meaning literally in the last 20 years), Matlab has had very poor ability to generate publication-quality images. Problems include: poor bounding boxes, weird rasterisation effects, weird layering issues, etc. | Traditionally (meaning literally in the last 20 years), Matlab has had very poor ability to generate publication-quality images. Problems include: poor bounding boxes, weird rasterisation effects, weird layering issues, etc. | ||
| Line 29: | Line 29: | ||
| in order to produce a PDF of the currently focused figure. | in order to produce a PDF of the currently focused figure. | ||
| - | ===== Advanced ===== | + | ===== 3. Annotations ===== |
| + | |||
| + | In order to add annotations to figures, you have a few options: | ||
| + | |||
| + | - Add the annotation natively within Matlab using commands like text(...); this is a good idea in combination with scripts. | ||
| + | - Add the annotation afterwards by using a vector editor like [[https:// | ||
| + | - Use a native LaTeX package like tikz or [[https:// | ||
| + | |||
| + | |||
| + | ===== 4. Advanced | ||
| More ' | More ' | ||
| - | Post-2010 there have been very powerful scripts that allow Matlab figures to be automatically converted to TiKZ, such as [[https:// | + | There are now very powerful scripts that allow Matlab figures to be automatically converted to TiKZ, such as [[https:// |
| + | |||
| + | <code matlab> | ||
| + | matlab2tikz | ||
| + | </ | ||
| + | |||
| + | Save the file, either as a .tex or as a .tikz. If you save it as a .tex, you can compile the file to generate the images. | ||
| If you are an undergrad student or under pressure to write a report, I don't recommend trying to learn this! | If you are an undergrad student or under pressure to write a report, I don't recommend trying to learn this! | ||
| + | ===== 5. Colormaps ===== | ||
| + | |||
| + | The default colormaps are not so good. Use [[https:// | ||
| + | |||
| + | <code matlab> | ||
| + | set(0,' | ||
| + | </ | ||
| + | |||
| + | You can view all the colormaps with | ||
| + | |||
| + | <code matlab> | ||
| + | brewermap(' | ||
| + | </ | ||
| + | |||
| + | Open via `open brewermap` to view the documentation and examples. | ||