@@ -670,23 +670,25 @@ function makescene2d(ctx, key)
670670 GL[1 , 1 ] = ctx[:scene ]
671671
672672 # , fontsize=0.5*ctx[:fontsize],ticklabelsize=0.5*ctx[:fontsize]
673- if ctx[:colorbar ] == :vertical
674- GL[1 , 2 ] = XMakie. Colorbar (
675- ctx[:figure ],
676- ctx[key];
677- width = 10 ,
678- ticks = unique (ctx[:cbarticks ]),
679- tickformat = " {:.2e}" ,
680- )
681- elseif ctx[:colorbar ] == :horizontal
682- GL[2 , 1 ] = XMakie. Colorbar (
683- ctx[:figure ],
684- ctx[key];
685- height = 10 ,
686- ticks = unique (ctx[:cbarticks ]),
687- vertical = false ,
688- tickformat = " {:.2e}" ,
689- )
673+ if ctx[:show_colorbar ]
674+ if ctx[:colorbar ] == :vertical
675+ GL[1 , 2 ] = XMakie. Colorbar (
676+ ctx[:figure ],
677+ ctx[key];
678+ width = 10 ,
679+ ticks = unique (ctx[:cbarticks ]),
680+ tickformat = " {:.2e}" ,
681+ )
682+ elseif ctx[:colorbar ] == :horizontal
683+ GL[2 , 1 ] = XMakie. Colorbar (
684+ ctx[:figure ],
685+ ctx[key];
686+ height = 10 ,
687+ ticks = unique (ctx[:cbarticks ]),
688+ vertical = false ,
689+ tickformat = " {:.2e}" ,
690+ )
691+ end
690692 end
691693 return GL
692694end
@@ -940,13 +942,17 @@ function makeaxis3d(ctx)
940942 XMakie = ctx[:Plotter ]
941943 if ctx[:scene3d ] == :LScene
942944 # "Old" LScene with zoom-in functionality
943- return XMakie. LScene (ctx[:figure ])
945+ lim = ctx[:limits ]
946+ lim = Observable (Rect3f (Vec3f (lim[1 ], lim[3 ], lim[5 ]), Vec3f (lim[2 ], lim[4 ], lim[6 ])))
947+ scene = XMakie. LScene (ctx[:figure ], scenekw = (; limits = lim))
948+ return scene
944949 else
945950 # "New" Axis3 with prospective new stuff by Julius.
946951 return XMakie. Axis3 (
947952 ctx[:figure ];
948953 aspect = :data ,
949- viewmode = :fit ,
954+ viewmode = ctx[:viewmode ],
955+ limits = ctx[:limits ],
950956 elevation = ctx[:elev ] * π / 180 ,
951957 azimuth = ctx[:azim ] * π / 180 ,
952958 perspectiveness = ctx[:perspectiveness ],
@@ -977,31 +983,32 @@ function makescene3d(ctx)
977983 end
978984 GL[1 , 1 ] = ctx[:scene ]
979985 # Horizontal or vertical colorbar
980- if haskey (ctx, :crange )
981- if ctx[:colorbar ] == :vertical
982- GL[1 , 2 ] = XMakie. Colorbar (
983- ctx[:figure ];
984- colormap = ctx[:colormap ],
985- colorrange = ctx[:crange ],
986- ticks = map (d -> d. c, ctx[:data ]),
987- tickformat = " {:.2e}" ,
988- width = 15 ,
989- ticklabelsize = 0.5 * ctx[:fontsize ],
990- )
991- elseif ctx[:colorbar ] == :horizontal
992- GL[2 , 1 ] = XMakie. Colorbar (
993- ctx[:figure ];
994- colormap = ctx[:colormap ],
995- colorrange = ctx[:crange ],
996- ticks = map (d -> d. c, ctx[:data ]),
997- tickformat = " {:.2e}" ,
998- height = 15 ,
999- ticklabelsize = 0.5 * ctx[:fontsize ],
1000- vertical = false ,
1001- )
986+ if ctx[:show_colorbar ]
987+ if haskey (ctx, :crange )
988+ if ctx[:colorbar ] == :vertical
989+ GL[1 , 2 ] = XMakie. Colorbar (
990+ ctx[:figure ];
991+ colormap = ctx[:colormap ],
992+ colorrange = ctx[:crange ],
993+ ticks = map (d -> d. c, ctx[:data ]),
994+ tickformat = " {:.2e}" ,
995+ width = 15 ,
996+ ticklabelsize = 0.5 * ctx[:fontsize ],
997+ )
998+ elseif ctx[:colorbar ] == :horizontal
999+ GL[2 , 1 ] = XMakie. Colorbar (
1000+ ctx[:figure ];
1001+ colormap = ctx[:colormap ],
1002+ colorrange = ctx[:crange ],
1003+ ticks = map (d -> d. c, ctx[:data ]),
1004+ tickformat = " {:.2e}" ,
1005+ height = 15 ,
1006+ ticklabelsize = 0.5 * ctx[:fontsize ],
1007+ vertical = false ,
1008+ )
1009+ end
10021010 end
10031011 end
1004-
10051012 # Put the status label into protrusion space on the bottom of the scene
10061013 GL[1 , 1 , XMakie. Bottom ()] = XMakie. Label (
10071014 ctx[:figure ],
@@ -1038,6 +1045,11 @@ function gridplot!(ctx, TP::Type{MakieType}, ::Type{Val{3}}, grid)
10381045 XMakie = ctx[:Plotter ]
10391046 xyzmin, xyzmax = xyzminmax (grid, ctx[:gridscale ])
10401047 xyzstep = (xyzmax - xyzmin) / 100
1048+ ctx[:limits ] = (
1049+ xyzmin[1 ], xyzmax[1 ],
1050+ xyzmin[2 ], xyzmax[2 ],
1051+ xyzmin[3 ], xyzmax[3 ],
1052+ )
10411053
10421054 function adjust_planes (xplane, yplane, zplane)
10431055 ctx[:ixplane ] = max (xyzmin[1 ], min (xyzmax[1 ], xplane))
@@ -1195,6 +1207,7 @@ function gridplot!(ctx, TP::Type{MakieType}, ::Type{Val{3}}, grid)
11951207
11961208 ctx[:status ] = Observable (" " )
11971209
1210+ XMakie. reset_limits! (ctx[:scene ])
11981211 add_scene! (ctx, makescene_grid (ctx))
11991212
12001213 else
@@ -1250,6 +1263,12 @@ function scalarplot!(ctx, TP::Type{MakieType}, ::Type{Val{3}}, grids, parentgrid
12501263 fstep = 0.1
12511264 end
12521265
1266+ ctx[:limits ] = (
1267+ xyzmin[1 ], xyzmax[1 ],
1268+ xyzmin[2 ], xyzmax[2 ],
1269+ xyzmin[3 ], xyzmax[3 ],
1270+ )
1271+
12531272 ctx[:ixplanes ] = collect (ctx[:xplanes ]) * ctx[:gridscale ]
12541273 ctx[:iyplanes ] = collect (ctx[:yplanes ]) * ctx[:gridscale ]
12551274 ctx[:izplanes ] = collect (ctx[:zplanes ]) * ctx[:gridscale ]
0 commit comments