You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to create a scientific visualization. I have two figures, fig1 and fig2, that I've created using the Figure() function. I want to combine these figures into a single figure, fig_combined, without changing the size or aspect ratio of the individual figures. Ideally, I'd like to arrange them side-by-side.
I provide a code example that demonstrates how to achieve this:
using CairoMakie
# Example data
x =LinRange(0, 10, 100)
y =sin.(x)
# Create two individual figures with square axes
fig1 =Figure() # Set the size of the figure
ax1 =Axis(fig1[1, 1], aspect =1, xlabel ="x-axis", ylabel ="y-axis") # Force square aspect ratio and add xlabellines!(ax1, x, y, color =:red)
fig2 =Figure() # Set the size of the figure
ax2 =Axis(fig2[1, 1], aspect =1, xlabel ="x-axis", ylabel =L"\beta_0\text{fs}^2") # Force square aspect ratio and add xlabellines!(ax2, x, y, color =:blue)
# Create a combined figure
fig_combined =Figure()
# Create axes in the combined figure
ax1_combined =Axis(fig_combined[1, 1], aspect =1, xlabel ="x-axis", ylabel ="y-axis")
ax2_combined =Axis(fig_combined[1, 2], aspect =1, xlabel ="x-axis", ylabel =L"\beta_0\text{fs}^2")
# Plot the contents into the respective axeslines!(ax1_combined, x, y, color =:red)
lines!(ax2_combined, x, y, color =:blue)
# Adjust column sizes to accommodate the individual figures' widthscolsize!(fig_combined.layout, 1, Aspect(1, 1)) # Make column 1 squarecolsize!(fig_combined.layout, 2, Aspect(1, 1)) # Make column 2 square# resize the combined figure to fit the layoutresize_to_layout!(fig_combined)
display(fig_combined)
For plot types, please add an image of how it should look like
Actually, I made this by powerpoint where I insert the 2 pictures and combine them into 1 picture and saveas .png.
The text was updated successfully, but these errors were encountered:
Feature description
I want to create a scientific visualization. I have two figures,
fig1
andfig2
, that I've created using theFigure()
function. I want to combine these figures into a single figure,fig_combined
, without changing the size or aspect ratio of the individual figures. Ideally, I'd like to arrange them side-by-side.I provide a code example that demonstrates how to achieve this:
For plot types, please add an image of how it should look like
Actually, I made this by powerpoint where I insert the 2 pictures and combine them into 1 picture and saveas .png.
The text was updated successfully, but these errors were encountered: