Matlab Plotting with out legend

3 views (last 30 days)
venkat siddhartha rama
venkat siddhartha rama on 8 Jan 2020
Answered: Peter O on 10 Jan 2020
Greetings friends,
I am working on a project in matlab and I need your help. In the plot shown below, I have 10 curves with respective values in the legend next to curves. It is hard to look legend and find the corresponding colour curve in the plot. I get different curves at different value of wind turbine capacity. Is there a way to get the value of the wind turbine capacity next to the curve as shown in example plot. in the examplt plot, the values are right next to the curve, which is easier to find the needed curve easily.
This is the code that I have used to get my plot:
figure
plot(KW_of_solar_panel,Solar_Optimization_total_Price)
xlabel('SOLAR NAME PLATE CAPACITY (KW) ')
ylabel('TOTAL PRICE IN PRESENT DAY DOLLARS ($)')
%title('Solar Name Plate Capacity VS Solar optimization total prize in present day dollars')
plot1_Increment1=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(1,1)*Turbine_rated_power);
plot1_Increment2=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(2,2)*Turbine_rated_power);
plot1_Increment3=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(3,3)*Turbine_rated_power);
plot1_Increment4=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(4,4)*Turbine_rated_power);
plot1_Increment5=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(5,5)*Turbine_rated_power);
plot1_Increment6=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(6,6)*Turbine_rated_power);
plot1_Increment7=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(7,7)*Turbine_rated_power);
plot1_Increment8=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(8,8)*Turbine_rated_power);
plot1_Increment9=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(9,9)*Turbine_rated_power);
plot1_Increment10=sprintf(' WIND TURBINE CAPACITY = %0.3d KW',no_of_wind_turbines(10,10)*Turbine_rated_power);
legend(plot1_Increment1,plot1_Increment2,plot1_Increment3,plot1_Increment4,plot1_Increment5,plot1_Increment6,...
plot1_Increment7,plot1_Increment8,plot1_Increment9,plot1_Increment10);
set(legend,'location','best')

Answers (1)

Peter O
Peter O on 10 Jan 2020
Check out the textbox() or annotation() commands. Text objects are placed inside the plot, while annotations are placed on the figure -- the text() function is probably the better choice.
You can specify the (x,y) point to match the first datapoint with either command and set the 'HorizontalAlignment' alignment property to 'right'
For instance, to place the labels in a position similar to the plot you've shown, try something like:
for ix=1:10
capacity = sprintf('%0.3d kW', no_wind_turbines(ix,ix)*rated_power)
x0 = nameplate_kw_panel(1);
y0 = panel_price(1,ix);
text(x0,y0,capacity,'HorizontalAlignment','right')
end

Categories

Find more on Wind Power in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!