How to add Line/Markers to an Axis Label?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Daniel
am 25 Jan. 2023
Bearbeitet: dpb
am 26 Jan. 2023
It is fairly common to add an example of either the line style or marker style to the Y-axis label of a plot when plotting multiple datasets to make the plot easier to understand. See attached examples. Is this possible to do in matlab?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1274190/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1274195/image.png)
I do not want to use a legend. Surprisingly I haven't been able to find any solutions on this.
5 Kommentare
dpb
am 25 Jan. 2023
Bearbeitet: dpb
am 26 Jan. 2023
Well, there are lots of little holes in handle graphics and annotation objects that weren't thought of in the beginning...annotation can draw line, but it is a different kind of line object than the one for plot; it has 'linestyle', but no 'marker' property. And, even if did, there's no facility to join disparate annotations types into a single coherent piece.
No hatching patterns, ...
Akzeptierte Antwort
Walter Roberson
am 25 Jan. 2023
Bearbeitet: Walter Roberson
am 25 Jan. 2023
L = "G\prime ( \bullet ) and G\prime\prime ( \color{red}{\bullet}\color{black} ) (Pa)";
ylabel(L, 'interpreter', 'tex')
See also https://www.mathworks.com/matlabcentral/answers/502442-matlab-colors-required-in-latex#comment_791006 where Adam showed how to specify color by RGB
Note that \color is a mode; the color continues until it is switched off. Also note that I used tex interpreter for this. And \bullet .
To extract the marker shape from a line and map it to tex to draw a similar shape would be more work; I do not know if it is generally possible for all of the markers, given the limitations of MATLAB's TeX and LaTeX
2 Kommentare
Walter Roberson
am 26 Jan. 2023
I wonder whether some of the options described in https://linuxhint.com/latex-horizontal-line/ could be used ?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!