How to include more asterisks on a line in a plot

52 ビュー (過去 30 日間)
Hail
Hail 2014 年 8 月 1 日
編集済み: Andrew Reibold 2014 年 8 月 1 日
I have a plot:
plot(time, y,'b-*')
The line that it plots has asterisks at each of my data points. Is there a way to include more asterisks along the line without having to include more data points?
Thanks

採用された回答

Star Strider
Star Strider 2014 年 8 月 1 日
Not that I’m aware of. Markers are plotted at specific (x,y) coordinates, according to the ‘Line Properties’ documentation. The 'LineStyle' option offers lines or lines and markers (or none), but not continuous markers.
The easiest way to create more data points is to use interp1 with the 'linear' (default method) option.

その他の回答 (1 件)

Andrew Reibold
Andrew Reibold 2014 年 8 月 1 日
編集済み: Andrew Reibold 2014 年 8 月 1 日
Hi Hail, I have an answer for oyu.
Lets say you have a small sample of 10 points.
time = [1 2 3 4 5 6 7 8 9 10]
y = [1 1 2 3 5 8 13 21 34 55]
Now plotting them you receive the following
figure
plot(time, y,'b-*')
Now if I want to put more 'points' on it for the asterisks, one way you can do this is by interpolating the data and simulating more points.
How_many_asterisks = 100;
New_Time = linspace(min(time),max(time),How_many_asterisks)
New_Y = interp1(time,y,New_Time)
figure
plot(New_Time, New_Y, 'b-*')
Now you can include as many asterisks as you want! (Change the How_many_asterisks variable)
-Andrew

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by