Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

9
New discovery (for me): You can set the alpha property of a line object
Post Body

Disclaimer up top: this appears to be undocumented MATLAB behavior, so know that Mathworks would be able to change this behavior at any time, so old code could break if you use this.

That being said, I was trying to come up with a method to "highlight" one of the lines in my plot (kind of make it glow) as a way to make it stand out for a presentation. The only way I could find to do it using documented code was to add a patch behind the line, and set the FaceAlpha property of that patch.

But what I found was that if you add a 4th element to the Color property of a line, that 4th element serves as the alpha value. So, for instance if you said:

h = plot(x,y,'Color', [1,0,0,0.25], 'LineWidth', 10);

That would make a red line, 10 units wide, with an alpha value of 0.25. Or, if you wanted to change it after the fact (so in my presentation, I show the full data, and then highlight one of them in the next plot) you can use the line:

set(h, 'Color', [h.Color, 0.25], 'LineWidth', 10);

This will have it keep the same color as it was before, and then make it thicker and partially transparent.

Anyway, maybe this was already well known, but I found it really helpful for making my plots look how I wanted.

Author
Account Strength
100%
Account Age
14 years
Verified Email
Yes
Verified Flair
No
Total Karma
386,554
Link Karma
6,904
Comment Karma
370,092
Profile updated: 1 month ago
Posts updated: 10 months ago
+5

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago