Changing marker size in legends (gramm)

4 visualizaciones (últimos 30 días)
z8080
z8080 el 1 de Abr. de 2022
I am using the gramm toolbox to do plots of all sorts in Matlab. One thing I'm having to always edit post-hoc in most plots (i.e. using the Property Inspector, instead of programatically adjusting gramm calls) is the marker size in legends, which by default are tiny. This amounts to increasing lineWidth:
Gramm does have a function dedicated to changing marker sizes, set_point_options, but that only refers to markers in the main plot, and does not affect those in the legend. Similarly, the set_text_options function has scaling parameters for the title & text of the legend, but not for the markers. Sadly, the toolbox's author is no longer available for support.
My usual way of changing legend marker sizes (for Matlab-native plot functions) is given below, but does not work with gramm plots:
x = 1:10;
plot(x, 1*x, 'o');
hold on;
plot(x, 2*x, 's');
[~, objh] = legend({'one','two'});
objhl = findobj(objh, 'type', 'line');
set(objhl, 'Markersize', 18);
% or, for Patch plots:
objhl = findobj(objh, 'type', 'patch');
set(objhl, 'Markersize', markerSize_legend);
  3 comentarios
z8080
z8080 el 8 de Jun. de 2022
Sadly no. I reverted to normal plotting in Matlab, as gramm simply imposes too many restrictions that I don't know / don't have time to get around, and is also sadly not really supported, neither by the author nor by any real community of users.
Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro el 8 de Jun. de 2022
Why don't you define your properties directly from the plots:
x = 1:10;
plot(x, 1*x, 'o','markersize',9);
hold on;
plot(x, 2*x, 's','markersize',6);
You can also use handles to sort this without having to use any property inspector, but try this to see if it works. If not, let me know.

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by