Unable to combine plots?

5 views (last 30 days)
Roger Breton
Roger Breton on 27 Jun 2023
Edited: Adam Danz on 27 Jun 2023
I created a monster of a script which satisfies my research needs for the moments but I am struggling with the subplots.
You will find my code in the attached m file and here is a screen capture of the two figures I try to combine to no avail :
The problem that I run into is that, once I use subplots to define each graph, I end up with a decent size image plot but a completely squished rectangles plot. For the purpose of my work, I need to rectangles plots to come up about the size you see here.
Any help is appreciated.
I wanted to contribute my code for others who might be doing 'color imaging' research. My goal is to find a visual mean of representing colors in an image such that relationships between colors so that the underlying rules of harmony could be intuitively interpreted. For the time being, my analysis is based on CIE Lch color format. Eventually, I would like to restate the 36 final colors in terms of Munsell color system.
My next step is to plot those 36 colors on a 3D scatter as "histograms", with chroma being the "height" and CIE a* and b* forming the 2D coordinates. It should prove an interesting visualization.
BTW, I want to say I still consider myself a Matlab newbie. So if you find grossly inefficient data structures, be gentle on me :-)
Have to add I could not have made it this far without ChatGPT.
  2 Comments
DGM
DGM on 27 Jun 2023
Could you not do something like:
x = 1:100;
subplot(1,4,1)
plot(x) % something to fill the axes
subplot(1,4,2:4)
plot(x) % something to fill the axes
Of course, it gets squished beyond reason since I can't really control the figure aspect ratio on the forum, but you can make subplots span multiple "tiles" for lack of a better word. I'm pretty sure tiledlayout can do similar, but I'm running R2019b, and tiledlayout has changed a lot since then.
Adam Danz
Adam Danz on 27 Jun 2023
Edited: Adam Danz on 27 Jun 2023
I'd love to know what ChatGPT prompts you used to create the chart with the colorful rectangles (bar chart).

Sign in to comment.

Answers (1)

Adam Danz
Adam Danz on 27 Jun 2023
Edited: Adam Danz on 27 Jun 2023
fig = gcf; % from your code
tcl = tiledlayout(1,4,'TileSpacing','Compact');
ax1 = nexttile(tcl);
% PLOT IMAGE
ax2 = nexttile(tcl,[1,3]);
% Plot rectangles (bar chart)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!