Markers intersect with axis in MATLAB plot
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello
I am plotting some data with markers, e.g.:
loglog(t55,r55,'ko','markerfacecolor','w','markersize',12);
However this marker intersects with my axis and i can see the border outside the actual plotting area defined by xlim and ylim. Altering markersize and boundaries is no option!
How can I adapt my plot that only the part of the marker in plotting are is seen?
Thanks
1 comentario
Daniel Shub
el 23 de Jul. de 2013
I don't think it can be easily done. See a previous unanswered question of mine where I was trying to figure out the extents of the markers.
Respuestas (4)
David Sanchez
el 23 de Jul. de 2013
Set the axis according to your data, extending the limits to your need:
x= rand(10,1);
y = rand(10,1);
loglog(x,y,'ko','markerfacecolor','w','markersize',12);
ext=1; % adapt this value to your needs
axis([min(x)-ext max(x)+ext min(y)-ext max(y)+ext])
1 comentario
Jan
el 23 de Jul. de 2013
The OP wrote:
Altering markersize and boundaries is no option!
Jan
el 23 de Jul. de 2013
Try to clip the axes' children:
AxesH = loglog(t55,r55,'ko','markerfacecolor','w','markersize',12);
Child = get(AxesH, 'Children');
set(Child, 'Clipping', 'on');
But perhaps this matters the center of the markers only, but not if only parts of the circles are outside the axes' limits.
3 comentarios
Jan
el 23 de Jul. de 2013
This means, that there is no trivial solution. Then explain, why you need this and in which format you ant to export the diagrams.
Alexander Weitzel
el 7 de Nov. de 2022
Reposting from: Showing only part of markers that overflow off the edges of a plot? - MATLAB Answers - MATLAB Central (mathworks.com)
Even though this question is already quite old, I can present a simple and viable solution for the problem of overflowing markers.
Assuming you are interested in a clean picture for an article or a dissertation, simply set 'ClippingStyle' to 'rectangle' and print the figure to pdf, parts of markers lying outside of axes are now clipped.
set(gca,'ClippingStyle','rectangle');
print(gcf,'foo.pdf','-dpdf','-r300','-bestfit');
0 comentarios
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!