I have got a polarplot with 3 "circles" and want to change the color between the first and third circle to grey. My code is:
"polarplot(Ext);
grid on"
Can anyone help me
Related
I am trying to fill the area between two lines with a checkered or lined "surface" in Matlab. I am currently using the fill command to display the area, however the area is displayed as a solid surface. What I am trying to do is to let the area appear as in the diagram presented below.
This is what I got so far:
My code currently in use:
x2 = [x, fliplr(x)];
inBetween = [Auf1_mW_pro_mg(1781:length(Auf1_mW_pro_mg)), fliplr(y_Temp)];
fill(x2, inBetween, 'g','facealpha',.5,'LineStyle','none');
Note : All the variables are vectors.
Does anybody know how to do this using the fill or another command?
Thank you!
I created a tiledlayout(4,3)-object and I want to emphasize the 8th tile by a surrounding line or changing the backgroundcolor (not of the graph itself, but just the greyspace behind the graph, labels, axes etc.).
I could not find anything that changes the backgroundcolor of just one tile, so I tried to draw a rectangle around the tile and color it.
I executed the code below and expected to get a red line around the OuterPosition- or the TightInset-position, but nothing happened. The code created the tiles without any error-codes and there was no red rectangle around the 8th tile.
Can anyone tell me how to color the background of a tile or get a rectangle around it?
Thank you very much!
ax = nexttile(8)
lines_around_tile = get(ax, 'OuterPosition'); %'TightInset')
rectangle('Position', lines_around_tile, 'EdgeColor', 'r', 'LineWidth',10)
I got this result.
Result
To draw a rectangle, run the code and in matlab figure (with all the tiles) go to view -> Plot Edit Toolbar. It generates a toolbar where you can find lines, rectangles, circles...
Then insert your rectangle, right click on it, Property Inspector. In this window you can change the facecolor, linecolor, linewidth...
I need some help making some changes in the way my plot is plotted with this code.
First of all, I need dark colours. I want my the lines to start from black and slowly go to dark red/purple. Scaling from black to dark red/purple smoothly.
The other thing I need is on how to get other variations in my linestyle. I stole the linestyle code from somewhere and it is kinda useful, but I need more than the 4 variations given.
I also wanna add another line, with semilogx again and add it on the legend. How can I achieve that without messing with the previous legend? If I just add the line and put an extra line on the legend, it gives me the wrong color. (if I just use hold on and add an ,'', in the legend it gets a parula color and not the actual color)
fig = semilogx(SMPSFIN(1,5:75),z);
numLines = length(fig);
cmap = colormap(parula(numLines));
style = {'-','--',':','-.'};
for i = 1:numLines
fig(i).Color = cmap(i,:);
set(fig(i),'Linewidth',i*sqrt(1.5*i)*0.1);
set(fig(i),'linestyle',style{1+int8(mod(i,4))});
end
Thanks a lot for your time :)
This may be a very simple problem but I would greatly appreciate your help. I have created a direction/intensity plot using the wind_rose function in Matlab, however, I would like to change the scaling of the legend. The plot currently produces a legend that has 12 colors that go up in 10 cm blocks, for example blue = 0-0.1, light blue = 0.1-0.2, green = 0.2-0.3 etc. I would like there to be far less colors and the scaling to be more like blue = 0-0.5, light blue = 0.5-1.0 etc. This is the code I use to plot the wind rose:
h = wind_rose(M,D,'dtype','meteo','n',12,'lablegend','Hm0 (metres)','ci', 0:10:60,'quad',[4])
Am I able to add a simple code that will scale the legend how I want it to be?
Figured it out:
'di', 0:0.5:3
Very simple really oops. I am now looking to remove white boxes that appear around text on the figure, any ideas?
I want to paint some edges on my plot using gradient color according to their repetition percentage.
So the most repeated edge on my graph to be red, the next lesser to be orange and the edge with the less repetitions to be light beige.
The Percentage of the repetition can be obtained from a txt file.
The rest area of the plot i would like to stay intact in white color. Something like the next image (consider objects shape and size irrelevant, just the color gradient is what i am interested for).
How can i do this with matlab?
My approach so far:
EDIT it works with the addition of the hold all cmd
for jkl=1:size(edges,1)
plot(edges(jkl,1), edges(jk,2),'^','Color',[edgespercentage(jkl)/100 0 1], 'LineWidth', 2.5,'DisplayName', 'Edges with gradient color'); hold all
end
But as i see plot cant keep each iteration's color and plots at the end the last calculated color only (as expected).
Thank you in advance.
Solution found with the tip of David K (Thank you!)
I'm not sure if this is exactly what you want, but give it a shot:
mesh(xvals,yvals,zvals,repititionVals);
colormap('hot');
You can play around with colormap to get the exact shading you want, but I think either hot or autumn is the closest predefined map to what you're looking for