What is the method for plotting certain values of a plotted vector with varied markers in Matlab?

add a comment

2

In Matlab, you can plot certain values of a plotted vector with varied markers using the "plot" function with the option to specify a vector of markers using the 'Marker' property.

Here's an example:

Suppose you have a vector of data points:

x = 1:10; y = x.^2;

To plot all of the points with the same marker style, you can simply use the 'plot' function without specifying a marker:

plot(x,y)

To plot certain values (e.g. the even values) with a different marker style, you can create a vector of markers representing the style for each point, using the 'Marker' property:

markers = repmat('o',1,10); %create a 1x10 vector of circles markers(2:2:end) = 's'; %change every other marker to a square

Then, you can use the 'plot' function again, but this time specify both the data points and the markers to use:

plot(x,y,'Marker',markers)

This will plot the data points with circles for odd values and squares for even values.

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Asked: ** 2022-08-30 11:00:00 +0000 **

Seen: **14 times**

Last updated: **Aug 01 '22**

What are some other options instead of Scipy to compute CubicSpline?

How can I use oversampling to address a problem?

How to determine the time average from netCDF with four dimensions?

What is the process for creating a mathematical model in MATLAB with the use of a Graph?

Can Polyspace be set up and executed using MATLAB APIs?

How can data preprocessing be performed using Matlab?

What is the process of using Debye's equation in either Matlab or Python to model experimental data?

How can the IR/Depth feed be obtained from a Logitech Brio 4k stream on a Windows device?

Copyright QStack.ai, 2010-2023. Content on this site is licensed under the Creative Commons Attribution Share Alike 3.0 license.