Effacer les filtres
Effacer les filtres

Changing the plot parameters for the rfplot function

14 vues (au cours des 30 derniers jours)
John Carroll
John Carroll le 25 Avr 2023
Commenté : Em le 13 Mar 2024
Hello
I am trying to change the parameters of an rfplot. I have an s-parameter object S{1}. S has a series of s-parameter objects so I would independantly graph S{1}, S{2}, S{3} and so on. For each graph I would like to plot only the S11 or S21 data. I have used the following.
rfplot(S{1},2,1)
to plot the S21 which works well.
If I change the code to the following it works well.
rfplot(S{1},2,1,'r')
This allows me to change the color to red.
However I have tried to use the following code and receive an error
rfplot(S{1},2,1,'color',[1 0 0],'LineWidth',2)
Here I am attempting to create the same graph while defining a custom color and specify a line thickness.
What would the correct way to achieve this?
Thank you

Réponse acceptée

LeoAiE
LeoAiE le 26 Avr 2023
In the rfplot function, you can't directly pass the line properties as additional arguments like in the basic plot functions. Instead, you can use the output of the rfplot function, which gives you a handle to the lines on the plot, and then modify their properties.
% Plot the S21 data and get the line handle
h = rfplot(S{1}, 2, 1);
% Set the line properties (color and line width)
set(h, 'Color', [1 0 0], 'LineWidth', 2);
This code first plots the S21 data and gets the handle to the line on the plot. Then, it uses the set function to modify the line properties. You can customize other line properties in the same way by passing additional property-value pairs to the set function.
  2 commentaires
John Carroll
John Carroll le 26 Avr 2023
This worked perfectly thank you
Em
Em le 13 Mar 2024
This answer has been really helpful! May I also ask how you could make a colourscale if plotting lots of these on the same axes?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur App Building dans Help Center et File Exchange

Tags

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by