How to change the colors of multiple plots in GUI

2 visualizaciones (últimos 30 días)
gulsen kosoglu
gulsen kosoglu el 19 de Sept. de 2019
Comentada: gulsen kosoglu el 20 de Sept. de 2019
Hi, I am trying to build a GUI which reads multiple colums of datas from excell files then chooses one by one each column, reads data, plots it, then fits the custom fitting function, and finally plots whole graphs on the same graph after repeating the procedure for different data sets. My GUI can do all these and can plot the different lines all together on the same graph, but all of their colors are the same!..I am not able to use a loop of plottings because I repeat all process after I finish plotting, so in each round I can only plot one graph. Then I used "hold on" to plot them on the same graph.
I may save whole plotted datas in a matrix then use all these datas in the matrix and plot them alltogether, but this road seems too much and unnecessary to me, there must be a short way to achieve it. I could not find an easy way to change the color of each plotting. I am attaching the final picture of the GUI plotting. I can not label them automatically or change the colors of each line automatically :/...
Thanks all your advice..
multiple plottings.jpg
  2 comentarios
thoughtGarden
thoughtGarden el 19 de Sept. de 2019
Can you post the code showing where you plot the data?
gulsen kosoglu
gulsen kosoglu el 19 de Sept. de 2019
Editada: gulsen kosoglu el 19 de Sept. de 2019
The plotting is written under a Call back function. I put two graph window one for GUI front page one other for another open window to see all plotted ones together. Son I can see the instant graph on GUI window and put them together on the second window(figure1).
function FitData_Callback(hObject, eventdata, handles)
% hObject handle to FitData (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[fitresult, gof] = createFit(handles.cx,handles.ny2);
[xData, yData] = prepareCurveData(handles.cx,handles.ny2);
axes(handles.axes1)
h = plot( fitresult, xData, yData );
grid on
grid minor
xlim([-100 100])
ylim([0.6 1.02])
figure(1)
h=plot(fitresult, xData, yData), xlabel('-z to +z [mm]'),ylabel('Normalized Int [a.u.]');
grid minor
hold on
grid on
xlim([-100 100])
ylim([0.6 1.02])

Iniciar sesión para comentar.

Respuestas (1)

thiago plaza
thiago plaza el 19 de Sept. de 2019
20Y´´´- 80Y´´- 100Y´=0

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by