why does it has to be tedious to produce high quality figures for (academic) publications using MATLAB? (open Discussion)
14 ビュー (過去 30 日間)
古いコメントを表示
If you use Matlab for data treatment, at some point you plot figures and you want to use them in reports, talks, papers, thesis...
Why does it has to be tedious to produce high quality figures?
I'll give you three examples to proof my point. Even if some of my examples are obsolet by now, or become obsolet later, there are plenty more. Please leave a comment on what should be implemented asap to improve the overall Matlab Figure experience. Leave a comment if you had a related problem with a link to an existing Forum entry to discuss solutions there. I'd like to push this topic to Mathworks.
Disclaimer:
Of course there are more powerful plotting alternatives to Matlab, I dont want to discuss this. By now, Matlab is usually good enough to get the work done. Yet, in many cases you have to rely on "dodgy" workarounds (practical speacking: community solutions of peaple kind enough to share their troubles) which tend to cause subsequent problems, or there may be no solution at all!
Example 1) exporting Figures:
Usually, with Matlab (e.g. savefig(), print(), or exportgraphics()) you get something else as what you see in the figure even if the aimed file formate theroretically supports the crucible options. This is very unintuitive! Therefore, Community solutions (export_fig, matlab2tikz/matlab2tikz...) have been trending for a decade (!) and are still my way to go!
Take Mathworks latest Solution "exportgraphics" (available since R2020a and decent in my opinion): you cannot control to what extend the white space is cut. Thus, the final Figure has random dimensions. I also have problems that fontSizes end up being 11.987... rather than 12-which is minor but still pain.
Example 2) customizing legends: should be a basic and intuitive thing:
- you cannot directly chose the objects you displayed in the legend. Either you make a dumb 'manual' customized legend that does not update with your data, or you have take to ALL objects (obviously, annotation boxes, lines arrows should be optional in the legend)... (https://ch.mathworks.com/matlabcentral/answers/455329-remove-data-elements-of-the-legend-from-figure)
- you have no control on the spacings in the legend. Matlab is by default very generous with white spacings and whats better to have in figures than white space...(https://ch.mathworks.com/matlabcentral/answers/367343-how-to-decrease-the-size-of-the-legend-in-a-figure, https://ch.mathworks.com/matlabcentral/answers/438845-change-figure-legend-horizontal-spacing)
- in matlab, it makes a difference whether to use plot or scatter regarding the legend, because with scatter you cannot directly control the legend(!) marker icon size. There may be obvious reasons why, but there is no resonable reason why this is not overcome Scatter should have customizable legend marker icon sizes- period. (https://ch.mathworks.com/matlabcentral/answers/50250-how-can-i-change-the-marker-size-in-legend)
Example 3) breaking axis
occcasionally, you may want to break one or more axis due to your data distribution. Breaking the axis with a visual highlight may be used for this (https://ch.mathworks.com/matlabcentral/answers/42537-break-in-the-axis). Yet, Matlab has not a native solution for this. Instead you have to write your own solution or rely on community code (breakaxis, break plot...).
0 件のコメント
回答 (1 件)
Jan
2022 年 11 月 17 日
編集済み: Jan
2022 年 11 月 17 日
My trivial answer: This is the nature of "high quality figures". Depending on the journal you are publishing in different properties must by considered. There cannot be a general tool to match all of them on one hand and to produce fast graphic output on the other hand.
3 件のコメント
Jan
2022 年 11 月 18 日
I support a large program for clinical decition making. It is essential, that it runs over decades and therefore the lab used Matlab R6.5 for many years, proceeded to R2009a and now to 2018b. Introducing a new Matlab version takes about 2 months of testing, if the results are really equivalent. Beside unit- and integration tests for the > 300'000 lines of code (plus comments), we need exhaustive tests of the GUIs by users.
The legend() function has been subject to changes frequently and to get reliable outputs adjustments have been required for each Matlab version. Therefore we use our own code to create legends. This is disappointing.
While the change from HG1 to HG2 was not a serious problem, there are still some strange effects in both versions: With the OpenGL renderer the box around axes is not drawn reliably, but it helps to rotate the axes by 0.00001 degrees. The artifacts in PDF are legendary and using export_fig was a fundamental solution.
I do agree: There is a high potential for improvements.
On the other hand: I've written about 15 small wrapper functions to handle the incompatibilities between R6.5, R2009a and R2018b. The long term compatibility of Matlab code is really excellent, and the bad examples of legend and the graphic output are rare exceptions.
Thanks for your question. I agree in general, that the graphics export is tedious. If I had implemented the mentioned tool in C, an export of graphics would be something near to pure hell.
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!