How to append an image to a plot curve
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ron Fredericks
le 21 Avr 2022
Commenté : Ron Fredericks
le 22 Avr 2022
I have an engineering plot using MATLAB plot command, and circuit schematic png image cooresponding to this plot. I would like to create one figure with the plot and the image stacked on tope of each other.
sample plot using command like this:
plot(app.timeArray, app.vcArray, ...
'LineWidth',app.LineWidthEditField.Value, 'Color','#ea710c')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/971470/image.png)
Sample image using command like this
circuit = imread(which('RC_Charge_Circuit_Voltage.png'));
imshow(circuit)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/971475/image.png)
Somehow I would like to have a script with one figure combining both the plot and the circuit image stacked (or appended) into one. The final image might look like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/971480/image.png)
0 commentaires
Réponse acceptée
Chris
le 21 Avr 2022
Modifié(e) : Chris
le 21 Avr 2022
You should be able to use a tiled layout.
circuit = imread(which('RC_Charge_Circuit_Voltage.png'));
figure
tiledlayout(2,1)
nexttile
plot(app.timeArray, app.vcArray, ...
'LineWidth',app.LineWidthEditField.Value, 'Color','#ea710c')
nexttile
imshow(circuit)
If you want to make the figure background white afterward:
f = gcf;
f.Color = [1 1 1];
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!