How do I create a new image that has a stem function hist next to (i.e., side by side) an image?
Show older comments
I am new to matlab but have experience with other programming languages. Currently I am trying to create a new png or jpeg image that has all of my histograms and images in one "figure" but I am running into some issues.
Here is my code:
__________________
output=figure(1);
subplot(3,1,1); imshow(outputfinaltemp);
subplot(3,1,2); imshow(ipf);
subplot(3,1,3)
stem(0:255, opfhist);
__________________
output is a variable I assigned to refer to the final "figure", outputfinaltemp and ipf are just some images, and opfhist is one of many histograms that I am trying to include in this final figure. I am just working to get this one histogram to work but I am having some issues.
Note: I am trying to not use/rely on functions like hist or histograms because I am attempting to learn and work with more fundamental programming.
Is there a simple way I can combine multiple different graphs and images together without relying on premade programs?
Any help and direction would be greatly appreciated!
4 Comments
Such an image could be constructed entirely without relying on plotting tools (e.g. using histcounts() to generate an image programmatically), but programmatically generating that image would be a bit cumbersome. Programmatically adding text or axis labels would potentially be another inconvenience unless you have CVT or want to resort to using third-party tools.
That said, even if you used stem() to do the work of generating the stem plot, that doesn't mean you need to use the figure as a compositor for everything else. You could use stem(), capture the axes, and then programmatically composite the three images. Assuming the images are of mismatched size, one may be able to use imtile() or something (or just resize/pad as desired and then concatenate).
Depends how dedicated you are to avoiding the use of plot tools.
Jong Han Lee
on 12 Oct 2022
> opfhist is one of many histograms
Could you elaborate on this? I interpret a histogram to be a graphics object produced by the histogram function. Do you mean that it's a vector of bin counts produced, for example, by histcounts?
What problems are you having, specifically? An error message? An unexpected image?
> Is there a simple way I can combine multiple different graphs and images together
I'm also having trouble understanding this goal. Do you mean together on the same figure which appears to be what you're doing?
Jong Han Lee
on 12 Oct 2022
Edited: Jong Han Lee
on 12 Oct 2022
Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!