Clear Filters
Clear Filters

How do I prevent LineWidth property from affecting line start and end point on plot?

3 views (last 30 days)
Using R2014b, when plotting a line with a large LineWidth, the data, as visualized in a figure, appears to extend beyond its true value. It appears that the LineWidth is being added to the front and back end of the line segment in addition to just affecting its width.
In R2014b,
plot([0 1],[1 1],'LineWidth',10)
appears to extend below 0 and beyond 1. http://imgur.com/YvAyiPX
In previous versions, the LineWidth did not affect the apparent start/end points of a line, and the above example would start and end (visually) at 0 and 1. Is there a way to ensure this for the R2014b graphics system?
  3 Comments
Matt
Matt on 30 Mar 2015
The issue is still present in R2015a.
In the image linked, all lines are drawn on the interval [0 1], with the y-axis also being the LineWidth setting, but you can see they visually extend beyond, being more pronounced with greater LineWidth. (Image generated from R2015a, occurs with renderer = 'opengl' or 'painters'.)
Matt
Matt on 7 Apr 2015
Purely on accident I discovered a workaround. The line endings stop at the expected location if I switch to using the OpenGL software renderer, opengl('software') .
Just for reference, the hardware info, opengl('info'), where I experience the extended lines is as follows:
Version: '4.3.0'
Vendor: 'NVIDIA Corporation'
Renderer: 'NVS 5200M/PCIe/SSE2'
MaxTextureSize: 16384
Visual: 'Visual 0x07, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceler...'
Software: 'false'
SupportsGraphicsSmoothing: 1
SupportsDepthPeelTransparency: 1
SupportsAlignVertexCenters: 1
Extensions: {271x1 cell}
MaxFrameBufferSize: 16384
I also see it on my desktop with the Intel driver:
Version: '4.2.0 - Build 10.18.10.3412'
Vendor: 'Intel'
Renderer: 'Intel(R) HD Graphics 4600'
MaxTextureSize: 16384
Visual: 'Visual 0x07, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware accelerati...'
Software: 'false'
SupportsGraphicsSmoothing: 1
SupportsDepthPeelTransparency: 1
SupportsAlignVertexCenters: 1
Extensions: {184x1 cell}
MaxFrameBufferSize: 16384
I have not tried playing around with other drivers and the like to see if may fix the issue.

Sign in to comment.

Answers (2)

Doug Hull
Doug Hull on 12 Nov 2014
There is not currently a way to turn of the endcaps on the lines.
Maybe you could use less wide lines, or put markers over the data points?

Matt
Matt on 2 Dec 2014
Just to follow up on my own question, it appears to be a bug in the new graphics engine, so I will stick to R2014a and hope that they fix this in R2015a. I received the following response from the MathWorks Technical Support Department on 11/24:
-------------
Thank you for sending all of your reproduction information. I was able to reproduce the behavior you were experiencing and confirmed with the graphics development team that this is a known issue in R2014b that they are actively investigating.
In R2014b, there is no known workaround. The best recommendation I can offer is to plot markers at the endpoints of the lines by setting the 'Marker' property in the 'plot' call so that there will be some visual indication of the correct length.
I apologize for the inconvenience this issue is causing as well the extended amount of time it took to reproduce the issue and get back to you with a conclusive answer. If you have any further questions, please let me know and I will be happy to assist you.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!