Borrar filtros
Borrar filtros

Bug using SmithChart function to plot multiple curves with different colors

5 visualizaciones (últimos 30 días)
I'm using matkab 2019b. I'm tryng to plot multiple curves (lines) on a smith chart plot.
For some reasons I am not able to have more than 7 distinc colors when using the function smithplot.
When I try chaning the 8th curve color uing the interactive figure GUI, changing the 8th curve color also changes the 1st curve color.
I have tried inputting the curve colors manually, but same thing, the 8th curve color overwrites the first curve color and I end up with the 1st and 8th curves having the same color.
Any suggestions on how to solve the issue or maybe a work around?

Respuestas (1)

Shubham
Shubham el 8 de Mzo. de 2023
Hi Ahmed,
One possible solution is to manually define the colors for each curve using the 'ColorOrder' property of the axes object. This property specifies the default order of colors used for plotting lines.
Here's an example code that demonstrates how to do this:
% Create some sample data
s = smithplot;
z = linspace(0.1, 1, 10);
y = rand(size(z)) + 1i*rand(size(z));
% Define the colors for each curve
colors = lines(10); % or any other colormap you prefer
ax = gca;
ax.ColorOrder = colors;
% Plot the lines
for i = 1:numel(z)
plot(s, z(i), y(i), 'LineWidth', 2);
end
In this example, we first create a smith chart using the smithplot function. Then we define some sample data for 10 curves. We also define the colors for each curve using the lines colormap and set the ColorOrder property of the current axes object to these colors. Finally, we plot each curve using a loop and the plot function.
By setting the ColorOrder property of the axes object, we ensure that each curve will be plotted with a distinct color. This should solve the issue of overwriting colors when plotting more than 7 curves.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by